aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-05 15:09:34 +0000
committerGitHub <noreply@github.com>2020-11-05 15:09:34 +0000
commite1aee3fcb56ea4dbca57903ae44254ea969cd81f (patch)
tree930a1b96a2c3123c533adac53a8bc9cc1020ef42
parent8b7d8532b3b373203f9643048e0c41defe99e2df (diff)
parentf5b931b8146548f0ce6bac07734b014885ace29a (diff)
downloadrspamd-e1aee3fcb56ea4dbca57903ae44254ea969cd81f.tar.gz
rspamd-e1aee3fcb56ea4dbca57903ae44254ea969cd81f.zip
Merge pull request #3544 from fatalbanana/tp
[Test] Rework composites test
-rw-r--r--test/functional/cases/109_composites.robot50
-rw-r--r--test/functional/lib/rspamd.robot23
2 files changed, 45 insertions, 28 deletions
diff --git a/test/functional/cases/109_composites.robot b/test/functional/cases/109_composites.robot
index ef154603a..3aeb009ed 100644
--- a/test/functional/cases/109_composites.robot
+++ b/test/functional/cases/109_composites.robot
@@ -14,31 +14,31 @@ ${RSPAMD_SCOPE} Suite
*** Test Cases ***
Composites - All in One
Scan File ${MESSAGE}
- Expect Symbol With Score EXPRESSIONS 5
- Expect Symbol With Score EXPRESSIONS_B 0
- Expect Symbol With Score POLICY_REMOVE_WEIGHT 5
- Expect Symbol With Score POLICY_REMOVE_WEIGHT_B 0
- Do Not Expect Symbol POLICY_REMOVE_WEIGHT_A
- Expect Symbol With Score POLICY_FORCE_REMOVE 5.00
- Expect Symbol With Score POLICY_FORCE_REMOVE_A 1.00
- Do Not Expect Symbol POLICY_FORCE_REMOVE_B
- Expect Symbol With Score POLICY_LEAVE 5.00
- Do Not Expect Symbol POLICY_LEAVE_A
- Expect Symbol With Score POLICY_LEAVE_B 1.00
- Expect Symbol With Score DEFAULT_POLICY_REMOVE_WEIGHT 5.00
- Expect Symbol With Score DEFAULT_POLICY_REMOVE_WEIGHT_A 0.00
- Expect Symbol With Score DEFAULT_POLICY_REMOVE_WEIGHT_B 0.00
- Expect Symbol With Score DEFAULT_POLICY_REMOVE_SYMBOL 5.00
- Do Not Expect Symbol DEFAULT_POLICY_REMOVE_SYMBOL_A
- Do Not Expect Symbol DEFAULT_POLICY_REMOVE_SYMBOL_B
- Expect Symbol With Score DEFAULT_POLICY_LEAVE 5.00
- Expect Symbol With Score DEFAULT_POLICY_LEAVE_A 1.00
- Expect Symbol With Score DEFAULT_POLICY_LEAVE_B 1.00
- Expect Symbol With Score SYMBOL_GROUPS 5.00
- Expect Symbol With Score POSITIVE_A -1.00
- Expect Symbol With Score ANY_A -1.00
- Expect Symbol With Score NEGATIVE_B 1.00
- Do Not Expect Symbol NEGATIVE_A
+ Expect Symbols With Scores EXPRESSIONS=5
+ ... EXPRESSIONS_B=0
+ ... POLICY_REMOVE_WEIGHT=5
+ ... POLICY_REMOVE_WEIGHT_B=0
+ ... POLICY_FORCE_REMOVE=5.00
+ ... POLICY_FORCE_REMOVE_A=1.00
+ ... POLICY_LEAVE=5.00
+ ... POLICY_LEAVE_B=1.00
+ ... DEFAULT_POLICY_REMOVE_WEIGHT=5.00
+ ... DEFAULT_POLICY_REMOVE_WEIGHT_A=0.00
+ ... DEFAULT_POLICY_REMOVE_WEIGHT_B=0.00
+ ... DEFAULT_POLICY_REMOVE_SYMBOL=5.00
+ ... DEFAULT_POLICY_LEAVE=5.00
+ ... DEFAULT_POLICY_LEAVE_A=1.00
+ ... DEFAULT_POLICY_LEAVE_B=1.00
+ ... SYMBOL_GROUPS=5.00
+ ... POSITIVE_A=-1.00
+ ... ANY_A=-1.00
+ ... NEGATIVE_B=1.00
+ Do Not Expect Symbols DEFAULT_POLICY_REMOVE_SYMBOL_A
+ ... DEFAULT_POLICY_REMOVE_SYMBOL_B
+ ... NEGATIVE_A
+ ... POLICY_REMOVE_WEIGHT_A
+ ... POLICY_FORCE_REMOVE_B
+ ... POLICY_LEAVE_A
Expect Score 50
Expect Required Score To Be Null
diff --git a/test/functional/lib/rspamd.robot b/test/functional/lib/rspamd.robot
index e310db4b5..6487a2e11 100644
--- a/test/functional/lib/rspamd.robot
+++ b/test/functional/lib/rspamd.robot
@@ -46,8 +46,15 @@ Check Rspamc Match String
Do Not Expect Symbol
[Arguments] ${symbol}
- ${passed} = Run Keyword And Return Status Expect Symbol ${symbol}
- Run Keyword If ${passed} Fail Unexpected symbol ${symbol} was found in result
+ Dictionary Should Not Contain Key ${SCAN_RESULT}[symbols] ${symbol}
+ ... msg=Symbol ${symbol} was not expected to be found in result
+
+Do Not Expect Symbols
+ [Arguments] @{symbols}
+ FOR ${symbol} IN @{symbols}
+ Dictionary Should Not Contain Key ${SCAN_RESULT}[symbols] ${symbol}
+ ... msg=Symbol ${symbol} was not expected to be found in result
+ END
Generic Setup
[Arguments] @{vargs} &{kwargs}
@@ -103,10 +110,20 @@ Expect Symbol With Option
Expect Symbol With Score
[Arguments] ${symbol} ${score}
- Expect Symbol ${symbol}
+ Dictionary Should Contain Key ${SCAN_RESULT}[symbols] ${symbol}
+ ... msg=Symbol ${symbol} wasn't found in result
Should Be Equal As Numbers ${SCAN_RESULT}[symbols][${symbol}][score] ${score}
... msg="Symbol ${symbol} has score of ${SCAN_RESULT}[symbols][${symbol}][score] but expected ${score}"
+Expect Symbols With Scores
+ [Arguments] &{symscores}
+ FOR ${key} ${value} IN &{symscores}
+ Dictionary Should Contain Key ${SCAN_RESULT}[symbols] ${key}
+ ... msg=Symbol ${key} wasn't found in result
+ Should Be Equal As Numbers ${SCAN_RESULT}[symbols][${key}][score] ${value}
+ ... msg="Symbol ${key} has score of ${SCAN_RESULT}[symbols][${key}][score] but expected ${value}"
+ END
+
Expect Symbol With Score And Exact Options
[Arguments] ${symbol} ${score} @{options}
Expect Symbol With Exact Options ${symbol} @{options}