coverage++

This commit is contained in:
Maximilian Hils 2019-11-18 04:34:23 +01:00
parent da0755106d
commit dd556f052b
1 changed files with 23 additions and 1 deletions

View File

@ -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")