aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-28 12:10:02 +1200
committerGitHub <noreply@github.com>2017-04-28 12:10:02 +1200
commitcbb35cee51a6fa89d248cd8808af6e03f3dbfe2a (patch)
tree9dde488216525ac70d63d6729a8fd712381ebe13 /test
parent29b3e787cab7e9bf9ca74453c894fc47882cc32d (diff)
parentce01cb9c097614c12113df15e1f35839c1926e4d (diff)
downloadmitmproxy-cbb35cee51a6fa89d248cd8808af6e03f3dbfe2a.tar.gz
mitmproxy-cbb35cee51a6fa89d248cd8808af6e03f3dbfe2a.tar.bz2
mitmproxy-cbb35cee51a6fa89d248cd8808af6e03f3dbfe2a.zip
Merge pull request #2280 from cortesi/coreset
commands: add the core command addon, and the command "set"
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_core.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_core.py b/test/mitmproxy/addons/test_core.py
new file mode 100644
index 00000000..6ebf4ba9
--- /dev/null
+++ b/test/mitmproxy/addons/test_core.py
@@ -0,0 +1,17 @@
+from mitmproxy.addons import core
+from mitmproxy.test import taddons
+from mitmproxy import exceptions
+import pytest
+
+
+def test_set():
+ sa = core.Core()
+ with taddons.context() as tctx:
+ tctx.master.addons.add(sa)
+
+ assert not tctx.master.options.anticomp
+ tctx.command(sa.set, "anticomp")
+ assert tctx.master.options.anticomp
+
+ with pytest.raises(exceptions.CommandError):
+ tctx.command(sa.set, "nonexistent")