use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method ensureDraftPatientInfoUpdated.
@Test
public void ensureDraftPatientInfoUpdated() {
IntegrationParameters parameters = new IntegrationParameters(null, null, ALTERNATE_SSN, null, null, null, null, null, null, false, false, false, false);
WebCertUser user = createDefaultUser();
user.setParameters(parameters);
testee.ensureDraftPatientInfoUpdated("lisjp", null, 0l, user);
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method prepareRedirectToIntygSuccess.
@Test
public void prepareRedirectToIntygSuccess() {
// given
when(utkastRepository.findOne(anyString())).thenReturn(createUtkast());
when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(SekretessStatus.FALSE);
IntegrationParameters parameters = new IntegrationParameters(null, null, ALTERNATE_SSN, "Nollan", null, "Nollansson", "Nollgatan", "000000", "Nollby", false, false, false, false);
WebCertUser user = createDefaultUser();
user.setParameters(parameters);
// when
PrepareRedirectToIntyg prepareRedirectToIntyg = testee.prepareRedirectToIntyg(INTYGSTYP, INTYGSID, user);
// then
verify(utkastRepository).findOne(anyString());
verify(patientDetailsResolver).getSekretessStatus(any(Personnummer.class));
assertEquals(INTYGSTYP, prepareRedirectToIntyg.getIntygTyp());
assertEquals(INTYGSID, prepareRedirectToIntyg.getIntygId());
assertTrue(prepareRedirectToIntyg.isUtkast());
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method userIsAuthorizedToHandleSekretessmarkeradPatient.
@Test
public void userIsAuthorizedToHandleSekretessmarkeradPatient() {
// given
when(utkastRepository.findOne(anyString())).thenReturn(createUtkast());
when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(SekretessStatus.TRUE);
IntegrationParameters parameters = new IntegrationParameters(null, null, ALTERNATE_SSN, "Nollan", null, "Nollansson", "Nollgatan", "000000", "Nollby", false, false, false, false);
Privilege p = createPrivilege(AuthoritiesConstants.PRIVILEGE_HANTERA_SEKRETESSMARKERAD_PATIENT, // p1 is restricted to these intygstyper
Arrays.asList("lisjp", "ts-bas"), Arrays.asList(createRequestOrigin(UserOriginType.DJUPINTEGRATION.name(), Arrays.asList("lisjp")), createRequestOrigin(UserOriginType.DJUPINTEGRATION.name(), Arrays.asList("ts-bas"))));
WebCertUser user = createDefaultUser();
user.setParameters(parameters);
user.getAuthorities().put(AuthoritiesConstants.PRIVILEGE_HANTERA_SEKRETESSMARKERAD_PATIENT, p);
// when
PrepareRedirectToIntyg prepareRedirectToIntyg = testee.prepareRedirectToIntyg(INTYGSTYP, INTYGSID, user);
// then
verify(utkastRepository).findOne(anyString());
verify(patientDetailsResolver).getSekretessStatus(any(Personnummer.class));
assertEquals(INTYGSTYP, prepareRedirectToIntyg.getIntygTyp());
assertEquals(INTYGSID, prepareRedirectToIntyg.getIntygId());
assertTrue(prepareRedirectToIntyg.isUtkast());
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method verifyMonitoringWhenSammanhallenSjukforingAndOtherVardgivare.
@Test
public void verifyMonitoringWhenSammanhallenSjukforingAndOtherVardgivare() {
// given
when(utkastRepository.findOne(anyString())).thenReturn(createUtkast());
when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(SekretessStatus.FALSE);
IntegrationParameters parameters = new IntegrationParameters(null, null, ALTERNATE_SSN, "Nollan", null, "Nollansson", "Nollgatan", "000000", "Nollby", true, false, false, false);
WebCertUser user = createDefaultUser();
user.setParameters(parameters);
user.setValdVardgivare(createVardgivare());
// when
testee.prepareRedirectToIntyg(INTYGSTYP, INTYGSID, user);
// then
verify(monitoringLog).logIntegratedOtherCaregiver(anyString(), anyString(), anyString(), anyString());
}
use of se.inera.intyg.webcert.web.web.controller.integration.dto.IntegrationParameters in project webcert by sklintyg.
the class IntygModuleApiControllerTest method testCreateNewCompletion.
@Test
public void testCreateNewCompletion() {
final String personnummer = "191212121212";
final String newIntygId = "newIntygId";
final String meddelandeId = "meddelandeId";
final String newPersonnummer = "201212121212";
final String efternamn = "efternamn";
final String fornamn = "fornamn";
final String mellannamn = "mellannamn";
final String postadress = "postadress";
final String postort = "postort";
final String postnummer = "postnummer";
final CopyIntygRequest request = new CopyIntygRequest();
request.setPatientPersonnummer(createPnr(personnummer));
WebCertUser user = new WebCertUser();
user.setParameters(new IntegrationParameters(null, null, newPersonnummer, fornamn, mellannamn, efternamn, postadress, postnummer, postort, false, false, false, true));
addFeatures(user, CERTIFICATE_TYPE, AuthoritiesConstants.FEATURE_FORNYA_INTYG);
addPrivileges(user, CERTIFICATE_TYPE, AuthoritiesConstants.PRIVILEGE_SVARA_MED_NYTT_INTYG);
user.setOrigin("NORMAL");
ArgumentCaptor<CreateCompletionCopyRequest> captor = ArgumentCaptor.forClass(CreateCompletionCopyRequest.class);
when(copyUtkastService.createCompletion(captor.capture())).thenReturn(new CreateCompletionCopyResponse(CERTIFICATE_TYPE, newIntygId, CERTIFICATE_ID));
when(webcertUserService.getUser()).thenReturn(user);
Response response = moduleApiController.createCompletion(request, CERTIFICATE_TYPE, CERTIFICATE_ID);
verify(copyUtkastService).createCompletion(any());
verifyNoMoreInteractions(copyUtkastService);
assertEquals(newIntygId, ((CopyIntygResponse) response.getEntity()).getIntygsUtkastId());
assertEquals(personnummer, captor.getValue().getPatient().getPersonId().getPersonnummer());
assertEquals(fornamn, captor.getValue().getPatient().getFornamn());
assertEquals(efternamn, captor.getValue().getPatient().getEfternamn());
assertEquals(mellannamn, captor.getValue().getPatient().getMellannamn());
assertEquals(postadress, captor.getValue().getPatient().getPostadress());
assertEquals(postnummer, captor.getValue().getPatient().getPostnummer());
assertEquals(postort, captor.getValue().getPatient().getPostort());
assertEquals(newPersonnummer, captor.getValue().getNyttPatientPersonnummer().getPersonnummer());
}
Aggregations