aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-09-27 14:10:28 +0100
committerGitHub <noreply@github.com>2023-09-27 14:10:28 +0100
commit2a04d19ac7c5a2d5fa895a0b5f625c7d0ecc34f2 (patch)
treecf17a20132069ab078732eb4fa5ecb56a70cdcfa /test/functional
parent832aa1d93fba5d642d62c2c0275541542874b3f9 (diff)
parent447b8684c7099d8e2f1bbf2752f0b015d51bb5ed (diff)
downloadrspamd-2a04d19ac7c5a2d5fa895a0b5f625c7d0ecc34f2.tar.gz
rspamd-2a04d19ac7c5a2d5fa895a0b5f625c7d0ecc34f2.zip
Merge pull request #4615 from rspamd/vstakhov-known-senders
Merge tests into master branch
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/cases/400_known_senders.robot36
-rw-r--r--test/functional/configs/known_senders-local.conf4
-rw-r--r--test/functional/configs/known_senders.conf7
-rw-r--r--test/functional/configs/maps/known_senders_domains.map2
-rw-r--r--test/functional/lib/vars.py1
5 files changed, 50 insertions, 0 deletions
diff --git a/test/functional/cases/400_known_senders.robot b/test/functional/cases/400_known_senders.robot
new file mode 100644
index 000000000..f258113da
--- /dev/null
+++ b/test/functional/cases/400_known_senders.robot
@@ -0,0 +1,36 @@
+*** Settings ***
+Suite Setup Rspamd Redis Setup
+Suite Teardown Rspamd Redis Teardown
+Library ${RSPAMD_TESTDIR}/lib/rspamd.py
+Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
+Variables ${RSPAMD_TESTDIR}/lib/vars.py
+
+*** Variables ***
+${CONFIG} ${RSPAMD_TESTDIR}/configs/known_senders.conf
+${REDIS_SCOPE} Suite
+${RSPAMD_SCOPE} Suite
+
+*** Test Cases ***
+UNKNOWN SENDER
+ Scan File ${RSPAMD_TESTDIR}/messages/spam_message.eml
+ ... Settings={symbols_enabled [KNOWN_SENDER]}
+ Do Not Expect Symbol KNOWN_SENDER
+ Expect Symbol UNKNOWN_SENDER
+
+UNKNOWN SENDER BECOMES KNOWN
+ Scan File ${RSPAMD_TESTDIR}/messages/spam_message.eml
+ ... Settings={symbols_enabled [KNOWN_SENDER]}
+ Expect Symbol KNOWN_SENDER
+ Do Not Expect Symbol UNKNOWN_SENDER
+
+UNKNOWN SENDER WRONG DOMAIN
+ Scan File ${RSPAMD_TESTDIR}/messages/empty_part.eml
+ ... Settings={symbols_enabled [KNOWN_SENDER]}
+ Do Not Expect Symbol KNOWN_SENDER
+ Do Not Expect Symbol UNKNOWN_SENDER
+
+UNKNOWN SENDER WRONG DOMAIN RESCAN
+ Scan File ${RSPAMD_TESTDIR}/messages/empty_part.eml
+ ... Settings={symbols_enabled [KNOWN_SENDER]}
+ Do Not Expect Symbol KNOWN_SENDER
+ Do Not Expect Symbol UNKNOWN_SENDER
diff --git a/test/functional/configs/known_senders-local.conf b/test/functional/configs/known_senders-local.conf
new file mode 100644
index 000000000..40522ae47
--- /dev/null
+++ b/test/functional/configs/known_senders-local.conf
@@ -0,0 +1,4 @@
+known_senders {
+ enabled = true;
+ domains = "{= env.TESTDIR =}/configs/maps/known_senders_domains.map";
+}
diff --git a/test/functional/configs/known_senders.conf b/test/functional/configs/known_senders.conf
new file mode 100644
index 000000000..0880ceaf7
--- /dev/null
+++ b/test/functional/configs/known_senders.conf
@@ -0,0 +1,7 @@
+.include "{= env.TESTDIR =}/../../conf/rspamd.conf"
+
+lua = "{= env.TESTDIR =}/lua/test_coverage.lua"
+
+.include(priority=1,duplicate=merge) "{= env.TESTDIR =}/configs/known_senders-local.conf"
+.include(priority=1,duplicate=merge) "{= env.TESTDIR =}/configs/merged-local.conf"
+.include(priority=2,duplicate=replace) "{= env.TESTDIR =}/configs/merged-override.conf"
diff --git a/test/functional/configs/maps/known_senders_domains.map b/test/functional/configs/maps/known_senders_domains.map
new file mode 100644
index 000000000..8ddda0fd4
--- /dev/null
+++ b/test/functional/configs/maps/known_senders_domains.map
@@ -0,0 +1,2 @@
+outlook.com
+example.com
diff --git a/test/functional/lib/vars.py b/test/functional/lib/vars.py
index 7d57f9f8f..898d21286 100644
--- a/test/functional/lib/vars.py
+++ b/test/functional/lib/vars.py
@@ -1,6 +1,7 @@
import socket
CONTROLLER_ERRORS = True
+RSPAMD_EXTERNAL_RELAY_ENABLED = False
RSPAMD_KEY_PVT1 = 'ekd3x36tfa5gd76t6pa8hqif3ott7n1siuux68exbkk7ukscte9y'
RSPAMD_KEY_PUB1 = 'm8kneubpcjsb8sbsoj7jy7azj9fdd3xmj63txni86a8ye9ncomny'
RSPAMD_LOCAL_ADDR = '127.0.0.1'