summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/extensions/editheader/utf8.svtest
blob: 159a71cc518d8994bb5557fe1784d6f029ba5333 (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
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
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";
	}
}