File tree Expand file tree Collapse file tree 2 files changed +59
-0
lines changed
Expand file tree Collapse file tree 2 files changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -440,6 +440,34 @@ def test_bad_image_format_or_color_space(
440440 result_code = ResultCodes .BAD_IMAGE ,
441441 )
442442
443+ def test_corrupted (
444+ self ,
445+ vuforia_database_keys : VuforiaDatabaseKeys ,
446+ png_rgb : io .BytesIO ,
447+ ) -> None :
448+ """
449+ No error is returned when the given image is corrupted.
450+ """
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 )
454+
455+ image_data = corrupted_file .read ()
456+ image_data_encoded = base64 .b64encode (image_data ).decode ('ascii' )
457+
458+ data = {
459+ 'name' : 'example_name' ,
460+ 'width' : 1 ,
461+ 'image' : image_data_encoded ,
462+ }
463+
464+ response = add_target_to_vws (
465+ vuforia_database_keys = vuforia_database_keys ,
466+ data = data ,
467+ )
468+
469+ assert_success (response = response )
470+
443471 def test_too_large_and_corrupted (
444472 self ,
445473 vuforia_database_keys : VuforiaDatabaseKeys ,
Original file line number Diff line number Diff line change @@ -765,6 +765,37 @@ def test_bad_image_format_or_color_space(
765765 result_code = ResultCodes .BAD_IMAGE ,
766766 )
767767
768+ def test_corrupted (
769+ self ,
770+ vuforia_database_keys : VuforiaDatabaseKeys ,
771+ png_rgb : io .BytesIO ,
772+ target_id : str ,
773+ ) -> None :
774+ """
775+ No error is returned when the given image is corrupted.
776+ """
777+ original_data = png_rgb .getvalue ()
778+ corrupted_data = original_data .replace (b'IEND' , b'\x00 ' + b'IEND' )
779+
780+ image_data_encoded = base64 .b64encode (corrupted_data ).decode ('ascii' )
781+
782+ wait_for_target_processed (
783+ vuforia_database_keys = vuforia_database_keys ,
784+ target_id = target_id ,
785+ )
786+
787+ response = update_target (
788+ vuforia_database_keys = vuforia_database_keys ,
789+ data = {'image' : image_data_encoded },
790+ target_id = target_id ,
791+ )
792+
793+ assert_vws_response (
794+ response = response ,
795+ status_code = codes .OK ,
796+ result_code = ResultCodes .SUCCESS ,
797+ )
798+
768799 def test_too_large_and_corrupted (
769800 self ,
770801 vuforia_database_keys : VuforiaDatabaseKeys ,
You can’t perform that action at this time.
0 commit comments