diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-09-26 01:23:59 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-09-26 01:23:59 +0200 |
commit | b13acd7956f2e09bf5f9001f8f55d018a381f6c2 (patch) | |
tree | 0cb1a99bcd453c435886a0bfd516520e1cd13612 /test | |
parent | a978c6b9cee134d01f84216f3fbcf1ae9303d965 (diff) | |
download | mitmproxy-b13acd7956f2e09bf5f9001f8f55d018a381f6c2.tar.gz mitmproxy-b13acd7956f2e09bf5f9001f8f55d018a381f6c2.tar.bz2 mitmproxy-b13acd7956f2e09bf5f9001f8f55d018a381f6c2.zip |
adjust to netlib request changes + docs
Diffstat (limited to 'test')
-rw-r--r-- | test/test_dump.py | 2 | ||||
-rw-r--r-- | test/test_flow.py | 10 | ||||
-rw-r--r-- | test/test_server.py | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/test/test_dump.py b/test/test_dump.py index 56d3edd2..9586a304 100644 --- a/test/test_dump.py +++ b/test/test_dump.py @@ -62,7 +62,7 @@ def test_contentview(get_content_view): class TestDumpMaster: def _cycle(self, m, content): - f = tutils.tflow(req=netlib.tutils.treq(body=content)) + f = tutils.tflow(req=netlib.tutils.treq(content=content)) l = Log("connect") l.reply = mock.MagicMock() m.handle_log(l) diff --git a/test/test_flow.py b/test/test_flow.py index b54b7508..0cd45576 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -338,7 +338,7 @@ class TestServerPlaybackState: assert s._hash(r) == s._hash(r2) -class TestFlow: +class TestFlow(object): def test_copy(self): f = tutils.tflow(resp=True) a0 = f.get_state() @@ -1017,10 +1017,10 @@ class TestRequest: r.port = 22 assert r.url == "https://address:22/path" - assert r.pretty_url(True) == "https://address:22/path" + assert r.pretty_url == "https://address:22/path" r.headers["Host"] = "foo.com" - assert r.pretty_url(False) == "https://address:22/path" - assert r.pretty_url(True) == "https://foo.com:22/path" + assert r.url == "https://address:22/path" + assert r.pretty_url == "https://foo.com:22/path" def test_path_components(self): r = HTTPRequest.wrap(netlib.tutils.treq()) @@ -1043,7 +1043,7 @@ class TestRequest: def test_getset_form_urlencoded(self): d = odict.ODict([("one", "two"), ("three", "four")]) - r = HTTPRequest.wrap(netlib.tutils.treq(body=netlib.utils.urlencode(d.lst))) + r = HTTPRequest.wrap(netlib.tutils.treq(content=netlib.utils.urlencode(d.lst))) r.headers["content-type"] = HDR_FORM_URLENCODED assert r.get_form_urlencoded() == d diff --git a/test/test_server.py b/test/test_server.py index 5f644c96..2a09d2e5 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -235,7 +235,8 @@ class TestHTTP(tservers.HTTPProxTest, CommonMixin, AppMixin): # There's a race here, which means we can get any of a number of errors. # Rather than introduce yet another sleep into the test suite, we just # relax the Exception specification. - tutils.raises(Exception, p.request, "get:'%s'" % response) + with raises(Exception): + p.request("get:'%s'" % response) def test_reconnect(self): req = "get:'%s/p/200:b@1:da'" % self.server.urlbase @@ -573,7 +574,6 @@ class TestProxy(tservers.HTTPProxTest): recvd += len(connection.recv(5000)) connection.close() - print(self.master.state.view._list) first_flow = self.master.state.view[0] second_flow = self.master.state.view[1] assert first_flow.server_conn.timestamp_tcp_setup |