1
require "vnd.dovecot.testsuite";
4
require "comparator-i;ascii-numeric";
11
test_set "message" text:
12
From: legitimate@example.com
13
To: victim@dovecot.example.net
15
X-VirusCheck: Definitely
16
X-VirusCheck1: Almost Certain
17
X-VirusCheck2: Not sure
18
X-VirusCheck3: Presumed Clean
20
X-Virus-Scan: Found to be clean.
21
X-Virus-Scan1: Found to be infected.
22
X-Virus-Scan2: Found to be harmless.
28
test_config :set "sieve_virustest_status_header" "X-VirusCheck";
29
test_config :set "sieve_virustest_status_type" "text";
30
test_config :set "sieve_virustest_text_value1" "Clean";
31
test_config :set "sieve_virustest_text_value2" "Presumed Clean";
32
test_config :set "sieve_virustest_text_value3" "Not sure";
33
test_config :set "sieve_virustest_text_value4" "Almost Certain";
34
test_config :set "sieve_virustest_text_value5" "Definitely";
35
test_config :reload "virustest";
38
if virustest :is "0" {
39
test_fail "virustest not configured or test failed";
42
if not virustest :value "eq" "5" {
43
if virustest :matches "*" { }
44
test_fail "wrong virus value produced: ${1}";
48
test_config :set "sieve_virustest_status_header" "X-VirusCheck1";
49
test_config :reload "virustest";
52
if virustest :is "0" {
53
test_fail "virustest not configured or test failed";
56
if not virustest :value "eq" "4" {
57
if virustest :matches "*" { }
58
test_fail "wrong virus value produced: ${1}";
62
test_config :set "sieve_virustest_status_header" "X-VirusCheck2";
63
test_config :reload "virustest";
66
if virustest :is "0" {
67
test_fail "virustest not configured or test failed";
70
if not virustest :value "eq" "3" {
71
if virustest :matches "*" { }
72
test_fail "wrong virus value produced: ${1}";
76
test_config :set "sieve_virustest_status_header" "X-VirusCheck3";
77
test_config :reload "virustest";
80
if virustest :is "0" {
81
test_fail "virustest not configured or test failed";
84
if not virustest :value "eq" "2" {
85
if virustest :matches "*" { }
86
test_fail "wrong virus value produced: ${1}";
90
test_config :set "sieve_virustest_status_header" "X-VirusCheck4";
91
test_config :reload "virustest";
94
if virustest :is "0" {
95
test_fail "virustest not configured or test failed";
98
if not virustest :value "eq" "1" {
99
if virustest :matches "*" { }
100
test_fail "wrong virus value produced: ${1}";
104
test_config :set "sieve_virustest_status_header" "X-Virus-Scan:Found to be (.+)\.";
105
test_config :set "sieve_virustest_status_type" "text";
106
test_config :set "sieve_virustest_text_value1" "clean";
107
test_config :set "sieve_virustest_text_value5" "infected";
108
test_config :reload "virustest";
110
test "Text: regex: 1" {
111
if virustest :is "0" {
112
test_fail "virustest not configured or test failed";
115
if not virustest :value "eq" "1" {
116
if virustest :matches "*" { }
117
test_fail "wrong virus value produced: ${1}";
121
test_config :set "sieve_virustest_status_header" "X-Virus-Scan1:Found to be (.+)\.";
122
test_config :reload "virustest";
124
test "Text: regex: 5" {
125
if virustest :is "0" {
126
test_fail "virustest not configured or test failed";
129
if not virustest :value "eq" "5" {
130
if virustest :matches "*" { }
131
test_fail "wrong virus value produced: ${1}";
135
test_config :set "sieve_virustest_status_header" "X-Virus-Scan2:Found to be (.+)\.";
136
test_config :reload "virustest";
138
test "Text: regex: 0" {
139
if not virustest :is "0" {
140
if virustest :matches "*" { }
141
test_fail "wrong virus value produced: ${1}";