Skip to content

Commit ceeb684

Browse files
NPA-4511: Reworked exmaples
1 parent c002f40 commit ceeb684

File tree

7 files changed

+22
-48
lines changed

7 files changed

+22
-48
lines changed

sandbox/api/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def get_related_persons() -> Union[dict, tuple]:
114114
raise ValueError("Invalid request")
115115

116116
except Exception as e:
117-
logger.error(e)
117+
logger.exception("GET related person failed")
118118
return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500)
119119

120120

@@ -129,7 +129,7 @@ def post_questionnaire_response() -> Union[dict, tuple]:
129129
try:
130130
return generate_response_from_example(QUESTIONNAIRE_RESPONSE__SUCCESS, 200)
131131
except Exception as e:
132-
logger.error(e)
132+
logger.exception("POST questionnaire response failed")
133133
return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500)
134134

135135

@@ -187,8 +187,8 @@ def get_consent() -> Union[dict, tuple]:
187187
logger.error("Performer identifier does not match examples")
188188
return generate_response_from_example(INVALIDATED_RESOURCE, 404)
189189

190-
except Exception as e:
191-
logger.error(e)
190+
except Exception:
191+
logger.exception("GET Consent failed")
192192
return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500)
193193

194194

@@ -238,7 +238,7 @@ def post_consent() -> Union[dict, tuple]:
238238

239239
return response
240240

241-
except Exception as e:
241+
except Exception:
242242
# Handle any general error
243-
logger.error(e)
243+
logger.exception("POST Consent failed")
244244
return generate_response_from_example(INTERNAL_SERVER_ERROR_EXAMPLE, 500)

specification/examples/responses/POST_Consent/errors/business_rule_validation_failed.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

specification/examples/responses/POST_Consent/errors/conflict_with_request_proxy_role.yaml

Lines changed: 0 additions & 15 deletions
This file was deleted.

specification/examples/responses/POST_Consent/errors/duplicate_relationship_error.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PostConsentDuplicateRelationshipError:
2-
summary: Bad request for proxy role that already exists
2+
summary: Duplicate request for proxy role that already exists
33
description: 409 error response bundle for a duplicate proxy role
44
value:
55
issue:

specification/examples/responses/POST_Consent/errors/invalid_evidence_error.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PostConsentInvalidEvidenceError:
2-
summary: Bad request missing evidence of responsibility
2+
summary: Missing evidence of responsibility
33
description: 422 error response bundle for a request without evidence of responsibility
44
value:
55
issue:

specification/examples/responses/POST_Consent/errors/invalid_patient_age_error.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PostConsentInvalidPatientAgeError:
2-
summary: Bad request invalid patient age
2+
summary: Invalid patient age
33
description: 422 error response bundle for a request with an invalid patient age
44
value:
55
issue:

specification/validated-relationships-service-api.yaml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,19 @@ paths:
483483
Use this endpoint to create a new proxy role between a patient and a related person (proxy).
484484
485485
## Sandbox test scenarios
486-
| Scenario | Request | Response |
487-
| --------------------------------------- | ------------------------------------------------------------- | --------------------------------------------------------- |
488-
| Successful parent-child proxy creation | Valid request with a legal basis of parental responsibility | HTTP Status 201 and OperationOutcome response |
489-
| Successful adult-adult proxy creation | Valid request with legal basis of consent | HTTP Status 201 and OperationOutcome response |
490-
| Invalid performer NHS number | Request with invalid NHS number format | HTTP Status 400 and INVALID_NHS_NUMBER error response |
491-
| Missing required evidence | Request without evidence of responsibility | HTTP Status 422 and MISSING_EVIDENCE error response |
492-
| Invalid access level | Request with undefined access level code | HTTP Status 400 and INVALID_ACCESS_LEVEL error response |
493-
| Patient age validation failure | Request for child proxy where child is over 16 | HTTP Status 422 and INVALID_PATIENT_AGE error response |
494-
| Duplicate relationship | Request for relationship that already exists | HTTP Status 409 and DUPLICATE_RELATIONSHIP error response |
486+
487+
The sandbox supports a limited number of scenarios, and does not attempt to validate requests. The expected results is dependant up the `performer.identifier.value`performer.identifier.value
488+
489+
See the postman collection for the full JSON.
490+
| Scenario | Request | Response |
491+
| --------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
492+
| Successful parent-child proxy creation | Valid request with a legal basis of parental responsibility, with performer identifier value of 9000000009 | HTTP Status 201 and OperationOutcome response |
493+
| Successful adult-adult proxy creation | Valid request with legal basis of consent, with performer identifier value of 9000000017 | HTTP Status 201 and OperationOutcome response |
494+
| Invalid performer NHS number | Request with invalid NHS number format, with performer identifier value of 9000000000 | HTTP Status 400 and INVALID_NHS_NUMBER error response |
495+
| Invalid access level | Request with undefined access level code, with performer identifier value of 9000000025 | HTTP Status 400 and INVALID_ACCESS_LEVEL error response |
496+
| Missing required evidence | Request without evidence of responsibility, with performer identifier value of 9000000033 | HTTP Status 422 and MISSING_EVIDENCE error response |
497+
| Patient age validation failure | Request for child proxy where child is over 16, with performer identifier value of 9000000041 | HTTP Status 422 and INVALID_PATIENT_AGE error response |
498+
| Duplicate relationship | Request for relationship that already exists, with performer identifier value of 9000000049 | HTTP Status 409 and DUPLICATE_RELATIONSHIP error response |
495499
requestBody:
496500
required: true
497501
content:

0 commit comments

Comments
 (0)