diff options
author | Thomas Kriechbaumer <Kriechi@users.noreply.github.com> | 2017-03-29 16:57:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-29 16:57:37 +0200 |
commit | 9e3edd16c27a57d93e9d8abfa123196a909c5b55 (patch) | |
tree | 22141e5deaad74a9f1a5eed22ede78fe971b09e7 | |
parent | 98957673f0c4041339df91deda37b26fd46affc0 (diff) | |
parent | 442999c75cff39e4c8f3059689f973954d64e2f1 (diff) | |
download | mitmproxy-9e3edd16c27a57d93e9d8abfa123196a909c5b55.tar.gz mitmproxy-9e3edd16c27a57d93e9d8abfa123196a909c5b55.tar.bz2 mitmproxy-9e3edd16c27a57d93e9d8abfa123196a909c5b55.zip |
Merge pull request #2223 from krsoninikhil/empty-logbuffer
Add tests for set_focus
-rw-r--r-- | test/mitmproxy/console/test_flowlist.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/mitmproxy/console/test_flowlist.py b/test/mitmproxy/console/test_flowlist.py index 7c442b63..d63dab1c 100644 --- a/test/mitmproxy/console/test_flowlist.py +++ b/test/mitmproxy/console/test_flowlist.py @@ -1,4 +1,5 @@ from unittest import mock +import urwid import mitmproxy.tools.console.flowlist as flowlist from mitmproxy.tools import console @@ -19,3 +20,18 @@ class TestFlowlist: 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) + e = urwid.Text("Log message") + m.logbuffer.append(e) + m.logbuffer.append(e) + + assert len(m.logbuffer) == 2 + b.set_focus(0) + assert m.logbuffer.focus == 0 + b.set_focus(1) + assert m.logbuffer.focus == 1 + b.set_focus(2) + assert m.logbuffer.focus == 1 |