Skip to content

Commit cca29c1

Browse files
committed
Progress towards tests which show error
1 parent 43ad556 commit cca29c1

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

tests/mock_vws/test_query.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,11 @@ class TestMaximumImageSize:
10651065
"""
10661066
Tests for maximum image sizes.
10671067
"""
1068+
# # Look at history to find what max size was, I think it was
1069+
# 835^2 or 836^2
1070+
# # This gives 422 on real, 200 on mock
1071+
# width = 1
1072+
# height = int(max_size / 2)
10681073

10691074
def test_png(
10701075
self,
@@ -1074,16 +1079,15 @@ def test_png(
10741079
See https://github.com/adamtheturtle/vws-python/issues/357 for
10751080
implementing this test.
10761081
"""
1077-
png_not_too_large = 1
1078-
# 835 no error, 836 error
1079-
width = height = 836
1080-
# width = height = 835
1081-
1082-
# # This gives 422 on real, 200 on mock
1083-
# width = 1
1084-
# height = int(max_size / 2)
1082+
width = height = 835
1083+
png_not_too_large = image_file(
1084+
file_format='PNG',
1085+
color_space='RGB',
1086+
width=width,
1087+
height=height,
1088+
)
10851089

1086-
image_content = image_buffer.getvalue()
1090+
image_content = png_not_too_large.getvalue()
10871091
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
10881092

10891093
response = query(
@@ -1094,6 +1098,23 @@ def test_png(
10941098
assert_query_success(response=response)
10951099
assert response.json()['results'] == []
10961100

1101+
width = height = 836
1102+
png_not_too_large = image_file(
1103+
file_format='PNG',
1104+
color_space='RGB',
1105+
width=width,
1106+
height=height,
1107+
)
1108+
1109+
image_content = png_not_too_large.getvalue()
1110+
body = {'image': ('image.jpeg', image_content, 'image/jpeg')}
1111+
1112+
with pytest.raises(requests.exceptions.ConnectionError):
1113+
query(
1114+
vuforia_database_keys=vuforia_database_keys,
1115+
body=body,
1116+
)
1117+
10971118
def test_jpeg(self) -> None:
10981119
"""
10991120
See https://github.com/adamtheturtle/vws-python/issues/357 for

0 commit comments

Comments
 (0)