aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-04-29 09:14:44 +1200
committerAldo Cortesi <aldo@corte.si>2017-04-29 09:14:44 +1200
commitf21a970f294486e47b183472ef9f535e2a661604 (patch)
treed6b854740b9842a64550569dbbe62b9256d1ea1c /test
parent217addbf316230a7314581d64d6f1313b050bbd7 (diff)
downloadmitmproxy-f21a970f294486e47b183472ef9f535e2a661604.tar.gz
mitmproxy-f21a970f294486e47b183472ef9f535e2a661604.tar.bz2
mitmproxy-f21a970f294486e47b183472ef9f535e2a661604.zip
commands: marking
Add "view.mark [flows] bool" and "view.mark.toggle [flows]". Use this to rebind marking keys in flowlist.
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/addons/test_core.py14
-rw-r--r--test/mitmproxy/test_command.py6
2 files changed, 20 insertions, 0 deletions
diff --git a/test/mitmproxy/addons/test_core.py b/test/mitmproxy/addons/test_core.py
index 39aac935..2d9ee751 100644
--- a/test/mitmproxy/addons/test_core.py
+++ b/test/mitmproxy/addons/test_core.py
@@ -26,3 +26,17 @@ def test_resume():
f.intercept()
sa.resume([f])
assert not f.reply.state == "taken"
+
+
+def test_mark():
+ sa = core.Core()
+ with taddons.context():
+ f = tflow.tflow()
+ assert not f.marked
+ sa.mark([f], True)
+ assert f.marked
+
+ sa.mark_toggle([f])
+ assert not f.marked
+ sa.mark_toggle([f])
+ assert f.marked
diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py
index 306650c7..96d79dba 100644
--- a/test/mitmproxy/test_command.py
+++ b/test/mitmproxy/test_command.py
@@ -76,10 +76,16 @@ def test_parsearg():
with taddons.context() as tctx:
tctx.master.addons.add(DummyConsole())
assert command.parsearg(tctx.master.commands, "foo", str) == "foo"
+
assert command.parsearg(tctx.master.commands, "1", int) == 1
with pytest.raises(exceptions.CommandError):
command.parsearg(tctx.master.commands, "foo", int)
+ assert command.parsearg(tctx.master.commands, "true", bool) is True
+ assert command.parsearg(tctx.master.commands, "false", bool) is False
+ with pytest.raises(exceptions.CommandError):
+ command.parsearg(tctx.master.commands, "flobble", bool)
+
assert len(command.parsearg(
tctx.master.commands, "2", typing.Sequence[flow.Flow]
)) == 2