diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_command.py | 30 | ||||
-rw-r--r-- | test/mitmproxy/test_types.py | 1 |
2 files changed, 16 insertions, 15 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index 608a08b6..75b10098 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -78,46 +78,46 @@ class TestCommand: [ "foo bar", [ - command.ParseResult(value = "foo", type = mitmproxy.types.Cmd), - command.ParseResult(value = "bar", type = str) + command.ParseResult(value = "foo", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "bar", type = str, valid = True) ], ], [ "foo 'bar", [ - command.ParseResult(value = "foo", type = mitmproxy.types.Cmd), - command.ParseResult(value = "'bar", type = str) + command.ParseResult(value = "foo", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "'bar", type = str, valid = True) ] ], - ["a", [command.ParseResult(value = "a", type = mitmproxy.types.Cmd)]], - ["", [command.ParseResult(value = "", type = mitmproxy.types.Cmd)]], + ["a", [command.ParseResult(value = "a", type = mitmproxy.types.Cmd, valid = True)]], + ["", [command.ParseResult(value = "", type = mitmproxy.types.Cmd, valid = True)]], [ "cmd3 1", [ - command.ParseResult(value = "cmd3", type = mitmproxy.types.Cmd), - command.ParseResult(value = "1", type = int), + command.ParseResult(value = "cmd3", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "1", type = int, valid = True), ] ], [ "cmd3 ", [ - command.ParseResult(value = "cmd3", type = mitmproxy.types.Cmd), - command.ParseResult(value = "", type = int), + command.ParseResult(value = "cmd3", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "", type = int, valid = False), ] ], [ "subcommand ", [ - command.ParseResult(value = "subcommand", type = mitmproxy.types.Cmd), - command.ParseResult(value = "", type = mitmproxy.types.Cmd), + command.ParseResult(value = "subcommand", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "", type = mitmproxy.types.Cmd, valid = True), ] ], [ "subcommand cmd3 ", [ - command.ParseResult(value = "subcommand", type = mitmproxy.types.Cmd), - command.ParseResult(value = "cmd3", type = mitmproxy.types.Cmd), - command.ParseResult(value = "", type = int), + command.ParseResult(value = "subcommand", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "cmd3", type = mitmproxy.types.Cmd, valid = True), + command.ParseResult(value = "", type = int, valid = False), ] ], ] diff --git a/test/mitmproxy/test_types.py b/test/mitmproxy/test_types.py index df9bd4e0..5b1dd3a2 100644 --- a/test/mitmproxy/test_types.py +++ b/test/mitmproxy/test_types.py @@ -182,6 +182,7 @@ def test_data(): assert b.is_valid(tctx.master.commands, mitmproxy.types.Data, []) is True assert b.is_valid(tctx.master.commands, mitmproxy.types.Data, [["x"]]) is True assert b.is_valid(tctx.master.commands, mitmproxy.types.Data, [[b"x"]]) is True + assert b.is_valid(tctx.master.commands, mitmproxy.types.Data, [[1]]) is False with pytest.raises(mitmproxy.exceptions.TypeError): b.parse(tctx.master.commands, mitmproxy.types.Data, "foo") with pytest.raises(mitmproxy.exceptions.TypeError): |