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.

108_settings.robot 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. *** Settings ***
  2. Suite Setup Settings Setup
  3. Suite Teardown Settings 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/plugins.conf
  9. ${LUA_SCRIPT} ${TESTDIR}/lua/settings.lua
  10. ${MESSAGE} ${TESTDIR}/messages/spam_message.eml
  11. ${RSPAMD_SCOPE} Suite
  12. ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
  13. *** Test Cases ***
  14. NO SETTINGS
  15. ${result} = Scan Message With Rspamc ${MESSAGE}
  16. Check Rspamc ${result} SIMPLE_TEST
  17. Should Contain ${result.stdout} SIMPLE_PRE
  18. Should Contain ${result.stdout} SIMPLE_POST
  19. ENABLE SYMBOL - NORMAL
  20. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={symbols_enabled = ["SIMPLE_TEST"]}
  21. Check Rspamc ${result} SIMPLE_TEST
  22. Should Not Contain ${result.stdout} SIMPLE_PRE
  23. Should Not Contain ${result.stdout} SIMPLE_POST
  24. ENABLE SYMBOL - POSTFILTER
  25. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={symbols_enabled = ["SIMPLE_TEST", "SIMPLE_POST"]}
  26. Check Rspamc ${result} SIMPLE_TEST
  27. Should Contain ${result.stdout} SIMPLE_POST
  28. Should Not Contain ${result.stdout} SIMPLE_PRE
  29. ENABLE SYMBOL - PREFILTER
  30. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={symbols_enabled = ["SIMPLE_PRE"]}
  31. Check Rspamc ${result} SIMPLE_PRE
  32. Should Not Contain ${result.stdout} SIMPLE_POST
  33. Should Not Contain ${result.stdout} SIMPLE_TEST
  34. DISABLE SYMBOL - NORMAL
  35. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={symbols_disabled = ["SIMPLE_TEST"]}
  36. Check Rspamc ${result} SIMPLE_TEST inverse=1
  37. Should Contain ${result.stdout} SIMPLE_PRE
  38. Should Contain ${result.stdout} SIMPLE_POST
  39. RESCORE SYMBOL - NORMAL
  40. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={SIMPLE_TEST = 3.33}
  41. Check Rspamc ${result} SIMPLE_TEST (3.33)
  42. RESCORE ACTION
  43. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={actions { reject = 1234.5; } }
  44. Check Rspamc ${result} ${SPACE}/ 1234.50
  45. DISABLE GROUP - NORMAL
  46. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={groups_disabled = ["b"]}
  47. Check Rspamc ${result} SIMPLE_TEST inverse=1
  48. Should Contain ${result.stdout} SIMPLE_PRE
  49. Should Contain ${result.stdout} SIMPLE_POST
  50. ENABLE GROUP - NORMAL
  51. ${result} = Scan Message With Rspamc ${MESSAGE} --header Settings={groups_enabled = ["b"]}
  52. Check Rspamc ${result} SIMPLE_TEST
  53. Should Not Contain ${result.stdout} SIMPLE_PRE
  54. Should Not Contain ${result.stdout} SIMPLE_POST
  55. *** Keywords ***
  56. Settings Setup
  57. ${PLUGIN_CONFIG} = Get File ${TESTDIR}/configs/settings.conf
  58. Set Suite Variable ${PLUGIN_CONFIG}
  59. Generic Setup PLUGIN_CONFIG
  60. Settings Teardown
  61. Normal Teardown