From 25931e8fb535905470ef0eb43d2e187a5c5d7783 Mon Sep 17 00:00:00 2001
From: Vsevolod Stakhov <vsevolod@highsecure.ru>
Date: Sat, 15 Jun 2019 12:20:48 +0100
Subject: [Test] Improve settings tests coverage

---
 test/functional/cases/108_settings.robot |  4 ++++
 test/functional/lua/settings.lua         | 11 +++++++++++
 2 files changed, 15 insertions(+)

(limited to 'test')

diff --git a/test/functional/cases/108_settings.robot b/test/functional/cases/108_settings.robot
index f1b92c214..071ad88d7 100644
--- a/test/functional/cases/108_settings.robot
+++ b/test/functional/cases/108_settings.robot
@@ -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
 
diff --git a/test/functional/lua/settings.lua b/test/functional/lua/settings.lua
index 828e1cb37..d0f496c68 100644
--- a/test/functional/lua/settings.lua
+++ b/test/functional/lua/settings.lua
@@ -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,
+})
-- 
cgit v1.2.3