From d95f28e6bf581c65a06d410137160a50e584dbfd Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 13 Jun 2017 09:33:29 +1200 Subject: config: don't crash with a config file containing only comments --- test/mitmproxy/test_optmanager.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 04ec7ded..cadc5d76 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -257,6 +257,10 @@ def test_serialize(): with pytest.raises(Exception, match="Config error"): optmanager.load(o2, t) + t = "# a comment" + optmanager.load(o2, t) + assert optmanager.load(o2, "foobar: '123'") == {"foobar": "123"} + t = "" optmanager.load(o2, t) assert optmanager.load(o2, "foobar: '123'") == {"foobar": "123"} -- cgit v1.2.3 From 56eb0441da1ae85399fdbc5597cf181eeb408223 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 13 Jun 2017 10:26:03 +1200 Subject: commands: teach parser correct annotations for variable args We should annotate with the base type, not the resulting sequence. --- test/mitmproxy/test_command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/mitmproxy/test_command.py b/test/mitmproxy/test_command.py index 958328b2..87432163 100644 --- a/test/mitmproxy/test_command.py +++ b/test/mitmproxy/test_command.py @@ -22,7 +22,7 @@ class TAddon: def empty(self) -> None: pass - def varargs(self, one: str, *var: typing.Sequence[str]) -> typing.Sequence[str]: + def varargs(self, one: str, *var: str) -> typing.Sequence[str]: return list(var) -- cgit v1.2.3 From 88832f92a35cacc0d80bffa477d9ffb0e2bee97e Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 13 Jun 2017 10:32:47 +1200 Subject: view: show a message if we remove more than one flow from view --- test/mitmproxy/addons/test_view.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index d5a3a456..03b2c8dd 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -262,6 +262,16 @@ def test_duplicate(): assert v.focus.index == 2 +def test_remove(): + v = view.View() + with taddons.context(): + f = [tflow.tflow(), tflow.tflow() ] + v.add(f) + assert len(v) == 2 + v.remove(f) + assert len(v) == 0 + + def test_setgetval(): v = view.View() with taddons.context(): -- cgit v1.2.3 From ba49b556843a7564b5a2a9bd49b206e42d8327c9 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 13 Jun 2017 11:48:08 +1200 Subject: console: key binding viewer Read-only for now. --- test/mitmproxy/addons/test_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index 03b2c8dd..40136f1f 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -265,7 +265,7 @@ def test_duplicate(): def test_remove(): v = view.View() with taddons.context(): - f = [tflow.tflow(), tflow.tflow() ] + f = [tflow.tflow(), tflow.tflow()] v.add(f) assert len(v) == 2 v.remove(f) -- cgit v1.2.3