Skip to content

Commit c0c5f0d

Browse files
committed
Progress towards corruption test
1 parent 266ccd4 commit c0c5f0d

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

tests/mock_vws/test_add_target.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -443,20 +443,16 @@ def test_bad_image_format_or_color_space(
443443
def test_corrupted(
444444
self,
445445
vuforia_database_keys: VuforiaDatabaseKeys,
446-
png_large: io.BytesIO,
446+
png_rgb: io.BytesIO,
447447
) -> None:
448448
"""
449-
An `ImageTooLarge` result is returned if the image is above a certain
450-
threshold.
451-
452-
This threshold is documented as being 2 MB but it is actually
453-
slightly larger. See the `png_large` fixture for more details.
449+
No error is returned when the given image is corrupted.
454450
"""
455-
original_data = png_large.getvalue()
456-
longer_data = original_data.replace(b'IEND', b'\x00' + b'IEND')
457-
too_large_file = io.BytesIO(longer_data)
451+
original_data = png_rgb.getvalue()
452+
corrupted_data = original_data.replace(b'IEND', b'\x00' + b'IEND')
453+
corrupted_file = io.BytesIO(corrupted_data)
458454

459-
image_data = too_large_file.read()
455+
image_data = corrupted_file.read()
460456
image_data_encoded = base64.b64encode(image_data).decode('ascii')
461457

462458
data = {
@@ -470,11 +466,7 @@ def test_corrupted(
470466
data=data,
471467
)
472468

473-
assert_vws_failure(
474-
response=response,
475-
status_code=codes.UNPROCESSABLE_ENTITY,
476-
result_code=ResultCodes.IMAGE_TOO_LARGE,
477-
)
469+
assert_success(response=response)
478470

479471
def test_jpeg_too_large(
480472
self,

0 commit comments

Comments
 (0)