aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/test_server.py b/test/test_server.py
index ee6873c7..3686a6a8 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,6 +1,7 @@
+import socket, time
from netlib import tcp
-from time import sleep
-import tutils, socket
+from libpathod import pathoc
+import tutils
"""
Note that the choice of response code in these tests matters more than you
@@ -53,6 +54,20 @@ class TestHTTP(tutils.HTTPProxTest, SanityMixin):
t.wfile.flush()
assert "Bad Request" in t.rfile.readline()
+ def test_upstream_ssl_error(self):
+ p = self.pathoc()
+ ret = p.request("get:'https://localhost:%s/'"%self.server.port)
+ assert ret[1] == 400
+
+ def test_http(self):
+ f = self.pathod("304")
+ assert f.status_code == 304
+
+ l = self.master.state.view[0]
+ assert l.request.client_conn.address
+ assert "host" in l.request.headers
+ assert l.response.code == 304
+
class TestHTTPS(tutils.HTTPProxTest, SanityMixin):
ssl = True
@@ -93,7 +108,7 @@ class TestProxy(tutils.HTTPProxTest):
# call pathod server, wait a second to complete the request
connection.send("GET http://localhost:%d/p/304:b@1k HTTP/1.1\r\n"%self.server.port)
- sleep(2.1)
+ time.sleep(2.1)
connection.send("\r\n");
connection.recv(50000)
connection.close()
@@ -107,7 +122,7 @@ class TestProxy(tutils.HTTPProxTest):
f = self.pathod("304:b@10k")
assert f.status_code == 304
- sleep(1)
+ time.sleep(1)
f = self.pathod("304:b@10k")
assert f.status_code == 304