Skip to content

Commit 3d0bc3b

Browse files
bruno tests for orange box
1 parent e8ccff7 commit 3d0bc3b

7 files changed

Lines changed: 172 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
meta {
2+
name: APIM_ping
3+
type: http
4+
seq: 4
5+
}
6+
7+
get {
8+
url: {{BASE_URL}}/clinical-data-gateway-api-poc/_ping
9+
body: none
10+
auth: inherit
11+
}
12+
13+
settings {
14+
encodeUrl: true
15+
timeout: 0
16+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
meta {
2+
name: APIM_post
3+
type: http
4+
seq: 6
5+
}
6+
7+
post {
8+
url: {{BASE_URL}}/patient/$gpc.getstructuredrecord
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"resourceType": "Parameters",
16+
"parameter": [
17+
{
18+
"name": "patientNHSNumber",
19+
"valueIdentifier": {
20+
"system": "https://fhir.nhs.uk/Id/nhs-number",
21+
"value": "9999999999"
22+
}
23+
}
24+
]
25+
}
26+
}
27+
28+
settings {
29+
encodeUrl: true
30+
timeout: 0
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
meta {
2+
name: AWS_POST
3+
type: http
4+
seq: 3
5+
}
6+
7+
post {
8+
url: {{BASE_URL}}/patient/$gpc.getstructuredrecord
9+
body: json
10+
auth: inherit
11+
}
12+
13+
body:json {
14+
{
15+
"resourceType": "Parameters",
16+
"parameter": [
17+
{
18+
"name": "patientNHSNumber",
19+
"valueIdentifier": {
20+
"system": "https://fhir.nhs.uk/Id/nhs-number",
21+
"value": "9999999999"
22+
}
23+
}
24+
]
25+
}
26+
}
27+
28+
settings {
29+
encodeUrl: true
30+
timeout: 0
31+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
meta {
2+
name: AWS_health
3+
type: http
4+
seq: 1
5+
}
6+
7+
get {
8+
url: {{BASE_URL}}/health
9+
body: none
10+
auth: inherit
11+
}
12+
13+
settings {
14+
encodeUrl: true
15+
timeout: 0
16+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
meta {
2+
name: OrangeBox
3+
type: http
4+
seq: 1
5+
}
6+
7+
post {
8+
url: {{BASE_URL}}/patient/$gpc.getstructuredrecord
9+
body: json
10+
auth: none
11+
}
12+
13+
headers {
14+
Content-Type: application/fhir+json
15+
Accept: application/fhir+json
16+
Ods-From: S44444
17+
}
18+
19+
body:json {
20+
{
21+
"resourceType": "Parameters",
22+
"parameter": [
23+
{
24+
"name": "patientNHSNumber",
25+
"valueIdentifier": {
26+
"system": "https://fhir.nhs.uk/Id/nhs-number",
27+
"value": "{{nhs_number}}"
28+
}
29+
}
30+
]
31+
}
32+
}
33+
34+
script:pre-request {
35+
const { v4: uuidv4 } = require('uuid');
36+
req.setHeader("Ssp-TraceID", uuidv4());
37+
}
38+
39+
tests {
40+
test("Returns a 200 OK status", function() {
41+
expect(res.getStatus()).to.equal(200);
42+
});
43+
44+
test("Response is a standard FHIR Bundle", function() {
45+
const body = res.getBody();
46+
expect(body.resourceType).to.equal("Bundle");
47+
expect(body.type).to.equal("collection");
48+
});
49+
50+
test("Bundle contains the requested Patient data", function() {
51+
const body = res.getBody();
52+
const expectedNhsNumber = bru.getEnvVar("nhs_number");
53+
const expectedFamilyName = bru.getEnvVar("family_name");
54+
const patientEntry = body.entry.find(e => e.resource.resourceType === "Patient");
55+
56+
expect(patientEntry).to.not.be.undefined;
57+
58+
const nhsIdentifier = patientEntry.resource.identifier.find(
59+
id => id.system === "https://fhir.nhs.uk/Id/nhs-number"
60+
);
61+
expect(nhsIdentifier.value).to.equal(expectedNhsNumber);
62+
expect(patientEntry.resource.name[0].family.toUpperCase()).to.equal(expectedFamilyName.toUpperCase());;
63+
});
64+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": "1",
3+
"name": "clinical-data-gateway-api-poc",
4+
"type": "collection",
5+
"ignore": [
6+
"node_modules",
7+
".git"
8+
]
9+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
vars {
2+
BASE_URL: http://localhost:5000
3+
nhs_number: 9690937278
4+
family_name: SAMUAL
5+
}

0 commit comments

Comments
 (0)