diff options
author | Maximilian Hils <git@maximilianhils.com> | 2015-08-29 20:53:25 +0200 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2015-08-29 20:53:25 +0200 |
commit | a7058e2a3c59cc2b13aaea3d7c767a3ca4a4bc40 (patch) | |
tree | cfdfef8dd58f014adc77a81838bbef1c87011621 /test/test_server.py | |
parent | 63844df34367bf7147c2d43a9e4061515f6430c9 (diff) | |
download | mitmproxy-a7058e2a3c59cc2b13aaea3d7c767a3ca4a4bc40.tar.gz mitmproxy-a7058e2a3c59cc2b13aaea3d7c767a3ca4a4bc40.tar.bz2 mitmproxy-a7058e2a3c59cc2b13aaea3d7c767a3ca4a4bc40.zip |
fix bugs, fix tests
Diffstat (limited to 'test/test_server.py')
-rw-r--r-- | test/test_server.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/test_server.py b/test/test_server.py index 1216a349..7b66c582 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -68,7 +68,7 @@ class CommonMixin: # SSL with the upstream proxy. rt = self.master.replay_request(l, block=True) assert not rt - if isinstance(self, tservers.HTTPUpstreamProxTest) and not self.ssl: + if isinstance(self, tservers.HTTPUpstreamProxTest): assert l.response.code == 502 else: assert l.error @@ -506,7 +506,7 @@ class TestTransparentSSL(tservers.TransparentProxTest, CommonMixin, TcpMixin): p = pathoc.Pathoc(("localhost", self.proxy.port), fp=None) p.connect() r = p.request("get:/") - assert r.status_code == 400 + assert r.status_code == 502 class TestProxy(tservers.HTTPProxTest): @@ -724,9 +724,9 @@ class TestStreamRequest(tservers.HTTPProxTest): assert resp.headers["Transfer-Encoding"][0] == 'chunked' assert resp.status_code == 200 - chunks = list( - content for _, content, _ in protocol.read_http_body_chunked( - resp.headers, None, "GET", 200, False)) + chunks = list(protocol.read_http_body_chunked( + resp.headers, None, "GET", 200, False + )) assert chunks == ["this", "isatest", ""] connection.close() @@ -959,6 +959,9 @@ class TestProxyChainingSSLReconnect(tservers.HTTPUpstreamProxTest): p = self.pathoc() req = p.request("get:'/p/418:b\"content\"'") + assert req.content == "content" + assert req.status_code == 418 + assert self.proxy.tmaster.state.flow_count() == 2 # CONNECT and request # CONNECT, failing request, assert self.chain[0].tmaster.state.flow_count() == 4 @@ -967,8 +970,7 @@ class TestProxyChainingSSLReconnect(tservers.HTTPUpstreamProxTest): assert self.chain[1].tmaster.state.flow_count() == 2 # (doesn't store (repeated) CONNECTs from chain[0] # as it is a regular proxy) - assert req.content == "content" - assert req.status_code == 418 + assert not self.chain[1].tmaster.state.flows[0].response # killed assert self.chain[1].tmaster.state.flows[1].response |