aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-10-14 02:00:36 -0700
committerGitHub <noreply@github.com>2016-10-14 02:00:36 -0700
commitd5873302c1c91dfb373f7048ad61617434bba297 (patch)
treec2274bfa401f4a9649a12859499dbb8f0702fabd /test
parent61a1b96ca4bfa63ddbef65913ccd50b4327f90a6 (diff)
parente9284ab7eef2ed37565860acd301b717bfcb6018 (diff)
downloadmitmproxy-d5873302c1c91dfb373f7048ad61617434bba297.tar.gz
mitmproxy-d5873302c1c91dfb373f7048ad61617434bba297.tar.bz2
mitmproxy-d5873302c1c91dfb373f7048ad61617434bba297.zip
Merge pull request #1610 from mhils/issue-1605
Fix #1605
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/console/test_master.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/mitmproxy/console/test_master.py b/test/mitmproxy/console/test_master.py
index 8388a6bd..e57846ae 100644
--- a/test/mitmproxy/console/test_master.py
+++ b/test/mitmproxy/console/test_master.py
@@ -122,3 +122,16 @@ class TestMaster(mastertest.MasterTest):
for i in (1, 2, 3):
self.dummy_cycle(m, 1, b"")
assert len(m.state.flows) == i
+
+ def test_intercept(self):
+ """regression test for https://github.com/mitmproxy/mitmproxy/issues/1605"""
+ m = self.mkmaster(intercept="~b bar")
+ f = tutils.tflow(req=netlib.tutils.treq(content=b"foo"))
+ m.request(f)
+ assert not m.state.flows[0].intercepted
+ f = tutils.tflow(req=netlib.tutils.treq(content=b"bar"))
+ m.request(f)
+ assert m.state.flows[1].intercepted
+ f = tutils.tflow(resp=netlib.tutils.tresp(content=b"bar"))
+ m.request(f)
+ assert m.state.flows[2].intercepted