Debian Codegraph @

test/functional/cases/001_merged/101_lua.robot

raw
1 *** Settings ***
2 Library ${RSPAMD_TESTDIR}/lib/rspamd.py
3 Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
4 Variables ${RSPAMD_TESTDIR}/lib/vars.py
5
6 *** Variables ***
7 ${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml
8 ${RSPAMD_MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list
9 ${RSPAMD_RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list
10 ${RSPAMD_REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list
11 ${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml
12
13 *** Test Cases ***
14 Recipient Parsing Sanity
15 Scan File ${MESSAGE} Rcpt=rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar
16 ... Settings={symbols_enabled = [TEST_RCPT]}
17 Expect Symbol With Exact Options TEST_RCPT rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar
18
19 TLD parts
20 Scan File ${MESSAGE} Settings={symbols_enabled = [TEST_TLD]}
21 Expect Symbol With Exact Options TEST_TLD no worry
22
23 Hashes
24 Scan File ${MESSAGE} Settings={symbols_enabled = [TEST_HASHES]}
25 Expect Symbol With Exact Options TEST_HASHES no worry
26
27 Maps Key Values
28 Scan File ${MESSAGE} Settings={symbols_enabled = [RADIX_KV, REGEXP_KV, MAP_KV]}
29 Expect Symbol With Exact Options RADIX_KV no worry
30 Expect Symbol With Exact Options REGEXP_KV no worry
31 Expect Symbol With Exact Options MAP_KV no worry
32
33 Option Order
34 Scan File ${MESSAGE} Settings={symbols_enabled = [OPTION_ORDER, TBL_OPTION_ORDER]}
35 Expect Symbol With Exact Options OPTION_ORDER one two three 4 5 a
36 Expect Symbol With Exact Options TBL_OPTION_ORDER one two three 4 5 a
37
38 Remove Result
39 Scan File ${MESSAGE} Settings={symbols_enabled = [REMOVE_RESULT_EXPECTED, REMOVE_RESULT_UNEXPECTED]}
40 Expect Symbol REMOVE_RESULT_EXPECTED
41 Do Not Expect Symbol REMOVE_RESULT_UNEXPECTED
42
43 Rule conditions
44 Scan File ${MESSAGE} Settings={symbols_enabled = [ANY_A]}
45 Expect Symbol With Option ANY_A hello3
46 Expect Symbol With Option ANY_A hello1
47 Expect Symbol With Option ANY_A hello2
48
49 External Maps Simple
50 Scan File ${MESSAGE} Settings={symbols_enabled = [EXTERNAL_MAP]}
51 Expect Symbol With Exact Options EXTERNAL_MAP +hello map
52
53 Task Inject Url
54 Scan File ${URL_ICS} Settings={symbols_enabled = [TEST_INJECT_URL]}
55 Expect Symbol TEST_INJECT_URL
56
57 Group Score Positive
58 Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_POSITIVE16]}
59 Expect Symbol With Score GR_POSITIVE1 1
60 Expect Symbol With Score GR_POSITIVE2 2
61 Expect Symbol With Score GR_POSITIVE4 4
62 Expect Symbol With Score GR_POSITIVE8 3
63 Expect Symbol With Score GR_POSITIVE16 0
64
65 Group Score Negative
66 Scan File ${MESSAGE} Settings={symbols_enabled = [GR_NEGATIVE1, GR_NEGATIVE2, GR_NEGATIVE4, GR_NEGATIVE8]}
67 Expect Symbol With Score GR_NEGATIVE1 -1
68 Expect Symbol With Score GR_NEGATIVE2 -2
69 Expect Symbol With Score GR_NEGATIVE4 -4
70 Expect Symbol With Score GR_NEGATIVE8 -3
71
72 Group Score Mix 1
73 Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_NEGATIVE1, GR_NEGATIVE2, GR_NEGATIVE4, GR_NEGATIVE8]}
74 Expect Symbol With Score GR_POSITIVE1 1
75 Expect Symbol With Score GR_POSITIVE2 2
76 Expect Symbol With Score GR_POSITIVE4 4
77 Expect Symbol With Score GR_POSITIVE8 3
78 Expect Symbol With Score GR_NEGATIVE1 -1
79 Expect Symbol With Score GR_NEGATIVE2 -2
80 Expect Symbol With Score GR_NEGATIVE4 -4
81 Expect Symbol With Score GR_NEGATIVE8 -8
82
83 Group Score Mix 2
84 Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_POSITIVE2, GR_POSITIVE4, GR_POSITIVE8, GR_NEGATIVE16]}
85 Expect Symbol With Score GR_POSITIVE1 1
86 Expect Symbol With Score GR_POSITIVE2 2
87 Expect Symbol With Score GR_POSITIVE4 4
88 Expect Symbol With Score GR_POSITIVE8 3
89 Expect Symbol With Score GR_NEGATIVE16 -16
90
91 Group Score Mix 3
92 Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE1, GR_NEGATIVE16]}
93 Expect Symbol With Score GR_POSITIVE1 1
94 Expect Symbol With Score GR_NEGATIVE16 -11
95
96 Group Score Mix 4
97 Scan File ${MESSAGE} Settings={symbols_enabled = [GR_POSITIVE16, GR_NEGATIVE16]}
98 Expect Symbol With Score GR_POSITIVE16 10
99 Expect Symbol With Score GR_NEGATIVE16 -16