summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-08-11 18:22:29 +0100
committerGitHub <noreply@github.com>2016-08-11 18:22:29 +0100
commit198483c33218ce35bac3f2c81fc2ccdbf5c1c90e (patch)
tree55b70f706a95c50fde3baafe824250209cc71e3f /test/functional
parentbf89dbe2f57afe0fb65fdde76d5c605d1900bbdd (diff)
parentfde7a15af4418789b037d3f275201e436eb42578 (diff)
downloadrspamd-198483c33218ce35bac3f2c81fc2ccdbf5c1c90e.tar.gz
rspamd-198483c33218ce35bac3f2c81fc2ccdbf5c1c90e.zip
Merge pull request #840 from fatalbanana/sa_wlbl
[Test] Some tests for SpamAssassin WLBLEval
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/cases/135_spamassassin.robot27
-rw-r--r--test/functional/configs/spamassassin.rules52
2 files changed, 73 insertions, 6 deletions
diff --git a/test/functional/cases/135_spamassassin.robot b/test/functional/cases/135_spamassassin.robot
index 09904651d..f2c24a294 100644
--- a/test/functional/cases/135_spamassassin.robot
+++ b/test/functional/cases/135_spamassassin.robot
@@ -11,23 +11,38 @@ ${RSPAMD_SCOPE} Suite
*** Test Cases ***
Freemail Scan
- Set Suite Variable ${FREEMAIL_RESULT} ${EMPTY}
${FREEMAIL_RESULT} = Scan Message With Rspamc ${TESTDIR}/messages/freemail.eml
... --from faked.asdfjisiwosp372@outlook.com
+ Set Suite Variable ${FREEMAIL_RESULT} ${FREEMAIL_RESULT}
Check Rspamc ${FREEMAIL_RESULT} ${EMPTY}
- Set Suite Variable ${FREEMAIL_RESULT} ${FREEMAIL_RESULT.stdout}
Freemail From
- Should Contain ${FREEMAIL_RESULT} FREEMAIL_FROM
+ Should Contain ${FREEMAIL_RESULT.stdout} FREEMAIL_FROM
Freemail From Enddigit
- Should Contain ${FREEMAIL_RESULT} FREEMAIL_ENVFROM_END_DIGIT
+ Should Contain ${FREEMAIL_RESULT.stdout} FREEMAIL_ENVFROM_END_DIGIT
Freemail Subject
- Should Contain ${FREEMAIL_RESULT} FREEMAIL_SUBJECT
+ Should Contain ${FREEMAIL_RESULT.stdout} FREEMAIL_SUBJECT
Metas
- Should Contain ${FREEMAIL_RESULT} TEST_META3
+ Should Contain ${FREEMAIL_RESULT.stdout} TEST_META3
+
+WLBL From Whitelist
+ ${BAD_MESSAGE_RESULT} = Scan Message With Rspamc ${TESTDIR}/messages/bad_message.eml
+ Set Suite Variable ${BAD_MESSAGE_RESULT} ${BAD_MESSAGE_RESULT}
+ Check Rspamc ${BAD_MESSAGE_RESULT} USER_IN_WHITELIST (
+
+WLBL To Whitelist
+ Should Contain ${BAD_MESSAGE_RESULT.stdout} USER_IN_WHITELIST_TO
+
+WLBL From Blacklist
+ ${UTF_RESULT} = Scan Message With Rspamc ${TESTDIR}/messages/utf.eml
+ Set Suite Variable ${UTF_RESULT} ${UTF_RESULT}
+ Check Rspamc ${UTF_RESULT} USER_IN_BLACKLIST (
+
+WLBL To Blacklist
+ Should Contain ${UTF_RESULT.stdout} USER_IN_BLACKLIST_TO
*** Keywords ***
SpamAssassin Setup
diff --git a/test/functional/configs/spamassassin.rules b/test/functional/configs/spamassassin.rules
index 201dd1ae5..ee59af32f 100644
--- a/test/functional/configs/spamassassin.rules
+++ b/test/functional/configs/spamassassin.rules
@@ -33,6 +33,58 @@ score FREEMAIL_SUBJECT 1.0
endif
+ifplugin Mail::SpamAssassin::Plugin::WLBLEval
+
+header USER_IN_BLACKLIST eval:check_from_in_blacklist()
+describe USER_IN_BLACKLIST From: address is in the user's black-list
+tflags USER_IN_BLACKLIST userconf noautolearn
+score USER_IN_BLACKLIST 10.0
+
+header USER_IN_WHITELIST eval:check_from_in_whitelist()
+describe USER_IN_WHITELIST From: address is in the user's white-list
+tflags USER_IN_WHITELIST userconf nice noautolearn
+score USER_IN_WHITELIST -10.0
+
+header USER_IN_BLACKLIST_TO eval:check_to_in_blacklist()
+describe USER_IN_BLACKLIST_TO User is listed in 'blacklist_to'
+tflags USER_IN_BLACKLIST_TO userconf noautolearn
+score USER_IN_BLACKLIST_TO 10.0
+
+header USER_IN_WHITELIST_TO eval:check_to_in_whitelist()
+describe USER_IN_WHITELIST_TO User is listed in 'whitelist_to'
+tflags USER_IN_WHITELIST_TO userconf nice noautolearn
+score USER_IN_WHITELIST_TO -10.0
+
+# not implemented
+#header USER_IN_DEF_WHITELIST eval:check_from_in_default_whitelist()
+#describe USER_IN_DEF_WHITELIST From: address is in the default white-list
+#tflags USER_IN_DEF_WHITELIST userconf nice noautolearn
+#score USER_IN_DEF_WHITELIST -10.0
+
+# not implemented
+#header USER_IN_MORE_SPAM_TO eval:check_to_in_more_spam()
+#describe USER_IN_MORE_SPAM_TO User is listed in 'more_spam_to'
+#tflags USER_IN_MORE_SPAM_TO userconf nice noautolearn
+
+# not implemented
+#header USER_IN_ALL_SPAM_TO eval:check_to_in_all_spam()
+#describe USER_IN_ALL_SPAM_TO User is listed in 'all_spam_to'
+#tflags USER_IN_ALL_SPAM_TO userconf nice noautolearn
+
+blacklist_to xxx@example.com
+blacklist_from yy@example.com
+whitelist_from nasutkadqw@esumare.ru
+whitelist_to zelen@megafonkavkaz.ru
+# not implemented
+#whitelist_from example@example.net yy@example.com
+# not implemented
+#whitelist_from *@example.com
+# not implemented
+#whitelist_from_rcvd *@example.org
+# not implemented
+#def_whitelist_from rspamd.com
+endif
+
# These rules are /not/ from SpamAssassin project
header TEST_XFOO X-Foo =~ /.{1,50}/