summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/extensions/editheader/utf8.svtest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:51:24 +0000
commitf7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch)
treea3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /pigeonhole/tests/extensions/editheader/utf8.svtest
parentInitial commit. (diff)
downloaddovecot-upstream.tar.xz
dovecot-upstream.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/editheader/utf8.svtest')
-rw-r--r--pigeonhole/tests/extensions/editheader/utf8.svtest97
1 files changed, 97 insertions, 0 deletions
diff --git a/pigeonhole/tests/extensions/editheader/utf8.svtest b/pigeonhole/tests/extensions/editheader/utf8.svtest
new file mode 100644
index 0000000..159a71c
--- /dev/null
+++ b/pigeonhole/tests/extensions/editheader/utf8.svtest
@@ -0,0 +1,97 @@
+require "vnd.dovecot.testsuite";
+
+require "encoded-character";
+require "variables";
+require "editheader";
+
+test_set "message" text:
+Subject: Frop!
+From: stephan@example.com
+To: stephan@example.com
+
+Frop!
+.
+;
+
+test "UTF8 - add; get" {
+ set "comment" "Ein unerh${unicode:00F6}rt gro${unicode:00DF}er Test";
+
+ addheader "Comment" "${comment}";
+
+ if not exists "comment" {
+ test_fail "header not added";
+ }
+
+ if not header :is "comment" "${comment}" {
+ test_fail "wrong content added/retrieved";
+ }
+
+ redirect "frop@example.com";
+
+ if not test_result_execute {
+ test_fail "failed to execute result";
+ }
+
+ /* redirected message */
+
+ if not test_message :smtp 0 {
+ test_fail "message not redirected";
+ }
+
+ if not exists "comment" {
+ test_fail "header not added in redirected mail";
+ }
+
+ if not header :is "comment" "${comment}" {
+ test_fail "wrong content added/retrieved from redirected mail";
+ }
+}
+
+test_result_reset;
+
+test_set "message" text:
+Subject: Frop!
+Comment: Ein =?utf-8?q?unerh=C3=B6rt_gro=C3=9Fer?= Test
+X-Spam: no
+From: stephan@example.com
+To: stephan@example.com
+
+Frop!
+.
+;
+
+test "UTF8 - existing; delete other; get" {
+ set "comment" "Ein unerh${unicode:00F6}rt gro${unicode:00DF}er Test";
+
+ deleteheader "x-spam";
+
+ if not exists "comment" {
+ test_fail "header not present";
+ }
+
+ if not header :is "comment" "${comment}" {
+ test_fail "wrong content retrieved";
+ }
+
+ redirect "frop@example.com";
+
+ if not test_result_execute {
+ test_fail "failed to execute result";
+ }
+
+ /* redirected message */
+
+ if not test_message :smtp 0 {
+ test_fail "message not redirected";
+ }
+
+ if not exists "comment" {
+ test_fail "header not present in redirected mail";
+ }
+
+ if not header :is "comment" "${comment}" {
+ test_fail "wrong content retrieved from redirected mail";
+ }
+}
+
+