From 2290a0ae59e0b2a5928926711f2a54d755bf5eb6 Mon Sep 17 00:00:00 2001 From: Ellie Bound <175816742+ellie-bound1-NHSD@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:47:42 +0100 Subject: [PATCH 1/3] NPA-5088: Update postman json --- ...ip Service Sandbox.postman_collection.json | 124 ++++++++++++++---- 1 file changed, 95 insertions(+), 29 deletions(-) diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 5c3d4a6f..5a22ae0c 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -1,10 +1,10 @@ { "info": { - "_postman_id": "e3d42c87-bf68-4cae-b08d-e1fd0dba1f80", - "name": "Validate Relationship Service Sandbox 29/05/25", + "_postman_id": "de538326-5564-4efd-9ed2-d1c64142fcfe", + "name": "Validate Relationship Service Sandbox 04/06/25", "description": "Example usage of the Validate Relationship Service (VRS) sandbox.\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)", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "34042403" + "_exporter_id": "44536620" }, "item": [ { @@ -6053,7 +6053,7 @@ "});", "", "pm.test(\"Location header is returned\", () => {", - " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/9000000009\")", + " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205\")", "})" ], "type": "text/javascript", @@ -6112,7 +6112,7 @@ "});", "", "pm.test(\"Location header is returned\", () => {", - " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/9000000017\")", + " pm.response.to.have.header(\"Location\", \"https://sandbox.api.service.nhs.uk/validated-relationships/FHIR/R4/Consent/90b9863e-e33c-4895-a333-fd0ea0e23205\")", "})" ], "type": "text/javascript", @@ -6328,13 +6328,13 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/c6f48e4d", + "raw": "{{api_base_url}}/Consent/c512b0db-6702-43ee-8c21-bbded2552da9", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "c6f48e4d" + "c512b0db-6702-43ee-8c21-bbded2552da9" ] }, "description": "Valid patch changing status to 'active'" @@ -6385,13 +6385,13 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/0c56a594", + "raw": "{{api_base_url}}/Consent/6b71ac92-baa3-4b76-b0f5-a601257e2722", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "0c56a594" + "6b71ac92-baa3-4b76-b0f5-a601257e2722" ] }, "description": "Valid patch modifying the role end date" @@ -6442,13 +6442,13 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/b02ea26c", + "raw": "{{api_base_url}}/Consent/43003db8-ffcd-4bd6-ab2f-b49b9656f9e5", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "b02ea26c" + "43003db8-ffcd-4bd6-ab2f-b49b9656f9e5" ] }, "description": "Valid patch modifying the role end date" @@ -6466,12 +6466,12 @@ " \"issue\": [", " {", " \"code\": \"invalid\",", - " \"diagnostics\": \"Patch attempting invalid status change.\",", + " \"diagnostics\": \"Invalid status code.\",", " \"details\": {", " \"coding\": [", " {", - " \"code\": \"INVALID_STATE_TRANSITION\",", - " \"display\": \"Status change is invalid.\",", + " \"code\": \"INVALID_STATUS_CODE\",", + " \"display\": \"Status code is invalid.\",", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\"", " }", @@ -6510,13 +6510,13 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/6fb4361b", + "raw": "{{api_base_url}}/Consent/78c35330-fa2f-4934-a5dd-fff847f38de5", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "6fb4361b" + "78c35330-fa2f-4934-a5dd-fff847f38de5" ] }, "description": "Patch with invalid status value" @@ -6578,13 +6578,13 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/94df7c8f", + "raw": "{{api_base_url}}/Consent/01abb0c5-b1ac-499d-9655-9cd0b8d3588f", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "94df7c8f" + "01abb0c5-b1ac-499d-9655-9cd0b8d3588f" ] }, "description": "Patch targeting non-existent element" @@ -6714,13 +6714,13 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/3a2679eb", + "raw": "{{api_base_url}}/Consent/849ea584-2318-471b-a24c-cee1b5ad0137", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "3a2679eb" + "849ea584-2318-471b-a24c-cee1b5ad0137" ] }, "description": "Malformed JSON patch document" @@ -6738,12 +6738,12 @@ " \"issue\": [", " {", " \"code\": \"invalid\",", - " \"diagnostics\": \"Malformed JSON patch document.\",", + " \"diagnostics\": \"Patch attempting invalid status change.\",", " \"details\": {", " \"coding\": [", " {", - " \"code\": \"INVALID_PATCH_FORMAT\",", - " \"display\": \"Request format is invalid.\",", + " \"code\": \"INVALID_STATE_TRANSITION\",", + " \"display\": \"Status change is invalid.\",", " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", " \"version\": \"1\"", " }", @@ -6755,8 +6755,8 @@ " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 400\", function () {", - " pm.response.to.have.status(400);", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(422);", "});", "", "pm.test(\"Should have correct response body\", () => {", @@ -6774,7 +6774,7 @@ "header": [], "body": { "mode": "raw", - "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"active\"\n }\n]", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"someinvalidcode\"\n }\n]", "options": { "raw": { "language": "json" @@ -6782,16 +6782,82 @@ } }, "url": { - "raw": "{{api_base_url}}/Consent/3a2679eb", + "raw": "{{api_base_url}}/Consent/7b7f47b8-96e5-43eb-b733-283bf1449f2c", "host": [ "{{api_base_url}}" ], "path": [ "Consent", - "3a2679eb" + "7b7f47b8-96e5-43eb-b733-283bf1449f2c" ] + } + }, + "response": [] + }, + { + "name": "Invalid Status Reason", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const expectedResponseBody = {", + " \"issue\": [", + " {", + " \"code\": \"invalid\",", + " \"diagnostics\": \"Invalid status reason.\",", + " \"details\": {", + " \"coding\": [", + " {", + " \"code\": \"INVALID_STATUS_REASON\",", + " \"display\": \"Status reason is invalid.\",", + " \"system\": \"https://fhir.nhs.uk/R4/CodeSystem/ValidatedRelationships-ErrorOrWarningCode\",", + " \"version\": \"1\"", + " }", + " ]", + " },", + " \"severity\": \"error\"", + " }", + " ],", + " \"resourceType\": \"OperationOutcome\"", + "}", + "", + "pm.test(\"Status code is 201\", function () {", + " pm.response.to.have.status(422);", + "});", + "", + "pm.test(\"Should have correct response body\", () => {", + " var responseJson = pm.response.json();", + " pm.expect(responseJson).to.eql(expectedResponseBody);", + "});" + ], + "type": "text/javascript", + "packages": {} + } + } + ], + "request": { + "method": "PATCH", + "header": [], + "body": { + "mode": "raw", + "raw": "[\n {\n \"op\": \"replace\",\n \"path\": \"/status\",\n \"value\": \"someinvalidcode\"\n }\n]", + "options": { + "raw": { + "language": "json" + } + } }, - "description": "Malformed JSON patch document" + "url": { + "raw": "{{api_base_url}}/Consent/51fb4df5-815a-45cd-8427-04d6558336b7", + "host": [ + "{{api_base_url}}" + ], + "path": [ + "Consent", + "51fb4df5-815a-45cd-8427-04d6558336b7" + ] + } }, "response": [] } From 5124efbeeca391d0970c248287e1870d478c06f5 Mon Sep 17 00:00:00 2001 From: Ellie Bound <175816742+ellie-bound1-NHSD@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:03:24 +0100 Subject: [PATCH 2/3] NPA-5088: Update run postman url --- specification/validated-relationships-service-api.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/validated-relationships-service-api.yaml b/specification/validated-relationships-service-api.yaml index 6ae72bbf..6281b592 100644 --- a/specification/validated-relationships-service-api.yaml +++ b/specification/validated-relationships-service-api.yaml @@ -126,7 +126,7 @@ info: * only covers a limited set of scenarios * is open access, so does not allow you to test authorisation - [Run In Postman](https://god.gw.postman.com/run-collection/34042403-e3d42c87-bf68-4cae-b08d-e1fd0dba1f80?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D34042403-e3d42c87-bf68-4cae-b08d-e1fd0dba1f80%26entityType%3Dcollection%26workspaceId%3Deb44f07f-093a-4e15-8899-2ecefa9775a5) + [Run In Postman](https://god.gw.postman.com/run-collection/44536620-de538326-5564-4efd-9ed2-d1c64142fcfe?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D44536620-de538326-5564-4efd-9ed2-d1c64142fcfe%26entityType%3Dcollection%26workspaceId%3Dd553b6fe-6915-4ada-a926-d96af988d3cc) ### Integration testing From c197fe54dccdf257ad2913f86bcdefae788f05a0 Mon Sep 17 00:00:00 2001 From: Ellie Bound <175816742+ellie-bound1-NHSD@users.noreply.github.com> Date: Wed, 4 Jun 2025 16:17:02 +0100 Subject: [PATCH 3/3] NPA-5088: Upate postman so expected status code matches assertion --- ...ate Relationship Service Sandbox.postman_collection.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postman/Validate Relationship Service Sandbox.postman_collection.json b/postman/Validate Relationship Service Sandbox.postman_collection.json index 5a22ae0c..1ee64f1f 100644 --- a/postman/Validate Relationship Service Sandbox.postman_collection.json +++ b/postman/Validate Relationship Service Sandbox.postman_collection.json @@ -6483,7 +6483,7 @@ " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 201\", function () {", + "pm.test(\"Status code is 422\", function () {", " pm.response.to.have.status(422);", "});", "", @@ -6755,7 +6755,7 @@ " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 201\", function () {", + "pm.test(\"Status code is 422\", function () {", " pm.response.to.have.status(422);", "});", "", @@ -6822,7 +6822,7 @@ " \"resourceType\": \"OperationOutcome\"", "}", "", - "pm.test(\"Status code is 201\", function () {", + "pm.test(\"Status code is 422\", function () {", " pm.response.to.have.status(422);", "});", "",