Browse Source

[Test] Add tests for #2584 and #2349

pull/2632/head
Vsevolod Stakhov 7 years ago
parent
commit
cf6ff4df42
  1. 39
      test/functional/cases/280_rules.robot
  2. 30
      test/functional/messages/fws_fn.eml
  3. 56
      test/functional/messages/fws_fp.eml
  4. 56
      test/functional/messages/fws_tp.eml

39
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

30
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--

56
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==--

56
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==--
Loading…
Cancel
Save