Skip to content

Commit 969ff8f

Browse files
committed
NRL-1053 add feature tests
1 parent e61078a commit 969ff8f

File tree

4 files changed

+200
-0
lines changed

4 files changed

+200
-0
lines changed

tests/features/consumer/searchDocumentReference-failure.feature

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,31 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
191191
"diagnostics": "Your organisation 'RX898' does not have permission to access this resource. Contact the onboarding team."
192192
}
193193
"""
194+
195+
Scenario: Search rejects request with type system they are not allowed to use
196+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
197+
And the organisation 'RX898' is authorised to access pointer types:
198+
| system | value |
199+
| http://snomed.info/sct | 736253002 |
200+
When consumer 'RX898' searches for DocumentReferences with parameters:
201+
| parameter | value |
202+
| subject | 9278693472 |
203+
| category | http://incorrect.info/sct\|736253002 |
204+
Then the response status code is 400
205+
And the response is an OperationOutcome with 1 issue
206+
And the OperationOutcome contains the issue:
207+
"""
208+
{
209+
"severity": "error",
210+
"code": "code-invalid",
211+
"details": {
212+
"coding": [{
213+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
214+
"code": "INVALID_CODE_SYSTEM",
215+
"display": "Invalid code system"
216+
}]
217+
},
218+
"diagnostics": "Invalid query parameter (The provided category is not valid)",
219+
"expression": ["type"]
220+
}
221+
"""

tests/features/consumer/searchDocumentReference-success.feature

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,78 @@ Feature: Consumer - searchDocumentReference - Success Scenarios
271271
And the Bundle has a total of 0
272272
And the Bundle has 0 entry
273273

274+
Scenario: Search for multiple DocumentReferences by NHS number and Category
275+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
276+
And the organisation 'RX898' is authorised to access pointer types:
277+
| system | value |
278+
| http://snomed.info/sct | 736253002 |
279+
| http://snomed.info/sct | 1363501000000100 |
280+
And a DocumentReference resource exists with values:
281+
| property | value |
282+
| id | 02V-1111111111-SearchMultipleRefTest1 |
283+
| subject | 9278693472 |
284+
| status | current |
285+
| type | 736253002 |
286+
| category | 734163000 |
287+
| contentType | application/pdf |
288+
| url | https://example.org/my-doc-1.pdf |
289+
| custodian | 02V |
290+
| author | 02V |
291+
And a DocumentReference resource exists with values:
292+
| property | value |
293+
| id | 02V-1111111111-SearchMultipleRefTest2 |
294+
| subject | 9278693472 |
295+
| status | current |
296+
| type | 736253002 |
297+
| category | 734163000 |
298+
| contentType | application/pdf |
299+
| url | https://example.org/my-doc-2.pdf |
300+
| custodian | 02V |
301+
| author | 02V |
302+
And a DocumentReference resource exists with values:
303+
| property | value |
304+
| id | 02V-1111111111-SearchMultipleRefTest3 |
305+
| subject | 9278693472 |
306+
| status | current |
307+
| type | 1363501000000100 |
308+
| category | 1102421000000108 |
309+
| contentType | application/pdf |
310+
| url | https://example.org/my-doc-3.pdf |
311+
| custodian | 02V |
312+
| author | 02V |
313+
When consumer 'RX898' searches for DocumentReferences with parameters:
314+
| parameter | value |
315+
| subject | 9278693472 |
316+
| category | 734163000 |
317+
Then the response status code is 200
318+
And the response is a searchset Bundle
319+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&category=http://snomed.info/sct|734163000'
320+
And the Bundle has a total of 2
321+
And the Bundle has 2 entries
322+
And the Bundle contains an DocumentReference with values
323+
| property | value |
324+
| id | 02V-1111111111-SearchMultipleRefTest1 |
325+
| subject | 9278693472 |
326+
| status | current |
327+
| type | 736253002 |
328+
| category | 734163000 |
329+
| contentType | application/pdf |
330+
| url | https://example.org/my-doc-1.pdf |
331+
| custodian | 02V |
332+
| author | 02V |
333+
And the Bundle contains an DocumentReference with values
334+
| property | value |
335+
| id | 02V-1111111111-SearchMultipleRefTest2 |
336+
| subject | 9278693472 |
337+
| status | current |
338+
| type | 736253002 |
339+
| category | 734163000 |
340+
| contentType | application/pdf |
341+
| url | https://example.org/my-doc-2.pdf |
342+
| custodian | 02V |
343+
| author | 02V |
344+
And the Bundle does not contain a DocumentReference with ID '02V-1111111111-SearchMultipleRefTest3'
345+
274346
# No pointers found - done
275347
# Pointers exist but no permissions - covered in failure scenarios
276348
# Search by custodian - done

tests/features/consumer/searchPostDocumentReference-failure.feature

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,3 +191,32 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
191191
"diagnostics": "Your organisation 'RX898' does not have permission to access this resource. Contact the onboarding team."
192192
}
193193
"""
194+
195+
Scenario: Search for multiple DocumentReferences by NHS number and an invalid Category
196+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
197+
And the organisation 'RX898' is authorised to access pointer types:
198+
| system | value |
199+
| http://snomed.info/sct | 736253002 |
200+
| http://snomed.info/sct | 1363501000000100 |
201+
When consumer 'RX898' searches for DocumentReferences with parameters:
202+
| parameter | value |
203+
| subject | 9278693472 |
204+
| category | invalid |
205+
Then the response status code is 400
206+
And the response is an OperationOutcome with 1 issue
207+
And the OperationOutcome contains the issue:
208+
"""
209+
{
210+
"severity": "error",
211+
"code": "code-invalid",
212+
"details": {
213+
"coding": [{
214+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
215+
"code": "INVALID_CODE_SYSTEM",
216+
"display": "Invalid code system"
217+
}]
218+
},
219+
"diagnostics": "Invalid category (The provided category is not valid)",
220+
"expression": ["category"]
221+
}
222+
"""

tests/features/consumer/searchPostDocumentReference-success.feature

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,74 @@ Feature: Consumer - searchDocumentReference - Success Scenarios
242242
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&custodian:identifier=https://fhir.nhs.uk/Id/ods-organization-code|RX898'
243243
And the Bundle has a total of 0
244244
And the Bundle has 0 entry
245+
246+
Scenario: Search for multiple DocumentReferences by NHS number and Category
247+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
248+
And the organisation 'RX898' is authorised to access pointer types:
249+
| system | value |
250+
| http://snomed.info/sct | 736253002 |
251+
| http://snomed.info/sct | 1363501000000100 |
252+
And a DocumentReference resource exists with values:
253+
| property | value |
254+
| id | X26-1111111111-SearchMultipleRefTest1 |
255+
| subject | 9278693472 |
256+
| status | current |
257+
| type | 736253002 |
258+
| category | 734163000 |
259+
| contentType | application/pdf |
260+
| url | https://example.org/my-doc-1.pdf |
261+
| custodian | X26 |
262+
| author | X26 |
263+
And a DocumentReference resource exists with values:
264+
| property | value |
265+
| id | X26-1111111111-SearchMultipleRefTest2 |
266+
| subject | 9278693472 |
267+
| status | current |
268+
| type | 736253002 |
269+
| category | 734163000 |
270+
| contentType | application/pdf |
271+
| url | https://example.org/my-doc-2.pdf |
272+
| custodian | X26 |
273+
| author | X26 |
274+
And a DocumentReference resource exists with values:
275+
| property | value |
276+
| id | x26-1111111111-SearchMultipleRefTest3 |
277+
| subject | 9278693472 |
278+
| status | current |
279+
| type | 1363501000000100 |
280+
| category | 1102421000000108 |
281+
| contentType | application/pdf |
282+
| url | https://example.org/my-doc-3.pdf |
283+
| custodian | x26 |
284+
| author | x26 |
285+
When consumer 'RX898' searches for DocumentReferences using POST with request body:
286+
| key | value |
287+
| subject | 9278693472 |
288+
| category | 734163000 |
289+
Then the response status code is 200
290+
And the response is a searchset Bundle
291+
And the Bundle has a total of 2
292+
And the Bundle has 2 entries
293+
And the Bundle contains an DocumentReference with values
294+
| property | value |
295+
| id | X26-1111111111-SearchMultipleRefTest1 |
296+
| subject | 9278693472 |
297+
| status | current |
298+
| type | 736253002 |
299+
| category | 734163000 |
300+
| contentType | application/pdf |
301+
| url | https://example.org/my-doc-1.pdf |
302+
| custodian | X26 |
303+
| author | X26 |
304+
And the Bundle contains an DocumentReference with values
305+
| property | value |
306+
| id | X26-1111111111-SearchMultipleRefTest2 |
307+
| subject | 9278693472 |
308+
| status | current |
309+
| type | 736253002 |
310+
| category | 734163000 |
311+
| contentType | application/pdf |
312+
| url | https://example.org/my-doc-2.pdf |
313+
| custodian | X26 |
314+
| author | X26 |
315+
And the Bundle does not contain a DocumentReference with ID 'x26-1111111111-SearchMultipleRefTest3'

0 commit comments

Comments
 (0)