aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIvan Stakhov <50211739+LeftTry@users.noreply.github.com>2024-06-25 17:49:56 +0500
committerGitHub <noreply@github.com>2024-06-25 13:49:56 +0100
commitec1b9b8affaa66dd78f25f712040b3a1bb62fc39 (patch)
treef0d3659a7e57a7044e8247ee2cfefac13b0cd59f /test
parent1995012959e219e02aef939f9fd3765ffd718e04 (diff)
downloadrspamd-ec1b9b8affaa66dd78f25f712040b3a1bb62fc39.tar.gz
rspamd-ec1b9b8affaa66dd78f25f712040b3a1bb62fc39.zip
Fixed bug with task:inject() function according to the issue #5010 (#5021)
* [Fix] Fix issue with task:inject_url * [Minor] Code clean up * [Minor] Clean up * [Minor] Small fix * [Minor] Fix small typo * [Test] Debug * [Test] Debug * [Test] Debug inject_url * [Test] Debugging * [Test] Debugging task:inject test * [Test] Debugging task:inject test * [Test] Debugging task:inject test * [Minor] Debug task:inject_url test * [Minor] Small fix * [Minor] Debug task:inject_url test * [Test] Test base task:inject * [Test] Test updated task:inject * [Test] Test updated task:inject * [Test] Test updated task:inject * [Test] Test updated task:inject * [Test] Test updated task:inject * [Test] Test fixed task:inject * [Test] Test fixed task:inject * [Test] Testing task:inject * [Test] Testing task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Test base task:inject * [Test] Test base task:inject * [Test] Test base task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Test] Fix task:inject * [Minor] Clean up code in task:inject * [Minor] Updated test for task:inject * [Test] Debug test for task:inject_url * [Test] Debug test for task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Fix task:inject_url * [Test] Check task:inject_url * [Test] Check task:inject_url * [Test] Check task:inject_url * [Test] Check task:inject_url * [Test] Check task:inject_url * [Test] Check task:inject_url * [Minor] Clean up code * [Minor] Clean up code * [Minor] Little fix for error messages in url.create function * [Test] Change way to inject url * [Test] Fix inject url * [Test] Fix inject url * [Test] Fix inject url * [Test] Fix inject url * [Test] Fix inject url * [Minor] Clean up code * [Test] Without fake mime_part * [Test] Without fake mime_part * [Minor] Clean up * [Test] Mime part of the task * [Test] Mpart should exist * [Test] Mpart should exist * [Test] Mpart should exist * [Test] Another check for mpart->urls * [Minor] Clean up * [Minor] Clean up * [Fix] Fixing OpenSSL 3.0 compatibility * [Fix] Reverted
Diffstat (limited to 'test')
-rw-r--r--test/functional/cases/001_merged/101_lua.robot7
-rw-r--r--test/functional/configs/merged.conf1
-rw-r--r--test/functional/lua/inject_url.lua17
3 files changed, 24 insertions, 1 deletions
diff --git a/test/functional/cases/001_merged/101_lua.robot b/test/functional/cases/001_merged/101_lua.robot
index d1a771cb3..2cfc03677 100644
--- a/test/functional/cases/001_merged/101_lua.robot
+++ b/test/functional/cases/001_merged/101_lua.robot
@@ -8,6 +8,7 @@ ${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml
${RSPAMD_MAP_MAP} ${RSPAMD_TESTDIR}/configs/maps/map.list
${RSPAMD_RADIX_MAP} ${RSPAMD_TESTDIR}/configs/maps/ip2.list
${RSPAMD_REGEXP_MAP} ${RSPAMD_TESTDIR}/configs/maps/regexp.list
+${URL_ICS} ${RSPAMD_TESTDIR}/messages/ics.eml
*** Test Cases ***
Recipient Parsing Sanity
@@ -47,4 +48,8 @@ Rule conditions
External Maps Simple
Scan File ${MESSAGE} Settings={symbols_enabled = [EXTERNAL_MAP]}
- Expect Symbol With Exact Options EXTERNAL_MAP +hello map \ No newline at end of file
+ Expect Symbol With Exact Options EXTERNAL_MAP +hello map
+
+Task Inject Url
+ Scan File ${URL_ICS} Settings={symbols_enabled = [TEST_INJECT_URL]}
+ Expect Symbol TEST_INJECT_URL \ No newline at end of file
diff --git a/test/functional/configs/merged.conf b/test/functional/configs/merged.conf
index 2b3640048..0ee224ceb 100644
--- a/test/functional/configs/merged.conf
+++ b/test/functional/configs/merged.conf
@@ -10,6 +10,7 @@ lua = "{= env.TESTDIR =}/lua/option_order.lua"
lua = "{= env.TESTDIR =}/lua/recipients.lua"
lua = "{= env.TESTDIR =}/lua/remove_result.lua"
lua = "{= env.TESTDIR =}/lua/tlds.lua"
+lua = "{= env.TESTDIR =}/lua/inject_url.lua"
# 104_get_from
lua = "{= env.TESTDIR =}/lua/get_from.lua"
diff --git a/test/functional/lua/inject_url.lua b/test/functional/lua/inject_url.lua
new file mode 100644
index 000000000..f8764b213
--- /dev/null
+++ b/test/functional/lua/inject_url.lua
@@ -0,0 +1,17 @@
+local url = require('rspamd_url')
+
+local function task_inject_cb (task)
+ local url_text = 'http://example.com?redir=https://another.com'
+ local url_to_inject = url.create(task:get_mempool(), url_text)
+ task:inject_url(url_to_inject)
+ if #(task:get_urls()) == 2 then
+ return true
+ end
+ return false
+end
+
+rspamd_config:register_symbol({
+ name = 'TEST_INJECT_URL',
+ score = 1.0,
+ callback = task_inject_cb
+})