diff options
| author | root <root@mint> | 2013-12-24 14:28:20 +1300 |
|---|---|---|
| committer | root <root@mint> | 2013-12-24 14:28:20 +1300 |
| commit | 932464d0a0f572e256f6dea898196db1e3f66b50 (patch) | |
| tree | 2c9f43881e81e961e37b97e4daa46ba080e0edc9 /test | |
| parent | 359573a764220a3bad94729ff5dce4e94ce2a187 (diff) | |
| download | mitmproxy-932464d0a0f572e256f6dea898196db1e3f66b50.tar.gz mitmproxy-932464d0a0f572e256f6dea898196db1e3f66b50.tar.bz2 mitmproxy-932464d0a0f572e256f6dea898196db1e3f66b50.zip | |
test passing, UI still not working
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_console_contentview.py | 14 | ||||
| -rw-r--r-- | test/tutils.py | 10 |
2 files changed, 24 insertions, 0 deletions
diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py index ef44f834..c2ed2ffa 100644 --- a/test/test_console_contentview.py +++ b/test/test_console_contentview.py @@ -250,3 +250,17 @@ if cv.ViewProtobuf.is_available(): def test_get_by_shortcut(): assert cv.get_by_shortcut("h") + +def test_search_highlights(): + # Default text in requests is content. We will search for nt once, and + # expect the first bit to be highlighted. We will do it again and expect the + # second to be. + f = tutils.tflowview() + + ui_elements = f.search("nt") + text_object = ui_elements.contents()[2] + assert text_object.get_text() == ('content', [(None, 2), ('dark red', 2)]) + + ui_elements = f.search("nt") + text_object = ui_elements.contents()[2] + assert text_object.get_text() == ('content', [(None, 5), ('dark red', 2)]) diff --git a/test/tutils.py b/test/tutils.py index 4cd7b7f8..afc1fb51 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -1,8 +1,11 @@ import os, shutil, tempfile from contextlib import contextmanager from libmproxy import flow, utils, controller +from libmproxy.console.flowview import FlowView +from libmproxy.console import ConsoleState from netlib import certutils from nose.plugins.skip import SkipTest +from mock import Mock def _SkipWindows(): raise SkipTest("Skipped on Windows.") @@ -57,6 +60,13 @@ def tflow_err(): f.error = terr(f.request) return f +def tflowview(): + m = Mock() + cs = ConsoleState() + flow = tflow() + fv = FlowView(m, cs, flow) + return fv + @contextmanager def tmpdir(*args, **kwargs): |
