diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /pigeonhole/tests/extensions/vacation/reply.svtest | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pigeonhole/tests/extensions/vacation/reply.svtest')
-rw-r--r-- | pigeonhole/tests/extensions/vacation/reply.svtest | 536 |
1 files changed, 536 insertions, 0 deletions
diff --git a/pigeonhole/tests/extensions/vacation/reply.svtest b/pigeonhole/tests/extensions/vacation/reply.svtest new file mode 100644 index 0000000..55cc58d --- /dev/null +++ b/pigeonhole/tests/extensions/vacation/reply.svtest @@ -0,0 +1,536 @@ +require "vnd.dovecot.testsuite"; +require "envelope"; +require "vacation"; + +test_set "message" text: +From: sirius@example.com +To: sirius@example.com +Cc: stephan@example.com +Subject: Frop! + +Frop! +. +; + +/* + * No reply to own address + */ + +test_set "envelope.from" "stephan@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to own address" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to alternative address + */ + +test_result_reset; + +test_set "envelope.from" "sirius@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to alternative address" { + vacation :addresses "sirius@example.com" "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to mailing list + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: dovecot@lists.example.com +List-ID: <dovecot.lists.example.com> +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "<dovecot-bounces+timo=example.com@lists.example.com>"; +test_set "envelope.to" "dovecot@lists.example.com"; + +test "No reply to mailing list" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + + +/* + * No reply to bulk mail + */ + +test_result_reset; + +test_set "message" text: +From: spam@example.com +To: stephan@example.com +Precedence: bulk +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "spam@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to bulk mail" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to auto-submitted mail + */ + +test_result_reset; + +test_set "message" text: +From: spam@example.com +To: stephan@example.com +Auto-submitted: yes +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "spam@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to auto-submitted mail" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to Microsoft X-Auto-Response-Suppress - All + */ + +test_result_reset; + +test_set "message" text: +From: spam@example.com +To: stephan@example.com +X-Auto-Response-Suppress: All +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "spam@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to Microsoft X-Auto-Response-Suppress - All" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to Microsoft X-Auto-Response-Suppress - OOF + */ + +test_result_reset; + +test_set "message" text: +From: spam@example.com +To: stephan@example.com +X-Auto-Response-Suppress: OOF +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "spam@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to Microsoft X-Auto-Response-Suppress - OOF" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to Microsoft X-Auto-Response-Suppress - DR,OOF,RN + */ + +test_result_reset; + +test_set "message" text: +From: spam@example.com +To: stephan@example.com +X-Auto-Response-Suppress: DR, OOF, RN +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "spam@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to Microsoft X-Auto-Response-Suppress - DR,OOF,RN" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to system address + */ + +test_result_reset; + +test_set "message" text: +From: dovecot@lists.example.com +To: stephan@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "dovecot-request@lists.example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "No reply to system address" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to implicitly delivered message + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: all@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test_config_set "sieve_user_email" "jason@example.com"; +test_config_reload; + +test "No reply for implicitly delivered message" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * No reply to original recipient + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: all@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; +test_set "envelope.orig_to" "all@example.com"; + +test "No reply for original recipient" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if test_message :smtp 0 { + test_fail "vacation not supposed to send message"; + } +} + +/* + * Reply for normal mail + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: stephan@example.com +Subject: Frop! +Auto-submitted: no +Precedence: normal +X-Auto-Response-Suppress: None + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "Reply for normal mail" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } +} + +/* + * Reply for :addresses + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: all@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "Reply for :addresses" { + vacation :addresses "all@example.com" "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } +} + +/* + * Reply for :addresses (case sensitivity) + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: Stephan.Bosch@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test "Reply for :addresses (case sensitivity)" { + vacation :addresses "stephan.bosch@example.com" "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } +} + +/* + * Reply for original recipient + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: all@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; +test_set "envelope.orig_to" "all@example.com"; + +test_config_set "sieve_vacation_use_original_recipient" "yes"; +test_config_reload :extension "vacation"; + +test "Reply for original recipient" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } +} + +/* + * Reply for user's explicitly configured email address + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: user@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "jibberish@example.com"; +test_set "envelope.orig_to" "even-more-jibberish@example.com"; + +test_config_set "sieve_user_email" "user@example.com"; +test_config_reload; + +test "Reply for user's explicitly configured email address" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } + + if not address "from" "user@example.com" { + test_fail "mail not sent from user's email address"; + } +} + +/* + * Reply for any recipient + */ + +test_result_reset; + +test_set "message" text: +From: timo@example.com +To: all@example.com +Subject: Frop! + +Frop! +. +; + +test_set "envelope.from" "timo@example.com"; +test_set "envelope.to" "stephan@example.com"; + +test_config_set "sieve_vacation_dont_check_recipient" "yes"; +test_config_reload :extension "vacation"; + +test "Reply for any recipient" { + vacation "I am gone"; + + if not test_result_execute { + test_fail "failed to execute vacation"; + } + + if not test_message :smtp 0 { + test_fail "vacation did not reply"; + } +} + + + + |