diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-25 18:37:21 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-25 18:37:21 +0100 |
commit | f13fc5a747acc490f8ed99f1b15677b29cbf93f6 (patch) | |
tree | 99981209a625f3e2d4e651623fbdfd8580b9fe2a /test/functional | |
parent | a2748a06d9e4c50ac31e2c2669ef2cd8b882b662 (diff) | |
download | rspamd-f13fc5a747acc490f8ed99f1b15677b29cbf93f6.tar.gz rspamd-f13fc5a747acc490f8ed99f1b15677b29cbf93f6.zip |
[Test] Add moar tests for settings
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/cases/108_settings.robot | 67 | ||||
-rw-r--r-- | test/functional/configs/settings.conf | 14 | ||||
-rw-r--r-- | test/functional/messages/empty-plain-text.eml | 1 |
3 files changed, 82 insertions, 0 deletions
diff --git a/test/functional/cases/108_settings.robot b/test/functional/cases/108_settings.robot index 2fc27ea70..9de9a48a6 100644 --- a/test/functional/cases/108_settings.robot +++ b/test/functional/cases/108_settings.robot @@ -9,6 +9,9 @@ Variables ${TESTDIR}/lib/vars.py ${CONFIG} ${TESTDIR}/configs/plugins.conf ${LUA_SCRIPT} ${TESTDIR}/lua/settings.lua ${MESSAGE} ${TESTDIR}/messages/spam_message.eml +${MESSAGE_7BIT} ${TESTDIR}/messages/utf.eml +${MESSAGE_CUSTOM_HDR} ${TESTDIR}/messages/empty-plain-text.eml +${MESSAGE_ABSENT_MIME} ${TESTDIR}/messages/ed25519.eml ${SPAM_MESSAGE} ${TESTDIR}/messages/spam.eml ${HAM_MESSAGE} ${TESTDIR}/messages/ham.eml ${RSPAMD_SCOPE} Suite @@ -113,6 +116,70 @@ SETTINGS ID - VIRTUAL GROUP Should Not Contain ${result.stdout} SIMPLE_POST Should Not Contain ${result.stdout} SIMPLE_PRE +SETTINGS ID - VIRTUAL FROM + ${result} = Scan Message With Rspamc ${MESSAGE} --from test2@example.com + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL USER + ${result} = Scan Message With Rspamc ${MESSAGE} --user test@example.com + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL HOSTNAME + ${result} = Scan Message With Rspamc ${MESSAGE} --hostname example.com + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL SELECTOR + ${result} = Scan Message With Rspamc ${MESSAGE} --rcpt user3@example.com + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL HEADER MATCH + ${result} = Scan Message With Rspamc ${MESSAGE_7BIT} + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL HEADER EXISTS + ${result} = Scan Message With Rspamc ${MESSAGE_CUSTOM_HDR} + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL HEADER ABSENT + ${result} = Scan Message With Rspamc ${MESSAGE_ABSENT_MIME} + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + +SETTINGS ID - VIRTUAL REQUEST HEADER + ${result} = Scan Message With Rspamc ${MESSAGE} --header Test=passed + Check Rspamc ${result} SIMPLE_VIRTUAL (10 + Should Not Contain ${result.stdout} SIMPLE_TEST + Should Not Contain ${result.stdout} SIMPLE_VIRTUAL1 + Should Not Contain ${result.stdout} SIMPLE_POST + Should Not Contain ${result.stdout} SIMPLE_PRE + *** Keywords *** Settings Setup Copy File ${TESTDIR}/data/bayes.spam.sqlite3 /tmp/bayes.spam.sqlite3 diff --git a/test/functional/configs/settings.conf b/test/functional/configs/settings.conf index d46c46b30..8a68465f4 100644 --- a/test/functional/configs/settings.conf +++ b/test/functional/configs/settings.conf @@ -21,6 +21,20 @@ settings { } id_virtual_group { + user = "test@example.com"; + from = "test2@example.com"; + hostname = "example.com"; + selector = "rcpts:addr.in(test3@example.com)"; + header = { + "Content-Transfer-Encoding" = "7bit"; + "Custom-Header" = true; + "Mime-Version" = false; + } + request_header = { + "Test" = "passed"; + } + + expression = 'user || from || hostname || selector:1 || header:mime_version || header:custom_header || header:1 || request_header:test' apply { groups_enabled = ["vg"]; SIMPLE_VIRTUAL = 10.0; diff --git a/test/functional/messages/empty-plain-text.eml b/test/functional/messages/empty-plain-text.eml index 2c4fa3e90..1deeaf1ad 100644 --- a/test/functional/messages/empty-plain-text.eml +++ b/test/functional/messages/empty-plain-text.eml @@ -10,5 +10,6 @@ Message-ID: <d9946a191e0c97733a86424c48e65eca@test.com> Subject: Test Subject To: Me <me@me.me> Content-Type: text/plain; charset="UTF-8" +Custom-Header: foo |