aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-28 10:43:05 +1200
committerGitHub <noreply@github.com>2017-04-28 10:43:05 +1200
commit29b3e787cab7e9bf9ca74453c894fc47882cc32d (patch)
treea752241775002f161a345a4fab36d6a0b2b5fb37 /test
parentb73b06b3643555d9ef559574b60b405550b42bbb (diff)
parentbe1b76b975ea6f9510a44cc3314414043c9364c6 (diff)
downloadmitmproxy-29b3e787cab7e9bf9ca74453c894fc47882cc32d.tar.gz
mitmproxy-29b3e787cab7e9bf9ca74453c894fc47882cc32d.tar.bz2
mitmproxy-29b3e787cab7e9bf9ca74453c894fc47882cc32d.zip
Merge pull request #2279 from cortesi/keymap
console: keymap
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_command.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index 92d8c77b..0c272a2c 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -12,11 +12,15 @@ import pytest
class TAddon:
def cmd1(self, foo: str) -> str:
+ """cmd1 help"""
return "ret " + foo
def cmd2(self, foo: str) -> str:
return 99
+ def empty(self) -> None:
+ pass
+
class TestCommand:
def test_call(self):
@@ -40,6 +44,7 @@ def test_simple():
c = command.CommandManager(m)
a = TAddon()
c.add("one.two", a.cmd1)
+ assert c.commands["one.two"].help == "cmd1 help"
assert(c.call("one.two foo") == "ret foo")
with pytest.raises(exceptions.CommandError, match="Unknown"):
c.call("nonexistent")
@@ -48,6 +53,9 @@ def test_simple():
with pytest.raises(exceptions.CommandError, match="Usage"):
c.call("one.two too many args")
+ c.add("empty", a.empty)
+ c.call("empty")
+
def test_typename():
assert command.typename(str, True) == "str"