Skip to content

Commit cc96bda

Browse files
authored
Merge pull request #698 from NHSDigital/feature/eema1-NRL-936-custodianTypeMatchIntegrationTests
NRL-936 add integration tests
2 parents 1eda970 + d01e097 commit cc96bda

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

api/producer/readDocumentReference/read_document_reference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def handler(
5959
document_reference = DocumentReference.parse_raw(result.document)
6060
except ValidationError as exc:
6161
logger.log(
62-
LogReference.CONREAD003,
62+
LogReference.PROREAD003,
6363
exc_info=sys.exc_info(),
6464
stacklevel=5,
6565
error=str(exc),

layer/nrlf/core/log_references.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class LogReference(Enum):
203203
"EXCEPTION", "The DocumentReference resource could not be parsed"
204204
)
205205
CONPOSTSEARCH999 = _Reference(
206-
"INFO", "Successfully completed consumer searchDocumentReference"
206+
"INFO", "Successfully completed consumer searchPostDocumentReference"
207207
)
208208

209209
# Producer - CreateDocumentReference

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,44 @@ Feature: Producer - createDocumentReference - Failure Scenarios
257257
}
258258
"""
259259

260+
Scenario: Invalid category for type
261+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
262+
And the organisation 'X26' is authorised to access pointer types:
263+
| system | value |
264+
| http://snomed.info/sct | 1363501000000100 |
265+
| http://snomed.info/sct | 736253002 |
266+
When producer 'X26' creates a DocumentReference with values:
267+
| property | value |
268+
| subject | 9999999999 |
269+
| status | current |
270+
| type | 736253002 |
271+
| category | 1102421000000108 |
272+
| custodian | X26 |
273+
| author | HAR1 |
274+
| url | https://example.org/my-doc.pdf |
275+
Then the response status code is 400
276+
And the response is an OperationOutcome with 1 issue
277+
And the OperationOutcome contains the issue:
278+
"""
279+
{
280+
"severity": "error",
281+
"code": "invalid",
282+
"details": {
283+
"coding": [
284+
{
285+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
286+
"code": "BAD_REQUEST",
287+
"display": "Bad request"
288+
}
289+
]
290+
},
291+
"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'",
292+
"expression": [
293+
"category.coding[0].code"
294+
]
295+
}
296+
"""
297+
260298
# Invalid document reference - invalid Type
261299
# NRL-769 Known issue: Type display is not validated
262300
# Scenario: Invalid type (valid code but wrong display value)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Feature: Producer - upsertDocumentReference - Failure Scenarios
2+
3+
Scenario: Invalid category for type
4+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
5+
And the organisation 'X26' is authorised to access pointer types:
6+
| system | value |
7+
| http://snomed.info/sct | 1363501000000100 |
8+
| http://snomed.info/sct | 736253002 |
9+
When producer 'X26' upserts a DocumentReference with values:
10+
| property | value |
11+
| id | X26-testid-upsert-0001-0001 |
12+
| subject | 9999999999 |
13+
| status | current |
14+
| type | 736253002 |
15+
| category | 1102421000000108 |
16+
| custodian | X26 |
17+
| author | HAR1 |
18+
| url | https://example.org/my-doc.pdf |
19+
Then the response status code is 400
20+
And the response is an OperationOutcome with 1 issue
21+
And the OperationOutcome contains the issue:
22+
"""
23+
{
24+
"severity": "error",
25+
"code": "invalid",
26+
"details": {
27+
"coding": [
28+
{
29+
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
30+
"code": "BAD_REQUEST",
31+
"display": "Bad request"
32+
}
33+
]
34+
},
35+
"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'",
36+
"expression": [
37+
"category.coding[0].code"
38+
]
39+
}
40+
"""

0 commit comments

Comments
 (0)