Skip to content

Commit 7171add

Browse files
committed
VED-736: refactor search response to avoid getting no response2
1 parent 2a47c9a commit 7171add

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

backend/src/fhir_service.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def get_immunization_by_identifier(
6969
)
7070

7171
patient_full_url = f"urn:uuid:{str(uuid4())}"
72-
imms_list = [imms_resp] if isinstance(imms_resp, dict) else list(imms_resp or [])
73-
filtered_response = [Filter.search(imms, patient_full_url) for imms in imms_list]
72+
filtered_response = [Filter.search(imms, patient_full_url) for imms in imms_resp]
7473

7574
if not filtered_response:
7675
base_url = f"{get_service_url()}/Immunization"

backend/tests/test_fhir_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,11 @@ def test_get_immunization_by_identifier(self):
339339
def test_immunization_not_found(self):
340340
"""it should return None if Immunization doesn't exist"""
341341
imms_id = "none"
342+
imms_ids = ["imms-1", "imms-2"]
342343
identifier = "test"
343344
element = "id"
344-
self.imms_repo.get_immunization_by_identifier.return_value = None
345+
imms_list = [create_covid_19_immunization_dict(imms_id) for imms_id in imms_ids]
346+
self.imms_repo.find_immunizations.return_value = deepcopy(imms_list)
345347

346348
# When
347349
act_imms = self.fhir_service.get_immunization_by_identifier(imms_id, "COVID19.S", identifier, element)

0 commit comments

Comments
 (0)