]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Improve settings tests coverage
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 15 Jun 2019 11:20:48 +0000 (12:20 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 15 Jun 2019 11:20:48 +0000 (12:20 +0100)
test/functional/cases/108_settings.robot
test/functional/lua/settings.lua

index f1b92c214ae5c16bed4925818b8736b743c2314a..071ad88d731ba03bddbb2fb450d6f3b9e0d80dd0 100644 (file)
@@ -18,6 +18,8 @@ ${URL_TLD}      ${TESTDIR}/../lua/unit/test_tld.dat
 NO SETTINGS SPAM
   ${result} =  Scan Message With Rspamc  ${SPAM_MESSAGE}
   Check Rspamc  ${result}  SIMPLE_TEST
+  Should Contain  ${result.stdout}  SIMPLE_VIRTUAL
+  Should Not Contain  ${result.stdout}  SIMPLE_VIRTUAL1
   Should Contain  ${result.stdout}  SIMPLE_PRE
   Should Contain  ${result.stdout}  SIMPLE_POST
   Should Contain  ${result.stdout}  BAYES_SPAM
@@ -99,6 +101,7 @@ SETTINGS ID - VIRTUAL
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings-Id=id_virtual
   Check Rspamc  ${result}  SIMPLE_VIRTUAL
   Should Not Contain  ${result.stdout}  SIMPLE_TEST
+  Should Not Contain  ${result.stdout}  SIMPLE_VIRTUAL1
   Should Not Contain  ${result.stdout}  SIMPLE_POST
   Should Not Contain  ${result.stdout}  SIMPLE_PRE
 
@@ -106,6 +109,7 @@ SETTINGS ID - VIRTUAL GROUP
   ${result} =  Scan Message With Rspamc  ${MESSAGE}  --header  Settings-Id=id_virtual_group
   Check Rspamc  ${result}  SIMPLE_VIRTUAL
   Should Not Contain  ${result.stdout}  SIMPLE_TEST
+  Should Not Contain  ${result.stdout}  SIMPLE_VIRTUAL1
   Should Not Contain  ${result.stdout}  SIMPLE_POST
   Should Not Contain  ${result.stdout}  SIMPLE_PRE
 
index 828e1cb37b3ef0d875a07f6aeda32036369ba2ab..d0f496c68e6009f4e5e8cb58d4c569f8f775add8 100644 (file)
@@ -25,6 +25,7 @@ local id = rspamd_config:register_symbol({
   group = 'b',
   callback = function(task)
     task:insert_result('SIMPLE_VIRTUAL', 1.0)
+    task:insert_result('SIMPLE_VIRTUAL1', 1.0)
     return true, 'Fires always'
   end
 })
@@ -36,3 +37,13 @@ rspamd_config:register_symbol({
   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,
+})