From fc82065ae262a871808b3b374150b431d934d7e6 Mon Sep 17 00:00:00 2001 From: russellpollock Date: Thu, 26 Mar 2026 12:22:26 +0000 Subject: [PATCH] bruno tests for orange box --- .../api-test/steel-thread/APIM_ping.bru | 16 +++++ .../api-test/steel-thread/APIM_post.bru | 31 +++++++++ .../api-test/steel-thread/AWS_POST.bru | 31 +++++++++ .../api-test/steel-thread/AWS_health.bru | 16 +++++ .../api-test/steel-thread/OrangBox.bru | 64 +++++++++++++++++++ .../api-test/steel-thread/bruno.json | 9 +++ .../steel-thread/environments/local.bru | 5 ++ 7 files changed, 172 insertions(+) create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/APIM_ping.bru create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/APIM_post.bru create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/AWS_POST.bru create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/AWS_health.bru create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/OrangBox.bru create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/bruno.json create mode 100644 gateway-api/tests/manual-test/api-test/steel-thread/environments/local.bru diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/APIM_ping.bru b/gateway-api/tests/manual-test/api-test/steel-thread/APIM_ping.bru new file mode 100644 index 00000000..269d550f --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/APIM_ping.bru @@ -0,0 +1,16 @@ +meta { + name: APIM_ping + type: http + seq: 4 +} + +get { + url: {{BASE_URL}}/clinical-data-gateway-api-poc/_ping + body: none + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/APIM_post.bru b/gateway-api/tests/manual-test/api-test/steel-thread/APIM_post.bru new file mode 100644 index 00000000..6beb7cd4 --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/APIM_post.bru @@ -0,0 +1,31 @@ +meta { + name: APIM_post + type: http + seq: 6 +} + +post { + url: {{BASE_URL}}/patient/$gpc.getstructuredrecord + body: json + auth: inherit +} + +body:json { + { + "resourceType": "Parameters", + "parameter": [ + { + "name": "patientNHSNumber", + "valueIdentifier": { + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "9999999999" + } + } + ] + } +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/AWS_POST.bru b/gateway-api/tests/manual-test/api-test/steel-thread/AWS_POST.bru new file mode 100644 index 00000000..29e668de --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/AWS_POST.bru @@ -0,0 +1,31 @@ +meta { + name: AWS_POST + type: http + seq: 3 +} + +post { + url: {{BASE_URL}}/patient/$gpc.getstructuredrecord + body: json + auth: inherit +} + +body:json { + { + "resourceType": "Parameters", + "parameter": [ + { + "name": "patientNHSNumber", + "valueIdentifier": { + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "9999999999" + } + } + ] + } +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/AWS_health.bru b/gateway-api/tests/manual-test/api-test/steel-thread/AWS_health.bru new file mode 100644 index 00000000..72fd190d --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/AWS_health.bru @@ -0,0 +1,16 @@ +meta { + name: AWS_health + type: http + seq: 1 +} + +get { + url: {{BASE_URL}}/health + body: none + auth: inherit +} + +settings { + encodeUrl: true + timeout: 0 +} diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/OrangBox.bru b/gateway-api/tests/manual-test/api-test/steel-thread/OrangBox.bru new file mode 100644 index 00000000..362e6ee9 --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/OrangBox.bru @@ -0,0 +1,64 @@ +meta { + name: OrangeBox + type: http + seq: 1 +} + +post { + url: {{BASE_URL}}/patient/$gpc.getstructuredrecord + body: json + auth: none +} + +headers { + Content-Type: application/fhir+json + Accept: application/fhir+json + Ods-From: S44444 +} + +body:json { + { + "resourceType": "Parameters", + "parameter": [ + { + "name": "patientNHSNumber", + "valueIdentifier": { + "system": "https://fhir.nhs.uk/Id/nhs-number", + "value": "{{nhs_number}}" + } + } + ] + } +} + +script:pre-request { + const { v4: uuidv4 } = require('uuid'); + req.setHeader("Ssp-TraceID", uuidv4()); +} + +tests { + test("Returns a 200 OK status", function() { + expect(res.getStatus()).to.equal(200); + }); + + test("Response is a standard FHIR Bundle", function() { + const body = res.getBody(); + expect(body.resourceType).to.equal("Bundle"); + expect(body.type).to.equal("collection"); + }); + + test("Bundle contains the requested Patient data", function() { + const body = res.getBody(); + const expectedNhsNumber = bru.getEnvVar("nhs_number"); + const expectedFamilyName = bru.getEnvVar("family_name"); + const patientEntry = body.entry.find(e => e.resource.resourceType === "Patient"); + + expect(patientEntry).to.not.be.undefined; + + const nhsIdentifier = patientEntry.resource.identifier.find( + id => id.system === "https://fhir.nhs.uk/Id/nhs-number" + ); + expect(nhsIdentifier.value).to.equal(expectedNhsNumber); + expect(patientEntry.resource.name[0].family.toUpperCase()).to.equal(expectedFamilyName.toUpperCase());; + }); +} diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/bruno.json b/gateway-api/tests/manual-test/api-test/steel-thread/bruno.json new file mode 100644 index 00000000..4d2b45e4 --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "clinical-data-gateway-api-poc", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} diff --git a/gateway-api/tests/manual-test/api-test/steel-thread/environments/local.bru b/gateway-api/tests/manual-test/api-test/steel-thread/environments/local.bru new file mode 100644 index 00000000..7e7978f6 --- /dev/null +++ b/gateway-api/tests/manual-test/api-test/steel-thread/environments/local.bru @@ -0,0 +1,5 @@ +vars { + BASE_URL: http://localhost:5000 + nhs_number: 9690937278 + family_name: SAMUAL +}