File: basic.svtest

package info (click to toggle)
dovecot 1%3A2.3.4.1-5%2Bdeb10u6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 48,648 kB
  • sloc: ansic: 500,433; makefile: 7,372; sh: 5,592; cpp: 1,555; perl: 303; python: 73; xml: 44; pascal: 27
file content (111 lines) | stat: -rw-r--r-- 2,443 bytes parent folder | download | duplicates (12)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
require "vnd.dovecot.testsuite";
require "envelope";
require "subaddress";

test_set "message" text:
From: stephan+sieve@example.org
To: test+failed@example.com
Subject: subaddress test

Test!
.
;

test_set "envelope.to" "friep+frop@dovecot.example.net";
test_set "envelope.from" "list+request@lists.dovecot.example.net";

test "Address from :user" {
	if not address :is :user "from" "stephan" {
		test_fail "wrong user part extracted";
	}

	if address :is :user "from" "nonsence" {
		test_fail "address test failed";
	}
}

test "Address from :detail" {
	if not address :is :detail "from" "sieve" {
		test_fail "wrong user part extracted";
	}

	if address :is :detail "from" "nonsence" {
		test_fail "address test failed";
	}
}

test "Address to :user" {
	if not address :contains :user "to" "est" {
		test_fail "wrong user part extracted";
	}

	if address :contains :user "to" "ail" {
		test_fail "address test failed";
	}
}

test "Address to :detail" {
	if not address :contains :detail "to" "fai" {
		test_fail "wrong user part extracted";
	}

	if address :contains :detail "to" "sen" {
		test_fail "address test failed";
	}
}


test "Envelope :user" {
	if not envelope :is :user "to" "friep" {
		test_fail "wrong user part extracted 1";
	}

	if not envelope :comparator "i;ascii-casemap" :is :user "to" "FRIEP" {
		test_fail "wrong user part extracted";
	}

	if envelope :comparator "i;ascii-casemap" :is :user "to" "FROP" {
		test_fail "envelope test failed";
	}
}

test "Envelope :detail" {
	if not envelope :comparator "i;ascii-casemap" :contains :detail "from" "QUES" {
		test_fail "wrong user part extracted";
	}

	if envelope :comparator "i;ascii-casemap" :contains :detail "from" "LIS" {
		test_fail "address test failed";
	}
}

test_set "message" text:
From: frop@examples.com
To: undisclosed-recipients:;
Subject: subaddress test

Test!
.
;

test "Undisclosed-recipients" {
	if address :detail :contains "to" "undisclosed-recipients" {
		test_fail ":detail matched group name";
	}

	if address :user :contains "to" "undisclosed-recipients" {
		test_fail ":user matched group name";
	}
}

test_set "envelope.to" "frop@sieve.example.net";

test "No detail" {
	if envelope :detail "to" "virus" {
		test_fail ":detail matched non-existent detail element in envelope (separator is missing)";
	}

	if address :detail "from" "virus" {
		test_fail ":detail matched non-existent detail element in from header (separator is missing)";
	}
}