diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-30 16:51:55 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-08-30 16:51:55 +0100 |
commit | b4d4cff66970d51f4f82a37e03de2db07291742e (patch) | |
tree | d425b58e1f22a7c54a21016ba1d33ed37cd9ef5a /test/functional/cases | |
parent | a78803aeb558c0ebb9ada2a0f71f960ac31f373d (diff) | |
download | rspamd-b4d4cff66970d51f4f82a37e03de2db07291742e.tar.gz rspamd-b4d4cff66970d51f4f82a37e03de2db07291742e.zip |
[Test] Test for TCP library
Diffstat (limited to 'test/functional/cases')
-rw-r--r-- | test/functional/cases/220_http.robot | 3 | ||||
-rw-r--r-- | test/functional/cases/230_tcp.robot | 63 |
2 files changed, 64 insertions, 2 deletions
diff --git a/test/functional/cases/220_http.robot b/test/functional/cases/220_http.robot index a8f47faa8..b1ac67bd9 100644 --- a/test/functional/cases/220_http.robot +++ b/test/functional/cases/220_http.robot @@ -11,8 +11,7 @@ Variables ${TESTDIR}/lib/vars.py ${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat ${CONFIG} ${TESTDIR}/configs/lua_test.conf ${MESSAGE} ${TESTDIR}/messages/spam_message.eml -${REDIS_SCOPE} Suite -${RSPAMD_SCOPE} Suite +${RSPAMD_SCOPE} Test *** Test Cases *** Simple HTTP request diff --git a/test/functional/cases/230_tcp.robot b/test/functional/cases/230_tcp.robot new file mode 100644 index 000000000..4d8b2fbd6 --- /dev/null +++ b/test/functional/cases/230_tcp.robot @@ -0,0 +1,63 @@ +*** Settings *** +Test Setup Http Setup +Test Teardown Http Teardown +Library Process +Library ${TESTDIR}/lib/rspamd.py +Resource ${TESTDIR}/lib/rspamd.robot +Variables ${TESTDIR}/lib/vars.py + +*** Variables *** +# ${CONFIG} ${TESTDIR}/configs/http.conf +${URL_TLD} ${TESTDIR}/../lua/unit/test_tld.dat +${CONFIG} ${TESTDIR}/configs/lua_test.conf +${MESSAGE} ${TESTDIR}/messages/spam_message.eml +${RSPAMD_SCOPE} Test + +*** Test Cases *** +Simple TCP request + ${result} = Scan Message With Rspamc ${MESSAGE} + Check Rspamc ${result} HTTP_ASYNC_RESPONSE + Check Rspamc ${result} HTTP_ASYNC_RESPONSE_2 + + +Sync API TCP request + ${result} = Scan Message With Rspamc ${MESSAGE} + Check Rspamc ${result} HTTP_SYNC_RESPONSE + Check Rspamc ${result} HTTP_SYNC_RESPONSE_2 + Check Rspamc ${result} hello world + Check Rspamc ${result} hello post + +Sync API TCP get request + Check url /request get HTTP_SYNC_EOF_get (0.00)[hello world] + Check url /content-length get HTTP_SYNC_CONTENT_get (0.00)[hello world] + +Sync API TCP post request + Check url /request post HTTP_SYNC_EOF_post (0.00)[hello post] + Check url /content-length post HTTP_SYNC_CONTENT_post (0.00)[hello post] + +*** Keywords *** +Lua Setup + [Arguments] ${LUA_SCRIPT} + Set Global Variable ${LUA_SCRIPT} + Generic Setup + +Http Setup + Run Dummy Http + Lua Setup ${TESTDIR}/lua/tcp.lua + +Http Teardown + ${http_pid} = Get File /tmp/dummy_http.pid + Shutdown Process With Children ${http_pid} + Normal Teardown + +Run Dummy Http + [Arguments] + ${result} = Start Process ${TESTDIR}/util/dummy_http.py + Wait Until Created /tmp/dummy_http.pid + + +Check url + [Arguments] ${url} ${method} @{expect_results} + ${result} = Scan Message With Rspamc --header=url:${url} --header=method:${method} ${MESSAGE} + : FOR ${expect} IN @{expect_results} + \ Check Rspamc ${result} ${expect} |