@@ -303,15 +303,68 @@ class TestProcessing:
303303 Tests for targets in the processing stage.
304304 """
305305
306- def test_original_processing (self ) -> None :
306+ def test_original_processing (
307+ self ,
308+ vuforia_database_keys : VuforiaDatabaseKeys ,
309+ high_quality_image : io .BytesIO ,
310+ ) -> None :
307311 """
308312 Checking for duplicates on a target which is processing, ...
309313 """
310- pass
314+ image_data = high_quality_image .read ()
315+ image_data_encoded = base64 .b64encode (image_data ).decode ('ascii' )
311316
312- def test_duplicate_processing (self ) -> None :
313- """
314- Checking for duplicates on a target which is processed, when another
315- target which is a duplicate is processing, ...
316- """
317- pass
317+ data_1 = {
318+ 'name' : str (uuid .uuid4 ()),
319+ 'width' : 1 ,
320+ 'image' : image_data_encoded ,
321+ }
322+
323+ data_2 = {
324+ 'name' : str (uuid .uuid4 ()),
325+ 'width' : 1 ,
326+ 'image' : image_data_encoded ,
327+ }
328+
329+ resp_1 = add_target_to_vws (
330+ vuforia_database_keys = vuforia_database_keys ,
331+ data = data_1 ,
332+ )
333+
334+ target_id_1 = resp_1 .json ()['target_id' ]
335+
336+ wait_for_target_processed (
337+ vuforia_database_keys = vuforia_database_keys ,
338+ target_id = resp_1 ,
339+ )
340+
341+ resp_2 = add_target_to_vws (
342+ vuforia_database_keys = vuforia_database_keys ,
343+ data = data_2 ,
344+ )
345+
346+ target_id_2 = original_add_resp .json ()['target_id' ]
347+
348+ response = target_api_request (
349+ server_access_key = vuforia_database_keys .server_access_key ,
350+ server_secret_key = vuforia_database_keys .server_secret_key ,
351+ method = GET ,
352+ content = b'' ,
353+ request_path = '/duplicates/' + original_target_id ,
354+ )
355+
356+ assert_vws_response (
357+ response = response ,
358+ status_code = codes .OK ,
359+ result_code = ResultCodes .SUCCESS ,
360+ )
361+
362+ expected_keys = {
363+ 'result_code' ,
364+ 'transaction_id' ,
365+ 'similar_targets' ,
366+ }
367+
368+ assert response .json ().keys () == expected_keys
369+
370+ assert response .json ()['similar_targets' ] == [similar_target_id ]
0 commit comments