From dd556f052b0045b5e8f14b4810e302b4c2efc81f Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 18 Nov 2019 04:34:23 +0100 Subject: coverage++ --- test/mitmproxy/test_command.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index a34a8cf6..a432f9e3 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -171,6 +171,28 @@ class TestCommand: command.CommandParameter('args', mitmproxy.types.CmdArgs, kind=inspect.Parameter.VAR_POSITIONAL), ], ], + [ + "varargs one", + [ + command.ParseResult(value="varargs", type=mitmproxy.types.Cmd, valid=True), + command.ParseResult(value=" ", type=mitmproxy.types.Space, valid=True), + command.ParseResult(value="one", type=str, valid=True), + ], + [command.CommandParameter('var', str, kind=inspect.Parameter.VAR_POSITIONAL)] + ], + [ + "varargs one two three", + [ + command.ParseResult(value="varargs", type=mitmproxy.types.Cmd, valid=True), + command.ParseResult(value=" ", type=mitmproxy.types.Space, valid=True), + command.ParseResult(value="one", type=str, valid=True), + command.ParseResult(value=" ", type=mitmproxy.types.Space, valid=True), + command.ParseResult(value="two", type=str, valid=True), + command.ParseResult(value=" ", type=mitmproxy.types.Space, valid=True), + command.ParseResult(value="three", type=str, valid=True), + ], + [], + ], [ "subcommand cmd3 ", [ @@ -402,7 +424,7 @@ def test_simple(): assert (c.commands["one.two"].help == "cmd1 help") assert (c.execute("one.two foo") == "ret foo") assert (c.execute("one.two \"foo\"") == "ret foo") - assert (c.execute("one.two \"foo bar\"") == "ret foo bar") + assert (c.execute("one.two 'foo bar'") == "ret foo bar") assert (c.call("one.two", "foo") == "ret foo") with pytest.raises(exceptions.CommandError, match="Unknown"): c.execute("nonexistent") -- cgit v1.2.3