use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class SignaturServiceImplTest method clientGrpSignatureKOMPLTSuccess.
@Test
public void clientGrpSignatureKOMPLTSuccess() throws IOException, ModuleNotFoundException {
completedUtkast.setRelationKod(RelationKod.KOMPLT);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(completedUtkast);
SignaturTicket ticket = intygSignatureService.createDraftHash(INTYG_ID, completedUtkast.getVersion());
SignaturTicket status = intygSignatureService.ticketStatus(ticket.getId());
assertEquals(SignaturTicket.Status.BEARBETAR, status.getStatus());
String signature = "{\"signatur\":\"SIGNATURE\"}";
when(mockUtkastRepository.save(any(Utkast.class))).thenReturn(completedUtkast);
// Do the call
SignaturTicket signatureTicket = intygSignatureService.clientGrpSignature(ticket.getId(), signature, user);
verify(intygService).storeIntyg(completedUtkast);
verify(notificationService).sendNotificationForDraftSigned(any(Utkast.class));
// Assert pdl log
verify(logService).logSignIntyg(any(LogRequest.class), isNull());
assertNotNull(signatureTicket);
assertNotNull(completedUtkast.getSignatur());
assertEquals(UtkastStatus.SIGNED, completedUtkast.getStatus());
// Assert ticket status has changed from BEARBETAR to SIGNERAD
status = intygSignatureService.ticketStatus(ticket.getId());
assertEquals(SignaturTicket.Status.SIGNERAD, status.getStatus());
}
use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class SignaturServiceImplTest method serverSignatureSuccessUniqueIntyg.
@Test
public void serverSignatureSuccessUniqueIntyg() {
Feature f = new Feature();
f.setIntygstyper(ImmutableList.of(INTYG_TYPE));
f.setGlobal(true);
user.getFeatures().put(AuthoritiesConstants.FEATURE_UNIKT_INTYG, f);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(completedUtkast);
when(mockUtkastRepository.save(any(Utkast.class))).thenReturn(completedUtkast);
when(mockUtkastRepository.findAllByPatientPersonnummerAndIntygsTypIn(any(String.class), anySet())).thenReturn(Collections.emptyList());
SignaturTicket signatureTicket = intygSignatureService.serverSignature(INTYG_ID, completedUtkast.getVersion());
verify(intygService).storeIntyg(completedUtkast);
verify(notificationService).sendNotificationForDraftSigned(any(Utkast.class));
verify(logService).logSignIntyg(any(LogRequest.class));
assertNotNull(signatureTicket);
assertNotNull(completedUtkast.getSignatur());
assertEquals(UtkastStatus.SIGNED, completedUtkast.getStatus());
}
use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class SignaturServiceImplTest method serverSignatureKOMPLTSuccess.
@Test
public void serverSignatureKOMPLTSuccess() throws IOException, ModuleNotFoundException {
completedUtkast.setRelationKod(RelationKod.KOMPLT);
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(completedUtkast);
when(mockUtkastRepository.save(any(Utkast.class))).thenReturn(completedUtkast);
// Do the call
SignaturTicket signatureTicket = intygSignatureService.serverSignature(INTYG_ID, completedUtkast.getVersion());
verify(intygService).storeIntyg(completedUtkast);
verify(notificationService).sendNotificationForDraftSigned(any(Utkast.class));
// Assert pdl log
verify(logService).logSignIntyg(any(LogRequest.class));
assertNotNull(signatureTicket);
assertNotNull(completedUtkast.getSignatur());
assertEquals(UtkastStatus.SIGNED, completedUtkast.getStatus());
}
use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class SignaturServiceImplTest method userIsNotDoctorClientSignature.
@Test(expected = WebCertServiceException.class)
public void userIsNotDoctorClientSignature() throws IOException {
user = createWebCertUser(false);
when(webcertUserService.getUser()).thenReturn(user);
SignaturTicket ticket = intygSignatureService.createDraftHash(INTYG_ID, completedUtkast.getVersion());
intygSignatureService.clientSignature(ticket.getId(), "test");
}
use of se.inera.intyg.webcert.web.service.signatur.dto.SignaturTicket in project webcert by sklintyg.
the class SignaturServiceImplTest method clientGrpSignatureSuccess.
@Test
public void clientGrpSignatureSuccess() throws IOException {
when(mockUtkastRepository.findOne(INTYG_ID)).thenReturn(completedUtkast);
when(mockUtkastRepository.save(any(Utkast.class))).thenReturn(completedUtkast);
SignaturTicket ticket = intygSignatureService.createDraftHash(INTYG_ID, completedUtkast.getVersion());
SignaturTicket status = intygSignatureService.ticketStatus(ticket.getId());
assertEquals(SignaturTicket.Status.BEARBETAR, status.getStatus());
String signature = "{\"signatur\":\"SIGNATURE\"}";
// Do the call
SignaturTicket signatureTicket = intygSignatureService.clientGrpSignature(ticket.getId(), signature, user);
verify(intygService).storeIntyg(completedUtkast);
verify(notificationService).sendNotificationForDraftSigned(any(Utkast.class));
// Assert pdl log
verify(logService).logSignIntyg(any(LogRequest.class), isNull());
assertNotNull(signatureTicket);
assertNotNull(completedUtkast.getSignatur());
assertEquals(UtkastStatus.SIGNED, completedUtkast.getStatus());
// Assert ticket status has changed from BEARBETAR to SIGNERAD
status = intygSignatureService.ticketStatus(ticket.getId());
assertEquals(SignaturTicket.Status.SIGNERAD, status.getStatus());
}
Aggregations