diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-07 11:00:02 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-07-07 11:00:02 +0100 |
commit | de12aa88fbcf67aacec46bd1324f92e24e02163a (patch) | |
tree | e84d08d78469830f8b5353ba5077e9fbe9fbda1b /test | |
parent | 914623a044a7ca94c3bb80ed36ee571820c7b32c (diff) | |
download | rspamd-de12aa88fbcf67aacec46bd1324f92e24e02163a.tar.gz rspamd-de12aa88fbcf67aacec46bd1324f92e24e02163a.zip |
Add test for empty part learning.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/messages/empty_part.eml | 22 | ||||
-rw-r--r-- | test/functional/tests.bats | 22 |
2 files changed, 44 insertions, 0 deletions
diff --git a/test/functional/messages/empty_part.eml b/test/functional/messages/empty_part.eml new file mode 100644 index 000000000..7c3e6dc17 --- /dev/null +++ b/test/functional/messages/empty_part.eml @@ -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-- diff --git a/test/functional/tests.bats b/test/functional/tests.bats index 387c7c260..804c54a0e 100644 --- a/test/functional/tests.bats +++ b/test/functional/tests.bats @@ -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|' < \ |