diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2017-06-11 16:23:44 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-06-11 17:09:52 +1200 |
commit | 7caa7e7538581e21bab3f003e01b5388060683c3 (patch) | |
tree | e0f02ac8d2701b7809de89de2f78cb413c480280 /test | |
parent | fd68eca35112ad672f008fe9e4a6e687469af425 (diff) | |
download | mitmproxy-7caa7e7538581e21bab3f003e01b5388060683c3.tar.gz mitmproxy-7caa7e7538581e21bab3f003e01b5388060683c3.tar.bz2 mitmproxy-7caa7e7538581e21bab3f003e01b5388060683c3.zip |
console: auto-generate context key binding help
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/tools/console/test_help.py | 11 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_keymap.py | 37 |
2 files changed, 20 insertions, 28 deletions
diff --git a/test/mitmproxy/tools/console/test_help.py b/test/mitmproxy/tools/console/test_help.py deleted file mode 100644 index 0ebc2d6a..00000000 --- a/test/mitmproxy/tools/console/test_help.py +++ /dev/null @@ -1,11 +0,0 @@ -import mitmproxy.tools.console.help as help - -from ....conftest import skip_appveyor - - -@skip_appveyor -class TestHelp: - - def test_helptext(self): - h = help.HelpView(None) - assert h.helptext() diff --git a/test/mitmproxy/tools/console/test_keymap.py b/test/mitmproxy/tools/console/test_keymap.py index 6a75800e..bbca4ac9 100644 --- a/test/mitmproxy/tools/console/test_keymap.py +++ b/test/mitmproxy/tools/console/test_keymap.py @@ -5,25 +5,28 @@ import pytest def test_bind(): - with taddons.context() as tctx: - km = keymap.Keymap(tctx.master) - km.executor = mock.Mock() + with taddons.context() as tctx: + km = keymap.Keymap(tctx.master) + km.executor = mock.Mock() - with pytest.raises(ValueError): - km.add("foo", "bar", ["unsupported"]) + with pytest.raises(ValueError): + km.add("foo", "bar", ["unsupported"]) - km.add("key", "str", ["options", "commands"]) - assert km.get("options", "key") - assert km.get("commands", "key") - assert not km.get("flowlist", "key") + km.add("key", "str", ["options", "commands"]) + assert km.get("options", "key") + assert km.get("commands", "key") + assert not km.get("flowlist", "key") + assert len((km.list("commands"))) == 1 - km.handle("unknown", "unknown") - assert not km.executor.called + km.handle("unknown", "unknown") + assert not km.executor.called - km.handle("options", "key") - assert km.executor.called + km.handle("options", "key") + assert km.executor.called - km.add("glob", "str", ["global"]) - km.executor = mock.Mock() - km.handle("options", "glob") - assert km.executor.called + km.add("glob", "str", ["global"]) + km.executor = mock.Mock() + km.handle("options", "glob") + assert km.executor.called + + assert len((km.list("global"))) == 1 |