aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console_contentview.py
diff options
context:
space:
mode:
authorPedro Worcel <pedro@worcel.com>2013-12-26 17:04:18 +1300
committerPedro Worcel <pedro@worcel.com>2013-12-26 17:04:18 +1300
commit21efe2f2c84cd0615d0b0f47a9007efe34abc5b9 (patch)
tree5992cb9766437318c3504f1ad4010218fb248b3e /test/test_console_contentview.py
parent9cf8a1a89dadfebedaf48258519c9a8953375597 (diff)
downloadmitmproxy-21efe2f2c84cd0615d0b0f47a9007efe34abc5b9.tar.gz
mitmproxy-21efe2f2c84cd0615d0b0f47a9007efe34abc5b9.tar.bz2
mitmproxy-21efe2f2c84cd0615d0b0f47a9007efe34abc5b9.zip
add looping around
Diffstat (limited to 'test/test_console_contentview.py')
-rw-r--r--test/test_console_contentview.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py
index 32f4fad2..d013d10d 100644
--- a/test/test_console_contentview.py
+++ b/test/test_console_contentview.py
@@ -265,6 +265,13 @@ def test_search_highlights():
text_object = tutils.get_body_line(f.last_displayed_body, 1)
assert text_object.get_text() == ('content', [(None, 5), (f.highlight_color, 2)])
+def test_search_returns_useful_messages():
+ f = tutils.tflowview()
+
+ # original string is content. this string should not be in there.
+ response = f.search("oranges and other fruit.")
+ assert response == "no matches for 'oranges and other fruit.'"
+
def test_search_highlights_clears_prev():
f = tutils.tflowview(request_contents="this is string\nstring is string")
@@ -296,6 +303,20 @@ def test_search_highlights_multi_line():
text_object = tutils.get_body_line(f.last_displayed_body, 1)
assert text_object.get_text() == ('string is string', [(None, 10), (f.highlight_color, 6)])
+def test_search_loops():
+ f = tutils.tflowview(request_contents="this is string\nstring is string")
+
+ # get to the end.
+ f.search("string")
+ f.search("string")
+ f.search("string")
+
+ # should highlight the first line.
+ message = f.search("string")
+ text_object = tutils.get_body_line(f.last_displayed_body, 0)
+ assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)])
+ assert message == "search hit BOTTOM, continuing at TOP"
+
def test_search_focuses():
f = tutils.tflowview(request_contents="this is string\nstring is string")