diff options
author | Maximilian Hils <git@maximilianhils.com> | 2019-11-18 04:34:23 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2019-11-18 04:34:23 +0100 |
commit | dd556f052b0045b5e8f14b4810e302b4c2efc81f (patch) | |
tree | 4ff334db47dfd8cf818136102dc75b4dfdbadacf /test | |
parent | da0755106d76a9f45f281d2e65df38f83ae888c7 (diff) | |
download | mitmproxy-dd556f052b0045b5e8f14b4810e302b4c2efc81f.tar.gz mitmproxy-dd556f052b0045b5e8f14b4810e302b4c2efc81f.tar.bz2 mitmproxy-dd556f052b0045b5e8f14b4810e302b4c2efc81f.zip |
coverage++
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_command.py | 24 |
1 files changed, 23 insertions, 1 deletions
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 @@ -172,6 +172,28 @@ class TestCommand: ], ], [ + "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 ", [ command.ParseResult(value="subcommand", type=mitmproxy.types.Cmd, valid=True), @@ -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") |