aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSachin Kelkar <sachinkel19@gmail.com>2017-02-10 10:56:50 +0530
committerSachin Kelkar <sachinkel19@gmail.com>2017-02-10 11:16:23 +0530
commitc4e141a00087edb457df342884d147c5be8168a9 (patch)
tree41681d8814507cddef6c967225f18455f969f15e /test
parent5dd54ef012c95c6b20899f3d94b2dc65f634636d (diff)
downloadmitmproxy-c4e141a00087edb457df342884d147c5be8168a9.tar.gz
mitmproxy-c4e141a00087edb457df342884d147c5be8168a9.tar.bz2
mitmproxy-c4e141a00087edb457df342884d147c5be8168a9.zip
Add jpeg app0 sof0 com parsing
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/contentviews/test_image_parser.py24
-rw-r--r--test/mitmproxy/data/image_parser/comment.jpgbin0 -> 1779 bytes
-rw-r--r--test/mitmproxy/data/image_parser/example.jpgbin0 -> 1755 bytes
3 files changed, 24 insertions, 0 deletions
diff --git a/test/mitmproxy/contentviews/test_image_parser.py b/test/mitmproxy/contentviews/test_image_parser.py
index 4241a1bb..6c78c07b 100644
--- a/test/mitmproxy/contentviews/test_image_parser.py
+++ b/test/mitmproxy/contentviews/test_image_parser.py
@@ -104,3 +104,27 @@ def test_parse_png(filename, metadata):
def test_parse_gif(filename, metadata):
with open(tutils.test_data.path(filename), 'rb') as f:
assert metadata == image_parser.parse_gif(f.read())
+
+
+@pytest.mark.parametrize("filename, metadata", {
+ # check app0
+ "mitmproxy/data/image_parser/example.jpg": [
+ ('Format', 'JPEG (ISO 10918)'),
+ ('jfif_version', '(1, 1)'),
+ ('jfif_density', '(96, 96)'),
+ ('jfif_unit', '1'),
+ ('Size', '256 x 256 px')
+ ],
+ # check com
+ "mitmproxy/data/image_parser/comment.jpg": [
+ ('Format', 'JPEG (ISO 10918)'),
+ ('jfif_version', '(1, 1)'),
+ ('jfif_density', '(96, 96)'),
+ ('jfif_unit', '1'),
+ ('comment', "b'mitmproxy test image'"),
+ ('Size', '256 x 256 px')
+ ],
+}.items())
+def test_parse_jpeg(filename, metadata):
+ with open(tutils.test_data.path(filename), 'rb') as f:
+ assert metadata == image_parser.parse_jpeg(f.read())
diff --git a/test/mitmproxy/data/image_parser/comment.jpg b/test/mitmproxy/data/image_parser/comment.jpg
new file mode 100644
index 00000000..74d443dd
--- /dev/null
+++ b/test/mitmproxy/data/image_parser/comment.jpg
Binary files differ
diff --git a/test/mitmproxy/data/image_parser/example.jpg b/test/mitmproxy/data/image_parser/example.jpg
new file mode 100644
index 00000000..415ee4b2
--- /dev/null
+++ b/test/mitmproxy/data/image_parser/example.jpg
Binary files differ