diff options
author | Jason <jason.daurus@gmail.com> | 2016-06-17 21:54:31 +0800 |
---|---|---|
committer | Jason <jason.daurus@gmail.com> | 2016-06-17 21:54:31 +0800 |
commit | e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93 (patch) | |
tree | cb5e3be10e8bb813c1ade3aa88204460317d2548 /test/pathod/test_pathod.py | |
parent | 16a28eca258e07d45c7e2a8ee95368d4eb077d4d (diff) | |
parent | 9c6199db9be34fad18eaedb86463333671ae190a (diff) | |
download | mitmproxy-e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93.tar.gz mitmproxy-e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93.tar.bz2 mitmproxy-e4addd60f1ffbb445a8c05f3fb2b6c6e61bd7b93.zip |
Merge branch 'master' into websocket
Conflicts:
mitmproxy/web/static/app.css
mitmproxy/web/static/app.js
web/src/js/components/ProxyApp.jsx
Diffstat (limited to 'test/pathod/test_pathod.py')
-rw-r--r-- | test/pathod/test_pathod.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py index ed4ef49f..0b34f924 100644 --- a/test/pathod/test_pathod.py +++ b/test/pathod/test_pathod.py @@ -3,7 +3,8 @@ from six.moves import cStringIO as StringIO from pathod import pathod from netlib import tcp from netlib.exceptions import HttpException, TlsException -import tutils + +from . import tutils class TestPathod(object): @@ -52,7 +53,7 @@ class TestNotAfterConnect(tutils.DaemonTests): class TestCustomCert(tutils.DaemonTests): ssl = True ssloptions = dict( - certs=[("*", tutils.test_data.path("data/testkey.pem"))], + certs=[(b"*", tutils.test_data.path("data/testkey.pem"))], ) def test_connect(self): @@ -66,7 +67,7 @@ class TestCustomCert(tutils.DaemonTests): class TestSSLCN(tutils.DaemonTests): ssl = True ssloptions = dict( - cn="foo.com" + cn=b"foo.com" ) def test_connect(self): @@ -100,7 +101,7 @@ class TestNocraft(tutils.DaemonTests): def test_nocraft(self): r = self.get(r"200:b'\xf0'") assert r.status_code == 800 - assert "Crafting disabled" in r.content + assert b"Crafting disabled" in r.content class CommonTests(tutils.DaemonTests): @@ -137,7 +138,7 @@ class CommonTests(tutils.DaemonTests): def test_static(self): rsp = self.get("200:b<file") assert rsp.status_code == 200 - assert rsp.content.strip() == "testfile" + assert rsp.content.strip() == b"testfile" def test_anchor(self): rsp = self.getpath("/anchor/foo") @@ -148,7 +149,7 @@ class CommonTests(tutils.DaemonTests): with c.connect(): if self.ssl: c.convert_to_ssl() - c.wfile.write("foo\n\n\n") + c.wfile.write(b"foo\n\n\n") c.wfile.flush() l = self.d.last_log() assert l["type"] == "error" @@ -177,7 +178,7 @@ class CommonTests(tutils.DaemonTests): def test_source_access_denied(self): rsp = self.get("200:b</foo") assert rsp.status_code == 800 - assert "File access denied" in rsp.content + assert b"File access denied" in rsp.content def test_proxy(self): r, _ = self.pathoc([r"get:'http://foo.com/p/202':da"]) @@ -195,7 +196,7 @@ class CommonTests(tutils.DaemonTests): ["ws:/p/", "wf:f'wf:b\"test\"':pa,1"], ws_read_limit=1 ) - assert r[1].payload == "test" + assert r[1].payload == b"test" def test_websocket_frame_reflect_error(self): r, _ = self.pathoc( @@ -239,7 +240,7 @@ class TestDaemonSSL(CommonTests): c.rbufsize = 0 c.wbufsize = 0 with c.connect(): - c.wfile.write("\0\0\0\0") + c.wfile.write(b"\0\0\0\0") tutils.raises(TlsException, c.convert_to_ssl) l = self.d.last_log() assert l["type"] == "error" |