From ba466dbb358eba223c49fbe602a667aa1a3c7459 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 6 Jun 2016 23:08:58 -0700 Subject: simplify pretty_json, improve test coverage --- test/mitmproxy/test_contentview.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/mitmproxy/test_contentview.py b/test/mitmproxy/test_contentview.py index 48d6c307..f5ba45a6 100644 --- a/test/mitmproxy/test_contentview.py +++ b/test/mitmproxy/test_contentview.py @@ -1,5 +1,3 @@ -import json - from mitmproxy.exceptions import ContentViewException from netlib.http import Headers from netlib.odict import ODict @@ -279,6 +277,7 @@ def test_get_by_shortcut(): def test_pretty_json(): - s = json.dumps({"foo": 1}) - assert cv.pretty_json(s) + assert cv.pretty_json('{"foo": 1}') assert not cv.pretty_json("moo") + assert cv.pretty_json(b'{"foo" : "\xe4\xb8\x96\xe7\x95\x8c"}') # utf8 with chinese characters + assert not cv.pretty_json(b'{"foo" : "\xFF"}') -- cgit v1.2.3