aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pathoc.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-09-07 11:38:44 +1200
committerAldo Cortesi <aldo@nullcube.com>2014-09-07 11:38:44 +1200
commitc198406b1236cc0c108c450efc06b300d2509370 (patch)
treef05309bdd3441bb1e94329e98a228e10664bcb2d /test/test_pathoc.py
parente9a838ae53a9388bc6695721cd2d446e750e64c6 (diff)
downloadmitmproxy-c198406b1236cc0c108c450efc06b300d2509370.tar.gz
mitmproxy-c198406b1236cc0c108c450efc06b300d2509370.tar.bz2
mitmproxy-c198406b1236cc0c108c450efc06b300d2509370.zip
Silence insecure requets warnings in our test package
Diffstat (limited to 'test/test_pathoc.py')
-rw-r--r--test/test_pathoc.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/test/test_pathoc.py b/test/test_pathoc.py
index 3eeec9f6..fe7adc4d 100644
--- a/test/test_pathoc.py
+++ b/test/test_pathoc.py
@@ -1,7 +1,9 @@
-import json, cStringIO
+import json
+import cStringIO
from libpathod import pathoc, test, version, pathod
import tutils
+
def test_response():
r = pathoc.Response("1.1", 200, "Message", {}, None, None)
assert repr(r)
@@ -9,6 +11,7 @@ def test_response():
class _TestDaemon:
ssloptions = pathod.SSLOptions()
+
@classmethod
def setUpAll(self):
self.d = test.Daemon(
@@ -34,8 +37,8 @@ class _TestDaemon:
r = c.request("get:/api/info")
assert tuple(json.loads(r.content)["version"]) == version.IVERSION
- def tval(self, requests, showreq=False, showresp=False, explain=False,
- showssl=False, hexdump=False, timeout=None, ignorecodes=None,
+ def tval(self, requests, showreq=False, showresp=False, explain=False,
+ showssl=False, hexdump=False, timeout=None, ignorecodes=None,
ignoretimeout=None):
c = pathoc.Pathoc(("127.0.0.1", self.d.port), ssl=self.ssl)
c.connect()
@@ -60,6 +63,7 @@ class _TestDaemon:
class TestDaemonSSL(_TestDaemon):
ssl = True
ssloptions = pathod.SSLOptions(request_client_cert=True)
+
def test_sni(self):
c = pathoc.Pathoc(
("127.0.0.1", self.d.port),
@@ -73,7 +77,7 @@ class TestDaemonSSL(_TestDaemon):
assert d["log"][0]["request"]["sni"] == "foobar.com"
def test_showssl(self):
- assert "certificate chain" in self.tval(["get:/p/200"], showssl=True)
+ assert "certificate chain" in self.tval(["get:/p/200"], showssl=True)
def test_clientcert(self):
c = pathoc.Pathoc(
@@ -90,12 +94,13 @@ class TestDaemonSSL(_TestDaemon):
class TestDaemon(_TestDaemon):
ssl = False
+
def test_ssl_error(self):
c = pathoc.Pathoc(("127.0.0.1", self.d.port), ssl = True)
tutils.raises("ssl handshake", c.connect)
def test_showssl(self):
- assert not "certificate chain" in self.tval(["get:/p/200"], showssl=True)
+ assert not "certificate chain" in self.tval(["get:/p/200"], showssl=True)
def test_ignorecodes(self):
assert "200" in self.tval(["get:'/p/200:b@1'"])
@@ -109,7 +114,7 @@ class TestDaemon(_TestDaemon):
assert not "HTTP" in self.tval(["get:'/p/200:p5,10'"], showresp=True, timeout=0.01, ignoretimeout=True)
def test_showresp(self):
- reqs = [ "get:/api/info:p0,0", "get:/api/info:p0,0" ]
+ reqs = ["get:/api/info:p0,0", "get:/api/info:p0,0"]
assert self.tval(reqs).count("200") == 2
assert self.tval(reqs, showresp=True).count("unprintables escaped") == 2
assert self.tval(reqs, showresp=True, hexdump=True).count("hex dump") == 2