aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/cases/001_merged/220_http.robot
blob: a6bf5ff650eb2eba30793a80f4ce4358bb5d7747 (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
*** Settings ***
Test Setup      Http Setup
Test Teardown   Http Teardown
Library         Process
Library         ${RSPAMD_TESTDIR}/lib/rspamd.py
Resource        ${RSPAMD_TESTDIR}/lib/rspamd.robot
Variables       ${RSPAMD_TESTDIR}/lib/vars.py

*** Variables ***
${MESSAGE}      ${RSPAMD_TESTDIR}/messages/spam_message.eml

*** Test Cases ***
Simple HTTP request
  Scan File  ${MESSAGE}  Url=/request  Method=get
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_DNS_200  HTTP_200  HTTP_CORO_DNS_200
  Expect Symbol With Exact Options  HTTP_CORO_200  hello world

  Scan File  ${MESSAGE}  Url=/request  Method=post
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_DNS_200  HTTP_200  HTTP_CORO_DNS_200
  Expect Symbol With Exact Options  HTTP_CORO_200  hello post

HTTP request 403
  Scan File  ${MESSAGE}  Url=/error_403  Method=get
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_DNS_403  HTTP_403  HTTP_CORO_DNS_403  method_get

  Scan File  ${MESSAGE}  Url=/error_403  Method=post
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_DNS_403  HTTP_403  HTTP_CORO_DNS_403  method_post

HTTP timeout
  Scan File  ${MESSAGE}  Url=/timeout  Method=get
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_get
  # FIXME: where is "IO timeout"

  Scan File  ${MESSAGE}  Url=/timeout  Method=post
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_post
  # FIXME: where is "IO timeout"

HTTP empty response
  Scan File  ${MESSAGE}  Url=/empty  Method=get
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_get
  # FIXME: where is "IO read error: unexpected EOF"

  Scan File  ${MESSAGE}  Url=/empty  Method=post
  ...  Settings={symbols_enabled = [SIMPLE_HTTP_TEST]}
  Expect Symbols  HTTP_ERROR  HTTP_ERROR  HTTP_CORO_DNS_ERROR  HTTP_CORO_ERROR  method_post
  # FIXME: where is "IO read error: unexpected EOF"

SSL Large HTTP request
  Scan File  ${MESSAGE}
  ...  Settings={symbols_enabled = [LARGE_HTTP_TEST]}
  Expect Symbol  HTTP_SSL_LARGE

*** Keywords ***
Http Setup
  Run Dummy Http
  Run Dummy Https

Http Teardown
  ${http_pid} =  Get File  /tmp/dummy_http.pid
  Shutdown Process With Children  ${http_pid}
  ${https_pid} =  Get File  /tmp/dummy_https.pid
  Shutdown Process With Children  ${https_pid}

Run Dummy Http
  ${result} =  Start Process  ${RSPAMD_TESTDIR}/util/dummy_http.py
  Wait Until Created  /tmp/dummy_http.pid

Run Dummy Https
  ${result} =  Start Process  ${RSPAMD_TESTDIR}/util/dummy_https.py  ${RSPAMD_TESTDIR}/util/server.pem
  Wait Until Created  /tmp/dummy_https.pid