use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class IntygIntegrationControllerTest method createUser.
private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
WebCertUser user = new WebCertUser();
HashMap<String, Privilege> pMap = new HashMap<>();
pMap.put(p.getName(), p);
user.setAuthorities(pMap);
user.setOrigin(origin);
user.setFeatures(features);
HashMap<String, Role> rMap = new HashMap<>();
Role role = new Role();
role.setName(roleName);
rMap.put(roleName, role);
user.setRoles(rMap);
Vardgivare vg = new Vardgivare();
vg.setId("vg1");
Vardenhet ve = new Vardenhet();
ve.setVardgivareHsaId("vg1");
ve.setId(ENHETSID);
vg.setVardenheter(Arrays.asList(ve));
user.setVardgivare(Arrays.asList(vg));
return user;
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class IntygIntegrationControllerTest method referenceNotPersistedIfNotSupplied.
@Test
public void referenceNotPersistedIfNotSupplied() {
IntegrationParameters parameters = new IntegrationParameters(null, null, ALTERNATE_SSN, null, null, null, null, null, null, false, false, false, false);
WebCertUser user = createDefaultUser();
user.setParameters(parameters);
Response res = testee.handleRedirectToIntyg(uriInfo, INTYGSTYP, INTYGSID, ENHETSID, user);
assertEquals(Response.Status.TEMPORARY_REDIRECT.getStatusCode(), res.getStatus());
verify(referensService, times(0)).saveReferens(eq(INTYGSID), or(isNull(), any()));
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class IntygIntegrationControllerTest method referenceGetsPersistedCorrectly.
@Test
public void referenceGetsPersistedCorrectly() {
when(referensService.referensExists(eq(INTYGSID))).thenReturn(false);
String ref = "referens";
IntegrationParameters parameters = new IntegrationParameters(ref, null, ALTERNATE_SSN, null, null, null, null, null, null, false, false, false, false);
WebCertUser user = createDefaultUser();
user.setParameters(parameters);
Response res = testee.handleRedirectToIntyg(uriInfo, INTYGSTYP, INTYGSID, ENHETSID, user);
assertEquals(Response.Status.TEMPORARY_REDIRECT.getStatusCode(), res.getStatus());
verify(referensService).saveReferens(eq(INTYGSID), eq(ref));
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method createUser.
private WebCertUser createUser(String roleName, Privilege p, Map<String, Feature> features, String origin) {
WebCertUser user = new WebCertUser();
HashMap<String, Privilege> pMap = new HashMap<>();
pMap.put(p.getName(), p);
user.setAuthorities(pMap);
user.setOrigin(origin);
user.setFeatures(features);
HashMap<String, Role> rMap = new HashMap<>();
Role role = new Role();
role.setName(roleName);
rMap.put(roleName, role);
user.setRoles(rMap);
return user;
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class IntygIntegrationServiceImplTest method expectExceptionWhenSekretessStatusIsUndefined.
@Test(expected = WebCertServiceException.class)
public void expectExceptionWhenSekretessStatusIsUndefined() {
// given
when(utkastRepository.findOne(anyString())).thenReturn(createUtkast());
when(patientDetailsResolver.getSekretessStatus(any(Personnummer.class))).thenReturn(SekretessStatus.UNDEFINED);
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
testee.prepareRedirectToIntyg(INTYGSTYP, INTYGSID, user);
// if code reaches this point we fail the test
fail();
}
Aggregations