From 2f52d8b9ad0489b0528f6c9335a69ac5b7c93a68 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Mon, 1 May 2017 19:52:24 +1200 Subject: commands: view.setval, view.getval, view.setval.toggle Use these to bind the last of the key for flowview. Flow views are now 100% keybound. --- test/mitmproxy/addons/test_view.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index eca4b546..ef969d1d 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -260,6 +260,21 @@ def test_duplicate(): assert v.focus.index == 2 +def test_setgetval(): + v = view.View() + with taddons.context(): + f = tflow.tflow() + v.add([f]) + v.setvalue([f], "key", "value") + assert v.getvalue(f, "key", "default") == "value" + assert v.getvalue(f, "unknow", "default") == "default" + + v.setvalue_toggle([f], "key") + assert v.getvalue(f, "key", "default") == "true" + v.setvalue_toggle([f], "key") + assert v.getvalue(f, "key", "default") == "false" + + def test_order(): v = view.View() with taddons.context() as tctx: -- cgit v1.2.3