Remove Forbid from hapi-fhir and add to cdr

This commit is contained in:
souradeepsaha 2023-05-30 09:42:12 -04:00
parent fdf748ba9f
commit b5953af239

View File

@ -156,38 +156,6 @@ public class ConsentInterceptorTest {
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
public void testTotalModeIgnoredForConsentQueries() throws IOException {
Patient patientA = new Patient();