Debian Codegraph @

test/functional/cases/108_settings.robot

raw
1 *** Settings ***
2 Suite Setup Settings Setup
3 Suite Teardown Settings Teardown
4 Library ${RSPAMD_TESTDIR}/lib/rspamd.py
5 Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
6 Variables ${RSPAMD_TESTDIR}/lib/vars.py
7
8 *** Variables ***
9 ${CONFIG} ${RSPAMD_TESTDIR}/configs/settings.conf
10 ${HAM_MESSAGE} ${RSPAMD_TESTDIR}/messages/ham.eml
11 ${MESSAGE_7BIT} ${RSPAMD_TESTDIR}/messages/utf.eml
12 ${MESSAGE_ABSENT_MIME} ${RSPAMD_TESTDIR}/messages/ed25519.eml
13 ${MESSAGE_CUSTOM_HDR} ${RSPAMD_TESTDIR}/messages/empty-plain-text.eml
14 ${MESSAGE_PRIORITY} ${RSPAMD_TESTDIR}/messages/priority.eml
15 ${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml
16 ${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/settings.lua
17 ${RSPAMD_SCOPE} Suite
18 ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat
19 ${SPAM_MESSAGE} ${RSPAMD_TESTDIR}/messages/spam.eml
20
21 *** Keywords ***
22 Check Everything Disabled
23 Expect Action no action
24 Do Not Expect Symbol SIMPLE_VIRTUAL
25 Do Not Expect Symbol SIMPLE_PRE
26 Do Not Expect Symbol SIMPLE_POST
27 Do Not Expect Symbol BAYES_SPAM
28
29 *** Test Cases ***
30 NO SETTINGS SPAM
31 Scan File ${SPAM_MESSAGE}
32 Expect Symbol SIMPLE_TEST
33 Expect Symbol SIMPLE_VIRTUAL
34 Do Not Expect Symbol SIMPLE_VIRTUAL1
35 Expect Symbol SIMPLE_PRE
36 Expect Symbol SIMPLE_POST
37 Expect Symbol BAYES_SPAM
38
39 NO SETTINGS HAM
40 Scan File ${HAM_MESSAGE}
41 Expect Symbol SIMPLE_TEST
42 Expect Symbol SIMPLE_PRE
43 Expect Symbol SIMPLE_POST
44 Expect Symbol BAYES_HAM
45
46 EMPTY SYMBOLS ENABLED - STATIC
47 Scan File ${SPAM_MESSAGE} IP=5.5.5.5
48 Check Everything Disabled
49
50 EMPTY GROUPS ENABLED - STATIC
51 Scan File ${SPAM_MESSAGE} IP=5.5.5.6
52 Check Everything Disabled
53
54 EMPTY SYMBOLS ENABLED - SETTINGS-ID
55 Scan File ${SPAM_MESSAGE} Settings-Id=empty_symbols_enabled
56 Check Everything Disabled
57
58 EMPTY GROUPS ENABLED - SETTINGS-ID
59 Scan File ${SPAM_MESSAGE} Settings-Id=empty_groups_enabled
60 Check Everything Disabled
61
62 ENABLE SYMBOL - NORMAL
63 Scan File ${HAM_MESSAGE} Settings={symbols_enabled = ["SIMPLE_TEST"]}
64 Expect Symbol SIMPLE_TEST
65 Do Not Expect Symbol SIMPLE_PRE
66 Do Not Expect Symbol SIMPLE_POST
67 Do Not Expect Symbol BAYES_HAM
68
69 ENABLE SYMBOL - POSTFILTER
70 Scan File ${HAM_MESSAGE} Settings={symbols_enabled = ["SIMPLE_TEST", "SIMPLE_POST"]}
71 Expect Symbol SIMPLE_TEST
72 Expect Symbol SIMPLE_POST
73 Do Not Expect Symbol SIMPLE_PRE
74 Do Not Expect Symbol BAYES_HAM
75
76 ENABLE SYMBOL - PREFILTER
77 Scan File ${HAM_MESSAGE} Settings={symbols_enabled = ["SIMPLE_PRE"]}
78 Expect Symbol SIMPLE_PRE
79 Do Not Expect Symbol SIMPLE_POST
80 Do Not Expect Symbol SIMPLE_TEST
81 Do Not Expect Symbol BAYES_HAM
82
83 ENABLE SYMBOL - CLASSIFIER
84 Scan File ${HAM_MESSAGE} Settings={symbols_enabled = ["BAYES_HAM", "BAYES_SPAM"]}
85 Expect Symbol BAYES_HAM
86 Do Not Expect Symbol SIMPLE_PRE
87 Do Not Expect Symbol SIMPLE_POST
88 Do Not Expect Symbol SIMPLE_TEST
89
90 DISABLE SYMBOL - NORMAL
91 Scan File ${MESSAGE} Settings={symbols_disabled = ["SIMPLE_TEST"]}
92 Do Not Expect Symbol SIMPLE_TEST
93 Expect Symbol SIMPLE_PRE
94 Expect Symbol SIMPLE_POST
95
96 RESCORE SYMBOL - NORMAL
97 Scan File ${MESSAGE} Settings={SIMPLE_TEST = 3.33}
98 Expect Symbol With Score SIMPLE_TEST 3.33
99
100 INJECT SYMBOL - NORMAL
101 Scan File ${MESSAGE} Settings={symbols = ["INJECTED_SYMBOL1", "INJECTED_SYMBOL2"]}
102 Expect Symbol INJECTED_SYMBOL1
103 Expect Symbol INJECTED_SYMBOL2
104
105 RESCORE ACTION
106 Scan File ${MESSAGE} Settings={actions { reject = 1234.5; } }
107 Expect Required Score 1234.5
108
109 DISABLE GROUP - NORMAL
110 Scan File ${MESSAGE} Settings={groups_disabled = ["b"]}
111 Do Not Expect Symbol SIMPLE_TEST
112 Expect Symbol SIMPLE_PRE
113 Expect Symbol SIMPLE_POST
114
115 ENABLE GROUP - NORMAL
116 Scan File ${MESSAGE} Settings={groups_enabled = ["b"]}
117 Expect Symbol SIMPLE_TEST
118 Do Not Expect Symbol SIMPLE_PRE
119 Do Not Expect Symbol SIMPLE_POST
120
121 SETTINGS ID - NORMAL
122 Scan File ${MESSAGE} Settings-Id=id_test
123 Expect Symbol SIMPLE_TEST
124 Do Not Expect Symbol SIMPLE_PRE
125 Do Not Expect Symbol SIMPLE_POST
126
127 SETTINGS ID - PRE
128 Scan File ${MESSAGE} Settings-Id=id_pre
129 Expect Symbol SIMPLE_PRE
130 Do Not Expect Symbol SIMPLE_TEST
131 Do Not Expect Symbol SIMPLE_POST
132
133 SETTINGS ID - VIRTUAL
134 Scan File ${MESSAGE} Settings-Id=id_virtual
135 Expect Symbol SIMPLE_VIRTUAL
136 Do Not Expect Symbol SIMPLE_TEST
137 Do Not Expect Symbol SIMPLE_VIRTUAL1
138 Do Not Expect Symbol DEP_REAL
139 Do Not Expect Symbol SIMPLE_POST
140 Do Not Expect Symbol SIMPLE_PRE
141
142 SETTINGS ID - VIRTUAL GROUP
143 Scan File ${MESSAGE} Settings-Id=id_virtual_group
144 Expect Symbol With Score SIMPLE_VIRTUAL 10
145 Expect Symbol With Score EXPLICIT_VIRTUAL 10
146 Do Not Expect Symbol SIMPLE_TEST
147 Do Not Expect Symbol SIMPLE_VIRTUAL1
148 Do Not Expect Symbol DEP_REAL
149 Do Not Expect Symbol SIMPLE_POST
150 Do Not Expect Symbol SIMPLE_PRE
151
152 SETTINGS ID - VIRTUAL FROM
153 Scan File ${MESSAGE} [email protected]
154 Expect Symbol With Score SIMPLE_VIRTUAL 10
155 Expect Symbol With Score EXPLICIT_VIRTUAL 10
156 Do Not Expect Symbol SIMPLE_TEST
157 Do Not Expect Symbol SIMPLE_VIRTUAL1
158 Do Not Expect Symbol DEP_REAL
159 Do Not Expect Symbol SIMPLE_POST
160 Do Not Expect Symbol SIMPLE_PRE
161
162 SETTINGS ID - VIRTUAL USER
163 Scan File ${MESSAGE} [email protected]
164 Expect Symbol With Score SIMPLE_VIRTUAL 10
165 Expect Symbol With Score EXPLICIT_VIRTUAL 10
166 Do Not Expect Symbol SIMPLE_TEST
167 Do Not Expect Symbol SIMPLE_VIRTUAL1
168 Do Not Expect Symbol DEP_REAL
169 Do Not Expect Symbol SIMPLE_POST
170 Do Not Expect Symbol SIMPLE_PRE
171
172 SETTINGS ID - VIRTUAL HOSTNAME
173 Scan File ${MESSAGE} Hostname=example.com
174 Expect Symbol With Score SIMPLE_VIRTUAL 10
175 Expect Symbol With Score EXPLICIT_VIRTUAL 10
176 Do Not Expect Symbol SIMPLE_TEST
177 Do Not Expect Symbol SIMPLE_VIRTUAL1
178 Do Not Expect Symbol DEP_REAL
179 Do Not Expect Symbol SIMPLE_POST
180 Do Not Expect Symbol SIMPLE_PRE
181
182 SETTINGS ID - VIRTUAL SELECTOR
183 Scan File ${MESSAGE} [email protected]
184 Expect Symbol With Score SIMPLE_VIRTUAL 10
185 Expect Symbol With Score EXPLICIT_VIRTUAL 10
186 Do Not Expect Symbol SIMPLE_TEST
187 Do Not Expect Symbol SIMPLE_VIRTUAL1
188 Do Not Expect Symbol DEP_REAL
189 Do Not Expect Symbol SIMPLE_POST
190 Do Not Expect Symbol SIMPLE_PRE
191
192 SETTINGS ID - ANGLED RECIPIENT
193 Scan File ${MESSAGE} Rcpt=<[email protected]>
194 Expect Symbol With Score SIMPLE_VIRTUAL 10
195 Expect Symbol With Score EXPLICIT_VIRTUAL 10
196 Do Not Expect Symbol SIMPLE_TEST
197 Do Not Expect Symbol SIMPLE_VIRTUAL1
198 Do Not Expect Symbol DEP_REAL
199 Do Not Expect Symbol SIMPLE_POST
200 Do Not Expect Symbol SIMPLE_PRE
201
202 SETTINGS ID - VIRTUAL HEADER MATCH
203 Scan File ${MESSAGE_7BIT}
204 Expect Symbol With Score SIMPLE_VIRTUAL 10
205 Expect Symbol With Score EXPLICIT_VIRTUAL 10
206 Do Not Expect Symbol SIMPLE_TEST
207 Do Not Expect Symbol SIMPLE_VIRTUAL1
208 Do Not Expect Symbol DEP_REAL
209 Do Not Expect Symbol SIMPLE_POST
210 Do Not Expect Symbol SIMPLE_PRE
211
212 SETTINGS ID - VIRTUAL HEADER EXISTS
213 Scan File ${MESSAGE_CUSTOM_HDR}
214 Expect Symbol With Score SIMPLE_VIRTUAL 10
215 Do Not Expect Symbol SIMPLE_TEST
216 Do Not Expect Symbol SIMPLE_VIRTUAL1
217 Do Not Expect Symbol DEP_REAL
218 Do Not Expect Symbol SIMPLE_POST
219 Do Not Expect Symbol SIMPLE_PRE
220
221 SETTINGS ID - VIRTUAL HEADER ABSENT
222 Scan File ${MESSAGE_ABSENT_MIME}
223 Expect Symbol With Score SIMPLE_VIRTUAL 10
224 Do Not Expect Symbol SIMPLE_TEST
225 Do Not Expect Symbol SIMPLE_VIRTUAL1
226 Do Not Expect Symbol DEP_REAL
227 Do Not Expect Symbol SIMPLE_POST
228 Do Not Expect Symbol SIMPLE_PRE
229
230 SETTINGS ID - VIRTUAL REQUEST HEADER
231 Scan File ${MESSAGE} Test=passed
232 Expect Symbol With Score SIMPLE_VIRTUAL 10
233 Do Not Expect Symbol SIMPLE_TEST
234 Do Not Expect Symbol SIMPLE_VIRTUAL1
235 Do Not Expect Symbol DEP_REAL
236 Do Not Expect Symbol SIMPLE_POST
237 Do Not Expect Symbol SIMPLE_PRE
238
239 SETTINGS ID - VIRTUAL DEP
240 Scan File ${MESSAGE} Settings-Id=id_virtual1
241 Expect Symbol EXPLICIT_VIRTUAL1
242 Expect Symbol DEP_VIRTUAL
243 Expect Symbol DEP_REAL
244 Do Not Expect Symbol SIMPLE_TEST
245 Do Not Expect Symbol SIMPLE_VIRTUAL
246 Do Not Expect Symbol SIMPLE_POST
247 Do Not Expect Symbol SIMPLE_PRE
248
249 SETTINGS ID - EXTERNAL MAP
250 Scan File ${MESSAGE} Settings-Id=external
251 Expect Symbol EXTERNAL_SETTINGS
252
253 PRIORITY
254 Scan File ${MESSAGE_PRIORITY} Settings-Id=id_virtual_group [email protected]
255 Expect Symbol PRIORITY_2
256
257
258 *** Keywords ***
259 Settings Setup
260 Copy File ${RSPAMD_TESTDIR}/data/bayes.spam.sqlite3 /tmp/bayes.spam.sqlite3
261 Copy File ${RSPAMD_TESTDIR}/data/bayes.ham.sqlite3 /tmp/bayes.ham.sqlite3
262 Run Dummy Http
263 Rspamd Setup
264
265 Settings Teardown
266 Rspamd Teardown
267 Dummy Http Teardown
268 Remove Files /tmp/bayes.spam.sqlite3 /tmp/bayes.ham.sqlite3