aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-30 10:52:57 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-30 10:52:57 +1300
commitd1f14961ed8995e5857b7918ab90f3d066dedce0 (patch)
tree912935d87e938a36fda30cb919a4e63593240f7d /test
parentb4904d33bafc5a1b95946d14514c7799c7c85991 (diff)
downloadmitmproxy-d1f14961ed8995e5857b7918ab90f3d066dedce0.tar.gz
mitmproxy-d1f14961ed8995e5857b7918ab90f3d066dedce0.tar.bz2
mitmproxy-d1f14961ed8995e5857b7918ab90f3d066dedce0.zip
test.taddon: Add cycle() method, use it to test addons.intercept
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_intercept.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_intercept.py b/test/mitmproxy/addons/test_intercept.py
index 19828a62..f389ff8e 100644
--- a/test/mitmproxy/addons/test_intercept.py
+++ b/test/mitmproxy/addons/test_intercept.py
@@ -3,6 +3,7 @@ from mitmproxy import options
from mitmproxy import exceptions
from mitmproxy.test import taddons
from mitmproxy.test import tutils
+from mitmproxy.test import tflow
class Options(options.Options):
@@ -23,3 +24,13 @@ def test_simple():
r,
intercept="~~"
)
+
+ tctx.configure(r, intercept="~s")
+
+ f = tflow.tflow(resp=True)
+ tctx.cycle(r, f)
+ assert f.intercepted
+
+ f = tflow.tflow(resp=False)
+ tctx.cycle(r, f)
+ assert not f.intercepted