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.

230_tcp.robot 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. *** Settings ***
  2. Test Setup Http Setup
  3. Test Teardown Http Teardown
  4. Library Process
  5. Library ${TESTDIR}/lib/rspamd.py
  6. Resource ${TESTDIR}/lib/rspamd.robot
  7. Variables ${TESTDIR}/lib/vars.py
  8. *** Variables ***
  9. # ${CONFIG} ${TESTDIR}/configs/http.conf
  10. ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat
  11. ${CONFIG} ${TESTDIR}/configs/lua_test.conf
  12. ${MESSAGE} ${TESTDIR}/messages/spam_message.eml
  13. ${RSPAMD_SCOPE} Test
  14. *** Test Cases ***
  15. Simple TCP request
  16. ${result} = Scan Message With Rspamc ${MESSAGE}
  17. Check Rspamc ${result} HTTP_ASYNC_RESPONSE
  18. Check Rspamc ${result} HTTP_ASYNC_RESPONSE_2
  19. Sync API TCP request
  20. ${result} = Scan Message With Rspamc ${MESSAGE}
  21. Check Rspamc ${result} HTTP_SYNC_RESPONSE
  22. Check Rspamc ${result} HTTP_SYNC_RESPONSE_2
  23. Check Rspamc ${result} hello world
  24. Check Rspamc ${result} hello post
  25. Sync API TCP get request
  26. Check url /request get HTTP_SYNC_EOF_get (0.00)[hello world]
  27. Check url /content-length get HTTP_SYNC_CONTENT_get (0.00)[hello world]
  28. Sync API TCP post request
  29. Check url /request post HTTP_SYNC_EOF_post (0.00)[hello post]
  30. Check url /content-length post HTTP_SYNC_CONTENT_post (0.00)[hello post]
  31. *** Keywords ***
  32. Lua Setup
  33. [Arguments] ${LUA_SCRIPT}
  34. Set Global Variable ${LUA_SCRIPT}
  35. Generic Setup
  36. Http Setup
  37. Run Dummy Http
  38. Lua Setup ${TESTDIR}/lua/tcp.lua
  39. Http Teardown
  40. ${http_pid} = Get File /tmp/dummy_http.pid
  41. Shutdown Process With Children ${http_pid}
  42. Normal Teardown
  43. Run Dummy Http
  44. [Arguments]
  45. ${result} = Start Process ${TESTDIR}/util/dummy_http.py
  46. Wait Until Created /tmp/dummy_http.pid
  47. Check url
  48. [Arguments] ${url} ${method} @{expect_results}
  49. ${result} = Scan Message With Rspamc --header=url:${url} --header=method:${method} ${MESSAGE}
  50. : FOR ${expect} IN @{expect_results}
  51. \ Check Rspamc ${result} ${expect}