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
|
require "vnd.dovecot.testsuite";
require "virustest";
require "relational";
require "comparator-i;ascii-numeric";
require "variables";
/*
* Text
*/
test_set "message" text:
From: legitimate@example.com
To: victim@dovecot.example.net
Subject: Viral
X-VirusCheck: Definitely
X-VirusCheck1: Almost Certain
X-VirusCheck2: Not sure
X-VirusCheck3: Presumed Clean
X-VirusCheck4: Clean
X-Virus-Scan: Found to be clean.
X-Virus-Scan1: Found to be infected.
X-Virus-Scan2: Found to be harmless.
Test!
.
;
test_config_set "sieve_virustest_status_header" "X-VirusCheck";
test_config_set "sieve_virustest_status_type" "text";
test_config_set "sieve_virustest_text_value1" "Clean";
test_config_set "sieve_virustest_text_value2" "Presumed Clean";
test_config_set "sieve_virustest_text_value3" "Not sure";
test_config_set "sieve_virustest_text_value4" "Almost Certain";
test_config_set "sieve_virustest_text_value5" "Definitely";
test_config_reload :extension "virustest";
test "Text: 5" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "5" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-VirusCheck1";
test_config_reload :extension "virustest";
test "Text: 4" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "4" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-VirusCheck2";
test_config_reload :extension "virustest";
test "Text: 3" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "3" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-VirusCheck3";
test_config_reload :extension "virustest";
test "Text: 2" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "2" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-VirusCheck4";
test_config_reload :extension "virustest";
test "Text: 1" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "1" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-Virus-Scan:Found to be (.+)\.";
test_config_set "sieve_virustest_status_type" "text";
test_config_set "sieve_virustest_text_value1" "clean";
test_config_set "sieve_virustest_text_value5" "infected";
test_config_reload :extension "virustest";
test "Text: regex: 1" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "1" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-Virus-Scan1:Found to be (.+)\.";
test_config_reload :extension "virustest";
test "Text: regex: 5" {
if virustest :is "0" {
test_fail "virustest not configured or test failed";
}
if not virustest :value "eq" "5" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
test_config_set "sieve_virustest_status_header" "X-Virus-Scan2:Found to be (.+)\.";
test_config_reload :extension "virustest";
test "Text: regex: 0" {
if not virustest :is "0" {
if virustest :matches "*" { }
test_fail "wrong virus value produced: ${1}";
}
}
|