diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-10 21:30:40 +0000 |
commit | 133a45c109da5310add55824db21af5239951f93 (patch) | |
tree | ba6ac4c0a950a0dda56451944315d66409923918 /test/functional/lua/settings.lua | |
parent | Initial commit. (diff) | |
download | rspamd-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/settings.lua')
-rw-r--r-- | test/functional/lua/settings.lua | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/test/functional/lua/settings.lua b/test/functional/lua/settings.lua new file mode 100644 index 0000000..384c68e --- /dev/null +++ b/test/functional/lua/settings.lua @@ -0,0 +1,68 @@ +rspamd_config:register_symbol({ + name = 'SIMPLE_PRE', + score = 1.0, + priority = 9, -- after settings + group = 'a', + type = 'prefilter', + callback = function() + return true, 'Fires always' + end +}) + +rspamd_config:register_symbol({ + name = 'SIMPLE_POST', + score = 1.0, + type = 'postfilter', + group = 'c', + callback = function() + return true, 'Fires always' + end +}) + +local id = rspamd_config:register_symbol({ + name = 'SIMPLE_TEST', + score = 1.0, + group = 'b', + callback = function(task) + task:insert_result('SIMPLE_VIRTUAL', 1.0) + task:insert_result('SIMPLE_VIRTUAL1', 1.0) + return true, 'Fires always' + end +}) + +rspamd_config:register_symbol({ + name = 'SIMPLE_VIRTUAL', + type = 'virtual', + score = 1.0, + group = 'vg', + parent = id, +}) + +rspamd_config:register_symbol({ + name = 'SIMPLE_VIRTUAL1', + type = 'virtual', + forbidden_ids = 'id_virtual,id_virtual_group', + allowed_ids = 'id_virtual1', + score = 1.0, + group = 'vg', + parent = id, +}) + +id = rspamd_config:register_symbol({ + name = 'DEP_REAL', + callback = function(task) + task:insert_result('DEP_VIRTUAL', 1.0) + return true + end, + score = 1.0, +}) + +rspamd_config:register_symbol({ + name = 'DEP_VIRTUAL', + parent = id, + type = 'virtual', + allowed_ids = 'id_virtual1', + score = 1.0, +}) + +rspamd_config:register_dependency('DEP_VIRTUAL', 'EXPLICIT_VIRTUAL1')
\ No newline at end of file |