@@ -194,6 +194,13 @@ def test_status(
194194
195195 assert response .json ()['similar_targets' ] == []
196196
197+
198+ @pytest .mark .usefixtures ('verify_mock_vuforia' )
199+ class TestActiveFlag :
200+ """
201+ Tests for the effects of the active flag on duplicate matching.
202+ """
203+
197204 def test_active_flag_duplicate (
198205 self ,
199206 vuforia_database_keys : VuforiaDatabaseKeys ,
@@ -302,3 +309,73 @@ def test_active_flag_original(
302309 )
303310
304311 assert response .json ()['similar_targets' ] == [similar_target_id ]
312+
313+
314+ @pytest .mark .usefixtures ('verify_mock_vuforia' )
315+ class TestProcessing :
316+ """
317+ Tests for targets in the processing stage.
318+ """
319+
320+ def test_processing (
321+ self ,
322+ vuforia_database_keys : VuforiaDatabaseKeys ,
323+ high_quality_image : io .BytesIO ,
324+ ) -> None :
325+ """
326+ If a target is in the processing state, it can have duplicates.
327+ Targets can have duplicates in the processing state.
328+ """
329+ image_data = high_quality_image .read ()
330+ image_data_encoded = base64 .b64encode (image_data ).decode ('ascii' )
331+
332+ data_1 = {
333+ 'name' : str (uuid .uuid4 ()),
334+ 'width' : 1 ,
335+ 'image' : image_data_encoded ,
336+ }
337+
338+ data_2 = {
339+ 'name' : str (uuid .uuid4 ()),
340+ 'width' : 1 ,
341+ 'image' : image_data_encoded ,
342+ }
343+
344+ resp_1 = add_target_to_vws (
345+ vuforia_database_keys = vuforia_database_keys ,
346+ data = data_1 ,
347+ )
348+
349+ processed_target_id = resp_1 .json ()['target_id' ]
350+
351+ wait_for_target_processed (
352+ vuforia_database_keys = vuforia_database_keys ,
353+ target_id = processed_target_id ,
354+ )
355+
356+ resp_2 = add_target_to_vws (
357+ vuforia_database_keys = vuforia_database_keys ,
358+ data = data_2 ,
359+ )
360+
361+ processing_target_id = resp_2 .json ()['target_id' ]
362+
363+ response = target_duplicates (
364+ vuforia_database_keys = vuforia_database_keys ,
365+ target_id = processed_target_id ,
366+ )
367+
368+ assert response .json ()['similar_targets' ] == []
369+
370+ response = target_duplicates (
371+ vuforia_database_keys = vuforia_database_keys ,
372+ target_id = processing_target_id ,
373+ )
374+
375+ status_response = get_vws_target (
376+ vuforia_database_keys = vuforia_database_keys ,
377+ target_id = processing_target_id ,
378+ )
379+
380+ assert status_response .json ()['status' ] == 'processing'
381+ assert response .json ()['similar_targets' ] == [processed_target_id ]
0 commit comments