summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/deprecated/imapflags
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/deprecated/imapflags
parentInitial commit. (diff)
downloaddovecot-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/deprecated/imapflags')
-rw-r--r--pigeonhole/tests/deprecated/imapflags/errors.svtest24
-rw-r--r--pigeonhole/tests/deprecated/imapflags/errors/conflict-ihave.sieve6
-rw-r--r--pigeonhole/tests/deprecated/imapflags/errors/conflict.sieve4
-rw-r--r--pigeonhole/tests/deprecated/imapflags/execute.svtest92
-rw-r--r--pigeonhole/tests/deprecated/imapflags/execute/flags.sieve12
-rw-r--r--pigeonhole/tests/deprecated/imapflags/execute/mark.sieve11
6 files changed, 149 insertions, 0 deletions
diff --git a/pigeonhole/tests/deprecated/imapflags/errors.svtest b/pigeonhole/tests/deprecated/imapflags/errors.svtest
new file mode 100644
index 0000000..a9d9cde
--- /dev/null
+++ b/pigeonhole/tests/deprecated/imapflags/errors.svtest
@@ -0,0 +1,24 @@
+require "vnd.dovecot.testsuite";
+
+require "comparator-i;ascii-numeric";
+require "relational";
+
+test "Deprecated imapflags extension used with imap4flags" {
+ if test_script_compile "errors/conflict.sieve" {
+ test_fail "compile should have failed";
+ }
+
+ if not test_error :count "eq" :comparator "i;ascii-numeric" "2" {
+ test_fail "wrong number of errors reported";
+ }
+}
+
+test "Deprecated imapflags extension used with imap4flags (ihave)" {
+ if test_script_compile "errors/conflict-ihave.sieve" {
+ test_fail "compile should have failed";
+ }
+
+ if not test_error :count "eq" :comparator "i;ascii-numeric" "3" {
+ test_fail "wrong number of errors reported";
+ }
+}
diff --git a/pigeonhole/tests/deprecated/imapflags/errors/conflict-ihave.sieve b/pigeonhole/tests/deprecated/imapflags/errors/conflict-ihave.sieve
new file mode 100644
index 0000000..e924923
--- /dev/null
+++ b/pigeonhole/tests/deprecated/imapflags/errors/conflict-ihave.sieve
@@ -0,0 +1,6 @@
+require "imap4flags";
+require "ihave";
+
+if ihave "imapflags" {
+ addflags "Frop";
+}
diff --git a/pigeonhole/tests/deprecated/imapflags/errors/conflict.sieve b/pigeonhole/tests/deprecated/imapflags/errors/conflict.sieve
new file mode 100644
index 0000000..1b18a42
--- /dev/null
+++ b/pigeonhole/tests/deprecated/imapflags/errors/conflict.sieve
@@ -0,0 +1,4 @@
+require "imapflags";
+require "imap4flags";
+
+addflag "\\flagged";
diff --git a/pigeonhole/tests/deprecated/imapflags/execute.svtest b/pigeonhole/tests/deprecated/imapflags/execute.svtest
new file mode 100644
index 0000000..ea6657b
--- /dev/null
+++ b/pigeonhole/tests/deprecated/imapflags/execute.svtest
@@ -0,0 +1,92 @@
+require "vnd.dovecot.testsuite";
+require "fileinto";
+require "imap4flags";
+require "relational";
+require "comparator-i;ascii-numeric";
+require "mailbox";
+
+test_set "message" text:
+From: Henry von Flockenstoffen <henry@example.com>
+To: Dieter von Ausburg <dieter@example.com>
+Subject: Test message.
+
+Test message.
+.
+;
+
+test "Mark / Unmark" {
+ if not test_script_compile "execute/mark.sieve" {
+ test_fail "script compile failed";
+ }
+
+ if not test_script_run {
+ test_fail "script execute failed";
+ }
+
+ if not test_result_execute {
+ test_fail "failed to execute first result";
+ }
+
+ test_result_reset;
+
+ test_message :folder "Marked" 0;
+
+ if not hasflag "\\flagged" {
+ test_fail "message not marked";
+ }
+
+ test_result_reset;
+
+ test_message :folder "Unmarked" 0;
+
+ if hasflag "\\flagged" {
+ test_fail "message not unmarked";
+ }
+}
+
+test_result_reset;
+test "Setflag / Addflag / Removeflag" {
+ if not test_script_compile "execute/flags.sieve" {
+ test_fail "script compile failed";
+ }
+
+ if not test_script_run {
+ test_fail "script execute failed";
+ }
+
+ if not test_result_execute {
+ test_fail "failed to execute first result";
+ }
+
+ test_result_reset;
+
+ test_message :folder "Set" 0;
+
+ if not hasflag "\\draft" {
+ test_fail "flag not set";
+ }
+
+ test_result_reset;
+
+ test_message :folder "Add" 0;
+
+ if not hasflag "\\draft" {
+ test_fail "flag not retained";
+ }
+
+ if not hasflag "\\flagged" {
+ test_fail "flag not added";
+ }
+
+ test_result_reset;
+
+ test_message :folder "Remove" 0;
+
+ if not hasflag "\\flagged" {
+ test_fail "flag not retained";
+ }
+
+ if hasflag "\\draft" {
+ test_fail "flag not removed";
+ }
+}
diff --git a/pigeonhole/tests/deprecated/imapflags/execute/flags.sieve b/pigeonhole/tests/deprecated/imapflags/execute/flags.sieve
new file mode 100644
index 0000000..ba68b44
--- /dev/null
+++ b/pigeonhole/tests/deprecated/imapflags/execute/flags.sieve
@@ -0,0 +1,12 @@
+require "imapflags";
+require "fileinto";
+require "mailbox";
+
+setflag "\\draft";
+fileinto :create "Set";
+
+addflag "\\flagged";
+fileinto :create "Add";
+
+removeflag "\\draft";
+fileinto :create "Remove";
diff --git a/pigeonhole/tests/deprecated/imapflags/execute/mark.sieve b/pigeonhole/tests/deprecated/imapflags/execute/mark.sieve
new file mode 100644
index 0000000..3216ca4
--- /dev/null
+++ b/pigeonhole/tests/deprecated/imapflags/execute/mark.sieve
@@ -0,0 +1,11 @@
+require "imapflags";
+require "fileinto";
+require "mailbox";
+
+mark;
+
+fileinto :create "Marked";
+
+unmark;
+
+fileinto :create "Unmarked";