Skip to content

Commit 9f6e2ce

Browse files
NRL-1050 Add integration tests
1 parent cdecd38 commit 9f6e2ce

File tree

6 files changed

+609
-99
lines changed

6 files changed

+609
-99
lines changed

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 248 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -407,96 +407,251 @@ Feature: Producer - createDocumentReference - Failure Scenarios
407407
}
408408
"""
409409

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-
# """
452-
# Invalid document reference - empty content[0].attachment.url
453-
# Invalid document reference - create another producers document
454-
# 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)
493-
# Invalid document reference - invalid content (NRL-518)
494-
# Invalid document reference - invalid context.related for an SSP url
495-
# Invalid document reference - missing context.related for an SSP url
496-
# Invalid document reference - invalid context.practiceSetting (NRL-519)
497-
# Invalid document reference - invalid docStatus (NRL-477)
498-
# Invalid document reference - duplicate keys
499-
# Invalid document reference - duplicate relatesTo targets in URL
500-
# Invalid document reference - supersede with duplicate error
501-
# Invalid document reference - missing audit date when permission to set audit date
502-
# Invalid document reference - SSP URL?
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+
# """
452+
# Invalid document reference - empty content[0].attachment.url
453+
# Invalid document reference - create another producers document
454+
# 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)
493+
# Invalid document reference - invalid content (NRL-518)
494+
# Invalid document reference - invalid context.related for an SSP url
495+
# Invalid document reference - missing context.related for an SSP url
496+
# Invalid document reference - invalid context.practiceSetting (NRL-519)
497+
# Invalid document reference - invalid docStatus (NRL-477)
498+
# Invalid document reference - duplicate keys
499+
# Invalid document reference - duplicate relatesTo targets in URL
500+
# Invalid document reference - supersede with duplicate error
501+
# Invalid document reference - missing audit date when permission to set audit date
502+
# Invalid document reference - SSP URL?
503+
Scenario: System not supported in NRL 3.0
504+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
505+
And the organisation 'ANGY1' is authorised to access pointer types:
506+
| system | value |
507+
| http://snomed.info/sct | 736253002 |
508+
When producer 'ANGY1' creates a DocumentReference with values:
509+
| property | value |
510+
| subject | 9278693472 |
511+
| status | current |
512+
| type_system | http://invalidsystem.info/sct |
513+
| type | 736253002 |
514+
| category | 734163000 |
515+
| custodian | ANGY1 |
516+
| author | HAR1 |
517+
| url | https://example.org/my-doc.pdf |
518+
Then the response status code is 400
519+
And the response is an OperationOutcome with 1 issue
520+
And the OperationOutcome contains the issue:
521+
"""
522+
{
523+
"severity": "error",
524+
"code": "value",
525+
"details": {
526+
"coding": [
527+
{
528+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
529+
"code": "INVALID_RESOURCE",
530+
"display": "Invalid validation of resource"
531+
}
532+
]
533+
},
534+
"diagnostics": "Invalid type system: http://invalidsystem.info/sct Type system must be either 'http://snomed.info/sct' or 'https://nicip.nhs.uk'",
535+
"expression": ["type.coding[0].system"]
536+
}
537+
"""
538+
539+
Scenario: Invalid Document Reference Type
540+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
541+
And the organisation 'ANGY1' is authorised to access pointer types:
542+
| system | value |
543+
| http://snomed.info/sct | 736253002 |
544+
When producer 'ANGY1' creates a DocumentReference with values:
545+
| property | value |
546+
| subject | 9999999999 |
547+
| status | current |
548+
| type | invalid |
549+
| category | 734163000 |
550+
| custodian | ANGY1 |
551+
| author | HAR1 |
552+
| url | https://example.org/my-doc.pdf |
553+
Then the response status code is 400
554+
And the response is an OperationOutcome with 1 issue
555+
And the OperationOutcome contains the issue:
556+
"""
557+
{
558+
"severity": "error",
559+
"code": "value",
560+
"details": {
561+
"coding": [
562+
{
563+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
564+
"code": "INVALID_RESOURCE",
565+
"display": "Invalid validation of resource"
566+
}
567+
]
568+
},
569+
"diagnostics": "Invalid type code: invalid Type must be a member of the England-NRLRecordType value set (https://fhir.nhs.uk/England/CodeSystem/England-NRLRecordType)",
570+
"expression": [
571+
"type.coding[0].code"
572+
]
573+
}
574+
"""
575+
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+
614+
Scenario Outline: Invalid display value for type or category (imaging)
615+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
616+
And the organisation 'ANGY1' is authorised to access pointer types:
617+
| system | value |
618+
| https://nicip.nhs.uk | MAULR |
619+
| https://nicip.nhs.uk | MAXIB |
620+
When producer 'ANGY1' creates a DocumentReference with values:
621+
| property | value |
622+
| subject | 9999999999 |
623+
| status | current |
624+
| type_system | <type-system> |
625+
| type_display | <type-display> |
626+
| type | <type-code> |
627+
| category | <category-code> |
628+
| custodian | ANGY1 |
629+
| author | HAR1 |
630+
| url | https://example.org/my-doc.pdf |
631+
Then the response status code is 400
632+
And the response is an OperationOutcome with 1 issue
633+
And the OperationOutcome contains the issue:
634+
"""
635+
{
636+
"severity": "error",
637+
"code": "value",
638+
"details": {
639+
"coding": [
640+
{
641+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
642+
"code": "INVALID_RESOURCE",
643+
"display": "Invalid validation of resource"
644+
}
645+
]
646+
},
647+
"diagnostics": "type code '<type-code>' must have a display value of '<correct-display>'",
648+
"expression": [
649+
"type.coding[0].display"
650+
]
651+
}
652+
"""
653+
654+
Examples:
655+
| type-system | type-code | category-code | type-display | correct-display |
656+
| https://nicip.nhs.uk | MAULR | 721981007 | "Nonsense display" | MRA Upper Limb Rt |
657+
| https://nicip.nhs.uk | MAXIB | 103693007 | "Nonsense display" | MRI Axilla Both |

0 commit comments

Comments
 (0)