aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console_contentview.py
diff options
context:
space:
mode:
authorPedro Worcel <pedro@worcel.com>2013-12-26 22:18:34 +1300
committerPedro Worcel <pedro@worcel.com>2013-12-26 22:18:34 +1300
commit799c87767684880469c12d75053fb860f4a0d3c9 (patch)
tree215546065adb29f9831c15e3fccab6f5c0d564f9 /test/test_console_contentview.py
parenta4b059c2a7ebe4e03abedd63f297d359509347d6 (diff)
downloadmitmproxy-799c87767684880469c12d75053fb860f4a0d3c9.tar.gz
mitmproxy-799c87767684880469c12d75053fb860f4a0d3c9.tar.bz2
mitmproxy-799c87767684880469c12d75053fb860f4a0d3c9.zip
now really fix it + test
Diffstat (limited to 'test/test_console_contentview.py')
-rw-r--r--test/test_console_contentview.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py
index d013d10d..f581424b 100644
--- a/test/test_console_contentview.py
+++ b/test/test_console_contentview.py
@@ -295,7 +295,6 @@ def test_search_highlights_multi_line():
# should highlight second line, first appearance of string.
f.search("string")
text_object = tutils.get_body_line(f.last_displayed_body, 1)
- print text_object.get_text()
assert text_object.get_text() == ('string is string', [(None, 0), (f.highlight_color, 6)])
# should highlight third line, second appearance of string.
@@ -328,4 +327,24 @@ def test_search_focuses():
text_object = tutils.get_body_line(f.last_displayed_body, 1)
assert f.last_displayed_body.focus == text_object
+def test_search_does_not_crash_on_bad():
+ """
+ this used to crash, kept for reference.
+ """
+
+ f = tutils.tflowview(request_contents="this is string\nstring is string\n"+("A" * cv.VIEW_CUTOFF)+"AFTERCUTOFF")
+ f.search("AFTERCUTOFF")
+
+ # pretend F
+ f.state.add_flow_setting(
+ f.flow,
+ (f.state.view_flow_mode, "fullcontents"),
+ True
+ )
+ f.master.refresh_flow(f.flow)
+
+ # text changed, now this string will exist. can happen when user presses F
+ # for full text view
+ f.search("AFTERCUTOFF")
+