diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2017-04-30 22:45:31 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-04-30 22:45:31 +1200 |
commit | 685487d33ca07d23c7fd9adc49b6520c9aa19273 (patch) | |
tree | d88382737732523c2e468dd3920cd44efd4d983c /test | |
parent | a570caccbda28f19e637231df10b28550e8919af (diff) | |
download | mitmproxy-685487d33ca07d23c7fd9adc49b6520c9aa19273.tar.gz mitmproxy-685487d33ca07d23c7fd9adc49b6520c9aa19273.tar.bz2 mitmproxy-685487d33ca07d23c7fd9adc49b6520c9aa19273.zip |
commands: view.order.options, view.marked.toggle, view.create
And use these commands to remove the last hard-coded keybindings from flow
list. This means the flow list is now 100% command-driven, which is very
exciting.
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_view.py | 16 | ||||
-rw-r--r-- | test/mitmproxy/console/test_flowlist.py | 8 | ||||
-rw-r--r-- | test/mitmproxy/test_flow.py | 4 |
3 files changed, 16 insertions, 12 deletions
diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index eddcb04c..1724da49 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -137,6 +137,22 @@ def tdump(path, flows): w.add(i) +def test_create(): + v = view.View() + with taddons.context(): + v.create("get", "http://foo.com") + assert len(v) == 1 + assert v[0].request.url == "http://foo.com/" + v.create("get", "http://foo.com") + assert len(v) == 2 + + +def test_orders(): + v = view.View() + with taddons.context(): + assert v.order_options() + + def test_load(tmpdir): path = str(tmpdir.join("path")) v = view.View() diff --git a/test/mitmproxy/console/test_flowlist.py b/test/mitmproxy/console/test_flowlist.py index d63dab1c..6d82749d 100644 --- a/test/mitmproxy/console/test_flowlist.py +++ b/test/mitmproxy/console/test_flowlist.py @@ -1,4 +1,3 @@ -from unittest import mock import urwid import mitmproxy.tools.console.flowlist as flowlist @@ -14,13 +13,6 @@ class TestFlowlist: o = options.Options(**opts) return console.master.ConsoleMaster(o, proxy.DummyServer()) - def test_new_request(self): - m = self.mkmaster() - x = flowlist.FlowListBox(m) - with mock.patch('mitmproxy.tools.console.signals.status_message.send') as mock_thing: - x.new_request("nonexistent url", "GET") - mock_thing.assert_called_once_with(message="Invalid URL: No hostname given") - def test_logbuffer_set_focus(self): m = self.mkmaster() b = flowlist.LogBufferBox(m) diff --git a/test/mitmproxy/test_flow.py b/test/mitmproxy/test_flow.py index 78f893c0..19f0e7d9 100644 --- a/test/mitmproxy/test_flow.py +++ b/test/mitmproxy/test_flow.py @@ -113,10 +113,6 @@ class TestFlowMaster: with pytest.raises(Exception, match="live"): fm.replay_request(f) - def test_create_flow(self): - fm = master.Master(None, DummyServer()) - assert fm.create_request("GET", "http://example.com/") - def test_all(self): s = tservers.TestState() fm = master.Master(None, DummyServer()) |