mirror of
https://github.com/hapifhir/hapi-fhir.git
synced 2025-02-28 09:09:16 +00:00
Remove Forbid from hapi-fhir and add to cdr
This commit is contained in:
parent
fdf748ba9f
commit
b5953af239
@ -156,38 +156,6 @@ public class ConsentInterceptorTest {
|
|||||||
verify(myConsentSvc, timeout(2000).times(0)).completeOperationFailure(any(), any(), any());
|
verify(myConsentSvc, timeout(2000).times(0)).completeOperationFailure(any(), any(), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testConsentCanSeeResourceForbid() throws IOException {
|
|
||||||
Patient patientA = new Patient();
|
|
||||||
patientA.setId("PT-1-0");
|
|
||||||
patientA.setActive(true);
|
|
||||||
patientA.addName().setFamily("FAMILY").addGiven("GIVEN");
|
|
||||||
patientA.addIdentifier().setSystem("SYSTEM").setValue("VALUEA");
|
|
||||||
|
|
||||||
ourPatientProvider.store(patientA);
|
|
||||||
|
|
||||||
when(myConsentSvc.startOperation(any(), any())).thenReturn(ConsentOutcome.PROCEED);
|
|
||||||
when(myConsentSvc.canSeeResource(any(), any(), any())).thenReturn(ConsentOutcome.FORBID);
|
|
||||||
|
|
||||||
HttpPut httpPut = new HttpPut("http://localhost:" + myPort + "/Patient/PT-1-0");
|
|
||||||
httpPut.setHeader(HttpHeaders.CONTENT_TYPE, "application/json");
|
|
||||||
|
|
||||||
httpPut.setEntity(new StringEntity("{\"resourceType\": \"Patient\",\"id\": \"PT-1-0\",\"text\": {\"status\": \"generated\",\"div\": \"<div><p>A valid patient resource for testing purposes</p></div>\"},\"gender\": \"male\"}"));
|
|
||||||
|
|
||||||
try (CloseableHttpResponse status = myClient.execute(httpPut)) {
|
|
||||||
String responseContent = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
|
|
||||||
System.out.println("here");
|
|
||||||
ourLog.info("Response: {}", responseContent);
|
|
||||||
assertEquals(403, status.getStatusLine().getStatusCode());
|
|
||||||
//String responseContent = IOUtils.toString(status.getEntity().getContent(), Charsets.UTF_8);
|
|
||||||
System.out.println("here");
|
|
||||||
ourLog.info("Response: {}", responseContent);
|
|
||||||
}
|
|
||||||
|
|
||||||
verify(myConsentSvc, timeout(2000).times(1)).completeOperationSuccess(any(), any());
|
|
||||||
verify(myConsentSvc, timeout(2000).times(0)).completeOperationFailure(any(), any(), any());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTotalModeIgnoredForConsentQueries() throws IOException {
|
public void testTotalModeIgnoredForConsentQueries() throws IOException {
|
||||||
Patient patientA = new Patient();
|
Patient patientA = new Patient();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user