]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Add test for empty part learning.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Jul 2015 10:00:02 +0000 (11:00 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Jul 2015 10:00:02 +0000 (11:00 +0100)
test/functional/messages/empty_part.eml [new file with mode: 0644]
test/functional/tests.bats

diff --git a/test/functional/messages/empty_part.eml b/test/functional/messages/empty_part.eml
new file mode 100644 (file)
index 0000000..7c3e6dc
--- /dev/null
@@ -0,0 +1,22 @@
+Return-Path: <example@example.net>
+Date: 29 Apr 2015 04:56:53 -0000
+MIME-Version: 1.0
+From: example@example.net
+Subject: This is the subject
+Content-Type: multipart/alternative;
+ boundary="=_1ad00c4b74ff9921bb562f02b6e6df7a"
+Message-ID: <mid1234@example.net>
+To: example@example.net
+
+--=_1ad00c4b74ff9921bb562f02b6e6df7a
+Content-Type: text/plain; charset="ISO-8859-1"
+Content-Transfer-Encoding: 7bit
+
+
+--=_1ad00c4b74ff9921bb562f02b6e6df7a
+Content-Type: text/html; charset="ISO-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+<b>HTML part only. The previous part makes the controller process crash</b>
+
+--=_1ad00c4b74ff9921bb562f02b6e6df7a--
index 387c7c2603c9b0e39e57ba7714259a2ef48a8fc7..804c54a0e5d5010077266a3e49fd3848dcbe2d3f 100644 (file)
@@ -94,6 +94,28 @@ RSPAMC="$BATS_TEST_DIRNAME/../../src/client/rspamc"
        clear_stats
 }
 
+@test "Test learn message with an empty part" {
+       clear_stats
+       export RSPAMD_CONFIG="$BATS_TEST_DIRNAME/configs/stats.conf"
+       run_rspamd
+       run ${RSPAMC} -h localhost:56790 \
+               --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+               learn_spam \
+               "$BATS_TEST_DIRNAME/messages/empty_part.eml"
+       [ "$status" -eq 0 ]
+       
+       echo $output | egrep 'success.*true'
+       
+       run ${RSPAMC} -h localhost:56789 \
+               --key y3ms1knmetxf8gdeixkf74b6tbpxqugmxzqksnjodiqei7tksyty \
+               symbols \
+               "$BATS_TEST_DIRNAME/messages/empty_part.eml"
+       [ "$status" -eq 0 ]
+       
+       echo $output | grep 'BAYES_SPAM'
+       clear_stats
+}
+
 @test "Test rspamd dependencies" {
        clear_stats
        sed -e 's|@@LUA_SCRIPT@@|${CURDIR}/functional/cases/deps.lua|' < \