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 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. *** Settings ***
  2. Suite Setup Servers Setup
  3. Suite Teardown Servers Teardown
  4. Library Process
  5. Library ${RSPAMD_TESTDIR}/lib/rspamd.py
  6. Resource ${RSPAMD_TESTDIR}/lib/rspamd.robot
  7. Variables ${RSPAMD_TESTDIR}/lib/vars.py
  8. *** Variables ***
  9. ${CONFIG} ${RSPAMD_TESTDIR}/configs/lua_test.conf
  10. ${MESSAGE} ${RSPAMD_TESTDIR}/messages/spam_message.eml
  11. ${RSPAMD_LUA_SCRIPT} ${RSPAMD_TESTDIR}/lua/tcp.lua
  12. ${RSPAMD_SCOPE} Suite
  13. ${RSPAMD_URL_TLD} ${RSPAMD_TESTDIR}/../lua/unit/test_tld.dat
  14. *** Test Cases ***
  15. Simple TCP request
  16. Scan File ${MESSAGE}
  17. ... Settings={symbols_enabled = [SIMPLE_TCP_ASYNC_TEST]}
  18. Expect Symbol HTTP_ASYNC_RESPONSE
  19. Expect Symbol HTTP_ASYNC_RESPONSE_2
  20. #SSL TCP request
  21. # Scan File ${MESSAGE}
  22. # ... Settings={symbols_enabled = [SIMPLE_TCP_ASYNC_SSL_TEST]}
  23. # Expect Symbol With Exact Options TCP_SSL_RESPONSE hello
  24. # Expect Symbol With Exact Options TCP_SSL_RESPONSE_2 hello
  25. #SSL Large TCP request
  26. # Scan File ${MESSAGE}
  27. # ... Settings={symbols_enabled = [LARGE_TCP_ASYNC_SSL_TEST]}
  28. # Expect Symbol TCP_SSL_LARGE
  29. # Expect Symbol TCP_SSL_LARGE_2
  30. Sync API TCP request
  31. Scan File ${MESSAGE}
  32. ... Settings={symbols_enabled = [SIMPLE_TCP_TEST]}
  33. Expect Symbol HTTP_SYNC_RESPONSE
  34. Should Contain ${SCAN_RESULT}[symbols][HTTP_SYNC_RESPONSE][options][0] hello world
  35. Should Contain ${SCAN_RESULT}[symbols][HTTP_SYNC_RESPONSE_2][options][0] hello post
  36. Sync API TCP get request
  37. #Check url /request get HTTP_SYNC_EOF_get hello world
  38. Check url /request get HTTP_SYNC_CONTENT_get hello world
  39. # Broken due to dummy_https issues, disable for now
  40. #Sync API TCP post request
  41. # Check url /request post HTTP_SYNC_EOF_post hello post
  42. # Check url /content-length post HTTP_SYNC_CONTENT_post hello post
  43. *** Keywords ***
  44. Servers Setup
  45. Run Dummy Http
  46. Run Dummy Ssl
  47. Rspamd Setup
  48. Servers Teardown
  49. Dummy Http Teardown
  50. Rspamd Teardown
  51. Teardown Dummy Ssl
  52. Run Dummy Ssl
  53. [Arguments]
  54. ${result} = Start Process ${RSPAMD_TESTDIR}/util/dummy_ssl.py ${RSPAMD_TESTDIR}/util/server.pem
  55. Wait Until Created /tmp/dummy_ssl.pid timeout=2 second
  56. Teardown Dummy Ssl
  57. ${ssl_pid} = Get File /tmp/dummy_ssl.pid
  58. Shutdown Process With Children ${ssl_pid}
  59. Check url
  60. [Arguments] ${url} ${method} ${expect_symbol} @{expect_options}
  61. Scan File ${MESSAGE} URL=${url} Method=${method}
  62. ... Settings={symbols_enabled = [HTTP_TCP_TEST]}
  63. Expect Symbol With Exact Options ${expect_symbol} @{expect_options}