diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/contentviews/test_image_parser.py | 42 | ||||
-rw-r--r-- | test/mitmproxy/data/image_parser/aspect.png (renamed from test/mitmproxy/data/png_parser/aspect.png) | bin | 1230326 -> 1230326 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/chi.gif | bin | 0 -> 85539 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/ct0n0g04.png (renamed from test/mitmproxy/data/png_parser/ct0n0g04.png) | bin | 273 -> 273 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/ct1n0g04.png (renamed from test/mitmproxy/data/png_parser/ct1n0g04.png) | bin | 792 -> 792 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/cten0g04.png (renamed from test/mitmproxy/data/png_parser/cten0g04.png) | bin | 742 -> 742 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/ctzn0g04.png (renamed from test/mitmproxy/data/png_parser/ctzn0g04.png) | bin | 753 -> 753 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/g07n0g16.png (renamed from test/mitmproxy/data/png_parser/g07n0g16.png) | bin | 321 -> 321 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/hopper.gif | bin | 0 -> 15305 bytes | |||
-rw-r--r-- | test/mitmproxy/data/image_parser/iss634.gif | bin | 0 -> 277517 bytes |
10 files changed, 36 insertions, 6 deletions
diff --git a/test/mitmproxy/contentviews/test_image_parser.py b/test/mitmproxy/contentviews/test_image_parser.py index 62a07f56..4241a1bb 100644 --- a/test/mitmproxy/contentviews/test_image_parser.py +++ b/test/mitmproxy/contentviews/test_image_parser.py @@ -6,13 +6,13 @@ from mitmproxy.test import tutils @pytest.mark.parametrize("filename, metadata", { # no textual data - "mitmproxy/data/png_parser/ct0n0g04.png": [ + "mitmproxy/data/image_parser/ct0n0g04.png": [ ('Format', 'Portable network graphics'), ('Size', '32 x 32 px'), ('gamma', '1.0') ], # with textual data - "mitmproxy/data/png_parser/ct1n0g04.png": [ + "mitmproxy/data/image_parser/ct1n0g04.png": [ ('Format', 'Portable network graphics'), ('Size', '32 x 32 px'), ('gamma', '1.0'), @@ -27,7 +27,7 @@ from mitmproxy.test import tutils ('Disclaimer', 'Freeware.') ], # with compressed textual data - "mitmproxy/data/png_parser/ctzn0g04.png": [ + "mitmproxy/data/image_parser/ctzn0g04.png": [ ('Format', 'Portable network graphics'), ('Size', '32 x 32 px'), ('gamma', '1.0'), @@ -42,7 +42,7 @@ from mitmproxy.test import tutils ('Disclaimer', 'Freeware.') ], # UTF-8 international text - english - "mitmproxy/data/png_parser/cten0g04.png": [ + "mitmproxy/data/image_parser/cten0g04.png": [ ('Format', 'Portable network graphics'), ('Size', '32 x 32 px'), ('gamma', '1.0'), @@ -57,13 +57,13 @@ from mitmproxy.test import tutils ('Disclaimer', 'Freeware.') ], # check gamma value - "mitmproxy/data/png_parser/g07n0g16.png": [ + "mitmproxy/data/image_parser/g07n0g16.png": [ ('Format', 'Portable network graphics'), ('Size', '32 x 32 px'), ('gamma', '0.7') ], # check aspect value - "mitmproxy/data/png_parser/aspect.png": [ + "mitmproxy/data/image_parser/aspect.png": [ ('Format', 'Portable network graphics'), ('Size', '1280 x 798 px'), ('aspect', '72 x 72'), @@ -74,3 +74,33 @@ from mitmproxy.test import tutils def test_parse_png(filename, metadata): with open(tutils.test_data.path(filename), "rb") as f: assert metadata == image_parser.parse_png(f.read()) + + +@pytest.mark.parametrize("filename, metadata", { + # check comment + "mitmproxy/data/image_parser/hopper.gif": [ + ('Format', 'Compuserve GIF'), + ('version', 'GIF89a'), + ('Size', '128 x 128 px'), + ('background', '0'), + ('comment', "b'File written by Adobe Photoshop\\xa8 4.0'") + ], + # check background + "mitmproxy/data/image_parser/chi.gif": [ + ('Format', 'Compuserve GIF'), + ('version', 'GIF89a'), + ('Size', '320 x 240 px'), + ('background', '248'), + ('comment', "b'Created with GIMP'") + ], + # check working with color table + "mitmproxy/data/image_parser/iss634.gif": [ + ('Format', 'Compuserve GIF'), + ('version', 'GIF89a'), + ('Size', '245 x 245 px'), + ('background', '0') + ], +}.items()) +def test_parse_gif(filename, metadata): + with open(tutils.test_data.path(filename), 'rb') as f: + assert metadata == image_parser.parse_gif(f.read()) diff --git a/test/mitmproxy/data/png_parser/aspect.png b/test/mitmproxy/data/image_parser/aspect.png Binary files differindex 17c01913..17c01913 100644 --- a/test/mitmproxy/data/png_parser/aspect.png +++ b/test/mitmproxy/data/image_parser/aspect.png diff --git a/test/mitmproxy/data/image_parser/chi.gif b/test/mitmproxy/data/image_parser/chi.gif Binary files differnew file mode 100644 index 00000000..d217f8b5 --- /dev/null +++ b/test/mitmproxy/data/image_parser/chi.gif diff --git a/test/mitmproxy/data/png_parser/ct0n0g04.png b/test/mitmproxy/data/image_parser/ct0n0g04.png Binary files differindex 40d1e062..40d1e062 100644 --- a/test/mitmproxy/data/png_parser/ct0n0g04.png +++ b/test/mitmproxy/data/image_parser/ct0n0g04.png diff --git a/test/mitmproxy/data/png_parser/ct1n0g04.png b/test/mitmproxy/data/image_parser/ct1n0g04.png Binary files differindex 3ba110aa..3ba110aa 100644 --- a/test/mitmproxy/data/png_parser/ct1n0g04.png +++ b/test/mitmproxy/data/image_parser/ct1n0g04.png diff --git a/test/mitmproxy/data/png_parser/cten0g04.png b/test/mitmproxy/data/image_parser/cten0g04.png Binary files differindex a6a56faf..a6a56faf 100644 --- a/test/mitmproxy/data/png_parser/cten0g04.png +++ b/test/mitmproxy/data/image_parser/cten0g04.png diff --git a/test/mitmproxy/data/png_parser/ctzn0g04.png b/test/mitmproxy/data/image_parser/ctzn0g04.png Binary files differindex b4401c9c..b4401c9c 100644 --- a/test/mitmproxy/data/png_parser/ctzn0g04.png +++ b/test/mitmproxy/data/image_parser/ctzn0g04.png diff --git a/test/mitmproxy/data/png_parser/g07n0g16.png b/test/mitmproxy/data/image_parser/g07n0g16.png Binary files differindex d6a47c2d..d6a47c2d 100644 --- a/test/mitmproxy/data/png_parser/g07n0g16.png +++ b/test/mitmproxy/data/image_parser/g07n0g16.png diff --git a/test/mitmproxy/data/image_parser/hopper.gif b/test/mitmproxy/data/image_parser/hopper.gif Binary files differnew file mode 100644 index 00000000..2e7f5ade --- /dev/null +++ b/test/mitmproxy/data/image_parser/hopper.gif diff --git a/test/mitmproxy/data/image_parser/iss634.gif b/test/mitmproxy/data/image_parser/iss634.gif Binary files differnew file mode 100644 index 00000000..ba4e4566 --- /dev/null +++ b/test/mitmproxy/data/image_parser/iss634.gif |