Skip to content

Commit 10fa4fe

Browse files
committed
Passing test for target in the processing state
1 parent 05048e1 commit 10fa4fe

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/mock_vws/_mock_web_services_api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ def get_duplicates(
593593
other.target_id for other in other_targets
594594
if Image.open(other.image) == Image.open(target.image) and
595595
TargetStatuses.FAILED.value not in (target.status, other.status)
596-
and TargetStatuses.PROCESSING.value not in
597-
(target.status, other.status) and other.active_flag
596+
and TargetStatuses.PROCESSING.value != other.status
597+
and other.active_flag
598598
]
599599

600600
body = {

tests/mock_vws/test_get_duplicates.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,14 @@ class TestProcessing:
317317
Tests for targets in the processing stage.
318318
"""
319319

320-
def test_original_processing(
320+
def test_processing(
321321
self,
322322
vuforia_database_keys: VuforiaDatabaseKeys,
323323
high_quality_image: io.BytesIO,
324324
) -> None:
325325
"""
326-
Checking for duplicates on a target which is processing, ...
326+
If a target is in the processing state, it can have duplicates.
327+
Targets can have duplicates in the processing state.
327328
"""
328329
image_data = high_quality_image.read()
329330
image_data_encoded = base64.b64encode(image_data).decode('ascii')
@@ -370,4 +371,11 @@ def test_original_processing(
370371
vuforia_database_keys=vuforia_database_keys,
371372
target_id=processing_target_id,
372373
)
373-
assert response.json()['similar_targets'] == []
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

Comments
 (0)