aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-07-29 19:48:42 +0200
committerGitHub <noreply@github.com>2017-07-29 19:48:42 +0200
commit9ffd42edeacb19c3961840289bb25eaeca5991a5 (patch)
treefff2b2b5de61fd13f61e6790038a908b4febdd48 /test
parente79f4049aad287a28860e6e4722bfb4cc06b52d4 (diff)
parentf8c5fb3d15e555f2c2b9b2bd934cb25f9dfb85a4 (diff)
downloadmitmproxy-9ffd42edeacb19c3961840289bb25eaeca5991a5.tar.gz
mitmproxy-9ffd42edeacb19c3961840289bb25eaeca5991a5.tar.bz2
mitmproxy-9ffd42edeacb19c3961840289bb25eaeca5991a5.zip
Merge pull request #2452 from mattweidner/add_intercept_toggle
Add intercept toggle feature.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_intercept.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_intercept.py b/test/mitmproxy/addons/test_intercept.py
index f436a817..d4999eb5 100644
--- a/test/mitmproxy/addons/test_intercept.py
+++ b/test/mitmproxy/addons/test_intercept.py
@@ -13,10 +13,12 @@ def test_simple():
assert not r.filt
tctx.configure(r, intercept="~q")
assert r.filt
+ assert tctx.options.intercept_active
with pytest.raises(exceptions.OptionsError):
tctx.configure(r, intercept="~~")
tctx.configure(r, intercept=None)
assert not r.filt
+ assert not tctx.options.intercept_active
tctx.configure(r, intercept="~s")
@@ -31,3 +33,13 @@ def test_simple():
f = tflow.tflow(resp=True)
r.response(f)
assert f.intercepted
+
+ tctx.configure(r, intercept_active=False)
+ f = tflow.tflow(resp=True)
+ tctx.cycle(r, f)
+ assert not f.intercepted
+
+ tctx.configure(r, intercept_active=True)
+ f = tflow.tflow(resp=True)
+ tctx.cycle(r, f)
+ assert f.intercepted