diff options
author | Matthew Shao <me@matshao.com> | 2017-08-01 23:01:58 +0800 |
---|---|---|
committer | Matthew Shao <me@matshao.com> | 2017-08-01 23:01:58 +0800 |
commit | ddffcf83ecef8b6c81e5f23ff57ae17af6131219 (patch) | |
tree | 31806d2e843a89dc8d97f389dac26e55a36be695 /test | |
parent | 7bbd89b121334a6eec2e88897ef85b03034eb700 (diff) | |
download | mitmproxy-ddffcf83ecef8b6c81e5f23ff57ae17af6131219.tar.gz mitmproxy-ddffcf83ecef8b6c81e5f23ff57ae17af6131219.tar.bz2 mitmproxy-ddffcf83ecef8b6c81e5f23ff57ae17af6131219.zip |
Update tests.
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_script.py | 6 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_view.py | 29 |
2 files changed, 21 insertions, 14 deletions
diff --git a/test/mitmproxy/addons/test_script.py b/test/mitmproxy/addons/test_script.py index 64fd9505..5b05aec8 100644 --- a/test/mitmproxy/addons/test_script.py +++ b/test/mitmproxy/addons/test_script.py @@ -260,6 +260,9 @@ class TestScriptLoader: debug = [i.msg for i in tctx.master.logs if i.level == "debug"] assert debug == [ + 'a load', + 'b load', + 'c load', 'c configure', 'a configure', 'b configure', @@ -277,6 +280,9 @@ class TestScriptLoader: debug = [i.msg for i in tctx.master.logs if i.level == "debug"] assert debug == [ + 'c load', + 'a load', + 'b load', 'c done', 'b done', 'a configure', diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index 9a9534f9..a2e45e9b 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -7,10 +7,7 @@ from mitmproxy import flowfilter from mitmproxy import exceptions from mitmproxy import io from mitmproxy.test import taddons -from mitmproxy import options -from mitmproxy.tools.console.master import ConsoleMaster - -m = ConsoleMaster(options.Options()) +from mitmproxy.tools.console import consoleaddons def tft(*, method="get", start=0): @@ -30,8 +27,8 @@ def test_order_refresh(): v.sig_view_refresh.connect(save) tf = tflow.tflow(resp=True) - with taddons.context(m) as tctx: - tctx.configure(v, console_order="time") + with taddons.context() as tctx: + tctx.configure(v, view_order="time") v.add([tf]) tf.request.timestamp_start = 1 assert not sargs @@ -297,19 +294,19 @@ def test_setgetval(): def test_order(): v = view.View() - with taddons.context(m) as tctx: + with taddons.context() as tctx: v.request(tft(method="get", start=1)) v.request(tft(method="put", start=2)) v.request(tft(method="get", start=3)) v.request(tft(method="put", start=4)) assert [i.request.timestamp_start for i in v] == [1, 2, 3, 4] - tctx.configure(v, console_order="method") + tctx.configure(v, view_order="method") assert [i.request.method for i in v] == ["GET", "GET", "PUT", "PUT"] v.set_reversed(True) assert [i.request.method for i in v] == ["PUT", "PUT", "GET", "GET"] - tctx.configure(v, console_order="time") + tctx.configure(v, view_order="time") assert [i.request.timestamp_start for i in v] == [4, 3, 2, 1] v.set_reversed(False) @@ -428,7 +425,9 @@ def test_signals(): def test_focus_follow(): v = view.View() - with taddons.context(m) as tctx: + with taddons.context() as tctx: + console_addon = consoleaddons.ConsoleAddon(tctx.master) + tctx.configure(console_addon) tctx.configure(v, console_focus_follow=True, view_filter="~m get") v.add([tft(start=5)]) @@ -545,16 +544,18 @@ def test_settings(): def test_configure(): v = view.View() - with taddons.context(m) as tctx: + with taddons.context() as tctx: tctx.configure(v, view_filter="~q") with pytest.raises(Exception, match="Invalid interception filter"): tctx.configure(v, view_filter="~~") - tctx.configure(v, console_order="method") + tctx.configure(v, view_order="method") with pytest.raises(Exception, match="Unknown flow order"): - tctx.configure(v, console_order="no") + tctx.configure(v, view_order="no") - tctx.configure(v, console_order_reversed=True) + tctx.configure(v, view_order_reversed=True) + console_addon = consoleaddons.ConsoleAddon(tctx.master) + tctx.configure(console_addon) tctx.configure(v, console_focus_follow=True) assert v.focus_follow |