diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/mitmproxy/test_command.py | 8 |
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" |
