aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-12-14 15:43:15 +1300
committerAldo Cortesi <aldo@corte.si>2017-12-15 10:07:47 +1300
commite64d5c6bb963dedf291ed3c694ef735c8980a019 (patch)
treed719206b69921257e8a0e4020f7aee7f428ae215 /test
parent04e19f91716b9de6ec26df1478146eaedd47a329 (diff)
downloadmitmproxy-e64d5c6bb963dedf291ed3c694ef735c8980a019.tar.gz
mitmproxy-e64d5c6bb963dedf291ed3c694ef735c8980a019.tar.bz2
mitmproxy-e64d5c6bb963dedf291ed3c694ef735c8980a019.zip
commands: add a Cmd argument type
This represents a command passed as an argument. Also split arguments from command values themselves, making the command help for meta-commands much clearer.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_command.py4
-rw-r--r--test/mitmproxy/tools/console/test_commander.py3
2 files changed, 4 insertions, 3 deletions
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index e1879ba2..c8007463 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -100,6 +100,7 @@ def test_typename():
assert command.typename(command.Choice("foo"), False) == "choice"
assert command.typename(command.Path, False) == "path"
+ assert command.typename(command.Cmd, False) == "cmd"
class DummyConsole:
@@ -162,6 +163,9 @@ def test_parsearg():
assert command.parsearg(
tctx.master.commands, "foo", command.Path
) == "foo"
+ assert command.parsearg(
+ tctx.master.commands, "foo", command.Cmd
+ ) == "foo"
class TDec:
diff --git a/test/mitmproxy/tools/console/test_commander.py b/test/mitmproxy/tools/console/test_commander.py
index b1f23df4..fdf54897 100644
--- a/test/mitmproxy/tools/console/test_commander.py
+++ b/test/mitmproxy/tools/console/test_commander.py
@@ -32,6 +32,3 @@ class TestCommandBuffer:
cb.insert("x")
assert cb.buf == output[0]
assert cb.cursor == output[1]
-
-
-