]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] Add tests for sign maps
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 9 Apr 2019 11:43:51 +0000 (12:43 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 9 Apr 2019 11:43:51 +0000 (12:43 +0100)
test/functional/cases/131_dkim_signing/007_sign_maps.robot [new file with mode: 0644]
test/functional/configs/dkim_signing/sign_maps.conf [new file with mode: 0644]

diff --git a/test/functional/cases/131_dkim_signing/007_sign_maps.robot b/test/functional/cases/131_dkim_signing/007_sign_maps.robot
new file mode 100644 (file)
index 0000000..69d4c9a
--- /dev/null
@@ -0,0 +1,34 @@
+*** Settings ***
+Suite Setup     DKIM Signing Setup
+Suite Teardown  DKIM Signing Teardown
+Library         ${TESTDIR}/lib/rspamd.py
+Resource        ${TESTDIR}/lib/rspamd.robot
+Variables       ${TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG}       ${TESTDIR}/configs/plugins.conf
+${MESSAGE}      ${TESTDIR}/messages/dmarc/fail_none.eml
+${MESSAGE_FAIL}      ${TESTDIR}/messages/dmarc/fail_none1.eml
+${REDIS_SCOPE}  Suite
+${RSPAMD_SCOPE}  Suite
+${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
+
+*** Test Cases ***
+TEST SIGNED
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  -u  bob@cacophony.za.org
+  Check Rspamc  ${result}  DKIM-Signature:
+  Should Contain  ${result.stdout}  DKIM_SIGNED
+
+TEST NOT SIGNED - FROM WRONG DOMAIN
+  ${result} =  Scan Message With Rspamc  ${MESSAGE_FAIL}  -u  bob@cacophony.za.org
+  Check Rspamc  ${result}  DKIM-Signature:  inverse=1
+  Should Not Contain  ${result.stdout}  DKIM_SIGNED
+
+*** Keywords ***
+DKIM Signing Setup
+  ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/dkim_signing/sign_maps.conf
+  Set Suite Variable  ${PLUGIN_CONFIG}
+  Generic Setup  PLUGIN_CONFIG
+
+DKIM Signing Teardown
+  Normal Teardown
diff --git a/test/functional/configs/dkim_signing/sign_maps.conf b/test/functional/configs/dkim_signing/sign_maps.conf
new file mode 100644 (file)
index 0000000..9e63b7f
--- /dev/null
@@ -0,0 +1,9 @@
+dkim_signing {
+  signing_table = [
+    "*@cacophony.za.org cacophony.za.org",
+  ];
+
+  key_table = [
+    "cacophony.za.org %:eddsa:m5kGxtckRfsNe5EuYTe7bvkDjSh7LXaX3aXyIMPGLR0=",
+  ];
+}
\ No newline at end of file