Skip to content

Commit 766d9a2

Browse files
committed
Remove one more use of a custom helper
1 parent 8f93947 commit 766d9a2

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

tests/mock_vws/test_add_target.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -501,29 +501,24 @@ def test_image_valid(
501501
@staticmethod
502502
def test_bad_image_format_or_color_space(
503503
bad_image_file: io.BytesIO,
504-
vuforia_database: VuforiaDatabase,
504+
vws_client: VWS,
505505
) -> None:
506506
"""
507507
An `UNPROCESSABLE_ENTITY` response is returned if an image which is not
508508
a JPEG or PNG file is given, or if the given image is not in the
509509
greyscale or RGB color space.
510510
"""
511-
image_data = bad_image_file.read()
512-
image_data_encoded = base64.b64encode(s=image_data).decode("ascii")
513-
514-
data = {
515-
"name": "example_name",
516-
"width": 1,
517-
"image": image_data_encoded,
518-
}
519-
520-
response = _add_target_to_vws(
521-
vuforia_database=vuforia_database,
522-
data=data,
523-
)
511+
with pytest.raises(expected_exception=BadImage) as exc:
512+
vws_client.add_target(
513+
name="example_name",
514+
width=1,
515+
image=bad_image_file,
516+
application_metadata=None,
517+
active_flag=True,
518+
)
524519

525520
assert_vws_failure(
526-
response=response,
521+
response=exc.value.response,
527522
status_code=HTTPStatus.UNPROCESSABLE_ENTITY,
528523
result_code=ResultCodes.BAD_IMAGE,
529524
)

0 commit comments

Comments
 (0)