diff options
author | Maximilian Hils <git@maximilianhils.com> | 2017-08-16 22:52:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-16 22:52:02 +0200 |
commit | a006cab5cee773c60355660b4b44b702b4d51321 (patch) | |
tree | bca3caa8bb035bf3cadd70d48d0b3af85537f9bd /test | |
parent | 7c650aa53bc947207b2fcd0cbf195ba83a64252e (diff) | |
parent | 56781a0b08a0453fef0ff3f34d06c41c378cd7bc (diff) | |
download | mitmproxy-a006cab5cee773c60355660b4b44b702b4d51321.tar.gz mitmproxy-a006cab5cee773c60355660b4b44b702b4d51321.tar.bz2 mitmproxy-a006cab5cee773c60355660b4b44b702b4d51321.zip |
Merge pull request #2489 from MatthewShao/options-into-own-addon
Move console-related options into their own addon
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_view.py | 15 | ||||
-rw-r--r-- | test/mitmproxy/test_addonmanager.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/tools/console/test_statusbar.py | 3 |
3 files changed, 12 insertions, 8 deletions
diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index e8eeb591..1e0c3b55 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -7,6 +7,7 @@ from mitmproxy import flowfilter from mitmproxy import exceptions from mitmproxy import io from mitmproxy.test import taddons +from mitmproxy.tools.console import consoleaddons def tft(*, method="get", start=0): @@ -27,7 +28,7 @@ def test_order_refresh(): tf = tflow.tflow(resp=True) with taddons.context() as tctx: - tctx.configure(v, console_order="time") + tctx.configure(v, view_order="time") v.add([tf]) tf.request.timestamp_start = 1 assert not sargs @@ -300,12 +301,12 @@ def test_order(): 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) @@ -425,6 +426,8 @@ def test_signals(): def test_focus_follow(): v = view.View() 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)]) @@ -546,11 +549,11 @@ def test_configure(): 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) tctx.configure(v, console_focus_follow=True) assert v.focus_follow diff --git a/test/mitmproxy/test_addonmanager.py b/test/mitmproxy/test_addonmanager.py index accf48e0..274d2d90 100644 --- a/test/mitmproxy/test_addonmanager.py +++ b/test/mitmproxy/test_addonmanager.py @@ -137,6 +137,8 @@ def test_simple(): a.trigger("custom") assert ta.custom_called + assert ta in a + def test_load_option(): o = options.Options() diff --git a/test/mitmproxy/tools/console/test_statusbar.py b/test/mitmproxy/tools/console/test_statusbar.py index 2f7825c9..b131a5d3 100644 --- a/test/mitmproxy/tools/console/test_statusbar.py +++ b/test/mitmproxy/tools/console/test_statusbar.py @@ -13,20 +13,19 @@ def test_statusbar(monkeypatch): stickycookie="~dst example.com", stickyauth="~dst example.com", default_contentview="javascript", - console_order="url", anticache=True, anticomp=True, showhost=True, refresh_server_playback=False, replay_kill_extra=True, upstream_cert=False, - console_focus_follow=True, stream_large_bodies="3m", mode="transparent", scripts=["nonexistent"], save_stream_file="foo", ) m = master.ConsoleMaster(o) + m.options.update(view_order='url', console_focus_follow=True) monkeypatch.setattr(m.addons.get("clientplayback"), "count", lambda: 42) monkeypatch.setattr(m.addons.get("serverplayback"), "count", lambda: 42) |