aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorThomas Kriechbaumer <Kriechi@users.noreply.github.com>2017-02-15 15:29:57 +0100
committerGitHub <noreply@github.com>2017-02-15 15:29:57 +0100
commit94a7e99fdabee778f7872b0f0a7bd23ee533bc11 (patch)
treec7f90a78542e478d526565ff9c5ad67a42111f71 /test
parent4aa656f2a6a2791d5fd78fa5ac40ad35b2044fb9 (diff)
parent80113a9d6ec63d665f77db16aeb8341c41319bee (diff)
downloadmitmproxy-94a7e99fdabee778f7872b0f0a7bd23ee533bc11.tar.gz
mitmproxy-94a7e99fdabee778f7872b0f0a7bd23ee533bc11.tar.bz2
mitmproxy-94a7e99fdabee778f7872b0f0a7bd23ee533bc11.zip
Merge pull request #2028 from Kriechi/nuke-pillow
nuke Pillow
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/__init__.py1
-rw-r--r--test/mitmproxy/contentviews/image/test_image_parser.py6
-rw-r--r--test/mitmproxy/contentviews/image/test_view.py8
-rw-r--r--test/mitmproxy/contentviews/test_auto.py12
-rw-r--r--test/mitmproxy/proxy/protocol/test_http2.py2
5 files changed, 20 insertions, 9 deletions
diff --git a/test/mitmproxy/__init__.py b/test/mitmproxy/__init__.py
index 28dc133f..6f114e18 100644
--- a/test/mitmproxy/__init__.py
+++ b/test/mitmproxy/__init__.py
@@ -3,5 +3,4 @@ import logging
logging.getLogger("hyper").setLevel(logging.WARNING)
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("passlib").setLevel(logging.WARNING)
-logging.getLogger("PIL").setLevel(logging.WARNING)
logging.getLogger("tornado").setLevel(logging.WARNING)
diff --git a/test/mitmproxy/contentviews/image/test_image_parser.py b/test/mitmproxy/contentviews/image/test_image_parser.py
index 3c8bfdf7..3cb44ca6 100644
--- a/test/mitmproxy/contentviews/image/test_image_parser.py
+++ b/test/mitmproxy/contentviews/image/test_image_parser.py
@@ -80,7 +80,7 @@ def test_parse_png(filename, metadata):
# check comment
"mitmproxy/data/image_parser/hopper.gif": [
('Format', 'Compuserve GIF'),
- ('version', 'GIF89a'),
+ ('Version', 'GIF89a'),
('Size', '128 x 128 px'),
('background', '0'),
('comment', "b'File written by Adobe Photoshop\\xa8 4.0'")
@@ -88,7 +88,7 @@ def test_parse_png(filename, metadata):
# check background
"mitmproxy/data/image_parser/chi.gif": [
('Format', 'Compuserve GIF'),
- ('version', 'GIF89a'),
+ ('Version', 'GIF89a'),
('Size', '320 x 240 px'),
('background', '248'),
('comment', "b'Created with GIMP'")
@@ -96,7 +96,7 @@ def test_parse_png(filename, metadata):
# check working with color table
"mitmproxy/data/image_parser/iss634.gif": [
('Format', 'Compuserve GIF'),
- ('version', 'GIF89a'),
+ ('Version', 'GIF89a'),
('Size', '245 x 245 px'),
('background', '0')
],
diff --git a/test/mitmproxy/contentviews/image/test_view.py b/test/mitmproxy/contentviews/image/test_view.py
index ee2f9eaa..34f655a1 100644
--- a/test/mitmproxy/contentviews/image/test_view.py
+++ b/test/mitmproxy/contentviews/image/test_view.py
@@ -9,9 +9,11 @@ def test_view_image():
"mitmproxy/data/image.png",
"mitmproxy/data/image.gif",
"mitmproxy/data/all.jpeg",
- "mitmproxy/data/image.ico"
+ # https://bugs.python.org/issue21574
+ # "mitmproxy/data/image.ico",
]:
with open(tutils.test_data.path(img), "rb") as f:
- assert v(f.read())
+ viewname, lines = v(f.read())
+ assert img.split(".")[-1].upper() in viewname
- assert not v(b"flibble")
+ assert v(b"flibble") == ('Unknown Image', [[('header', 'Image Format: '), ('text', 'unknown')]])
diff --git a/test/mitmproxy/contentviews/test_auto.py b/test/mitmproxy/contentviews/test_auto.py
index a077affa..2ff43139 100644
--- a/test/mitmproxy/contentviews/test_auto.py
+++ b/test/mitmproxy/contentviews/test_auto.py
@@ -30,6 +30,18 @@ def test_view_auto():
)
assert f[0].startswith("XML")
+ f = v(
+ b"<svg></svg>",
+ headers=http.Headers(content_type="image/svg+xml")
+ )
+ assert f[0].startswith("XML")
+
+ f = v(
+ b"verybinary",
+ headers=http.Headers(content_type="image/new-magic-image-format")
+ )
+ assert f[0] == "Unknown Image"
+
f = v(b"\xFF" * 30)
assert f[0] == "Hex"
diff --git a/test/mitmproxy/proxy/protocol/test_http2.py b/test/mitmproxy/proxy/protocol/test_http2.py
index f5d9259d..cede0b80 100644
--- a/test/mitmproxy/proxy/protocol/test_http2.py
+++ b/test/mitmproxy/proxy/protocol/test_http2.py
@@ -23,8 +23,6 @@ logging.getLogger("hyper.packages.hpack.hpack").setLevel(logging.WARNING)
logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(logging.WARNING)
logging.getLogger("passlib.utils.compat").setLevel(logging.WARNING)
logging.getLogger("passlib.registry").setLevel(logging.WARNING)
-logging.getLogger("PIL.Image").setLevel(logging.WARNING)
-logging.getLogger("PIL.PngImagePlugin").setLevel(logging.WARNING)
# inspect the log: