aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-12-14 07:42:12 +1300
committerGitHub <noreply@github.com>2017-12-14 07:42:12 +1300
commit62561ed428caca2fffaa96c8d0765a6a7bba4d00 (patch)
treeb07c48f0d0b0496b3500277d297f1463a9875ce2 /test
parent5e0e08a4d604f126923b4c8c2bd40bc25cd5b022 (diff)
parente63bb8cde5a62c7b0ad0b6e6577e8e1a78e822f5 (diff)
downloadmitmproxy-62561ed428caca2fffaa96c8d0765a6a7bba4d00.tar.gz
mitmproxy-62561ed428caca2fffaa96c8d0765a6a7bba4d00.tar.bz2
mitmproxy-62561ed428caca2fffaa96c8d0765a6a7bba4d00.zip
Merge pull request #2669 from cortesi/path
commands: add a Path argument type
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_command.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index cb9dc4ed..abb09cea 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -35,6 +35,9 @@ class TAddon:
def choose(self, arg: TChoice) -> typing.Sequence[str]: # type: ignore
return ["one", "two", "three"]
+ def path(self, arg: command.Path) -> None:
+ pass
+
class TestCommand:
def test_varargs(self):
@@ -97,6 +100,7 @@ def test_typename():
assert command.typename(typing.Sequence[str], False) == "[str]"
assert command.typename(TChoice, False) == "choice"
+ assert command.typename(command.Path, False) == "path"
class DummyConsole:
@@ -156,6 +160,10 @@ def test_parsearg():
tctx.master.commands, "invalid", TChoice,
)
+ assert command.parsearg(
+ tctx.master.commands, "foo", command.Path
+ ) == "foo"
+
class TDec:
@command.command("cmd1")