Skip to content

Commit 75f832c

Browse files
authored
Merge pull request #884 from NHSDigital/feature/eema1-NRL-523-DeleteResponseIsOkForNoPointerFound
NRL-523 delete response is 200 for no pointer found
2 parents d88ea64 + 162118f commit 75f832c

File tree

4 files changed

+27
-15
lines changed

4 files changed

+27
-15
lines changed

api/producer/deleteDocumentReference/delete_document_reference.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ def handler(
4040

4141
if not (core_model := repository.get_by_id(pointer_id)):
4242
logger.log(LogReference.PRODELETE002, pointer_id=pointer_id)
43-
return SpineErrorResponse.NO_RECORD_FOUND(
44-
diagnostics="The requested DocumentReference could not be found",
45-
)
43+
return NRLResponse.RESOURCE_DOES_NOT_EXIST_DELETE()
4644

4745
repository.delete(core_model)
4846

api/producer/deleteDocumentReference/tests/test_delete_document_reference.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_delete_document_reference_not_exists(repository: DocumentPointerReposit
140140
body = result.pop("body")
141141

142142
assert result == {
143-
"statusCode": "404",
143+
"statusCode": "200",
144144
"headers": default_response_headers(),
145145
"isBase64Encoded": False,
146146
}
@@ -150,14 +150,14 @@ def test_delete_document_reference_not_exists(repository: DocumentPointerReposit
150150
"resourceType": "OperationOutcome",
151151
"issue": [
152152
{
153-
"severity": "error",
154-
"code": "not-found",
153+
"severity": "information",
154+
"code": "informational",
155155
"details": {
156156
"coding": [
157157
{
158-
"code": "NO_RECORD_FOUND",
159-
"display": "No record found",
160-
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
158+
"code": "RESOURCE_DELETED",
159+
"display": "Resource deleted",
160+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
161161
}
162162
]
163163
},

layer/nrlf/core/response.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ def RESOURCE_DELETED(cls):
117117
statusCode="200",
118118
)
119119

120+
@classmethod
121+
def RESOURCE_DOES_NOT_EXIST_DELETE(cls):
122+
return cls.from_issues(
123+
issues=[
124+
producer_model.OperationOutcomeIssue(
125+
severity="information",
126+
code="informational",
127+
details=NRLResponseConcept.from_code("RESOURCE_DELETED"),
128+
diagnostics="The requested DocumentReference could not be found",
129+
)
130+
],
131+
statusCode="200",
132+
)
133+
120134

121135
class SpineErrorResponse(Response):
122136
@classmethod

tests/features/producer/deleteDocumentReference-success.feature

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ Feature: Producer - deleteDocumentReference - Success Scenarios
4848
| system | value |
4949
| http://snomed.info/sct | 736253002 |
5050
When producer 'DK94' requests to delete DocumentReference with id 'DK94-000-NoPointerHere'
51-
Then the response status code is 404
51+
Then the response status code is 200
5252
And the response is an OperationOutcome with 1 issue
5353
And the OperationOutcome contains the issue:
5454
"""
5555
{
56-
"severity": "error",
57-
"code": "not-found",
56+
"severity": "information",
57+
"code": "informational",
5858
"details": {
5959
"coding": [
6060
{
61-
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
62-
"code": "NO_RECORD_FOUND",
63-
"display": "No record found"
61+
"system": "https://fhir.nhs.uk/ValueSet/NRL-ResponseCode",
62+
"code": "RESOURCE_DELETED",
63+
"display": "Resource deleted"
6464
}
6565
]
6666
},

0 commit comments

Comments
 (0)