summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/deprecated/notify/basic.svtest
blob: 974f8ca5b53da05b2b0c72e0c94051083da9a4c2 (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
require "vnd.dovecot.testsuite";
require "notify";
require "body";

test "Execute" {
	/* Test to catch runtime segfaults */
	notify
		:message "This is probably very important"
		:low
		:method "mailto"
		:options ["stephan@example.com", "stephan@example.org"];

	if not test_result_execute {
		test_fail "Execute failed";
	}
}

test_result_reset;

test_set "message" text:
To: user@example.com
From: stephan@example.org
Subject: Mail

Test!
.
;

test "Substitutions" {
	notify
		:message "$from$: $subject$"
		:options "stephan@example.com";
	if not test_result_execute {
		test_fail "Execute failed";
	}
	test_message :smtp 0;
	if not body :contains "stephan@example.org: Mail" {
		test_fail "Substitution failed";
	}
}

test_result_reset;

test_set "message" text:
To: user@example.com

Test!
.
;

test "Empty substitutions" {
	notify
		:message "$from$: $subject$"
		:options "stephan@example.com";
	if not test_result_execute {
		test_fail "Execute failed";
	}
}