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.

101_lua.robot 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. *** Settings ***
  2. Test Teardown Normal Teardown
  3. Library ${TESTDIR}/lib/rspamd.py
  4. Resource ${TESTDIR}/lib/rspamd.robot
  5. Variables ${TESTDIR}/lib/vars.py
  6. *** Variables ***
  7. ${CONFIG} ${TESTDIR}/configs/lua_test.conf
  8. ${MAP_MAP} ${TESTDIR}/configs/maps/map.list
  9. ${MESSAGE} ${TESTDIR}/messages/spam_message.eml
  10. ${RADIX_MAP} ${TESTDIR}/configs/maps/ip2.list
  11. ${REGEXP_MAP} ${TESTDIR}/configs/maps/regexp.list
  12. ${RSPAMD_SCOPE} Test
  13. ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
  14. *** Test Cases ***
  15. Flags
  16. [Setup] Lua Setup ${TESTDIR}/lua/flags.lua
  17. ${result} = Scan Message With Rspamc ${MESSAGE}
  18. Follow Rspamd Log
  19. ${result} = Run Rspamc -h ${LOCAL_ADDR}:${PORT_CONTROLLER} stat
  20. Should Contain ${result.stdout} Messages scanned: 0
  21. Dependencies
  22. [Setup] Lua Setup ${TESTDIR}/lua/deps.lua
  23. ${result} = Scan Message With Rspamc ${MESSAGE}
  24. Check Rspamc ${result} DEP10
  25. Pre and Post Filters
  26. [Setup] Lua Setup ${TESTDIR}/lua/prepostfilters.lua
  27. ${result} = Scan Message With Rspamc ${MESSAGE}
  28. Check Rspamc ${result} TEST_PRE
  29. Should Contain ${result.stdout} TEST_POST
  30. Recipient Parsing Sanity
  31. [Setup] Lua Setup ${TESTDIR}/lua/recipients.lua
  32. ${result} = Scan Message With Rspamc ${MESSAGE} -r rcpt1@foobar -r rcpt2@foobar
  33. ... -r rcpt3@foobar -r rcpt4@foobar
  34. Check Rspamc ${result} TEST_RCPT (1.00)[rcpt1@foobar,rcpt2@foobar,rcpt3@foobar,rcpt4@foobar]
  35. TLD parts
  36. [Setup] TLD Setup ${TESTDIR}/lua/tlds.lua
  37. ${result} = Scan Message With Rspamc ${MESSAGE}
  38. Check Rspamc ${result} TEST_TLD (1.00)[no worry]
  39. Hashes
  40. [Setup] Lua Setup ${TESTDIR}/lua/hashes.lua
  41. ${result} = Scan Message With Rspamc ${MESSAGE}
  42. Check Rspamc ${result} TEST_HASHES (1.00)[no worry]
  43. Maps Key Values
  44. [Setup] Lua Replace Setup ${TESTDIR}/lua/maps_kv.lua
  45. [Teardown] Lua Replace Teardown
  46. ${result} = Scan Message With Rspamc ${MESSAGE}
  47. Check Rspamc ${result} RADIX_KV (1.00)[no worry]
  48. Should Contain ${result.stdout} REGEXP_KV (1.00)[no worry]
  49. Should Contain ${result.stdout} MAP_KV (1.00)[no worry]
  50. Option Order
  51. [Setup] Lua Replace Setup ${TESTDIR}/lua/option_order.lua
  52. [Teardown] Lua Replace Teardown
  53. ${result} = Scan Message With Rspamc ${MESSAGE}
  54. Check Rspamc ${result} OPTION_ORDER (1.00)[one, two, three, 4, 5, a]
  55. Should Contain ${result.stdout} TBL_OPTION_ORDER (1.00)[one, two, three, 4, 5, a]
  56. *** Keywords ***
  57. Lua Setup
  58. [Arguments] ${LUA_SCRIPT}
  59. Set Test Variable ${LUA_SCRIPT}
  60. Generic Setup
  61. Lua Replace Setup
  62. [Arguments] ${LUA_SCRIPT_UNESC}
  63. ${LUA_SCRIPT} = Make Temporary File
  64. ${lua} = Get File ${LUA_SCRIPT_UNESC}
  65. ${lua} = Replace Variables ${lua}
  66. Create File ${LUA_SCRIPT} ${lua}
  67. Lua Setup ${LUA_SCRIPT}
  68. Lua Replace Teardown
  69. Remove File ${LUA_SCRIPT}
  70. Normal Teardown
  71. TLD Setup
  72. [Arguments] ${LUA_SCRIPT}
  73. Set Test Variable ${URL_TLD} ${TESTDIR}/../../contrib/publicsuffix/effective_tld_names.dat
  74. Lua Setup ${LUA_SCRIPT}