aboutsummaryrefslogtreecommitdiffstats
path: root/test/functional/util
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-08-23 13:49:59 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-08-23 13:49:59 +0100
commita4b08ac566aa631f4421114e4131b0098139a009 (patch)
tree22808253a54d5272910764b7ca72441ba62839c3 /test/functional/util
parent8c98b1f31b80702c5634f634a59a9f950d57a9a0 (diff)
downloadrspamd-a4b08ac566aa631f4421114e4131b0098139a009.tar.gz
rspamd-a4b08ac566aa631f4421114e4131b0098139a009.zip
[Test] More test cases for HTTP API
Diffstat (limited to 'test/functional/util')
-rwxr-xr-xtest/functional/util/dummy_http.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/test/functional/util/dummy_http.py b/test/functional/util/dummy_http.py
index 5a04b3664..4f8e67ffd 100755
--- a/test/functional/util/dummy_http.py
+++ b/test/functional/util/dummy_http.py
@@ -21,14 +21,36 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
"""Respond to a GET request."""
- self.send_response(200)
+ if self.path == "/empty":
+ self.finish()
+ return
+
+ if self.path == "/timeout":
+ time.sleep(2)
+
+ if self.path == "/error_403":
+ self.send_response(403)
+ else:
+ self.send_response(200)
+
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write("hello world")
def do_POST(self):
"""Respond to a GET request."""
- self.send_response(200)
+ if self.path == "/empty":
+ self.finish()
+ return
+
+ if self.path == "/timeout":
+ time.sleep(2)
+
+ if self.path == "/error_403":
+ self.send_response(403)
+ else:
+ self.send_response(200)
+
self.send_header("Content-type", "text/plain")
self.end_headers()
self.wfile.write("hello post")
@@ -69,7 +91,7 @@ if __name__ == '__main__':
signal.signal(signal.SIGALRM, alarm_handler)
signal.signal(signal.SIGTERM, alarm_handler)
- signal.alarm(5)
+ signal.alarm(10)
try:
httpd.run()