@@ -124,37 +124,34 @@ def test_install_and_call_flask_lambda_with_unknown_nhs_number(
124124 timeout = 10 ,
125125 )
126126
127- decoded_body_bytes = base64 .b64decode (response .text )
128- decoded_body_json = json .loads (decoded_body_bytes .decode ("utf-8" ))
129-
130127 assert_that (
131128 response ,
132129 is_response ()
133130 .with_status_code (HTTPStatus .NOT_FOUND )
134- .with_headers (has_entries ({"Content-Type" : "application/fhir+json" })),
135- )
136-
137- # Then
138- assert_that (
139- decoded_body_json ,
140- has_entries (
141- resourceType = equal_to ("OperationOutcome" ),
142- issue = contains_exactly (
131+ .with_headers (has_entries ({"Content-Type" : "application/fhir+json" }))
132+ .and_body (
133+ is_json_that (
143134 has_entries (
144- severity = "error" ,
145- code = "processing" ,
146- diagnostics = f"NHS Number '{ nhs_number !s} ' was not recognised by the Eligibility Signposting API" ,
147- details = {
148- "coding" : [
149- {
150- "system" : "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
151- "code" : "REFERENCE_NOT_FOUND" ,
152- "display" : "The given NHS number was not found in our datasets. "
153- "This could be because the number is incorrect or "
154- "some other reason we cannot process that number." ,
155- }
156- ]
157- },
135+ resourceType = "OperationOutcome" ,
136+ issue = contains_exactly (
137+ has_entries (
138+ severity = "error" ,
139+ code = "processing" ,
140+ diagnostics = f"NHS Number '{ nhs_number !s} ' was not "
141+ f"recognised by the Eligibility Signposting API" ,
142+ details = {
143+ "coding" : [
144+ {
145+ "system" : "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1" ,
146+ "code" : "REFERENCE_NOT_FOUND" ,
147+ "display" : "The given NHS number was not found in our datasets. "
148+ "This could be because the number is incorrect or "
149+ "some other reason we cannot process that number." ,
150+ }
151+ ]
152+ },
153+ )
154+ ),
158155 )
159156 ),
160157 ),
0 commit comments