summaryrefslogtreecommitdiffstats
path: root/test/functional/lua/composites.lua
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:30:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 21:30:40 +0000
commit133a45c109da5310add55824db21af5239951f93 (patch)
treeba6ac4c0a950a0dda56451944315d66409923918 /test/functional/lua/composites.lua
parentInitial commit. (diff)
downloadrspamd-133a45c109da5310add55824db21af5239951f93.tar.xz
rspamd-133a45c109da5310add55824db21af5239951f93.zip
Adding upstream version 3.8.1.upstream/3.8.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/functional/lua/composites.lua')
-rw-r--r--test/functional/lua/composites.lua140
1 files changed, 140 insertions, 0 deletions
diff --git a/test/functional/lua/composites.lua b/test/functional/lua/composites.lua
new file mode 100644
index 0000000..648eda0
--- /dev/null
+++ b/test/functional/lua/composites.lua
@@ -0,0 +1,140 @@
+rspamd_config:register_symbol({
+ name = 'EXPRESSIONS_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+
+rspamd_config:register_symbol({
+ name = 'POLICY_REMOVE_WEIGHT_A',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'POLICY_REMOVE_WEIGHT_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'POLICY_FORCE_REMOVE_A',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'POLICY_FORCE_REMOVE_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'POLICY_LEAVE_A',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'POLICY_LEAVE_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+
+rspamd_config:register_symbol({
+ name = 'DEFAULT_POLICY_REMOVE_WEIGHT_A',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'DEFAULT_POLICY_REMOVE_WEIGHT_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'DEFAULT_POLICY_REMOVE_SYMBOL_A',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'DEFAULT_POLICY_REMOVE_SYMBOL_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'DEFAULT_POLICY_LEAVE_A',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'DEFAULT_POLICY_LEAVE_B',
+ score = 1.0,
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+
+rspamd_config:register_symbol({
+ name = 'POSITIVE_A',
+ score = -1.0,
+ group = "positive",
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'NEGATIVE_A',
+ score = -1.0,
+ group = "negative",
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'NEGATIVE_B',
+ score = 1.0,
+ group = "negative",
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+rspamd_config:register_symbol({
+ name = 'ANY_A',
+ score = -1.0,
+ group = "any",
+ callback = function()
+ return true, 'Fires always'
+ end
+})
+
+rspamd_config:register_symbol({
+ name = 'OPTS',
+ score = -1.0,
+ group = "any",
+ callback = function(task)
+ local lua_util = require "lua_util"
+ local woot = lua_util.str_split(tostring(task:get_request_header('opts') or ''), ',')
+
+ if woot and #woot > 0 and #woot[1] > 0 then
+ return true, 1.0, woot
+ end
+ end
+})