diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-04-28 10:41:44 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-04-28 10:41:44 +1200 |
commit | 8a07059cf43104636f8f6c6f52854da66a9b9ea8 (patch) | |
tree | 0b968a9e6f9be45604e94d0939c519bf6866552a /test | |
parent | be1b76b975ea6f9510a44cc3314414043c9364c6 (diff) | |
download | mitmproxy-8a07059cf43104636f8f6c6f52854da66a9b9ea8.tar.gz mitmproxy-8a07059cf43104636f8f6c6f52854da66a9b9ea8.tar.bz2 mitmproxy-8a07059cf43104636f8f6c6f52854da66a9b9ea8.zip |
commands: add the core command addon, and the command "set"
The set command sets an option using the same syntax as commandline --set.
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_core.py | 15 |
1 files changed, 15 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..99bf3f40 --- /dev/null +++ b/test/mitmproxy/addons/test_core.py @@ -0,0 +1,15 @@ +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: + 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") |