Skip to content

Commit aba6214

Browse files
committed
NRL-1205 add negative tests for category search without correct perms
1 parent cb69b2c commit aba6214

File tree

1 file changed

+48
-19
lines changed

1 file changed

+48
-19
lines changed

tests/features/consumer/searchDocumentReference-failure.feature

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,14 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
162162
}
163163
"""
164164

165-
Scenario: Search gives 403 if no permission
165+
Scenario: Search rejects request if the organisation has no registered pointer types but uses category filter
166166
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
167-
And a DocumentReference resource exists with values:
168-
| property | value |
169-
| id | 8FW23-1114567890-SearchDocRefTest |
170-
| subject | 9278693472 |
171-
| status | current |
172-
| type | 736253002 |
173-
| category | 734163000 |
174-
| contentType | application/pdf |
175-
| url | https://example.org/my-doc.pdf |
176-
| custodian | 8FW23 |
177-
| author | 8FW23 |
178-
When consumer 'Z26' searches for DocumentReferences with parameters:
179-
| parameter | value |
180-
| subject | 9278693472 |
181-
| type | 736253002 |
167+
And the organisation 'RX898' is authorised to access pointer types:
168+
| system | value |
169+
When consumer 'RX898' searches for DocumentReferences with parameters:
170+
| parameter | value |
171+
| subject | 9278693472 |
172+
| category | http://snomed.info/sct\|734163000 |
182173
Then the response status code is 403
183174
And the response is an OperationOutcome with 1 issue
184175
And the OperationOutcome contains the issue:
@@ -193,15 +184,53 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
193184
"display": "Access has been denied to process this request"
194185
}]
195186
},
196-
"diagnostics": "Your organisation 'Z26' does not have permission to access this resource. Contact the onboarding team."
187+
"diagnostics": "Your organisation 'RX898' does not have permission to access this resource. Contact the onboarding team."
197188
}
198189
"""
199190

200-
Scenario: Search rejects request if the organisation has no registered pointer types
191+
Scenario: Search returns no results if category filter is used without any relevant type permissions
201192
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
193+
And the organisation 'RX898' is authorised to access pointer types:
194+
| system | value |
195+
| http://snomed.info/sct | 736253002 |
196+
And a DocumentReference resource exists with values:
197+
| property | value |
198+
| id | 8FW23-537854543-SearchDocRefTest |
199+
| subject | 9278693472 |
200+
| status | current |
201+
| type | 1363501000000100 |
202+
| category | 1102421000000108 |
203+
| contentType | application/pdf |
204+
| url | https://example.org/my-doc.pdf |
205+
| custodian | 8FW23 |
206+
| author | 8FW23 |
202207
When consumer 'RX898' searches for DocumentReferences with parameters:
208+
| parameter | value |
209+
| subject | 9278693472 |
210+
| category | http://snomed.info/sct\|1102421000000108 |
211+
Then the response status code is 200
212+
And the response is a searchset Bundle
213+
And the Bundle has a self link matching 'DocumentReference?subject:identifier=https://fhir.nhs.uk/Id/nhs-number|9278693472&category=http://snomed.info/sct|1102421000000108'
214+
And the Bundle has a total of 0
215+
And the Bundle has 0 entries
216+
217+
Scenario: Search gives 403 if no permission
218+
Given the application 'DataShare' (ID 'z00z-y11y-x22x') is registered to access the API
219+
And a DocumentReference resource exists with values:
220+
| property | value |
221+
| id | 8FW23-1114567890-SearchDocRefTest |
222+
| subject | 9278693472 |
223+
| status | current |
224+
| type | 736253002 |
225+
| category | 734163000 |
226+
| contentType | application/pdf |
227+
| url | https://example.org/my-doc.pdf |
228+
| custodian | 8FW23 |
229+
| author | 8FW23 |
230+
When consumer 'Z26' searches for DocumentReferences with parameters:
203231
| parameter | value |
204232
| subject | 9278693472 |
233+
| type | 736253002 |
205234
Then the response status code is 403
206235
And the response is an OperationOutcome with 1 issue
207236
And the OperationOutcome contains the issue:
@@ -216,7 +245,7 @@ Feature: Consumer - searchDocumentReference - Failure Scenarios
216245
"display": "Access has been denied to process this request"
217246
}]
218247
},
219-
"diagnostics": "Your organisation 'RX898' does not have permission to access this resource. Contact the onboarding team."
248+
"diagnostics": "Your organisation 'Z26' does not have permission to access this resource. Contact the onboarding team."
220249
}
221250
"""
222251

0 commit comments

Comments
 (0)