Skip to content

Commit 4e274ce

Browse files
committed
Passing test on real
1 parent 34ac43c commit 4e274ce

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

tests/mock_vws/test_add_target.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ def test_name_invalid(
249249
vuforia_database_keys: VuforiaDatabaseKeys,
250250
) -> None:
251251
"""
252-
A target's name must be a string of length 0 < N < 65.
252+
A target's name must be a UTF-8 encoded string of length 0 < N < 65.
253+
254+
We test bad encoding in another test as it has a different error.
253255
"""
254256
image_data = png_rgb.read()
255257
image_data_encoded = base64.b64encode(image_data).decode('ascii')
@@ -271,6 +273,33 @@ def test_name_invalid(
271273
result_code=ResultCodes.FAIL,
272274
)
273275

276+
# TODO also on update
277+
def test_not_utf8_encoded(
278+
self,
279+
png_rgb: io.BytesIO,
280+
vuforia_database_keys: VuforiaDatabaseKeys,
281+
) -> None:
282+
name = '\U0001f604'
283+
image_data = png_rgb.read()
284+
image_data_encoded = base64.b64encode(image_data).decode('ascii')
285+
286+
data = {
287+
'name': name,
288+
'width': 1,
289+
'image': image_data_encoded,
290+
}
291+
292+
response = add_target_to_vws(
293+
vuforia_database_keys=vuforia_database_keys,
294+
data=data,
295+
)
296+
297+
assert_vws_failure(
298+
response=response,
299+
status_code=codes.INTERNAL_SERVER_ERROR,
300+
result_code=ResultCodes.FAIL,
301+
)
302+
274303
def test_existing_target_name(
275304
self,
276305
png_rgb: io.BytesIO,

0 commit comments

Comments
 (0)