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.
This commit is contained in:
Aldo Cortesi
2017-04-30 22:45:31 +12:00
parent a570caccbd
commit 685487d33c
7 changed files with 52 additions and 91 deletions

View File

@@ -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()

View File

@@ -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)

View File

@@ -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())