aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2018-10-30 21:56:22 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2018-10-30 22:55:41 +0300
commit1fdff2d983b3b9f5bacf6f5141aa524c5257c28d (patch)
tree260344668751bd4cf3430e80e8d0ab1eb72178fa /test
parenta0584524b42a8fe196e77994c8cff0f08ad03ed3 (diff)
downloadrspamd-1fdff2d983b3b9f5bacf6f5141aa524c5257c28d.tar.gz
rspamd-1fdff2d983b3b9f5bacf6f5141aa524c5257c28d.zip
[Test] Add test for composites with symbol groups
Diffstat (limited to 'test')
-rw-r--r--test/functional/cases/109_composites.robot10
-rw-r--r--test/functional/configs/composites.conf5
-rw-r--r--test/functional/lua/composites.lua33
3 files changed, 47 insertions, 1 deletions
diff --git a/test/functional/cases/109_composites.robot b/test/functional/cases/109_composites.robot
index 94c9f58ee..d24c505e9 100644
--- a/test/functional/cases/109_composites.robot
+++ b/test/functional/cases/109_composites.robot
@@ -14,7 +14,7 @@ ${RSPAMD_SCOPE} Suite
*** Test Cases ***
Composites - Score
${result} = Scan Message With Rspamc ${MESSAGE}
- Check Rspamc ${result} ${SPACE}46.00 / 0.00
+ Check Rspamc ${result} ${SPACE}50.00 / 0.00
Composites - Expressions
${result} = Scan Message With Rspamc ${MESSAGE}
@@ -55,3 +55,11 @@ Composites - Default policy: leave
Check Rspamc ${result} DEFAULT_POLICY_LEAVE (5.00)
Should Contain ${result.stdout} DEFAULT_POLICY_LEAVE_A (1.00)
Should Contain ${result.stdout} DEFAULT_POLICY_LEAVE_B (1.00)
+
+Composites - Symbol groups
+ ${result} = Scan Message With Rspamc ${MESSAGE}
+ Check Rspamc ${result} SYMBOL_GROUPS (5.00)
+ Should Contain ${result.stdout} POSITIVE_A (-1.00)
+ Should Contain ${result.stdout} ANY_A (-1.00)
+ Should Contain ${result.stdout} NEGATIVE_B (1.00)
+ Should Not Contain ${result.stdout} NEGATIVE_A
diff --git a/test/functional/configs/composites.conf b/test/functional/configs/composites.conf
index 3b281fc57..8b79d5ae7 100644
--- a/test/functional/configs/composites.conf
+++ b/test/functional/configs/composites.conf
@@ -61,4 +61,9 @@ composites {
score = 5.0;
policy = "leave";
}
+
+ SYMBOL_GROUPS {
+ expression = "!g+:positive & g-:negative & -g:any";
+ score = 5.0;
+ }
}
diff --git a/test/functional/lua/composites.lua b/test/functional/lua/composites.lua
index de4642c3b..66d595cd8 100644
--- a/test/functional/lua/composites.lua
+++ b/test/functional/lua/composites.lua
@@ -91,3 +91,36 @@ rspamd_config:register_symbol({
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
+})