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
|
*** Settings ***
Library ${RSPAMD_TESTDIR}/lib/rspamd.py
Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
Variables ${RSPAMD_TESTDIR}/lib/vars.py
*** Variables ***
${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml
${RSPAMD_MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list
${RSPAMD_RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list
${RSPAMD_REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list
${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml
*** Test Cases ***
Recipient Parsing Sanity
Scan File ${MESSAGE} Rcpt=rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar
... Settings={symbols_enabled = [TEST_RCPT]}
Expect Symbol With Exact Options TEST_RCPT rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar
TLD parts
Scan File ${MESSAGE} Settings={symbols_enabled = [TEST_TLD]}
Expect Symbol With Exact Options TEST_TLD no worry
Hashes
Scan File ${MESSAGE} Settings={symbols_enabled = [TEST_HASHES]}
Expect Symbol With Exact Options TEST_HASHES no worry
Maps Key Values
Scan File ${MESSAGE} Settings={symbols_enabled = [RADIX_KV, REGEXP_KV, MAP_KV]}
Expect Symbol With Exact Options RADIX_KV no worry
Expect Symbol With Exact Options REGEXP_KV no worry
Expect Symbol With Exact Options MAP_KV no worry
Option Order
Scan File ${MESSAGE} Settings={symbols_enabled = [OPTION_ORDER, TBL_OPTION_ORDER]}
Expect Symbol With Exact Options OPTION_ORDER one two three 4 5 a
Expect Symbol With Exact Options TBL_OPTION_ORDER one two three 4 5 a
Remove Result
Scan File ${MESSAGE} Settings={symbols_enabled = [REMOVE_RESULT_EXPECTED, REMOVE_RESULT_UNEXPECTED]}
Expect Symbol REMOVE_RESULT_EXPECTED
Do Not Expect Symbol REMOVE_RESULT_UNEXPECTED
Rule conditions
Scan File ${MESSAGE} Settings={symbols_enabled = [ANY_A]}
Expect Symbol With Option ANY_A hello3
Expect Symbol With Option ANY_A hello1
Expect Symbol With Option ANY_A hello2
External Maps Simple
Scan File ${MESSAGE} Settings={symbols_enabled = [EXTERNAL_MAP]}
Expect Symbol With Exact Options EXTERNAL_MAP +hello map
Task Inject Url
Scan File ${URL_ICS} Settings={symbols_enabled = [TEST_INJECT_URL]}
Expect Symbol TEST_INJECT_URL
Group Score Positive
Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_POSITIVE16]}
Expect Symbol With Score GR_POSITIVE1 1
Expect Symbol With Score GR_POSITIVE2 2
Expect Symbol With Score GR_POSITIVE4 4
Expect Symbol With Score GR_POSITIVE8 3
Expect Symbol With Score GR_POSITIVE16 0
Group Score Negative
Scan File ${MESSAGE} Settings={symbols_enabled = [GR_NEGATIVE1, GR_NEGATIVE2, GR_NEGATIVE4, GR_NEGATIVE8]}
Expect Symbol With Score GR_NEGATIVE1 -1
Expect Symbol With Score GR_NEGATIVE2 -2
Expect Symbol With Score GR_NEGATIVE4 -4
Expect Symbol With Score GR_NEGATIVE8 -3
Group Score Mix 1
Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_NEGATIVE1, GR_NEGATIVE2, GR_NEGATIVE4, GR_NEGATIVE8]}
Expect Symbol With Score GR_POSITIVE1 1
Expect Symbol With Score GR_POSITIVE2 2
Expect Symbol With Score GR_POSITIVE4 4
Expect Symbol With Score GR_POSITIVE8 3
Expect Symbol With Score GR_NEGATIVE1 -1
Expect Symbol With Score GR_NEGATIVE2 -2
Expect Symbol With Score GR_NEGATIVE4 -4
Expect Symbol With Score GR_NEGATIVE8 -8
Group Score Mix 2
Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_NEGATIVE16]}
Expect Symbol With Score GR_POSITIVE1 1
Expect Symbol With Score GR_POSITIVE2 2
Expect Symbol With Score GR_POSITIVE4 4
Expect Symbol With Score GR_POSITIVE8 3
Expect Symbol With Score GR_NEGATIVE16 -16
Group Score Mix 3
Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_NEGATIVE16]}
Expect Symbol With Score GR_POSITIVE1 1
Expect Symbol With Score GR_NEGATIVE16 -11
Group Score Mix 4
Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE16, GR_NEGATIVE16]}
Expect Symbol With Score GR_POSITIVE16 10
Expect Symbol With Score GR_NEGATIVE16 -16
|