Skip to content

Commit 2aef83d

Browse files
committed
NRL-519 add create failure scenarios for invalid practice settings
1 parent 04b2c9d commit 2aef83d

File tree

1 file changed

+81
-121
lines changed

1 file changed

+81
-121
lines changed

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 81 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ Feature: Producer - createDocumentReference - Failure Scenarios
194194
}
195195
"""
196196

197-
# Invalid document reference - invalid custodian ID
198197
# Invalid document reference - invalid relatesTo target
199198
# Invalid document reference - invalid producer ID in relatesTo target
200199
Scenario: Unauthorised supersede - target belongs to a different custodian
@@ -331,7 +330,6 @@ Feature: Producer - createDocumentReference - Failure Scenarios
331330
}
332331
"""
333332

334-
# Credentials - missing pointer type for create
335333
Scenario: Producer lacks the permission for the pointer type requested
336334
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
337335
And the organisation 'ANGY1' is authorised to access pointer types:
@@ -407,93 +405,93 @@ Feature: Producer - createDocumentReference - Failure Scenarios
407405
}
408406
"""
409407

410-
# Invalid document reference - invalid Type
411-
# NRL-769 Known issue: Type display is not validated
412-
# Scenario: Invalid type (valid code but wrong display value)
413-
# Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
414-
# And the organisation 'TSTCUS' is authorised to access pointer types:
415-
# | system | value |
416-
# | http://snomed.info/sct | 1363501000000100 |
417-
# | http://snomed.info/sct | 736253002 |
418-
# When producer 'TSTCUS' requests creation of a DocumentReference with default test values except 'type' is:
419-
# """
420-
# "type": {
421-
# "coding": [
422-
# {
423-
# "system": "http://snomed.info/sct",
424-
# "code": "736253002",
425-
# "display": "Emergency Healthcare Plan"
426-
# }
427-
# ]
428-
# }
429-
# """
430-
# Then the response status code is 400
431-
# And the response is an OperationOutcome with 1 issue
432-
# And the OperationOutcome contains the issue:
433-
# """
434-
# {
435-
# "severity": "error",
436-
# "code": "invalid",
437-
# "details": {
438-
# "coding": [
439-
# {
440-
# "system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
441-
# "code": "BAD_REQUEST",
442-
# "display": "Bad request"
443-
# }
444-
# ]
445-
# },
446-
# "diagnostics": "The display does not match the expected value for this type",
447-
# "expression": [
448-
# "type.coding.display"
449-
# ]
450-
# }
451-
# """
408+
Scenario: Invalid practice setting (not in value set)
409+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
410+
And the organisation 'X26' is authorised to access pointer types:
411+
| system | value |
412+
| http://snomed.info/sct | 1363501000000100 |
413+
| http://snomed.info/sct | 736253002 |
414+
When producer 'X26' creates a DocumentReference with values:
415+
| property | value |
416+
| subject | 9999999999 |
417+
| status | current |
418+
| type | 736253002 |
419+
| category | 1102421000000108 |
420+
| custodian | X26 |
421+
| author | HAR1 |
422+
| url | https://example.org/my-doc.pdf |
423+
| practiceSetting | 12345 |
424+
Then the response status code is 400
425+
And the response is an OperationOutcome with 1 issue
426+
And the OperationOutcome contains the issue:
427+
"""
428+
{
429+
"severity": "error",
430+
"code": "value",
431+
"details": {
432+
"coding": [
433+
{
434+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
435+
"code": "INVALID_RESOURCE",
436+
"display": "Invalid validation of resource"
437+
}
438+
]
439+
},
440+
"diagnostics": "Invalid practice setting code: 12345 Practice Setting coding must be a member of value set https://fhir.nhs.uk/England/ValueSet/England-PracticeSetting",
441+
"expression": ["context.practiceSetting.coding[0].code"],
442+
443+
}
444+
"""
445+
446+
Scenario: Invalid practice setting (valid code but wrong display value)
447+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
448+
And the organisation 'TSTCUS' is authorised to access pointer types:
449+
| system | value |
450+
| http://snomed.info/sct | 1363501000000100 |
451+
| http://snomed.info/sct | 736253002 |
452+
When producer 'TSTCUS' requests creation of a DocumentReference with default test values except 'context' is:
453+
"""
454+
"context": {
455+
"practiceSetting": {
456+
"coding": [
457+
{
458+
"system": "http://snomed.info/sct",
459+
"code": "788002001",
460+
"display": "Ophthalmology service"
461+
}
462+
]
463+
}
464+
}
465+
"""
466+
Then the response status code is 400
467+
And the response is an OperationOutcome with 1 issue
468+
And the OperationOutcome contains the issue:
469+
"""
470+
{
471+
"severity": "error",
472+
"code": "value",
473+
"details": {
474+
"coding": [
475+
{
476+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
477+
"code": "INVALID_RESOURCE",
478+
"display": "Invalid validation of resource"
479+
}
480+
]
481+
},
482+
"diagnostics": "Invalid practice setting coding: display Ophthalmology service does not match the expected display for 788002001 Practice Setting coding is bound to value set https://fhir.nhs.uk/England/ValueSet/England-PracticeSetting",
483+
"expression": [
484+
"context.practiceSetting.coding[0]"
485+
]
486+
}
487+
"""
488+
452489
# Invalid document reference - empty content[0].attachment.url
453490
# Invalid document reference - create another producers document
454491
# Invalid document reference - bad JSON
455-
# Invalid document reference - invalid status (NRL-476 to ensure only 'current' is accepted)
456-
# Scenario: Invalid document reference - invalid status
457-
# Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
458-
# And the organisation 'ANGY1' is authorised to access pointer types:
459-
# | system | value |
460-
# | http://snomed.info/sct | 736253002 |
461-
# When producer 'ANGY1' creates a DocumentReference with values:
462-
# | property | value |
463-
# | subject | 9999999999 |
464-
# | status | notarealStatus |
465-
# | type | 736253002 |
466-
# | category | 734163000 |
467-
# | custodian | ANGY1 |
468-
# | author | HAR1 |
469-
# | url | https://example.org/my-doc.pdf |
470-
# Then the response status code is 400
471-
# And the response is an OperationOutcome with 1 issue
472-
# And the OperationOutcome contains the issue:
473-
# """
474-
# {
475-
# "severity": "error",
476-
# "code": "forbidden",
477-
# "details": {
478-
# "coding": [
479-
# {
480-
# "system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
481-
# "code": "AUTHOR_CREDENTIALS_ERROR",
482-
# "display": "Author credentials error"
483-
# }
484-
# ]
485-
# },
486-
# "diagnostics": "The type of the provided DocumentReference is not in the list of allowed types for this organisation",
487-
# "expression": [
488-
# "type.coding[0].code"
489-
# ]
490-
# }
491-
# """
492-
# Invalid document reference - invalid author (NRL-474)
493492
# Invalid document reference - invalid content (NRL-518)
494493
# Invalid document reference - invalid context.related for an SSP url
495494
# Invalid document reference - missing context.related for an SSP url
496-
# Invalid document reference - invalid context.practiceSetting (NRL-519)
497495
# Invalid document reference - invalid docStatus (NRL-477)
498496
# Invalid document reference - duplicate keys
499497
# Invalid document reference - duplicate relatesTo targets in URL
@@ -573,44 +571,6 @@ Feature: Producer - createDocumentReference - Failure Scenarios
573571
}
574572
"""
575573

576-
Scenario: Mismatched Category Code for Document Reference Type
577-
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
578-
And the organisation 'X26' is authorised to access pointer types:
579-
| system | value |
580-
| http://snomed.info/sct | 1363501000000100 |
581-
| http://snomed.info/sct | 736253002 |
582-
When producer 'X26' creates a DocumentReference with values:
583-
| property | value |
584-
| subject | 9999999999 |
585-
| status | current |
586-
| type | 736253002 |
587-
| category | 1102421000000108 |
588-
| custodian | X26 |
589-
| author | HAR1 |
590-
| url | https://example.org/my-doc.pdf |
591-
Then the response status code is 400
592-
And the response is an OperationOutcome with 1 issue
593-
And the OperationOutcome contains the issue:
594-
"""
595-
{
596-
"severity": "error",
597-
"code": "value",
598-
"details": {
599-
"coding": [
600-
{
601-
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
602-
"code": "INVALID_RESOURCE",
603-
"display": "Invalid validation of resource"
604-
}
605-
]
606-
},
607-
"diagnostics": "The Category code of the provided document 'http://snomed.info/sct|1102421000000108' must match the allowed category for pointer type 'http://snomed.info/sct|736253002' with a category value of 'http://snomed.info/sct|734163000'",
608-
"expression": [
609-
"category.coding[0].code"
610-
]
611-
}
612-
"""
613-
614574
Scenario Outline: Invalid display value for type or category (imaging)
615575
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
616576
And the organisation 'ANGY1' is authorised to access pointer types:

0 commit comments

Comments
 (0)