Skip to content

Commit 0d30b3b

Browse files
committed
NPA-5090 Update GET /Consent and /Consent/{id} Errors
1 parent bfbc604 commit 0d30b3b

File tree

8 files changed

+7
-310
lines changed

8 files changed

+7
-310
lines changed

postman/Validate Relationship Service Sandbox.postman_collection.json

Lines changed: 4 additions & 265 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"info": {
3-
"_postman_id": "110252c4-5fa1-46ca-a08d-b5ce96e28fde",
4-
"name": "Validate Relationship Service Sandbox 06/06/25",
3+
"_postman_id": "5b4ac95f-34fe-400e-ac8f-714d7cb9cb76",
4+
"name": "Validate Relationship Service Sandbox 09/06/25",
55
"description": "This Postman collection includes example scenarios for each of the Validated Relationship Service (VRS) API endpoints, covering both valid and invalid request scenarios.\n\nThe collection is pointed towards the VRS sandbox environment, which will return a specific example response based on the request sent. All data shown in the requests or responses is test data.\n\nOur sandbox environment only covers the scenarios listed in the Postman collection and is open access. It does not allow you to test authorisation or any scenarios beyond the ones documented.\n\nFull specification is available at [https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service](https://digital.nhs.uk/developer/api-catalogue/validated-relationship-service)",
66
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
7-
"_exporter_id": "18067099",
8-
"_collection_link": "https://www.postman.com/lunar-crescent-672573/workspace/validated-relationship-service-06-06-25/collection/18067099-110252c4-5fa1-46ca-a08d-b5ce96e28fde?action=share&source=collection_link&creator=18067099"
7+
"_exporter_id": "34042403",
8+
"_collection_link": "https://www.postman.com/jackplowman2/validated-relationship-service-sandbox-09-06-25/collection/lp2lvb8/validate-relationship-service-sandbox-09-06-25?action=share&source=collection_link&creator=34042403"
99
},
1010
"item": [
1111
{
@@ -6079,78 +6079,6 @@
60796079
},
60806080
"response": []
60816081
},
6082-
{
6083-
"name": "Invalid include parameter",
6084-
"event": [
6085-
{
6086-
"listen": "test",
6087-
"script": {
6088-
"exec": [
6089-
"const expectedResponseBody = {",
6090-
" \"resourceType\": \"OperationOutcome\",",
6091-
" \"issue\": [",
6092-
" {",
6093-
" \"code\": \"invalid\",",
6094-
" \"details\": {",
6095-
" \"coding\": [",
6096-
" {",
6097-
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
6098-
" \"version\": \"1\",",
6099-
" \"code\": \"INVALID_VALUE\",",
6100-
" \"display\": \"Required parameter(s) are invalid.\"",
6101-
" }",
6102-
" ]",
6103-
" },",
6104-
" \"severity\": \"error\"",
6105-
" }",
6106-
" ],",
6107-
" \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"",
6108-
"}",
6109-
"",
6110-
"const responseJson = pm.response.json();",
6111-
"",
6112-
"pm.test(\"Status code is 422\", function () {",
6113-
" pm.response.to.have.status(422);",
6114-
"});",
6115-
"",
6116-
"pm.test(\"Should have correct error response\", () => {",
6117-
" pm.expect(responseJson.issue[0].details.coding[0].code).to.eql(\"INVALID_VALUE\");",
6118-
"});",
6119-
"",
6120-
"pm.test(\"Should have correct response body\", () => {",
6121-
" pm.expect(responseJson).to.eql(expectedResponseBody);",
6122-
"});"
6123-
],
6124-
"type": "text/javascript",
6125-
"packages": {}
6126-
}
6127-
}
6128-
],
6129-
"request": {
6130-
"method": "GET",
6131-
"header": [],
6132-
"url": {
6133-
"raw": "{{api_base_url}}/Consent?performer:identifier=9000000019&_include=test",
6134-
"host": [
6135-
"{{api_base_url}}"
6136-
],
6137-
"path": [
6138-
"Consent"
6139-
],
6140-
"query": [
6141-
{
6142-
"key": "performer:identifier",
6143-
"value": "9000000019"
6144-
},
6145-
{
6146-
"key": "_include",
6147-
"value": "test"
6148-
}
6149-
]
6150-
}
6151-
},
6152-
"response": []
6153-
},
61546082
{
61556083
"name": "No performer record found",
61566084
"event": [
@@ -8007,195 +7935,6 @@
80077935
},
80087936
"response": []
80097937
},
8010-
{
8011-
"name": "Missing consent ID",
8012-
"event": [
8013-
{
8014-
"listen": "test",
8015-
"script": {
8016-
"exec": [
8017-
"const expectedResponseBody = {",
8018-
" \"issue\": [",
8019-
" {",
8020-
" \"code\": \"invalid\",",
8021-
" \"diagnostics\": \"Invalid request with error - ID must be specified in the request path.\",",
8022-
" \"details\": {",
8023-
" \"coding\": [",
8024-
" {",
8025-
" \"code\": \"MISSING_ID_VALUE\",",
8026-
" \"display\": \"Required parameter(s) are missing.\",",
8027-
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
8028-
" \"version\": \"1\"",
8029-
" }",
8030-
" ]",
8031-
" },",
8032-
" \"severity\": \"error\"",
8033-
" }",
8034-
" ],",
8035-
" \"resourceType\": \"OperationOutcome\"",
8036-
"}",
8037-
"",
8038-
"const responseJson = pm.response.json();",
8039-
"",
8040-
"pm.test(\"Status code is 400\", function () {",
8041-
" pm.response.to.have.status(400);",
8042-
"});",
8043-
"",
8044-
"pm.test(\"Should have correct response body\", () => {",
8045-
" pm.expect(responseJson).to.eql(expectedResponseBody);",
8046-
"});"
8047-
],
8048-
"type": "text/javascript",
8049-
"packages": {}
8050-
}
8051-
}
8052-
],
8053-
"request": {
8054-
"method": "GET",
8055-
"header": [],
8056-
"url": {
8057-
"raw": "{{api_base_url}}/Consent/ ",
8058-
"host": [
8059-
"{{api_base_url}}"
8060-
],
8061-
"path": [
8062-
"Consent",
8063-
" "
8064-
]
8065-
}
8066-
},
8067-
"response": []
8068-
},
8069-
{
8070-
"name": "Invalid include parameter",
8071-
"event": [
8072-
{
8073-
"listen": "test",
8074-
"script": {
8075-
"exec": [
8076-
"const expectedResponseBody = {",
8077-
" \"resourceType\": \"OperationOutcome\",",
8078-
" \"issue\": [",
8079-
" {",
8080-
" \"code\": \"invalid\",",
8081-
" \"details\": {",
8082-
" \"coding\": [",
8083-
" {",
8084-
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
8085-
" \"version\": \"1\",",
8086-
" \"code\": \"INVALID_VALUE\",",
8087-
" \"display\": \"Required parameter(s) are invalid.\"",
8088-
" }",
8089-
" ]",
8090-
" },",
8091-
" \"severity\": \"error\"",
8092-
" }",
8093-
" ],",
8094-
" \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"",
8095-
"}",
8096-
"",
8097-
"const responseJson = pm.response.json();",
8098-
"",
8099-
"pm.test(\"Status code is 422\", function () {",
8100-
" pm.response.to.have.status(422);",
8101-
"});",
8102-
"",
8103-
"pm.test(\"Should have correct response body\", () => {",
8104-
" pm.expect(responseJson).to.eql(expectedResponseBody);",
8105-
"});"
8106-
],
8107-
"type": "text/javascript",
8108-
"packages": {}
8109-
}
8110-
}
8111-
],
8112-
"request": {
8113-
"method": "GET",
8114-
"header": [],
8115-
"url": {
8116-
"raw": "{{api_base_url}}/Consent/39df03a2-1b14-4d19-b1dc-d5d8cbf96948?_include=Consent:invalid",
8117-
"host": [
8118-
"{{api_base_url}}"
8119-
],
8120-
"path": [
8121-
"Consent",
8122-
"39df03a2-1b14-4d19-b1dc-d5d8cbf96948"
8123-
],
8124-
"query": [
8125-
{
8126-
"key": "_include",
8127-
"value": "Consent:invalid"
8128-
}
8129-
]
8130-
}
8131-
},
8132-
"response": []
8133-
},
8134-
{
8135-
"name": "Invalid parameters",
8136-
"event": [
8137-
{
8138-
"listen": "test",
8139-
"script": {
8140-
"exec": [
8141-
"const expectedResponseBody = {",
8142-
" \"resourceType\": \"OperationOutcome\",",
8143-
" \"issue\": [",
8144-
" {",
8145-
" \"code\": \"invalid\",",
8146-
" \"details\": {",
8147-
" \"coding\": [",
8148-
" {",
8149-
" \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",",
8150-
" \"version\": \"1\",",
8151-
" \"code\": \"INVALID_VALUE\",",
8152-
" \"display\": \"Required parameter(s) are invalid.\"",
8153-
" }",
8154-
" ]",
8155-
" },",
8156-
" \"severity\": \"error\"",
8157-
" }",
8158-
" ],",
8159-
" \"diagnostics\": \"Invalid request with error - _include parameter is invalid.\"",
8160-
"}",
8161-
"",
8162-
"const responseJson = pm.response.json();",
8163-
"",
8164-
"pm.test(\"Status code is 422\", function () {",
8165-
" pm.response.to.have.status(422);",
8166-
"});",
8167-
"",
8168-
"pm.test(\"Should have correct response body\", () => {",
8169-
" pm.expect(responseJson).to.eql(expectedResponseBody);",
8170-
"});"
8171-
],
8172-
"type": "text/javascript",
8173-
"packages": {}
8174-
}
8175-
}
8176-
],
8177-
"request": {
8178-
"method": "GET",
8179-
"header": [],
8180-
"url": {
8181-
"raw": "{{api_base_url}}/Consent/74eed847-ca25-4e76-8cf2-f2c2d7842a7a?_unknown=true",
8182-
"host": [
8183-
"{{api_base_url}}"
8184-
],
8185-
"path": [
8186-
"Consent",
8187-
"74eed847-ca25-4e76-8cf2-f2c2d7842a7a"
8188-
],
8189-
"query": [
8190-
{
8191-
"key": "_unknown",
8192-
"value": "true"
8193-
}
8194-
]
8195-
}
8196-
},
8197-
"response": []
8198-
},
81997938
{
82007939
"name": "Proxy role not found",
82017940
"event": [

sandbox/api/constants.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373

7474
# GET Consent by ID
7575
GET_CONSENT_BY_ID__INVALID_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/invalid-id.yaml"
76-
GET_CONSENT_BY_ID__MISSING_ID_ERROR = f"{GET_CONSENT__DIRECTORY}ID/errors/missing-id.yaml"
7776

7877
# POST Consent
7978
POST_CONSENT__DIRECTORY = "./api/examples/POST_Consent/"

sandbox/api/get_consent_by_id.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PATIENT,
1515
GET_CONSENT__SINGLE_MOTHER_CHILD_RELATIONSHIP_INCLUDE_PERFORMER,
1616
GET_CONSENT_BY_ID__INVALID_ID_ERROR,
17-
GET_CONSENT_BY_ID__MISSING_ID_ERROR,
1817
BAD_REQUEST_INCLUDE_PARAM_INVALID,
1918
INVALIDATED_RESOURCE,
2019
)
@@ -54,8 +53,6 @@ def get_consent_by_id_response(identifier: str) -> Union[dict, tuple]:
5453
)
5554
elif identifier == "a0922245-1072-40c3-8f4e-a7490c10d365":
5655
return generate_response_from_example(INVALIDATED_RESOURCE, 404)
57-
elif identifier == " " or identifier is None:
58-
return generate_response_from_example(GET_CONSENT_BY_ID__MISSING_ID_ERROR, 400)
5956
else:
6057
return generate_response_from_example(GET_CONSENT_BY_ID__INVALID_ID_ERROR, 400)
6158

sandbox/api/tests/test_get_consent.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,6 @@ def test_get_consent_returns_expected_responses__mocked_get_consent(
173173
"./api/examples/GET_Consent/errors/invalid-status-parameter.yaml",
174174
422,
175175
),
176-
(
177-
"performer:identifier=9000000019&_include=test", # Invalid include parameter error
178-
"./api/examples/errors/invalid-include-parameter.yaml",
179-
422,
180-
),
181176
(
182177
"performer:identifier=90000009990", # Invalid performer identifier
183178
"./api/examples/GET_Consent/errors/invalid-identifier.yaml",

sandbox/api/tests/test_get_consent_by_id.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,12 @@
1111
@pytest.mark.parametrize(
1212
("consent_id", "include_params", "response_file_name", "status_code"),
1313
[
14-
(
15-
"a0922245-1072-40c3-8f4e-a7490c10d365", # Invalid parameters
16-
"_invalid=test",
17-
"./api/examples/errors/invalid-include-parameter.yaml",
18-
422,
19-
),
2014
(
2115
"a0922245-1072-40c3-8f4e-a7490c10d365", # No proxy-role record found error
2216
"",
2317
"./api/examples/errors/invalidated-resource.yaml",
2418
404,
2519
),
26-
(
27-
" ", # Missing consent ID
28-
"",
29-
"./api/examples/GET_Consent/ID/errors/missing-id.yaml",
30-
400,
31-
),
3220
(
3321
"test", # Invalid consent ID
3422
"",

sandbox/api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def check_for_consent_include_params(
262262
elif len(_include) == 2 and CONSENT_PATIENT in _include and CONSENT_PERFORMER in _include:
263263
return generate_response_from_example(include_both_response_yaml, 200)
264264
else:
265-
return generate_response_from_example(BAD_REQUEST_INCLUDE_PARAM_INVALID, 422)
265+
return generate_response_from_example(include_none_response_yaml, 200)
266266

267267

268268
def check_for_consent_filtering(

specification/examples/responses/GET_Consent/ID/errors/missing-id.yaml

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

0 commit comments

Comments
 (0)