-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/spinedem 2176 allocate nhs number tests (#981)
* adds new test code for create nhs number scenarios * fixes invalid post patient test * removes no-longer-needed json files * adds patient_create tests to the test pack * publish post patient test results * is new publish test results step causing error? * reimplements publish build results step
- Loading branch information
Pete Loggie
authored
Mar 12, 2024
1 parent
9d19610
commit 577a494
Showing
5 changed files
with
238 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
tests/functional/data/responses/valid_patient_post_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"id": "#nhsNumber", | ||
"identifier": [ | ||
{ | ||
"extension": [ | ||
{ | ||
"url": "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-NHSNumberVerificationStatus", | ||
"valueCodeableConcept": { | ||
"coding": [ | ||
{ | ||
"code": "01", | ||
"display": "Number present and verified", | ||
"system": "https://fhir.hl7.org.uk/CodeSystem/UKCore-NHSNumberVerificationStatus", | ||
"version": "1.0.0" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"system": "https://fhir.nhs.uk/Id/nhs-number", | ||
"value": "#nhsNumber" | ||
} | ||
], | ||
"meta": { | ||
"security": [ | ||
{ | ||
"code": "U", | ||
"display": "unrestricted", | ||
"system": "http://terminology.hl7.org/CodeSystem/v3-Confidentiality" | ||
} | ||
], | ||
"versionId": "1" | ||
}, | ||
"name": [ | ||
{ | ||
"family": "#family", | ||
"period": { | ||
"start": "#todayDate" | ||
}, | ||
"use": "usual" | ||
} | ||
], | ||
"resourceType": "Patient" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Feature: Post Patient | ||
|
||
Background: | ||
Given I am a healthcare worker user | ||
|
||
Scenario: Negative test - invalid request payload | ||
Given path "Patient" | ||
And request body: | ||
{"blahblahblah":"blah"} | ||
When method POST | ||
Then status 400 | ||
And response body: | ||
{ | ||
"issue": [ | ||
{ | ||
"code": "required", | ||
"details": { | ||
"coding": [ | ||
{ | ||
"code": "MISSING_VALUE", | ||
"display": "Required value is missing", | ||
"system": "https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode", | ||
"version": "1" | ||
} | ||
] | ||
}, | ||
"diagnostics": "Missing value - 'nhsNumberAllocation'", | ||
"severity": "error" | ||
} | ||
], | ||
"resourceType": "OperationOutcome" | ||
} | ||
|
||
Scenario: Valid request, basic payload | ||
Given path "Patient" | ||
And request body: | ||
{ | ||
"nhsNumberAllocation": "Done", | ||
"name": { | ||
"use": "L", | ||
"name.familyName": "Smith" | ||
}, | ||
"registeringAuthority": { | ||
"regAuthorityType.code": "x", | ||
"regAuthorityType.codeSystem": "2.16.840.1.113883.2.1.3.2.4.16.20", | ||
"regOrganisation.root": "2.16.840.1.113883.2.1.4.3", | ||
"regOrganisation.extension": "RWF", | ||
"authorPersonID": "", | ||
"authorSystemID": "230811201324", | ||
"deathStatus": "", | ||
"deceasedTime": "", | ||
"overallUpdateMode": "create" | ||
} | ||
} | ||
When method POST | ||
Then status 201 | ||
And expected_response template == read(valid_patient_post_response) | ||
And set expected_response['#nhsNumber'] = response['id'] | ||
And set expected_response['#family'] = 'Smith' | ||
And ignore in response comparison the family name Id | ||
And response body == expected_response | ||
|
||
|
||
Scenario: The rate limit is tripped when POSTing new Patients (>5tps) | ||
When I post to the Patient endpoint more than 5 times per second | ||
Then I get a mix of 400 and 429 HTTP response codes | ||
And the 429 response bodies alert me that there have been too many Create Patient requests |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters