aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2016-10-29 15:44:48 +1300
committerAldo Cortesi <aldo@nullcube.com>2016-10-29 15:44:48 +1300
commit2dc3284fbb6cc7218e47174c00ba64bf92a50cdf (patch)
treeaa1b4c5f1973bde084de763be9e0b0f4c2511d7c /test
parent71d2636594555dc48a9a25837ddd182ed3d5d564 (diff)
downloadmitmproxy-2dc3284fbb6cc7218e47174c00ba64bf92a50cdf.tar.gz
mitmproxy-2dc3284fbb6cc7218e47174c00ba64bf92a50cdf.tar.bz2
mitmproxy-2dc3284fbb6cc7218e47174c00ba64bf92a50cdf.zip
Add addons.intercept
- Add an addon to handle intercept based on a filter pattern - Start sketching out a nicer testing truss for addons in mitmproxy.test.taddon
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_intercept.py25
-rw-r--r--test/mitmproxy/mastertest.py4
2 files changed, 25 insertions, 4 deletions
diff --git a/test/mitmproxy/addons/test_intercept.py b/test/mitmproxy/addons/test_intercept.py
index e69de29b..19828a62 100644
--- a/test/mitmproxy/addons/test_intercept.py
+++ b/test/mitmproxy/addons/test_intercept.py
@@ -0,0 +1,25 @@
+from mitmproxy.addons import intercept
+from mitmproxy import options
+from mitmproxy import exceptions
+from mitmproxy.test import taddons
+from mitmproxy.test import tutils
+
+
+class Options(options.Options):
+ def __init__(self, *, intercept=None, **kwargs):
+ self.intercept = intercept
+ super().__init__(**kwargs)
+
+
+def test_simple():
+ r = intercept.Intercept()
+ with taddons.context(options=Options()) as tctx:
+ assert not r.filt
+ tctx.configure(r, intercept="~q")
+ assert r.filt
+ tutils.raises(
+ exceptions.OptionsError,
+ tctx.configure,
+ r,
+ intercept="~~"
+ )
diff --git a/test/mitmproxy/mastertest.py b/test/mitmproxy/mastertest.py
index cdfb5ad5..0672add9 100644
--- a/test/mitmproxy/mastertest.py
+++ b/test/mitmproxy/mastertest.py
@@ -10,10 +10,6 @@ from mitmproxy import http
from mitmproxy import options
-class TestMaster:
- pass
-
-
class MasterTest:
def cycle(self, master, content):