From 204d06f93f7c3fbdce38b12219c530e1eddc3e4d Mon Sep 17 00:00:00 2001 From: Ujjwal Verma Date: Wed, 17 May 2017 11:05:49 +0530 Subject: [PATCH] Increased xml_html contentview coverage --- test/mitmproxy/contentviews/test_xml_html.py | 8 ++++ .../test_xml_html_data/test-formatted.html | 44 +++++++++++++++++++ .../contentviews/test_xml_html_data/test.html | 14 ++++++ 3 files changed, 66 insertions(+) create mode 100644 test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html create mode 100644 test/mitmproxy/contentviews/test_xml_html_data/test.html diff --git a/test/mitmproxy/contentviews/test_xml_html.py b/test/mitmproxy/contentviews/test_xml_html.py index 2b0aee4d6..8148fd4ce 100644 --- a/test/mitmproxy/contentviews/test_xml_html.py +++ b/test/mitmproxy/contentviews/test_xml_html.py @@ -11,6 +11,13 @@ def test_simple(): v = full_eval(xml_html.ViewXmlHtml()) assert v(b"foo") == ('XML', [[('text', 'foo')]]) assert v(b"") == ('HTML', [[('text', '')]]) + assert v(b"<>") == ('XML', [[('text', '<>')]]) + assert v(b")" @pytest.mark.parametrize("filename", [ @@ -18,6 +25,7 @@ def test_simple(): "cdata.xml", "comment.xml", "inline.html", + "test.html" ]) def test_format_xml(filename): path = data.path(filename) diff --git a/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html b/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html new file mode 100644 index 000000000..0eb600048 --- /dev/null +++ b/test/mitmproxy/contentviews/test_xml_html_data/test-formatted.html @@ -0,0 +1,44 @@ + + + + + Title + + +

+ Lorem ipsum dolor +

+ sit amet, consectetur +

+ adipiscing elit, sed +

+ do eiusmod tempor +

+ incididunt ut +

+ labore et dolore +

+ magna aliqua. +

+ Ut enim ad minim +

+ veniam, quis nostrud +

+ exercitation +

+ ullamco laboris +

+ nisi ut aliquip ex ea +

+ commodo consequat. +

+ Duis aute irure +

+ dolor in reprehenderit +

+ in voluptate velit +

+ esse cillum dolore +

eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+ + diff --git a/test/mitmproxy/contentviews/test_xml_html_data/test.html b/test/mitmproxy/contentviews/test_xml_html_data/test.html new file mode 100644 index 000000000..e74ac3146 --- /dev/null +++ b/test/mitmproxy/contentviews/test_xml_html_data/test.html @@ -0,0 +1,14 @@ + + + + + Title + + +

Lorem ipsum dolor

sit amet, consectetur

adipiscing elit, sed

do eiusmod tempor

incididunt ut

labore et dolore

magna aliqua. +

Ut enim ad minim

veniam, quis nostrud

exercitation

ullamco laboris

+ nisi ut aliquip ex ea

commodo consequat.

Duis aute irure

dolor in reprehenderit

in voluptate velit

esse cillum dolore

eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

+ + + + \ No newline at end of file