aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console_search.py
diff options
context:
space:
mode:
authorPedro Worcel <pedro@worcel.com>2014-02-22 17:15:37 +1300
committerPedro Worcel <pedro@worcel.com>2014-02-22 17:15:37 +1300
commit3e500344282a364f1fbd7245c49d980fe0bfab11 (patch)
treea6c0acad04addf8509c0d1efd9b7aa3fd8edb688 /test/test_console_search.py
parent9fe6b8fd268c95fc1a93148c6e2f4cd4d8a5bb05 (diff)
downloadmitmproxy-3e500344282a364f1fbd7245c49d980fe0bfab11.tar.gz
mitmproxy-3e500344282a364f1fbd7245c49d980fe0bfab11.tar.bz2
mitmproxy-3e500344282a364f1fbd7245c49d980fe0bfab11.zip
fix the wrapping on backward searches
Diffstat (limited to 'test/test_console_search.py')
-rw-r--r--test/test_console_search.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/test_console_search.py b/test/test_console_search.py
index 60b998cc..0e47ef79 100644
--- a/test/test_console_search.py
+++ b/test/test_console_search.py
@@ -153,6 +153,24 @@ def test_search_back_multi_multi_line():
# first line now
f.search_again(backwards=True)
text_object = tutils.get_body_line(f.last_displayed_body, 0)
- print(text_object.get_text(), ('this is string', [(None, 8), (f.highlight_color, 6)]))
+ assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)])
+
+def test_search_backwards_wraps():
+ """
+ when searching past line 0, it should loop.
+ """
+ f = tutils.tflowview(request_contents="this is string\nthis is string\nthis is string")
+
+ # should be on second line
+ f.search("string")
+ f.search_again()
+ text_object = tutils.get_body_line(f.last_displayed_body, 1)
+ assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)])
+
+ # should be on third now.
+ f.search_again(backwards=True)
+ message = f.search_again(backwards=True)
+
+ text_object = tutils.get_body_line(f.last_displayed_body, 2)
assert text_object.get_text() == ('this is string', [(None, 8), (f.highlight_color, 6)])