aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Weidner <matt.weidner@gmail.com>2017-07-21 13:34:58 -0500
committerMatt Weidner <matt.weidner@gmail.com>2017-07-27 21:11:37 -0500
commitf8c5fb3d15e555f2c2b9b2bd934cb25f9dfb85a4 (patch)
tree9b166e870d79b6c49e048755f91c3468088b4397
parente754fe78cd34a380d013520ee915dc17cc3d6e0f (diff)
downloadmitmproxy-f8c5fb3d15e555f2c2b9b2bd934cb25f9dfb85a4.tar.gz
mitmproxy-f8c5fb3d15e555f2c2b9b2bd934cb25f9dfb85a4.tar.bz2
mitmproxy-f8c5fb3d15e555f2c2b9b2bd934cb25f9dfb85a4.zip
Extended intercept tests to include toggle feature
-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