aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-02-08 11:49:22 +0100
committerMaximilian Hils <git@maximilianhils.com>2017-02-09 15:24:31 +0100
commit9b97b6389127e6166fa0f1ad08951ccdb4a36290 (patch)
treeb30b96546f0e13c56577e31cdf0fdd2e85848fa3 /test
parent2316c0fb74efefd76970c685b8f77f45834f1490 (diff)
downloadmitmproxy-9b97b6389127e6166fa0f1ad08951ccdb4a36290.tar.gz
mitmproxy-9b97b6389127e6166fa0f1ad08951ccdb4a36290.tar.bz2
mitmproxy-9b97b6389127e6166fa0f1ad08951ccdb4a36290.zip
fix change_upstream_proxy_server
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_server.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py
index 6e7ca275..af121534 100644
--- a/test/mitmproxy/test_server.py
+++ b/test/mitmproxy/test_server.py
@@ -995,6 +995,29 @@ class TestUpstreamProxySSL(
assert not self.chain[1].tmaster.state.flows[0].server_conn.via
assert self.chain[1].tmaster.state.flow_count() == 1
+ def test_change_upstream_proxy_connect(self):
+ # skip chain[0].
+ self.proxy.tmaster.addons.add(
+ UpstreamProxyChanger(
+ ("127.0.0.1", self.chain[1].port)
+ )
+ )
+ p = self.pathoc()
+ with p.connect():
+ req = p.request("get:'/p/418'")
+
+ assert req.status_code == 418
+ assert self.chain[0].tmaster.state.flow_count() == 0
+ assert self.chain[1].tmaster.state.flow_count() == 1
+
+
+class UpstreamProxyChanger:
+ def __init__(self, addr):
+ self.address = addr
+
+ def request(self, f):
+ f.live.change_upstream_proxy_server(self.address)
+
class RequestKiller:
def __init__(self, exclude):