Skip to content

Commit 976c30f

Browse files
committed
Progress towards update test
1 parent 15b2833 commit 976c30f

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

tests/mock_vws/test_add_target.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,8 @@ def test_image_too_large(
492492
# We check that the image we created is just slightly smaller than the
493493
# maximum file size.
494494
#
495-
# This is just because of the implementation details of ``image_file``.
495+
# This is just because of the implementation details of
496+
# ``max_image_file``.
496497
assert image_content_size < max_bytes
497498
assert (image_content_size * 1.05) > max_bytes
498499

@@ -524,7 +525,8 @@ def test_image_too_large(
524525
# We check that the image we created is just slightly smaller than the
525526
# maximum file size.
526527
#
527-
# This is just because of the implementation details of ``image_file``.
528+
# This is just because of the implementation details of
529+
# ``max_image_file``.
528530
assert image_content_size < max_bytes
529531
assert (image_content_size * 1.05) > max_bytes
530532

tests/mock_vws/test_update_target.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,13 +804,30 @@ def test_image_too_large(
804804
"""
805805
No error is returned when the given image is corrupted.
806806
"""
807-
image_data_encoded = base64.b64encode(image_data).decode('ascii')
807+
max_bytes = 2.3 * 1024 * 1024
808+
width = height = 886
809+
png_not_too_large = make_image_file(
810+
file_format='PNG',
811+
color_space='RGB',
812+
width=width,
813+
height=height,
814+
)
815+
width = width + 1
816+
height = height + 1
817+
png_too_large = make_image_file(
818+
file_format='PNG',
819+
color_space='RGB',
820+
width=width,
821+
height=height,
822+
)
808823

809824
wait_for_target_processed(
810825
vuforia_database_keys=vuforia_database_keys,
811826
target_id=target_id,
812827
)
813828

829+
image_data_encoded = base64.b64encode(image_data).decode('ascii')
830+
814831
response = update_target(
815832
vuforia_database_keys=vuforia_database_keys,
816833
data={'image': image_data_encoded},
@@ -823,6 +840,11 @@ def test_image_too_large(
823840
result_code=ResultCodes.SUCCESS,
824841
)
825842

843+
wait_for_target_processed(
844+
vuforia_database_keys=vuforia_database_keys,
845+
target_id=target_id,
846+
)
847+
826848
def test_not_base64_encoded(
827849
self,
828850
vuforia_database_keys: VuforiaDatabaseKeys,

0 commit comments

Comments
 (0)