You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

109_composites.robot 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. *** Settings ***
  2. Suite Setup Generic Setup
  3. Suite Teardown Simple Teardown
  4. Library ${TESTDIR}/lib/rspamd.py
  5. Resource ${TESTDIR}/lib/rspamd.robot
  6. Variables ${TESTDIR}/lib/vars.py
  7. *** Variables ***
  8. ${CONFIG} ${TESTDIR}/configs/composites.conf
  9. ${LUA_SCRIPT} ${TESTDIR}/lua/composites.lua
  10. ${MESSAGE} ${TESTDIR}/messages/spam_message.eml
  11. ${RSPAMD_SCOPE} Suite
  12. *** Test Cases ***
  13. Composites - Score
  14. ${result} = Scan Message With Rspamc ${MESSAGE}
  15. Check Rspamc ${result} ${SPACE}50.00 / 0.00
  16. Composites - Expressions
  17. ${result} = Scan Message With Rspamc ${MESSAGE}
  18. Check Rspamc ${result} EXPRESSIONS (5.00)
  19. Should Contain ${result.stdout} EXPRESSIONS_B (0.00)
  20. Composites - Policy: remove_weight
  21. ${result} = Scan Message With Rspamc ${MESSAGE}
  22. Check Rspamc ${result} ${SPACE}POLICY_REMOVE_WEIGHT (5.00)
  23. Should Not Contain ${result.stdout} ${SPACE}POLICY_REMOVE_WEIGHT_A (1.00)
  24. Should Contain ${result.stdout} ${SPACE}POLICY_REMOVE_WEIGHT_B (0.00)
  25. Composites - Policy: force removing
  26. ${result} = Scan Message With Rspamc ${MESSAGE}
  27. Check Rspamc ${result} ${SPACE}POLICY_FORCE_REMOVE (5.00)
  28. Should Contain ${result.stdout} ${SPACE}POLICY_FORCE_REMOVE_A (1.00)
  29. Should Not Contain ${result.stdout} ${SPACE}POLICY_FORCE_REMOVE_B
  30. Composites - Policy: leave
  31. ${result} = Scan Message With Rspamc ${MESSAGE}
  32. Check Rspamc ${result} ${SPACE}POLICY_LEAVE (5.00)
  33. Should Not Contain ${result.stdout} ${SPACE}POLICY_LEAVE_A
  34. Should Contain ${result.stdout} ${SPACE}POLICY_LEAVE_B (1.00)
  35. Composites - Default policy: remove_weight
  36. ${result} = Scan Message With Rspamc ${MESSAGE}
  37. Check Rspamc ${result} DEFAULT_POLICY_REMOVE_WEIGHT (5.00)
  38. Should Contain ${result.stdout} DEFAULT_POLICY_REMOVE_WEIGHT_A (0.00)
  39. Should Contain ${result.stdout} DEFAULT_POLICY_REMOVE_WEIGHT_B (0.00)
  40. Composites - Default policy: remove_symbol
  41. ${result} = Scan Message With Rspamc ${MESSAGE}
  42. Check Rspamc ${result} DEFAULT_POLICY_REMOVE_SYMBOL (5.00)
  43. Should Not Contain ${result.stdout} DEFAULT_POLICY_REMOVE_SYMBOL_
  44. Composites - Default policy: leave
  45. ${result} = Scan Message With Rspamc ${MESSAGE}
  46. Check Rspamc ${result} DEFAULT_POLICY_LEAVE (5.00)
  47. Should Contain ${result.stdout} DEFAULT_POLICY_LEAVE_A (1.00)
  48. Should Contain ${result.stdout} DEFAULT_POLICY_LEAVE_B (1.00)
  49. Composites - Symbol groups
  50. ${result} = Scan Message With Rspamc ${MESSAGE}
  51. Check Rspamc ${result} SYMBOL_GROUPS (5.00)
  52. Should Contain ${result.stdout} POSITIVE_A (-1.00)
  53. Should Contain ${result.stdout} ANY_A (-1.00)
  54. Should Contain ${result.stdout} NEGATIVE_B (1.00)
  55. Should Not Contain ${result.stdout} NEGATIVE_A
  56. Composites - Opts Plain
  57. ${result} = Scan Message With Rspamc ${MESSAGE} --header=opts:sym1
  58. Check Rspamc ${result} SYMOPTS1 (5.00)
  59. Should Not Contain ${result.stdout} SYMOPTS2
  60. Composites - Opts RE Miss one
  61. ${result} = Scan Message With Rspamc ${MESSAGE} --header=opts:sym1,foo1
  62. Check Rspamc ${result} SYMOPTS1 (5.00)
  63. Should Not Contain ${result.stdout} SYMOPTS2
  64. Composites - Opts RE Miss both
  65. ${result} = Scan Message With Rspamc ${MESSAGE} --header=opts:sym2
  66. Should Not Contain ${result.stdout} SYMOPTS1
  67. Should Not Contain ${result.stdout} SYMOPTS2
  68. Composites - Opts RE Hit
  69. ${result} = Scan Message With Rspamc ${MESSAGE} --header=opts:sym2,foo1
  70. Check Rspamc ${result} SYMOPTS2 (6.00)
  71. Should Not Contain ${result.stdout} SYMOPTS1