diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_command.py | 14 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_commander.py | 18 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_defaultkeys.py | 3 |
3 files changed, 25 insertions, 10 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index ae4c400c..f5a641a8 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -92,8 +92,6 @@ class TestCommand: c = command.Command(cm, "varargs", a.varargs) assert c.signature_help() == "varargs str *str -> [str]" assert c.call(["one", "two", "three"]) == ["two", "three"] - with pytest.raises(exceptions.CommandError): - c.call(["one", "two", 3]) def test_call(self): with taddons.context() as tctx: @@ -333,18 +331,20 @@ class TestCommand: [], ], [ - " spaces_at_the_begining_are_stripped", + " spaces_at_the_begining_are_not_stripped", [ - command.ParseResult(value = "spaces_at_the_begining_are_stripped", type = mitmproxy.types.Cmd, valid = False), + command.ParseResult(value = " ", type = mitmproxy.types.Unknown, valid = False), + command.ParseResult(value = "spaces_at_the_begining_are_not_stripped", type = mitmproxy.types.Cmd, valid = False), ], [], ], [ - " spaces_at_the_begining_are_stripped but_not_at_the_end ", + " spaces_at_the_begining_are_not_stripped neither_at_the_end ", [ - command.ParseResult(value = "spaces_at_the_begining_are_stripped", type = mitmproxy.types.Cmd, valid = False), + command.ParseResult(value = " ", type = mitmproxy.types.Unknown, valid = False), + command.ParseResult(value = "spaces_at_the_begining_are_not_stripped", type = mitmproxy.types.Cmd, valid = False), command.ParseResult(value = " ", type = mitmproxy.types.Unknown, valid = False), - command.ParseResult(value = "but_not_at_the_end", type = mitmproxy.types.Unknown, valid = False), + command.ParseResult(value = "neither_at_the_end", type = mitmproxy.types.Unknown, valid = False), command.ParseResult(value = " ", type = mitmproxy.types.Unknown, valid = False), ], [], diff --git a/test/mitmproxy/tools/console/test_commander.py b/test/mitmproxy/tools/console/test_commander.py index 798ca5fe..8c3e6839 100644 --- a/test/mitmproxy/tools/console/test_commander.py +++ b/test/mitmproxy/tools/console/test_commander.py @@ -165,3 +165,21 @@ class TestCommandBuffer: cb = commander.CommandBuffer(tctx.master) cb.text = "foo" assert cb.render() + + cb.text = 'set view_filter=~bq test' + ret = cb.render() + assert ret[0] == ('commander_command', 'set') + assert ret[1] == ('commander_invalid', ' ') + assert ret[2] == ('text', 'view_filter=~bq') + assert ret[3] == ('commander_invalid', ' ') + assert ret[4] == ('commander_invalid', 'test') + + cb.text = "set" + ret = cb.render() + assert ret[0] == ('commander_command', 'set') + assert ret[1] == ('text', ' ') + assert ret[2] == ('commander_hint', 'str ') + + # import pdb + # pdb.set_trace() + # print('x') diff --git a/test/mitmproxy/tools/console/test_defaultkeys.py b/test/mitmproxy/tools/console/test_defaultkeys.py index 7e8df6b6..40e536b0 100644 --- a/test/mitmproxy/tools/console/test_defaultkeys.py +++ b/test/mitmproxy/tools/console/test_defaultkeys.py @@ -29,7 +29,4 @@ async def test_commands_exist(): try: cmd_obj.prepare_args(args) except Exception as e: - - import pdb - pdb.set_trace() raise ValueError("Invalid command: {}".format(binding.command)) from e |