File: smtp.svtest

package info (click to toggle)
dovecot 1%3A2.2.27-3~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 48,308 kB
  • sloc: ansic: 430,242; sh: 17,401; makefile: 6,581; cpp: 1,557; perl: 295; xml: 44; pascal: 27; python: 27
file content (157 lines) | stat: -rw-r--r-- 2,878 bytes parent folder | download | duplicates (9)
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
require "vnd.dovecot.testsuite";
require "envelope";
require "vacation";
require "variables";

test_set "message" text:
From: stephan@example.org
To: tss@example.net
Subject: Frop!

Frop!
.
;

test_set "envelope.from" "sirius@example.org";
test_set "envelope.to" "timo@example.net";

test "Basic" {
	vacation :addresses "tss@example.net" :from "Timo Sirainen <sirainen@example.net>" "I am gone";

	if not test_result_execute {
		test_fail "failed to execute vacation";
	}

	test_message :smtp 0;

	if not address :is "to" "sirius@example.org" {
		test_fail "to address incorrect";
	}

	if not address :is "from" "sirainen@example.net" {
		test_fail "from address incorrect";
	}

	if not envelope :is "to" "sirius@example.org" {
		test_fail "envelope recipient incorrect";
	}

	if not envelope :is "from" "" {
		test_fail "envelope sender not null";
	}
}

test_result_reset;
test_set "envelope.from" "<>";

test "Null Sender" {
	vacation :addresses "tss@example.net" "I am gone";

	if not test_result_execute {
		test_fail "failed to execute vacation";
	}

	if test_message :smtp 0 {
		test_fail "reject sent message to NULL sender";
	}
}

test_result_reset;

test_set "message" text:
From: stephan@example.org
To: timo@example.net
Cc: stephan@friep.example.com
Subject: Frop!

Frop!
.
;

test_set "envelope.from" "sirius@example.org";
test_set "envelope.to" "timo@example.net";

test "Envelope.to == To" {
	vacation "I am gone";

	if not test_result_execute {
		test_fail "failed to execute vacation";
	}

	test_message :smtp 0;

	if not address :is "from" "timo@example.net" {
		test_fail "from address incorrect";
	}

	if not envelope :is "from" "" {
		test_fail "envelope sender not null";
	}
}

test_result_reset;

test_set "message" text:
From: stephan@example.org
To: tss@example.net
Cc: stephan@friep.example.com
Subject: Frop!

Frop!
.
;

test_set "envelope.from" "sirius@example.org";
test_set "envelope.to" "timo@example.net";

test "Envelope.to != To" {
	vacation :addresses "tss@example.net" "I am gone";

	if not test_result_execute {
		test_fail "failed to execute vacation";
	}

	test_message :smtp 0;

	if not address :is "from" "tss@example.net" {
		test_fail "from address incorrect";
	}

	if not envelope :is "from" "" {
		test_fail "envelope sender not null";
	}
}

test_result_reset;

test_set "message" text:
From: stephan@example.org
To: tss@example.net
Cc: colleague@example.net
Subject: Frop!

Frop!
.
;

test_set "envelope.from" "sirius@example.org";
test_set "envelope.to" "colleague@example.net";

test "Cc" {
	vacation "I am gone";

	if not test_result_execute {
		test_fail "failed to execute vacation";
	}

	test_message :smtp 0;

	if not address :is "from" "colleague@example.net" {
		if address :matches "from" "*" { }
		test_fail "from address incorrect: ${1}";
	}

	if not envelope :is "from" "" {
		test_fail "envelope sender not null";
	}
}