diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2019-02-15 11:53:31 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2019-02-15 11:53:31 +0300 |
commit | 1156a22fa8ec673c35c634c38ceeca9b545eee79 (patch) | |
tree | 54dcaf6f224134aa8c2fba5e79653abc93a481b4 /test | |
parent | 2a82f0c2f55c812497ed639e528318193a7b5fef (diff) | |
download | rspamd-1156a22fa8ec673c35c634c38ceeca9b545eee79.tar.gz rspamd-1156a22fa8ec673c35c634c38ceeca9b545eee79.zip |
[Test] Add tests for MID module
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/cases/106_mid.robot | 42 | ||||
-rw-r--r-- | test/functional/configs/maps/mid.list | 2 | ||||
-rw-r--r-- | test/functional/configs/mid.conf | 9 | ||||
-rw-r--r-- | test/functional/messages/invalid_mid_allowed.eml | 10 |
4 files changed, 63 insertions, 0 deletions
diff --git a/test/functional/cases/106_mid.robot b/test/functional/cases/106_mid.robot new file mode 100644 index 000000000..7d8459dbd --- /dev/null +++ b/test/functional/cases/106_mid.robot @@ -0,0 +1,42 @@ +*** Settings *** +Suite Setup MID Setup +Suite Teardown Normal Teardown +Library ${TESTDIR}/lib/rspamd.py +Resource ${TESTDIR}/lib/rspamd.robot +Variables ${TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${TESTDIR}/configs/plugins.conf +${RSPAMD_SCOPE} Suite +${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat + +*** Test Cases *** +MID - invalid Message-ID + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/fws_fp.eml + Check Rspamc ${result} INVALID_MSGID (1.70) + Should Not Contain ${result.stdout} MISSING_MID + Should Not Contain ${result.stdout} INVALID_MSGID_ALLOWED + +MID - invalid Message-ID allowed + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/invalid_mid_allowed.eml + Check Rspamc ${result} INVALID_MSGID_ALLOWED (1.00) + Should Not Contain ${result.stdout} MISSING_MID + Should Not Contain ${result.stdout} INVALID_MSGID ( + +MID - missing Message-ID + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/freemail.eml + Check Rspamc ${result} MISSING_MID (2.50) + Should Not Contain ${result.stdout} MISSING_MID_ALLOWED + Should Not Contain ${result.stdout} INVALID_MSGID + +MID - missing Message-ID allowed + ${result} = Scan Message With Rspamc ${TESTDIR}/messages/dmarc/onsubdomain_pass_relaxed.eml + Check Rspamc ${result} MISSING_MID_ALLOWED (1.00) + Should Not Contain ${result.stdout} MISSING_MID ( + Should Not Contain ${result.stdout} INVALID_MSGID + +*** Keywords *** +MID Setup + ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/mid.conf + Set Suite Variable ${PLUGIN_CONFIG} + Generic Setup PLUGIN_CONFIG diff --git a/test/functional/configs/maps/mid.list b/test/functional/configs/maps/mid.list new file mode 100644 index 000000000..b89c084f0 --- /dev/null +++ b/test/functional/configs/maps/mid.list @@ -0,0 +1,2 @@ +cacophony.za.org /^<[A-z0-9+]{18}>$/ +mom.za.org diff --git a/test/functional/configs/mid.conf b/test/functional/configs/mid.conf new file mode 100644 index 000000000..49f5cb568 --- /dev/null +++ b/test/functional/configs/mid.conf @@ -0,0 +1,9 @@ +mid = { + source = { + url = [ + "https://maps.rspamd.com/rspamd/mid.inc.zst", + "fallback+file://${TESTDIR}/../../../conf/mid.inc", + "file://${TESTDIR}/configs/maps/mid.list" + ]; + } +} diff --git a/test/functional/messages/invalid_mid_allowed.eml b/test/functional/messages/invalid_mid_allowed.eml new file mode 100644 index 000000000..a7ee95081 --- /dev/null +++ b/test/functional/messages/invalid_mid_allowed.eml @@ -0,0 +1,10 @@ +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cacophony.za.org; + s=dkim; t=1550213458; + h=from:sender:reply-to:subject:date:message-id:message-id:to:cc: + mime-version:content-type:content-transfer-encoding:in-reply-to: + references; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=; + b=vcs/v32V8AvN1x0qk8DihZq46R2C35z1A4h6xEg26dDq2JSVZQOd1+WYRtmHG5SL6JlQsb + KxBHbIAFIoah7JA+uKt49mrKOVcnq9dww/P4Os3lDjm7WMwjDb8eEX2kECINjVo5MDMp6C + cCMnjVLppV76SL8f5ExdHDsw6eZ9y9k= +Message-ID: <JE47oX6KasQDNv6BEw> + |