diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-13 18:08:22 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-13 18:08:22 +0000 |
commit | cf6ff4df42cb4166b402ba20488c47254a20ba57 (patch) | |
tree | 94ba25741b46be80879c695c761f128437a3f638 /test/functional | |
parent | 18c8f28606d6beb2e2fc2bcd177bddef139752be (diff) | |
download | rspamd-cf6ff4df42cb4166b402ba20488c47254a20ba57.tar.gz rspamd-cf6ff4df42cb4166b402ba20488c47254a20ba57.zip |
[Test] Add tests for #2584 and #2349
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/cases/280_rules.robot | 39 | ||||
-rw-r--r-- | test/functional/messages/fws_fn.eml | 30 | ||||
-rw-r--r-- | test/functional/messages/fws_fp.eml | 56 | ||||
-rw-r--r-- | test/functional/messages/fws_tp.eml | 56 |
4 files changed, 181 insertions, 0 deletions
diff --git a/test/functional/cases/280_rules.robot b/test/functional/cases/280_rules.robot new file mode 100644 index 000000000..36dc4d63d --- /dev/null +++ b/test/functional/cases/280_rules.robot @@ -0,0 +1,39 @@ +*** Settings *** +Test Setup Rules Setup +Test Teardown Rules Teardown +Library ${TESTDIR}/lib/rspamd.py +Resource ${TESTDIR}/lib/rspamd.robot +Variables ${TESTDIR}/lib/vars.py + +*** Variables *** +${CONFIG} ${TESTDIR}/configs/plugins.conf +${MESSAGE1} ${TESTDIR}/messages/fws_fn.eml +${MESSAGE2} ${TESTDIR}/messages/fws_fp.eml +${MESSAGE3} ${TESTDIR}/messages/fws_tp.eml +${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${RSPAMD_SCOPE} Test + + +*** Test Cases *** +Broken MIME + ${result} = Scan Message With Rspamc ${MESSAGE3} + Check Rspamc ${result} MISSING_SUBJECT + +Issue 2584 + ${result} = Scan Message With Rspamc ${MESSAGE1} + Check Rspamc ${result} BROKEN_CONTENT_TYPE inverse=1 + Should Not Contain ${result.stdout} MISSING_SUBJECT + Should Not Contain ${result.stdout} R_MISSING_CHARSET + +Issue 2349 + ${result} = Scan Message With Rspamc ${MESSAGE2} + Check Rspamc ${result} MULTIPLE_UNIQUE_HEADERS inverse=1 + +*** Keywords *** +Rules Setup + ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/regexp.conf + Set Suite Variable ${PLUGIN_CONFIG} + Generic Setup PLUGIN_CONFIG + +Rules Teardown + Normal Teardown diff --git a/test/functional/messages/fws_fn.eml b/test/functional/messages/fws_fn.eml new file mode 100644 index 000000000..67601bea5 --- /dev/null +++ b/test/functional/messages/fws_fn.eml @@ -0,0 +1,30 @@ +From: <admin@aaa.example.com> +To: <ragamuffin@bbb.example.com> +Subject: Test content type +Date: Tue, 17 Jul 2018 18:06:01 +0200 (CEST) +Message-ID: <20180717160601.B25511E37E7@aaa.example.com> +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="sd8f70as98f70as98f70as98f70as98df70as98df7as90f87as90d8f7" + +--sd8f70as98f70as98f70as98f70as98df70as98df7as90f87as90d8f7 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html; charset=utf-8 +Content-Disposition: inline + +<html> +<body style=3D"font-family:arial"> +Hello world +</body> +</html> + +--sd8f70as98f70as98f70as98f70as98df70as98df7as90f87as90d8f7 +Content-ID: <qrcode> +Content-Transfer-Encoding: base64 +Content-Type: image/jpeg +Content-Disposition: inline + +alskfhaslkfjhlaskfjhlaskjfhlaskjfhlaksjfhklasjfhklasdjfhlask +lksjdfhalskjfhklasjfhlaskfhlaskfhklasfhklasdjfhlkasdjfhklasd + +--sd8f70as98f70as98f70as98f70as98df70as98df7as90f87as90d8f7-- + diff --git a/test/functional/messages/fws_fp.eml b/test/functional/messages/fws_fp.eml new file mode 100644 index 000000000..2c669c9e4 --- /dev/null +++ b/test/functional/messages/fws_fp.eml @@ -0,0 +1,56 @@ +From: Sender <sender@example.com> +Mime-Version: 1.0 (1.0) +Date: Fri, 5 Oct 2018 19:56:40 -0400 +Message-Id: <E7015E63-E006-4E30-9313-851CB7F2424E> +To: Receiver <receiver@example.com> +X-Spam_report: Spam detection software, running on the system "www.kamailio.org", + has NOT identified this incoming email as spam. The original + message has been attached to this so you can view it or label + similar future email. If you have any questions, see + the administrator of that system for details. + + Content preview: Here�s an old one from 5 years ago. The principles remain + the same. https://www.fredposner.com/1457/kamailio-behind-nat/ -- fred [...] + + + Content analysis details: (-1.9 points, 5.5 required) + + pts rule name description + ---- ---------------------- -------------------------------------------------- + -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% + [score: 0.0000] + 0.0 HTML_MESSAGE BODY: HTML included in message + 0.0 MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars +List-Id: yYY +Subject: XXX + +--===============1364639178== +Content-Type: multipart/alternative; + boundary=Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461 +Content-Transfer-Encoding: 7bit + + +--Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461 +Content-Type: text/plain; + charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +xxx + +--Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461 +Content-Type: text/html; + charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +yyy +--Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461-- + + +--===============1364639178== +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: base64 +Content-Disposition: inline + +zzzz +--===============1364639178==-- diff --git a/test/functional/messages/fws_tp.eml b/test/functional/messages/fws_tp.eml new file mode 100644 index 000000000..fbe2f901c --- /dev/null +++ b/test/functional/messages/fws_tp.eml @@ -0,0 +1,56 @@ +From: Sender <sender@example.com> +Mime-Version: 1.0 (1.0) +Date: Fri, 5 Oct 2018 19:56:40 -0400 +Message-Id: <E7015E63-E006-4E30-9313-851CB7F2424E> +To: Receiver <receiver@example.com> +X-Spam_report: Spam detection software, running on the system "www.kamailio.org", + has NOT identified this incoming email as spam. The original + message has been attached to this so you can view it or label + similar future email. If you have any questions, see + the administrator of that system for details. + + Content preview: Here�s an old one from 5 years ago. The principles remain + the same. https://www.fredposner.com/1457/kamailio-behind-nat/ -- fred [...] + + + Content analysis details: (-1.9 points, 5.5 required) + + pts rule name description + ---- ---------------------- -------------------------------------------------- + -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% + [score: 0.0000] + 0.0 HTML_MESSAGE BODY: HTML included in message + 0.0 MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars +List-Id: yYY +Subject: XXX + +--===============1364639178== +Content-Type: multipart/alternative; + boundary=Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461 +Content-Transfer-Encoding: 7bit + + +--Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461 +Content-Type: text/plain; + charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +xxx + +--Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461 +Content-Type: text/html; + charset=utf-8 +Content-Transfer-Encoding: quoted-printable + +yyy +--Apple-Mail-C9403573-708A-4D69-BF6C-F2730C368461-- + + +--===============1364639178== +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: base64 +Content-Disposition: inline + +zzzz +--===============1364639178==-- |