diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-07-01 14:10:48 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-07-01 14:10:48 -0700 |
commit | 536c7acd13426d42dc863ae8b50e6c3a4cb2e858 (patch) | |
tree | e868530aef8353273a3107b57645fd5b02e717b0 /test | |
parent | e0ed7699ca1258414a99812720f168e14a6ca219 (diff) | |
download | mitmproxy-536c7acd13426d42dc863ae8b50e6c3a4cb2e858.tar.gz mitmproxy-536c7acd13426d42dc863ae8b50e6c3a4cb2e858.tar.bz2 mitmproxy-536c7acd13426d42dc863ae8b50e6c3a4cb2e858.zip |
py3++
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_server.py | 10 | ||||
-rw-r--r-- | test/netlib/test_strutils.py | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 5415b660..c5caa21f 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -518,7 +518,7 @@ class TestTransparent(tservers.TransparentProxyTest, CommonMixin, TcpMixin): d = self.pathod('200:b"foo"') self._tcpproxy_off() - assert d.content == "bar" + assert d.content == b"bar" self.master.unload_scripts() @@ -641,7 +641,7 @@ class MasterRedirectRequest(tservers.TestMaster): @controller.handler def response(self, f): - f.response.content = str(f.client_conn.address.port) + f.response.content = bytes(f.client_conn.address.port) f.response.headers["server-conn-id"] = str(f.server_conn.source_address.port) super(MasterRedirectRequest, self).response(f) @@ -723,7 +723,7 @@ class TestStreamRequest(tservers.HTTPProxyTest): def test_stream_chunked(self): connection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) connection.connect(("127.0.0.1", self.proxy.port)) - fconn = connection.makefile() + fconn = connection.makefile("rb") spec = '200:h"Transfer-Encoding"="chunked":r:b"4\\r\\nthis\\r\\n11\\r\\nisatest__reachhex\\r\\n0\\r\\n\\r\\n"' connection.send( b"GET %s/p/%s HTTP/1.1\r\n" % @@ -736,7 +736,7 @@ class TestStreamRequest(tservers.HTTPProxyTest): assert resp.status_code == 200 chunks = list(http1.read_body(fconn, None)) - assert chunks == ["this", "isatest__reachhex"] + assert chunks == [b"this", b"isatest__reachhex"] connection.close() @@ -848,7 +848,7 @@ class TestUpstreamProxy(tservers.HTTPUpstreamProxyTest, CommonMixin, AppMixin): p = self.pathoc() req = p.request("get:'%s/p/418:b\"foo\"'" % self.server.urlbase) - assert req.content == "ORLY" + assert req.content == b"ORLY" assert req.status_code == 418 diff --git a/test/netlib/test_strutils.py b/test/netlib/test_strutils.py index 84a0dded..a50fc40a 100644 --- a/test/netlib/test_strutils.py +++ b/test/netlib/test_strutils.py @@ -29,10 +29,6 @@ def test_clean_bin(): assert strutils.clean_bin(u"\u2605") == u"\u2605" -def test_safe_subn(): - assert strutils.safe_subn("foo", u"bar", "\xc2foo") - - def test_bytes_to_escaped_str(): assert strutils.bytes_to_escaped_str(b"foo") == "foo" assert strutils.bytes_to_escaped_str(b"\b") == r"\x08" |