From f7548d6d28c313cf80e6f3ef89aed16a19815df1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:51:24 +0200 Subject: Adding upstream version 1:2.3.19.1+dfsg1. Signed-off-by: Daniel Baumann --- pigeonhole/tests/deprecated/notify/denotify.svtest | 279 +++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 pigeonhole/tests/deprecated/notify/denotify.svtest (limited to 'pigeonhole/tests/deprecated/notify/denotify.svtest') diff --git a/pigeonhole/tests/deprecated/notify/denotify.svtest b/pigeonhole/tests/deprecated/notify/denotify.svtest new file mode 100644 index 0000000..9f752e1 --- /dev/null +++ b/pigeonhole/tests/deprecated/notify/denotify.svtest @@ -0,0 +1,279 @@ +require "vnd.dovecot.testsuite"; +require "notify"; +require "envelope"; + +/* + * Denotify all + */ + +test_set "message" text: +From: stephan@example.org +To: nico@frop.example.org +Subject: Frop! + +Klutsefluts. +. +; + +test "Denotify All" { + notify :options "timo@example.com"; + notify :options "stephan@dovecot.example.net"; + notify :options "postmaster@frop.example.org"; + denotify; + + if not test_result_execute { + test_fail "failed to execute notify"; + } + + if test_message :smtp 0 { + test_fail "no notifications should have been sent"; + } +} + +/* + * Denotify First + */ + +test_result_reset; + +test_set "message" text: +From: stephan@example.org +To: nico@frop.example.org +Subject: Frop! + +Klutsefluts. +. +; + +test "Denotify ID First" { + /* #1 */ + notify :options "timo@example.com" :id "aap"; + + /* #2 */ + notify :options "stephan@dovecot.example.net" :id "noot"; + + /* #3 */ + notify :options "postmaster@frop.example.org" :id "mies"; + + denotify :is "aap"; + + if not test_result_execute { + test_fail "failed to execute notify"; + } + + if not test_message :smtp 0 { + test_fail "two notifications should have been sent (#2 missing)"; + } + + if not envelope "to" "stephan@dovecot.example.net" { + test_fail "message #2 unexpectedly missing from output"; + } + + if not test_message :smtp 1 { + test_fail "two notifications should have been sent (#3 missing)"; + } + + if not envelope "to" "postmaster@frop.example.org" { + test_fail "message #3 unexpectedly missing from output"; + } + + if test_message :smtp 2 { + test_fail "too many notifications sent"; + } +} + +/* + * Denotify Middle + */ + +test_result_reset; + +test_set "message" text: +From: stephan@example.org +To: nico@frop.example.org +Subject: Frop! + +Klutsefluts. +. +; + +test "Denotify ID Middle" { + /* #1 */ + notify :options "timo@example.com" :id "aap"; + + /* #2 */ + notify :options "stephan@dovecot.example.net" :id "noot"; + + /* #3 */ + notify :options "postmaster@frop.example.org" :id "mies"; + + denotify :is "noot"; + + if not test_result_execute { + test_fail "failed to execute notify"; + } + + if not test_message :smtp 0 { + test_fail "two notifications should have been sent (#1 missing)"; + } + + if not envelope "to" "timo@example.com" { + test_fail "message #1 unexpectedly missing from output"; + } + + if not test_message :smtp 1 { + test_fail "two notifications should have been sent (#3 missing)"; + } + + if not envelope "to" "postmaster@frop.example.org" { + test_fail "message #3 unexpectedly missing from output"; + } + + if test_message :smtp 2 { + test_fail "too many notifications sent"; + } +} + +/* + * Denotify Last + */ + +test_result_reset; + +test_set "message" text: +From: stephan@example.org +To: nico@frop.example.org +Subject: Frop! + +Klutsefluts. +. +; + +test "Denotify ID Last" { + /* #1 */ + notify :options "timo@example.com" :id "aap"; + + /* #2 */ + notify :options "stephan@dovecot.example.net" :id "noot"; + + /* #3 */ + notify :options "postmaster@frop.example.org" :id "mies"; + + denotify :is "mies"; + + if not test_result_execute { + test_fail "failed to execute notify"; + } + + if not test_message :smtp 0 { + test_fail "two notifications should have been sent (#1 missing)"; + } + + if not envelope "to" "timo@example.com" { + test_fail "message #1 unexpectedly missing from output"; + } + + if not test_message :smtp 1 { + test_fail "two notifications should have been sent (#2 missing)"; + } + + if not envelope "to" "stephan@dovecot.example.net" { + test_fail "message #2 unexpectedly missing from output"; + } + + if test_message :smtp 2 { + test_fail "too many notifications sent"; + } +} + + +/* + * Denotify Matching + */ + +test_result_reset; + +test_set "message" text: +From: stephan@example.org +To: nico@frop.example.org +Subject: Frop! + +Klutsefluts. +. +; + +test "Denotify Matching" { + /* #1 */ + notify :options "timo@example.com" :id "frop"; + + /* #2 */ + notify :options "stephan@dovecot.example.net" :id "noot"; + + /* #3 */ + notify :options "postmaster@frop.example.org" :id "friep"; + + denotify :matches "fr*"; + + if not test_result_execute { + test_fail "failed to execute notify"; + } + + if not test_message :smtp 0 { + test_fail "one notification should have been sent"; + } + + if not envelope "to" "stephan@dovecot.example.net" { + test_fail "message #2 unexpectedly missing from output"; + } + + if test_message :smtp 1 { + test_fail "too many notifications sent"; + } +} + + +/* + * Denotify Matching + */ + +test_result_reset; + +test_set "message" text: +From: stephan@example.org +To: nico@frop.example.org +Subject: Frop! + +Klutsefluts. +. +; + +test "Denotify Matching Importance" { + /* #1 */ + notify :options "timo@example.com" :id "frop" :low; + + /* #2 */ + notify :options "stephan@dovecot.example.net" :id "frml" :high; + + /* #3 */ + notify :options "postmaster@frop.example.org" :id "friep" :low; + + denotify :matches "fr*" :low; + + if not test_result_execute { + test_fail "failed to execute notify"; + } + + if not test_message :smtp 0 { + test_fail "one notification should have been sent"; + } + + if not envelope "to" "stephan@dovecot.example.net" { + test_fail "message #2 unexpectedly missing from output"; + } + + if test_message :smtp 1 { + test_fail "too many notifications sent"; + } +} + + -- cgit v1.2.3