File: spamtestplus.svtest

package info (click to toggle)
dovecot 1:2.2.13-12~deb8u4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 38,792 kB
  • sloc: ansic: 341,472; sh: 16,920; makefile: 5,393; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (136 lines) | stat: -rw-r--r-- 3,357 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
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
require "vnd.dovecot.testsuite";
require "spamtestplus";
require "relational";
require "comparator-i;ascii-numeric";
require "variables";

/*
 * Value
 */

test_set "message" text:
From: legitimate@example.com
To: victim@dovecot.example.net
Subject: Not spammish
X-SpamCheck: .00
X-SpamCheck1: .01
X-SpamCheck2: .13
X-SpamCheck3: .29
X-SpamCheck4: .51
X-SpamCheck5: .73
X-SpamCheck6: .89
X-SpamCheck7: 1.01
Test!
.
;

test_config_set "sieve_spamtest_status_header" "X-SpamCheck";
test_config_set "sieve_spamtest_max_value" "1";
test_config_set "sieve_spamtest_status_type" "score";
test_config_reload :extension "spamtestplus";

test "Value percent: .00" {
	if not spamtest :percent :is "0" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck1";
test_config_reload :extension "spamtestplus";

test "Value percent: .01" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "1" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck2";
test_config_reload :extension "spamtestplus";

test "Value percent: .13" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "13" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck3";
test_config_reload :extension "spamtestplus";

test "Value percent: .29" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "29" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck4";
test_config_reload :extension "spamtestplus";

test "Value percent: .51" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "51" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck5";
test_config_reload :extension "spamtestplus";

test "Value percent: .73" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "73" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck6";
test_config_reload :extension "spamtestplus";

test "Value percent: .89" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "89" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}

test_config_set "sieve_spamtest_status_header" "X-SpamCheck7";
test_config_reload :extension "spamtestplus";

test "Value percent: 1.01" {
	if spamtest :percent :is "0" {
		test_fail "spamtest not configured or test failed";
	}

	if not spamtest :percent :is "100" {
		if spamtest :percent :matches "*" { }
		test_fail "wrong percent spam value produced: ${1}";
	}
}