Skip to content

Commit 8489f32

Browse files
committed
Progress towards max char value
1 parent d459d46 commit 8489f32

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CONTRIBUTING.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,8 @@ A response to an invalid query may have an ``application/json`` content type but
178178

179179
After deleting a target, for up to approximately 30 seconds, matching it with a query returns a 500 response.
180180

181+
A target with the name ``\uffff`` gets stuck in processing.
182+
181183
Performing a release
182184
--------------------
183185

tests/mock_vws/test_add_target.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,16 @@ class TestTargetName:
203203
Tests for the target name field.
204204
"""
205205

206+
_MAX_CHAR_VALUE = 65535
207+
206208
@pytest.mark.parametrize(
207209
'name',
208210
[
209211
'á',
212+
chr(_MAX_CHAR_VALUE),
210213
'a' * 64,
211214
],
212-
ids=['Short name', 'Long name'],
215+
ids=['Short name', 'Max char value', 'Long name'],
213216
)
214217
def test_name_valid(
215218
self,
@@ -249,9 +252,10 @@ def test_name_invalid(
249252
vuforia_database_keys: VuforiaDatabaseKeys,
250253
) -> None:
251254
"""
252-
A target's name must be a UTF-8 encoded string of length 0 < N < 65.
255+
A target's name must be a string of length 0 < N < 65.
253256
254-
We test bad encoding in another test as it has a different error.
257+
We test characters out of range in another test as that gives a
258+
different error.
255259
"""
256260
image_data = png_rgb.read()
257261
image_data_encoded = base64.b64encode(image_data).decode('ascii')
@@ -273,13 +277,12 @@ def test_name_invalid(
273277
result_code=ResultCodes.FAIL,
274278
)
275279

276-
# TODO also on update
277-
def test_not_utf8_encoded(
280+
def test_character_out_of_range(
278281
self,
279282
png_rgb: io.BytesIO,
280283
vuforia_database_keys: VuforiaDatabaseKeys,
281284
) -> None:
282-
name = '\U0001f604'
285+
name = chr(self._MAX_CHAR_VALUE + 1)
283286
image_data = png_rgb.read()
284287
image_data_encoded = base64.b64encode(image_data).decode('ascii')
285288

0 commit comments

Comments
 (0)