summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/extensions/imap4flags/execute.svtest
blob: 1ee1906bacd822779c27df43b3db04f1a7819894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require "vnd.dovecot.testsuite";
require "imap4flags";
require "relational";


/*
 * Execution testing
 */

test_mailbox_create "INBOX.Junk";
test_mailbox_create "INBOX.Nonsense";

test "Flags Side Effect" {
	if not test_script_compile "execute/flags-side-effect.sieve" {
		test_fail "script compile failed";
	}

	if not test_script_run {
		test_fail "script execute failed";
	}

	if not test_result_execute {
		test_fail "result execute failed";
	}

	test_result_reset;

	if not test_message :folder "INBOX.Junk" 0 {
		test_fail "message not stored in INBOX.Junk";
	}

	if not hasflag :count "eq" "1" {
		test_fail "invalid number of flags for message in INBOX.Junk";
	}

	if not hasflag :is "NONSENSE" {
		test_fail "invalid flag set for message in INBOX.Junk";
	}

	test_result_reset;

	if not test_message :folder "INBOX" 0 {
		test_fail "message not stored in INBOX";
	}

	if not hasflag :count "eq" "1" {
		test_fail "invalid number of flags for message in INBOX";
	}

	if not hasflag :is "\\seen" {
		test_fail "invalid flag set for message in INBOX";
	}

	test_result_reset;

	if not test_message :folder "INBOX.Nonsense" 0 {
		test_fail "message not stored in INBOX.Nonsense";
	}

	if not hasflag :count "eq" "1" {
		test_fail "invalid number of flags for message in Inbox.Nonsense";
	}

	if not hasflag :is "IMPLICIT" {
		test_fail "invalid flag set for message in Inbox.Nonsene";
	}

}