From 7caa7e7538581e21bab3f003e01b5388060683c3 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 11 Jun 2017 16:23:44 +1200 Subject: console: auto-generate context key binding help --- test/mitmproxy/tools/console/test_help.py | 11 --------- test/mitmproxy/tools/console/test_keymap.py | 37 ++++++++++++++++------------- 2 files changed, 20 insertions(+), 28 deletions(-) delete mode 100644 test/mitmproxy/tools/console/test_help.py (limited to 'test') 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 -- cgit v1.2.3