Browse Source

[Test] Rework composites test

tags/2.7
Andrew Lewis 3 years ago
parent
commit
f5b931b814
2 changed files with 45 additions and 28 deletions
  1. 25
    25
      test/functional/cases/109_composites.robot
  2. 20
    3
      test/functional/lib/rspamd.robot

+ 25
- 25
test/functional/cases/109_composites.robot View File

@@ -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


+ 20
- 3
test/functional/lib/rspamd.robot View File

@@ -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}

Loading…
Cancel
Save