]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Settings: few more tests
authorAndrew Lewis <nerf@judo.za.org>
Mon, 28 Aug 2017 10:16:26 +0000 (12:16 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 28 Aug 2017 10:43:13 +0000 (12:43 +0200)
test/functional/cases/108_settings.robot
test/functional/lua/settings.lua

index 9a5a92e42158993c3ee8f87677a6cc6bf10c502d..4ed2b53f5f52d1784565c880882b2633732a15ec 100644 (file)
@@ -19,18 +19,50 @@ NO SETTINGS
   Should Contain  ${result.stdout}  SIMPLE_PRE
   Should Contain  ${result.stdout}  SIMPLE_POST
 
-ENABLE SYMBOL - SIMPLE_TEST
+ENABLE SYMBOL - NORMAL
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["SIMPLE_TEST"]}
   Check Rspamc  ${result}  SIMPLE_TEST
   Should Not Contain  ${result.stdout}  SIMPLE_PRE
   Should Not Contain  ${result.stdout}  SIMPLE_POST
 
-ENABLE SYMBOL - SIMPLE_POST
+ENABLE SYMBOL - POSTFILTER
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["SIMPLE_TEST", "SIMPLE_POST"]}
   Check Rspamc  ${result}  SIMPLE_TEST
   Should Contain  ${result.stdout}  SIMPLE_POST
   Should Not Contain  ${result.stdout}  SIMPLE_PRE
 
+ENABLE SYMBOL - PREFILTER
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_enabled = ["SIMPLE_PRE"]}
+  Check Rspamc  ${result}  SIMPLE_PRE
+  Should Not Contain  ${result.stdout}  SIMPLE_POST
+  Should Not Contain  ${result.stdout}  SIMPLE_TEST
+
+DISABLE SYMBOL - NORMAL
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={symbols_disabled = ["SIMPLE_TEST"]}
+  Check Rspamc  ${result}  SIMPLE_TEST  inverse=1
+  Should Contain  ${result.stdout}  SIMPLE_PRE
+  Should Contain  ${result.stdout}  SIMPLE_POST
+
+RESCORE SYMBOL - NORMAL
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={SIMPLE_TEST = 3.33}
+  Check Rspamc  ${result}  SIMPLE_TEST (3.33)
+
+RESCORE ACTION
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={actions { reject = 1234.5; } }
+  Check Rspamc  ${result}  ${SPACE}/ 1234.50
+
+DISABLE GROUP - NORMAL
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={groups_disabled = ["b"]}
+  Check Rspamc  ${result}  SIMPLE_TEST  inverse=1
+  Should Contain  ${result.stdout}  SIMPLE_PRE
+  Should Contain  ${result.stdout}  SIMPLE_POST
+
+ENABLE GROUP - NORMAL
+  ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings={groups_enabled = ["b"]}
+  Check Rspamc  ${result}  SIMPLE_TEST
+  Should Not Contain  ${result.stdout}  SIMPLE_PRE
+  Should Not Contain  ${result.stdout}  SIMPLE_POST
+
 *** Keywords ***
 Settings Setup
   ${PLUGIN_CONFIG} =  Get File  ${TESTDIR}/configs/settings.conf
index 0be6f71bf40fcbf9cc771f049862de75a063a1ca..e52325dacf2be6d6ff6ef9ad0f338d43e32b9eb5 100644 (file)
@@ -2,6 +2,7 @@ rspamd_config:register_symbol({
   name = 'SIMPLE_PRE',
   score = 1.0,
   priority = 9, -- after settings
+  group = 'a',
   type = 'prefilter',
   callback = function()
     return true, 'Fires always'
@@ -12,6 +13,7 @@ rspamd_config:register_symbol({
   name = 'SIMPLE_POST',
   score = 1.0,
   type = 'postfilter',
+  group = 'c',
   callback = function()
     return true, 'Fires always'
   end
@@ -20,6 +22,7 @@ rspamd_config:register_symbol({
 rspamd_config:register_symbol({
   name = 'SIMPLE_TEST',
   score = 1.0,
+  group = 'b',
   callback = function()
     return true, 'Fires always'
   end