commit c07cb6a: [Test] Use HTTP & simplified test style
Andrew Lewis
nerf at judo.za.org
Mon Sep 7 13:42:08 UTC 2020
Author: Andrew Lewis
Date: 2020-09-07 15:14:22 +0200
URL: https://github.com/rspamd/rspamd/commit/c07cb6a8c4f45d0cf35baacf539d5c78145fe1de (refs/pull/3444/head)
[Test] Use HTTP & simplified test style
---
test/functional/cases/100_general.robot | 29 ++-
test/functional/cases/101_lua.robot | 39 ++-
test/functional/cases/102_multimap.robot | 303 +++++++++++-----------
test/functional/cases/104_get_from.robot | 44 ++--
test/functional/cases/105_mimetypes.robot | 60 ++---
test/functional/cases/106_mid.robot | 32 +--
test/functional/cases/108_settings.robot | 333 ++++++++++++-------------
test/functional/cases/109_composites.robot | 94 +++----
test/functional/cases/110_statistics/lib.robot | 18 +-
test/functional/cases/114_phishing.robot | 12 +-
test/functional/cases/115_dmarc.robot | 84 +++----
test/functional/cases/116_dkim.robot | 36 +--
test/functional/cases/117_spf.robot | 162 ++++++------
test/functional/cases/120_fuzzy/lib.robot | 32 ++-
test/functional/cases/123_whitelist.robot | 102 ++++----
test/functional/cases/125_map_reload.robot | 8 +-
test/functional/cases/135_spamassassin.robot | 66 ++---
test/functional/cases/140_proxy.robot | 9 +-
test/functional/cases/160_antivirus.robot | 76 +++---
test/functional/cases/161_p0f.robot | 69 +++--
test/functional/cases/220_http.robot | 4 +-
test/functional/cases/230_tcp.robot | 43 ++--
test/functional/cases/240_redis.robot | 8 +-
test/functional/cases/241_redis_is_dead.robot | 8 +-
test/functional/cases/250_dns.robot | 12 +-
test/functional/cases/260_regex.robot | 22 +-
test/functional/cases/270_selector.robot | 6 +-
test/functional/cases/280_rules.robot | 94 +++----
test/functional/cases/281_fnames.robot | 8 +-
test/functional/cases/290_greylist.robot | 14 +-
test/functional/cases/300_rbl.robot | 41 +--
test/functional/cases/310_udp.robot | 12 +-
test/functional/cases/330_neural.robot | 56 ++---
test/functional/cases/340_surbl.robot | 208 ++++++++-------
test/functional/cases/350_magic.robot | 112 ++++-----
test/functional/cases/360_force_actions.robot | 38 +--
test/functional/lib/rspamd.py | 14 +-
test/functional/lib/rspamd.robot | 63 +++++
38 files changed, 1198 insertions(+), 1173 deletions(-)
diff --git a/test/functional/cases/100_general.robot b/test/functional/cases/100_general.robot
index 868c31d66..0a754a973 100644
--- a/test/functional/cases/100_general.robot
+++ b/test/functional/cases/100_general.robot
@@ -13,8 +13,8 @@ ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
*** Test Cases ***
GTUBE
- ${result} = Scan Message With Rspamc ${GTUBE}
- Check Rspamc ${result} GTUBE (
+ Scan File ${GTUBE}
+ Expect Symbol GTUBE
GTUBE - Encrypted
${result} = Run Rspamc -p -h ${LOCAL_ADDR}:${PORT_NORMAL} --key ${KEY_PUB1}
@@ -22,13 +22,13 @@ GTUBE - Encrypted
Check Rspamc ${result} GTUBE (
GTUBE - Scan File feature
- ${result} = Scan File ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE}
- Should Contain ${result} GTUBE
+ Scan File By Reference ${GTUBE}
+ Expect Symbol GTUBE
GTUBE - Scan File feature (encoded)
${encoded} = Encode Filename ${GTUBE}
- ${result} = Scan File ${LOCAL_ADDR} ${PORT_NORMAL} ${encoded}
- Should Contain ${result} GTUBE
+ Scan File By Reference ${encoded}
+ Expect Symbol GTUBE
GTUBE - SPAMC
${result} = Spamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE}
@@ -38,14 +38,13 @@ GTUBE - RSPAMC
${result} = Rspamc ${LOCAL_ADDR} ${PORT_NORMAL} ${GTUBE}
Should Contain ${result} GTUBE
-# Broken
-#EMAILS DETECTION 1
-# ${result} = Scan Message With Rspamc ${TESTDIR}/messages/emails1.eml
-# Check Rspamc ${result} "jim at example.net"
-# Should Contain ${result.stdout} "bob at example.net"
-# Should Contain ${result.stdout} "rupert at example.net"
+EMAILS DETECTION 1
+ Scan File ${TESTDIR}/messages/emails1.eml URL-Format=Extended
+ Expect Email jim at example.net
+ Expect Email bob at example.net
+ Expect Email rupert at example.net
EMAILS DETECTION ZEROFONT
- ${result} = Scan File ${LOCAL_ADDR} ${PORT_NORMAL} ${TESTDIR}/messages/zerofont.eml
- Should Contain ${result} MANY_INVISIBLE_PARTS
- Should Contain ${result} ZERO_FONT
+ Scan File ${TESTDIR}/messages/zerofont.eml
+ Expect Symbol MANY_INVISIBLE_PARTS
+ Expect Symbol ZERO_FONT
diff --git a/test/functional/cases/101_lua.robot b/test/functional/cases/101_lua.robot
index 8abb99b29..6e40c7300 100644
--- a/test/functional/cases/101_lua.robot
+++ b/test/functional/cases/101_lua.robot
@@ -16,51 +16,50 @@ ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
*** Test Cases ***
Flags
[Setup] Lua Setup ${TESTDIR}/lua/flags.lua
- ${result} = Scan Message With Rspamc ${MESSAGE}
+ Scan File ${MESSAGE}
${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} stat
Should Contain ${result.stdout} Messages scanned: 0
Dependencies
[Setup] Lua Setup ${TESTDIR}/lua/deps.lua
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} DEP10
+ Scan File ${MESSAGE}
+ Expect Symbol DEP10
Pre and Post Filters
[Setup] Lua Setup ${TESTDIR}/lua/prepostfilters.lua
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} TEST_PRE
- Should Contain ${result.stdout} TEST_POST
+ Scan File ${MESSAGE}
+ Expect Symbol TEST_PRE
+ Expect Symbol TEST_POST
Recipient Parsing Sanity
[Setup] Lua Setup ${TESTDIR}/lua/recipients.lua
- ${result} = Scan Message With Rspamc ${MESSAGE} -r rcpt1 at foobar -r rcpt2 at foobar
- ... -r rcpt3 at foobar -r rcpt4 at foobar
- Check Rspamc ${result} TEST_RCPT (1.00)[rcpt1 at foobar,rcpt2 at foobar,rcpt3 at foobar,rcpt4 at foobar]
+ Scan File ${MESSAGE} Rcpt=rcpt1 at foobar,rcpt2 at foobar,rcpt3 at foobar,rcpt4 at foobar
+ Expect Symbol With Exact Options TEST_RCPT rcpt1 at foobar,rcpt2 at foobar,rcpt3 at foobar,rcpt4 at foobar
TLD parts
[Setup] TLD Setup ${TESTDIR}/lua/tlds.lua
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} TEST_TLD (1.00)[no worry]
+ Scan File ${MESSAGE}
+ Expect Symbol With Exact Options TEST_TLD no worry
Hashes
[Setup] Lua Setup ${TESTDIR}/lua/hashes.lua
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} TEST_HASHES (1.00)[no worry]
+ Scan File ${MESSAGE}
+ Expect Symbol With Exact Options TEST_HASHES no worry
Maps Key Values
[Setup] Lua Replace Setup ${TESTDIR}/lua/maps_kv.lua
[Teardown] Lua Replace Teardown
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} RADIX_KV (1.00)[no worry]
- Should Contain ${result.stdout} REGEXP_KV (1.00)[no worry]
- Should Contain ${result.stdout} MAP_KV (1.00)[no worry]
+ Scan File ${MESSAGE}
+ 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
[Setup] Lua Replace Setup ${TESTDIR}/lua/option_order.lua
[Teardown] Lua Replace Teardown
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} OPTION_ORDER (1.00)[one, two, three, 4, 5, a]
- Should Contain ${result.stdout} TBL_OPTION_ORDER (1.00)[one, two, three, 4, 5, a]
+ Scan File ${MESSAGE}
+ 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
*** Keywords ***
Lua Setup
diff --git a/test/functional/cases/102_multimap.robot b/test/functional/cases/102_multimap.robot
index c953970dc..09bc9e205 100644
--- a/test/functional/cases/102_multimap.robot
+++ b/test/functional/cases/102_multimap.robot
@@ -26,312 +26,311 @@ ${URL_ICS} ${TESTDIR}/messages/ics.eml
*** Test Cases ***
URL_ICS
- ${result} = Scan Message With Rspamc ${URL_ICS}
- Check Rspamc ${result} Urls: ["test.com"]
+ Scan File ${URL_ICS}
+ Expect URL test.com
MAP - DNSBL HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2
- Check Rspamc ${result} DNSBL_MAP
+ Scan File ${MESSAGE} IP=127.0.0.2
+ Expect Symbol DNSBL_MAP
MAP - DNSBL MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1
- Check Rspamc ${result} DNSBL_MAP inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.1
+ Do Not Expect Symbol DNSBL_MAP
MAP - IP HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.1
- Check Rspamc ${result} IP_MAP
+ Scan File ${MESSAGE} IP=127.0.0.1
+ Expect Symbol IP_MAP
MAP - IP MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 127.0.0.2
- Check Rspamc ${result} IP_MAP inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.2
+ Do Not Expect Symbol IP_MAP
MAP - IP MASK
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 10.1.0.10
- Check Rspamc ${result} IP_MAP
+ Scan File ${MESSAGE} IP=10.1.0.10
+ Expect Symbol IP_MAP
MAP - IP MASK MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 11.1.0.10
- Check Rspamc ${result} IP_MAP inverse=1
+ Scan File ${MESSAGE} IP=11.1.0.10
+ Do Not Expect Symbol IP_MAP
MAP - IP V6
- ${result} = Scan Message With Rspamc ${MESSAGE} -i ::1
- Check Rspamc ${result} IP_MAP
+ Scan File ${MESSAGE} IP=::1
+ Expect Symbol IP_MAP
MAP - IP V6 MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i fe80::1
- Check Rspamc ${result} IP_MAP inverse=1
+ Scan File ${MESSAGE} IP=fe80::1
+ Do Not Expect Symbol IP_MAP
MAP - FROM
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user at example.com
- Check Rspamc ${result} FROM_MAP
+ Scan File ${MESSAGE} From=user at example.com
+ Expect Symbol FROM_MAP
MAP - COMBINED IP MASK FROM
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 10.1.0.10 --from user at example.com
- Check Rspamc ${result} COMBINED_MAP_AND
- Check Rspamc ${result} COMBINED_MAP_OR
+ Scan File ${MESSAGE} IP=10.1.0.10 From=user at example.com
+ Expect Symbol COMBINED_MAP_AND
+ Expect Symbol COMBINED_MAP_OR
MAP - COMBINED IP MASK ONLY
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 10.1.0.10
- Check Rspamc ${result} COMBINED_MAP_AND inverse=1
- Check Rspamc ${result} COMBINED_MAP_OR
+ Scan File ${MESSAGE} IP=10.1.0.10
+ Do Not Expect Symbol COMBINED_MAP_AND
+ Expect Symbol COMBINED_MAP_OR
MAP - COMBINED FROM ONLY
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user at example.com
- Check Rspamc ${result} COMBINED_MAP_AND inverse=1
- Check Rspamc ${result} COMBINED_MAP_OR
+ Scan File ${MESSAGE} From=user at example.com
+ Do Not Expect Symbol COMBINED_MAP_AND
+ Expect Symbol COMBINED_MAP_OR
MAP - COMBINED MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 11.1.0.10 --from user at other.com
- Check Rspamc ${result} COMBINED_MAP_AND inverse=1
- Check Rspamc ${result} COMBINED_MAP_OR inverse=1
+ Scan File ${MESSAGE} IP=11.1.0.10 From=user at other.com
+ Do Not Expect Symbol COMBINED_MAP_AND
+ Do Not Expect Symbol COMBINED_MAP_OR
MAP - FROM MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user at other.com
- Check Rspamc ${result} FROM_MAP inverse=1
+ Scan File ${MESSAGE} From=user at other.com
+ Do Not Expect Symbol FROM_MAP
MAP - FROM REGEXP
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user123 at test.com
- Check Rspamc ${result} REGEXP_MAP
- ${result} = Scan Message With Rspamc ${MESSAGE} --from somebody at example.com
- Check Rspamc ${result} REGEXP_MAP
+ Scan File ${MESSAGE} From=user123 at test.com
+ Expect Symbol REGEXP_MAP
+ Scan File ${MESSAGE} From=somebody at example.com
+ Expect Symbol REGEXP_MAP
MAP - FROM REGEXP MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user at other.org
- Check Rspamc ${result} REGEXP_MAP inverse=1
+ Scan File ${MESSAGE} From=user at other.org
+ Do Not Expect Symbol REGEXP_MAP
MAP - RCPT DOMAIN HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user at example.com
- Check Rspamc ${result} RCPT_DOMAIN
+ Scan File ${MESSAGE} Rcpt=user at example.com
+ Expect Symbol RCPT_DOMAIN
MAP - RCPT DOMAIN MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt example.com at user
- Check Rspamc ${result} RCPT_DOMAIN inverse=1
+ Scan File ${MESSAGE} Rcpt=example.com at user
+ Do Not Expect Symbol RCPT_DOMAIN
MAP - RCPT USER HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt bob at example.com
- Check Rspamc ${result} RCPT_USER
+ Scan File ${MESSAGE} Rcpt=bob at example.com
+ Expect Symbol RCPT_USER
MAP - RCPT USER MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --from example.com at bob
- Check Rspamc ${result} RCPT_USER inverse=1
+ Scan File ${MESSAGE} From=example.com at bob
+ Do Not Expect Symbol RCPT_USER
MAP - DEPENDS HIT
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 88.99.142.95 --from user123 at rspamd.com
- Check Rspamc ${result} DEPS_MAP
+ Scan File ${MESSAGE} IP=88.99.142.95 From=user123 at rspamd.com
+ Expect Symbol DEPS_MAP
MAP - DEPENDS MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 1.2.3.4 --from user123 at rspamd.com
- Check Rspamc ${result} DEPS_MAP inverse=1
+ Scan File ${MESSAGE} IP=1.2.3.4 From=user123 at rspamd.com
+ Do Not Expect Symbol DEPS_MAP
MAP - MULSYM PLAIN
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user1 at example.com
- Check Rspamc ${result} RCPT_MAP
+ Scan File ${MESSAGE} Rcpt=user1 at example.com
+ Expect Symbol RCPT_MAP
MAP - MULSYM SCORE
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user2 at example.com
- Check Rspamc ${result} RCPT_MAP (10.0
+ Scan File ${MESSAGE} Rcpt=user2 at example.com
+ Expect Symbol With Score RCPT_MAP 10.0
MAP - MULSYM SYMBOL
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user3 at example.com
- Check Rspamc ${result} SYM1 (1.0
+ Scan File ${MESSAGE} Rcpt=user3 at example.com
+ Expect Symbol With Score SYM1 1.0
MAP - MULSYM SYMBOL MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user4 at example.com
- Check Rspamc ${result} RCPT_MAP (1.0
+ Scan File ${MESSAGE} Rcpt=user4 at example.com
+ Expect Symbol With Score RCPT_MAP 1.0
MAP - MULSYM SYMBOL + SCORE
- ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user5 at example.com
- Check Rspamc ${result} SYM1 (-10.1
+ Scan File ${MESSAGE} Rcpt=user5 at example.com
+ Expect Symbol With Score SYM1 -10.1
MAP - UTF
- ${result} = Scan Message With Rspamc ${UTF_MESSAGE}
- Check Rspamc ${result} HEADER_MAP
+ Scan File ${UTF_MESSAGE}
+ Expect Symbol HEADER_MAP
MAP - UTF MISS
- ${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} HEADER_MAP inverse=1
+ Scan File ${MESSAGE}
+ Do Not Expect Symbol HEADER_MAP
MAP - HOSTNAME
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com
- Check Rspamc ${result} HOSTNAME_MAP
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com
+ Expect Symbol HOSTNAME_MAP
MAP - HOSTNAME MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
- Check Rspamc ${result} HOSTNAME_MAP inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com
+ Do Not Expect Symbol HOSTNAME_MAP
MAP - TOP
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com.au
- Check Rspamc ${result} HOSTNAME_TOP_MAP
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.au
+ Expect Symbol HOSTNAME_TOP_MAP
MAP - TOP MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com.bg
- Check Rspamc ${result} HOSTNAME_TOP_MAP inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com.bg
+ Do Not Expect Symbol HOSTNAME_TOP_MAP
MAP - CDB - HOSTNAME
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname example.com
- Check Rspamc ${result} CDB_HOSTNAME
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=example.com
+ Expect Symbol CDB_HOSTNAME
MAP - CDB - HOSTNAME MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
- Check Rspamc ${result} CDB_HOSTNAME inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com
+ Do Not Expect Symbol CDB_HOSTNAME
MAP - REDIS - HOSTNAME
Redis HSET hostname redistest.example.net ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname redistest.example.net
- Check Rspamc ${result} REDIS_HOSTNAME
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net
+ Expect Symbol REDIS_HOSTNAME
MAP - REDIS - HOSTNAME MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname rspamd.com
- Check Rspamc ${result} REDIS_HOSTNAME inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=rspamd.com
+ Do Not Expect Symbol REDIS_HOSTNAME
MAP - REDIS - HOSTNAME - EXPANSION - HIT
Redis HSET 127.0.0.1.foo.com redistest.example.net ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname redistest.example.net --rcpt bob at foo.com
- Check Rspamc ${result} REDIS_HOSTNAME_EXPANSION
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob at foo.com
+ Expect Symbol REDIS_HOSTNAME_EXPANSION
MAP - REDIS - HOSTNAME - EXPANSION - MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1 --hostname redistest.example.net --rcpt bob at bar.com
- Check Rspamc ${result} REDIS_HOSTNAME_EXPANSION inverse=1
+ Scan File ${MESSAGE} IP=127.0.0.1 Hostname=redistest.example.net Rcpt=bob at bar.com
+ Do Not Expect Symbol REDIS_HOSTNAME_EXPANSION
MAP - REDIS - IP
Redis HSET ipaddr 127.0.0.1 ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 127.0.0.1
- Check Rspamc ${result} REDIS_IPADDR
+ Scan File ${MESSAGE} IP=127.0.0.1
+ Expect Symbol REDIS_IPADDR
MAP - REDIS - IP - MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --ip 8.8.8.8
- Check Rspamc ${result} REDIS_IPADDR inverse=1
+ Scan File ${MESSAGE} IP=8.8.8.8
+ Do Not Expect Symbol REDIS_IPADDR
MAP - REDIS - FROM
Redis HSET emailaddr from at rspamd.tk ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} --from from at rspamd.tk
- Check Rspamc ${result} REDIS_FROMADDR
+ Scan File ${MESSAGE} From=from at rspamd.tk
+ Expect Symbol REDIS_FROMADDR
MAP - REDIS - FROM MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} --from user at other.com
- Check Rspamc ${result} REDIS_FROMADDR inverse=1
+ Scan File ${MESSAGE} From=user at other.com
+ Do Not Expect Symbol REDIS_FROMADDR
MAP - REDIS - URL TLD - HIT
Redis HSET hostname example.com ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL1}
- Check Rspamc ${result} REDIS_URL_TLD
+ Scan File ${URL1}
+ Expect Symbol REDIS_URL_TLD
MAP - REDIS - URL TLD - MISS
- ${result} = Scan Message With Rspamc ${URL2}
- Check Rspamc ${result} REDIS_URL_TLD inverse=1
+ Scan File ${URL2}
+ Do Not Expect Symbol REDIS_URL_TLD
MAP - REDIS - URL RE FULL - HIT
Redis HSET fullurlre html ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL2}
- Check Rspamc ${result} REDIS_URL_RE_FULL
+ Scan File ${URL2}
+ Expect Symbol REDIS_URL_RE_FULL
MAP - REDIS - URL RE FULL - MISS
- ${result} = Scan Message With Rspamc ${URL1}
- Check Rspamc ${result} REDIS_URL_RE_FULL inverse=1
+ Scan File ${URL1}
+ Do Not Expect Symbol REDIS_URL_RE_FULL
MAP - REDIS - URL FULL - HIT
Redis HSET fullurl https://www.example.com/foo?a=b ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL1}
- Check Rspamc ${result} REDIS_URL_FULL
+ Scan File ${URL1}
+ Expect Symbol REDIS_URL_FULL
MAP - REDIS - URL FULL - MISS
- ${result} = Scan Message With Rspamc ${URL2}
- Check Rspamc ${result} REDIS_URL_FULL inverse=1
+ Scan File ${URL2}
+ Do Not Expect Symbol REDIS_URL_FULL
MAP - REDIS - URL PHISHED - HIT
Redis HSET phishedurl www.rspamd.com ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL3}
- Check Rspamc ${result} REDIS_URL_PHISHED
+ Scan File ${URL3}
+ Expect Symbol REDIS_URL_PHISHED
MAP - REDIS - URL PHISHED - MISS
- ${result} = Scan Message With Rspamc ${URL4}
- Check Rspamc ${result} REDIS_URL_PHISHED inverse=1
+ Scan File ${URL4}
+ Do Not Expect Symbol REDIS_URL_PHISHED
MAP - REDIS - URL PLAIN REGEX - HIT
Redis HSET urlre www ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL3}
- Check Rspamc ${result} REDIS_URL_RE_PLAIN
+ Scan File ${URL3}
+ Expect Symbol REDIS_URL_RE_PLAIN
MAP - REDIS - URL PLAIN REGEX - MISS
- ${result} = Scan Message With Rspamc ${URL4}
- Check Rspamc ${result} REDIS_URL_RE_PLAIN inverse=1
+ Scan File ${URL4}
+ Do Not Expect Symbol REDIS_URL_RE_PLAIN
MAP - REDIS - URL TLD REGEX - HIT
Redis HSET tldre net ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL5}
- Check Rspamc ${result} REDIS_URL_RE_TLD
+ Scan File ${URL5}
+ Expect Symbol REDIS_URL_RE_TLD
MAP - REDIS - URL TLD REGEX - MISS
- ${result} = Scan Message With Rspamc ${URL4}
- Check Rspamc ${result} REDIS_URL_RE_TLD inverse=1
+ Scan File ${URL4}
+ Do Not Expect Symbol REDIS_URL_RE_TLD
MAP - REDIS - URL NOFILTER - HIT
Redis HSET urlnofilter www.example.net ${EMPTY}
- ${result} = Scan Message With Rspamc ${URL5}
- Check Rspamc ${result} REDIS_URL_NOFILTER
+ Scan File ${URL5}
+ Expect Symbol REDIS_URL_NOFILTER
MAP - REDIS - URL NOFILTER - MISS
- ${result} = Scan Message With Rspamc ${URL4}
- Check Rspamc ${result} REDIS_URL_NOFILTER inverse=1
+ Scan File ${URL4}
+ Do Not Expect Symbol REDIS_URL_NOFILTER
MAP - REDIS - ASN - HIT
Redis HSET asn 15169 ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 8.8.8.8
- Check Rspamc ${result} REDIS_ASN
+ Scan File ${MESSAGE} IP=8.8.8.8
+ Expect Symbol REDIS_ASN
MAP - REDIS - ASN - MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 46.228.47.114
- Check Rspamc ${result} REDIS_ASN inverse=1
+ Scan File ${MESSAGE} IP=46.228.47.114
+ Do Not Expect Symbol REDIS_ASN
MAP - REDIS - CC - HIT
Redis HSET cc US ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 8.8.8.8
- Check Rspamc ${result} REDIS_COUNTRY
+ Scan File ${MESSAGE} IP=8.8.8.8
+ Expect Symbol REDIS_COUNTRY
MAP - REDIS - CC - MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 46.228.47.114
- Check Rspamc ${result} REDIS_COUNTRY inverse=1
+ Scan File ${MESSAGE} IP=46.228.47.114
+ Do Not Expect Symbol REDIS_COUNTRY
MAP - REDIS - ASN FILTERED - HIT
Redis HSET asn 1 ${EMPTY}
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 8.8.8.8
- Check Rspamc ${result} REDIS_ASN_FILTERED
+ Scan File ${MESSAGE} IP=8.8.8.8
+ Expect Symbol REDIS_ASN_FILTERED
MAP - REDIS - ASN FILTERED - MISS
- ${result} = Scan Message With Rspamc ${MESSAGE} -i 46.228.47.114
- Check Rspamc ${result} REDIS_ASN_FILTERED inverse=1
+ Scan File ${MESSAGE} IP=46.228.47.114
+ Do Not Expect Symbol REDIS_ASN_FILTERED
MAP - RECEIVED - IP MINMAX POS - ONE
- ${result} = Scan Message With Rspamc ${RCVD1}
- Check Rspamc ${result} RCVD_TEST_01
- Check Rspamc ${result} RCVD_TEST_02 inverse=1
+ Scan File ${RCVD1}
+ Expect Symbol RCVD_TEST_01
+ Do Not Expect Symbol RCVD_TEST_02
# Relies on parsing of shitty received
#MAP - RECEIVED - IP MINMAX POS - TWO / RCVD_AUTHED_ONE HIT
-# ${result} = Scan Message With Rspamc ${RCVD2}
-# Check Rspamc ${result} RCVD_TEST_02
-# Should Not Contain ${result.stdout} RCVD_TEST_01
-# Should Contain ${result.stdout} RCVD_AUTHED_ONE
+# Scan File ${RCVD2}
+# Expect Symbol RCVD_TEST_02
+# Do Not Expect Symbol RCVD_TEST_01
+# Expect Symbol RCVD_AUTHED_ONE
MAP - RECEIVED - REDIS
Redis HSET RCVD_TEST 2a01:7c8:aab6:26d:5054:ff:fed1:1da2 ${EMPTY}
- ${result} = Scan Message With Rspamc ${RCVD1}
- Check Rspamc ${result} RCVD_TEST_REDIS_01
+ Scan File ${RCVD1}
+ Expect Symbol RCVD_TEST_REDIS_01
RCVD_AUTHED_ONE & RCVD_AUTHED_TWO - MISS
- ${result} = Scan Message With Rspamc ${RCVD3}
- Check Rspamc ${result} RCVD_AUTHED_ inverse=1
+ Scan File ${RCVD3}
+ Do Not Expect Symbol RCVD_AUTHED_ONE
+ Do Not Expect Symbol RCVD_AUTHED_TWO
RCVD_AUTHED_TWO HIT / RCVD_AUTHED_ONE MISS
- ${result} = Scan Message With Rspamc ${RCVD4}
- Check Rspamc ${result} RCVD_AUTHED_TWO
- Should Not Contain ${result.stdout} RCVD_AUTHED_ONE
+ Scan File ${RCVD4}
+ Expect Symbol RCVD_AUTHED_TWO
+ Do Not Expect Symbol RCVD_AUTHED_ONE
FREEMAIL_CC
- ${result} = Scan Message With Rspamc ${FREEMAIL_CC}
- Check Rspamc ${result} FREEMAIL_CC (19.00)[test.com, test1.com, test2.com, test3.com, test4.com, test5.com, test6.com, test7.com, test8.com, test9.com, test10.com, test11.com, test12.com, test13.com, test14.com]
-
-
+ Scan File ${FREEMAIL_CC}
+ Expect Symbol With Score And Exact Options FREEMAIL_CC 19.00 test.com test1.com test2.com test3.com test4.com test5.com test6.com test7.com test8.com test9.com test10.com test11.com test12.com test13.com test14.com
*** Keywords ***
Multimap Setup
diff --git a/test/functional/cases/104_get_from.robot b/test/functional/cases/104_get_from.robot
index 94f2590a4..c15e0cdba 100644
--- a/test/functional/cases/104_get_from.robot
+++ b/test/functional/cases/104_get_from.robot
@@ -10,44 +10,44 @@ ${CONFIG} ${TESTDIR}/configs/lua_script.conf
${LUA_SCRIPT} ${TESTDIR}/lua/get_from.lua
${RSPAMD_SCOPE} Suite
-${SYMBOL} GET_FROM (0.00)
-${SYMBOL1} ${SYMBOL}\[,user at example.org,user,example.org]
-${SYMBOL2} ${SYMBOL}\[First Last,user at example.org,user,example.org]
-${SYMBOL3} ${SYMBOL}\[First M. Last,user at example.org,user,example.org]
+${SYMBOL} GET_FROM
+${OPTIONS1} ,user at example.org,user,example.org
+${OPTIONS2} First Last,user at example.org,user,example.org
+${OPTIONS3} First M. Last,user at example.org,user,example.org
*** Test Cases ***
task:get_from('mime') - address only
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from.eml
- Check Rspamc ${result} ${SYMBOL1}
+ Scan File ${TESTDIR}/messages/from/from.eml
+ Expect Symbol ${SYMBOL}
task:get_from('mime') - comment
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_comment.eml
- Check Rspamc ${result} ${SYMBOL1}
+ Scan File ${TESTDIR}/messages/from/from_comment.eml
+ Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS1}
task:get_from('mime') - display name
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_dn.eml
- Check Rspamc ${result} ${SYMBOL2}
+ Scan File ${TESTDIR}/messages/from/from_dn.eml
+ Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2}
task:get_from('mime') - display name Base64
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_dn_base64.eml
- Check Rspamc ${result} ${SYMBOL}\[Кириллица,user at example.org,user,example.org]
+ Scan File ${TESTDIR}/messages/from/from_dn_base64.eml
+ Expect Symbol With Exact Options ${SYMBOL} Кириллица,user at example.org,user,example.org
task:get_from('mime') - display name and comment
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_dn_comment.eml
- Check Rspamc ${result} ${SYMBOL2}
+ Scan File ${TESTDIR}/messages/from/from_dn_comment.eml
+ Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS2}
task:get_from('mime') - quoted display name
- ${result} = Scan Message With Rspamc ${TESTDIR}/messages/from/from_quoted_dn.eml
- Check Rspamc ${result} ${SYMBOL3}
+ Scan File ${TESTDIR}/messages/from/from_quoted_dn.eml
+ Expect Symbol With Exact Options ${SYMBOL} ${OPTIONS3}
*** OUTPUT TRUNCATED, 2874 LINES SKIPPED ***
More information about the Commits
mailing list