Skip to content

Commit 49b8328

Browse files
committed
Resolve e2e test failures
1 parent 0f0abdc commit 49b8328

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

lambdas/backend/src/controller/fhir_controller.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,12 @@ def _get_search_params_from_request(
214214
"""Simple helper function to retrieve the search params from the relevant part of the AWS event, depending on
215215
which search endpoint is being used"""
216216
if not is_post_endpoint_req:
217-
return get_multi_value_query_params(aws_event)
217+
return get_multi_value_query_params(aws_event) if not None else {}
218218

219-
decoded_body = base64.b64decode(aws_event.get("body", "")).decode("utf-8")
219+
form_body = aws_event.get("body")
220+
221+
if not form_body:
222+
return {}
223+
224+
decoded_body = base64.b64decode(form_body).decode("utf-8")
220225
return parse_qs(decoded_body)

lambdas/backend/tests/service/test_fhir_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def test_get_immunization_by_identifier_when_elements_parameter_provided(self):
315315
)
316316
self.assertEqual(
317317
result.entry[0].resource,
318-
Immunization.construct(**{"resourceType": "Immunization", "id": "1234-some-id", "meta": {"versionId": "1"}}),
318+
Immunization.construct(**{"resourceType": "Immunization", "id": "1234-some-id", "meta": {"versionId": 1}}),
319319
)
320320

321321

lambdas/shared/src/common/models/utils/generic_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def make_search_bundle(
174174
if not resource:
175175
return make_empty_search_bundle(searched_url)
176176

177-
meta = {"versionId": str(version_id)}
177+
meta = {"versionId": version_id}
178178

179179
# Full Immunization payload to be returned if only the identifier parameter was provided and truncated when
180180
# _elements is used

tests/e2e/test_search_by_identifier_immunization.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ class SearchTestParams(NamedTuple):
182182
"POST",
183183
f"identifier={identifier_system}|{identifier_value}",
184184
f"identifier={identifier_system}|{identifier_value}",
185-
False,
186-
400,
185+
True,
186+
200,
187187
),
188188
]
189189
for search in searches:

tests/e2e/test_search_immunization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def test_search_immunization_accepts_include_and_provides_patient(self):
379379
imms_obj_id = self.store_records(imms_obj)
380380

381381
response = self.default_imms_api.search_immunizations_full(
382-
"POST",
382+
"GET",
383383
f"patient.identifier={valid_patient_identifier1}&-immunization.target={VaccineTypes.mmr}"
384384
+ "&_include=Immunization:patient",
385385
body=None,

0 commit comments

Comments
 (0)