Skip to content

Commit 772a93b

Browse files
committed
NRL-502 add integration test
1 parent da4802c commit 772a93b

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ Feature: Producer - createDocumentReference - Failure Scenarios
407407
}
408408
"""
409409

410-
Scenario: Invalid format code for attachment type
410+
Scenario: Invalid format code for attachment type contact details
411411
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
412412
And the organisation 'X26' is authorised to access pointer types:
413413
| system | value |
@@ -418,7 +418,7 @@ Feature: Producer - createDocumentReference - Failure Scenarios
418418
"content": [
419419
{
420420
"attachment": {
421-
"contentType": "application/pdf",
421+
"contentType": "text/html",
422422
"language": "en-US",
423423
"url": "https://spine-proxy.national.ncrs.nhs.uk/https%3A%2F%2Fp1.nhs.uk%2FMentalhealthCrisisPlanReport.pdf",
424424
"size": 3654,
@@ -428,8 +428,8 @@ Feature: Producer - createDocumentReference - Failure Scenarios
428428
},
429429
"format": {
430430
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
431-
"code": "urn:nhs-ic:record-contact",
432-
"display": "Contact details"
431+
"code": "urn:nhs-ic:unstructured",
432+
"display": "Unstructured Documents"
433433
}
434434
"""
435435
Then the response status code is 400
@@ -453,6 +453,51 @@ Feature: Producer - createDocumentReference - Failure Scenarios
453453
}
454454
"""
455455

456+
Scenario: Invalid format code for attachment type pdf
457+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
458+
And the organisation 'X26' is authorised to access pointer types:
459+
| system | value |
460+
| http://snomed.info/sct | 1363501000000100 |
461+
| http://snomed.info/sct | 736253002 |
462+
When producer 'TSTCUS' requests creation of a DocumentReference with default test values except 'content' is:
463+
"""
464+
"content": [
465+
{
466+
"attachment": {
467+
"contentType": "application/pdf",
468+
"language": "en-US",
469+
"url": "https://spine-proxy.national.ncrs.nhs.uk/https%3A%2F%2Fp1.nhs.uk%2FMentalhealthCrisisPlanReport.pdf",
470+
"size": 3654,
471+
"hash": "2jmj7l5rSw0yVb/vlWAYkK/YBwk=",
472+
"title": "Mental health crisis plan report",
473+
"creation": "2022-12-21T10:45:41+11:00"
474+
},
475+
"format": {
476+
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",
477+
"code": "urn:nhs-ic:record-contact",
478+
"display": "Contact details"
479+
}
480+
"""
481+
Then the response status code is 400
482+
And the response is an OperationOutcome with 1 issue
483+
And the OperationOutcome contains the issue:
484+
"""
485+
"severity": "error",
486+
"code": "value",
487+
"details": {
488+
"coding": [
489+
{
490+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
491+
"code": "INVALID_RESOURCE",
492+
"display": "Invalid validation of resource",
493+
}
494+
]
495+
},
496+
"diagnostics": "Invalid content format code: urn:nhs-ic:record-contact format code must be 'urn:nhs-ic:unstructured' for Unstructured Document attachments.",
497+
"expression": ["content[0].format.code"],
498+
}
499+
"""
500+
456501
# Invalid document reference - invalid Type
457502
# NRL-769 Known issue: Type display is not validated
458503
# Scenario: Invalid type (valid code but wrong display value)

0 commit comments

Comments
 (0)