diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_core.py | 14 | ||||
-rw-r--r-- | test/mitmproxy/test_command.py | 6 |
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 |