aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_console_contentview.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2014-01-04 14:04:02 -0800
committerAldo Cortesi <aldo@corte.si>2014-01-04 14:04:02 -0800
commitac31039ad3c5a7f808065cab426d3d9aeab0004c (patch)
treebe05ffb9ce190f7913532ee644f2d9b4148c43e3 /test/test_console_contentview.py
parenta2261e3cf01121fb466bc91cd4117204187ba059 (diff)
parentc5f4614ba5bc8e3497951ef49c66fde07fb02ddb (diff)
downloadmitmproxy-ac31039ad3c5a7f808065cab426d3d9aeab0004c.tar.gz
mitmproxy-ac31039ad3c5a7f808065cab426d3d9aeab0004c.tar.bz2
mitmproxy-ac31039ad3c5a7f808065cab426d3d9aeab0004c.zip
Merge pull request #198 from Kami/add_css_view
Add CSS view which beautifies minified CSS files
Diffstat (limited to 'test/test_console_contentview.py')
-rw-r--r--test/test_console_contentview.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py
index ef44f834..b982aff3 100644
--- a/test/test_console_contentview.py
+++ b/test/test_console_contentview.py
@@ -13,6 +13,11 @@ try:
except ImportError:
pyamf = None
+try:
+ import cssutils
+except:
+ cssutils = None
+
class TestContentView:
def test_trailer(self):
@@ -112,6 +117,26 @@ class TestContentView:
assert v([], "[1, 2, 3", 100)
assert v([], "function(a){[1, 2, 3]}", 100)
+ def test_view_css(self):
+ v = cv.ViewCSS()
+
+ with open('./test/data/1.css', 'r') as fp:
+ fixture_1 = fp.read()
+
+ result = v([], 'a', 100)
+
+ if cssutils:
+ assert len(result[1]) == 0
+ else:
+ assert len(result[1]) == 1
+
+ result = v([], fixture_1, 100)
+
+ if cssutils:
+ assert len(result[1]) > 1
+ else:
+ assert len(result[1]) == 1
+
def test_view_hex(self):
v = cv.ViewHex()
assert v([], "foo", 1000)