diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-12-20 09:09:40 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-12-20 09:09:40 +1300 |
commit | d7ee5d8f85044c93f5982756f49be8315d148e4c (patch) | |
tree | a7711babc31a37636de136d44ef6f359d9a00cc0 /test | |
parent | 3341edc9fa8e70306e91cf911e4b2b19ef60ba84 (diff) | |
download | mitmproxy-d7ee5d8f85044c93f5982756f49be8315d148e4c.tar.gz mitmproxy-d7ee5d8f85044c93f5982756f49be8315d148e4c.tar.bz2 mitmproxy-d7ee5d8f85044c93f5982756f49be8315d148e4c.zip |
commander: palette entries, highlight errors
- Add palette entries specific to commander
- Highlight errors
- Introduce an Unknown type to keep track of extra unknown arguments to
commands
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_command.py | 8 | ||||
-rw-r--r-- | test/mitmproxy/test_types.py | 9 |
2 files changed, 15 insertions, 2 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index 25df2e61..a989995c 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -78,8 +78,12 @@ class TestCommand: [ "foo bar", [ - command.ParseResult(value = "foo", type = mitmproxy.types.Cmd, valid = False), - command.ParseResult(value = "bar", type = str, valid = True) + command.ParseResult( + value = "foo", type = mitmproxy.types.Cmd, valid = False + ), + command.ParseResult( + value = "bar", type = mitmproxy.types.Unknown, valid = False + ) ], [], ], diff --git a/test/mitmproxy/test_types.py b/test/mitmproxy/test_types.py index 29e86203..72492fa9 100644 --- a/test/mitmproxy/test_types.py +++ b/test/mitmproxy/test_types.py @@ -43,6 +43,15 @@ def test_str(): assert b.parse(tctx.master.commands, str, "foo") == "foo" +def test_unknown(): + with taddons.context() as tctx: + b = mitmproxy.types._UnknownType() + assert b.is_valid(tctx.master.commands, mitmproxy.types.Unknown, "foo") is False + assert b.is_valid(tctx.master.commands, mitmproxy.types.Unknown, 1) is False + assert b.completion(tctx.master.commands, mitmproxy.types.Unknown, "") == [] + assert b.parse(tctx.master.commands, mitmproxy.types.Unknown, "foo") == "foo" + + def test_int(): with taddons.context() as tctx: b = mitmproxy.types._IntType() |