blob: b5801dba066233c2d7b968c89fe469a0a260d392 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
*** Settings ***
Suite Setup Servers Setup
Suite Teardown Servers 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} Suite
*** Test Cases ***
Simple TCP request
${result} = Scan Message With Rspamc ${MESSAGE}
Check Rspamc ${result} HTTP_ASYNC_RESPONSE
Check Rspamc ${result} HTTP_ASYNC_RESPONSE_2
SSL TCP request
${result} = Scan Message With Rspamc ${MESSAGE}
Check Rspamc ${result} TCP_SSL_RESPONSE (0.00)[hello]
Check Rspamc ${result} TCP_SSL_RESPONSE_2 (0.00)[hello]
SSL Large TCP request
${result} = Scan Message With Rspamc ${MESSAGE}
Check Rspamc ${result} TCP_SSL_LARGE (0.00)
Check Rspamc ${result} TCP_SSL_LARGE_2 (0.00)
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
Servers Setup
Run Dummy Http
Run Dummy Ssl
Lua Setup ${TESTDIR}/lua/tcp.lua
Servers Teardown
${http_pid} = Get File /tmp/dummy_http.pid
Shutdown Process With Children ${http_pid}
${ssl_pid} = Get File /tmp/dummy_ssl.pid
Shutdown Process With Children ${ssl_pid}
Normal Teardown
Run Dummy Http
[Arguments]
${result} = Start Process ${TESTDIR}/util/dummy_http.py
Wait Until Created /tmp/dummy_http.pid timeout=2 second
Run Dummy Ssl
[Arguments]
${result} = Start Process ${TESTDIR}/util/dummy_ssl.py ${TESTDIR}/util/server.pem
Wait Until Created /tmp/dummy_ssl.pid timeout=2 second
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}
|