aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2018-02-24 17:19:42 +1300
committerAldo Cortesi <aldo@nullcube.com>2018-02-24 18:33:15 +1300
commitf49aae312fb0df3c4dd484c6790c8a558fe540e8 (patch)
treefd9ea9513b09ed8c62eedc47e380ba051af0fd58 /test
parent93c49c47ae42a89c3c6b30988ea553df4ff19ab4 (diff)
downloadmitmproxy-f49aae312fb0df3c4dd484c6790c8a558fe540e8.tar.gz
mitmproxy-f49aae312fb0df3c4dd484c6790c8a558fe540e8.tar.bz2
mitmproxy-f49aae312fb0df3c4dd484c6790c8a558fe540e8.zip
Move intercept options to addon
As part of this, we zap an un-needed console command and use a boolean toggle setter instead. Also remove an ancient regression test that breaks encapsulation.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_intercept.py2
-rw-r--r--test/mitmproxy/tools/console/test_master.py15
2 files changed, 1 insertions, 16 deletions
diff --git a/test/mitmproxy/addons/test_intercept.py b/test/mitmproxy/addons/test_intercept.py
index d9598101..b3d24626 100644
--- a/test/mitmproxy/addons/test_intercept.py
+++ b/test/mitmproxy/addons/test_intercept.py
@@ -8,7 +8,7 @@ from mitmproxy.test import tflow
def test_simple():
r = intercept.Intercept()
- with taddons.context() as tctx:
+ with taddons.context(r) as tctx:
assert not r.filt
tctx.configure(r, intercept="~q")
assert r.filt
diff --git a/test/mitmproxy/tools/console/test_master.py b/test/mitmproxy/tools/console/test_master.py
index 6ea61991..5be035e8 100644
--- a/test/mitmproxy/tools/console/test_master.py
+++ b/test/mitmproxy/tools/console/test_master.py
@@ -1,8 +1,6 @@
import urwid
from mitmproxy import options
-from mitmproxy.test import tflow
-from mitmproxy.test import tutils
from mitmproxy.tools import console
from ... import tservers
@@ -24,16 +22,3 @@ class TestMaster(tservers.MasterTest):
except urwid.ExitMainLoop:
pass
assert len(m.view) == i
-
- def test_intercept(self):
- """regression test for https://github.com/mitmproxy/mitmproxy/issues/1605"""
- m = self.mkmaster(intercept="~b bar")
- f = tflow.tflow(req=tutils.treq(content=b"foo"))
- m.addons.handle_lifecycle("request", f)
- assert not m.view[0].intercepted
- f = tflow.tflow(req=tutils.treq(content=b"bar"))
- m.addons.handle_lifecycle("request", f)
- assert m.view[1].intercepted
- f = tflow.tflow(resp=tutils.tresp(content=b"bar"))
- m.addons.handle_lifecycle("request", f)
- assert m.view[2].intercepted