Skip to content

Commit 7b81946

Browse files
committed
Progress towards a passing test
1 parent 3221062 commit 7b81946

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/mock_vws/test_query.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,41 @@ def test_inactive(
10541054
assert response.json()['results'] == []
10551055

10561056

1057+
@pytest.mark.usefixtures('verify_mock_vuforia')
1058+
class TestBadImage:
1059+
"""
1060+
Tests for bad images.
1061+
"""
1062+
1063+
def test_png(
1064+
self,
1065+
vuforia_database_keys: VuforiaDatabaseKeys,
1066+
png_rgb: io.BytesIO,
1067+
) -> None:
1068+
"""
1069+
See https://github.com/adamtheturtle/vws-python/issues/357 for
1070+
implementing this test.
1071+
"""
1072+
original_data = png_rgb.getvalue()
1073+
corrupted_data = original_data.replace(b'IEND', b'\x00' + b'IEND')
1074+
1075+
body = {'image': ('image.jpeg', corrupted_data, 'image/jpeg')}
1076+
1077+
response = query(
1078+
vuforia_database_keys=vuforia_database_keys,
1079+
body=body,
1080+
)
1081+
1082+
assert_query_success(response=response)
1083+
assert response.json()['results'] == []
1084+
1085+
def test_jpeg(self) -> None:
1086+
"""
1087+
See https://github.com/adamtheturtle/vws-python/issues/357 for
1088+
implementing this test.
1089+
"""
1090+
1091+
10571092
@pytest.mark.usefixtures('verify_mock_vuforia')
10581093
class TestMaximumImageSize:
10591094
"""

0 commit comments

Comments
 (0)