use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class WebCertUserServiceTest method setupUserMottagningAccessTest.
private WebCertUser setupUserMottagningAccessTest() {
WebCertUser user = createWebCertUser(true);
((Vardenhet) user.getValdVardenhet()).getMottagningar().add(buildMottagning1());
((Vardenhet) user.getValdVardenhet()).getMottagningar().add(buildMottagning2());
applyUserToThreadLocalCtx(user);
return user;
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class WebCertUserServiceTest method testStoreExistingUserMetadata.
@Test
public void testStoreExistingUserMetadata() {
WebCertUser user = createWebCertUser(false);
applyUserToThreadLocalCtx(user);
when(anvandarPreferenceRepository.findByHsaIdAndKey("HSA-id", "key1")).thenReturn(new AnvandarPreference("HSA-id", "key1", "value1"));
webcertUserService.storeUserPreference("key1", "value1");
assertEquals("value1", user.getAnvandarPreference().get("key1"));
verify(anvandarPreferenceRepository, times(1)).findByHsaIdAndKey("HSA-id", "key1");
verify(anvandarPreferenceRepository, times(1)).save(any(AnvandarPreference.class));
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class WebCertUserServiceTest method testDeleteUnknownAnvandarPreference.
@Test
public void testDeleteUnknownAnvandarPreference() {
WebCertUser user = createWebCertUser(false);
applyUserToThreadLocalCtx(user);
when(anvandarPreferenceRepository.findByHsaIdAndKey(user.getHsaId(), "key1")).thenReturn(null);
webcertUserService.deleteUserPreference("key1");
verify(anvandarPreferenceRepository, times(1)).findByHsaIdAndKey("HSA-id", "key1");
verify(anvandarPreferenceRepository, times(0)).delete(any(AnvandarPreference.class));
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class WebCertUserServiceTest method testGetMiuOk.
@Test
public void testGetMiuOk() {
WebCertUser user = createWebCertUser(false);
assertEquals("Mitt uppdrag", user.getSelectedMedarbetarUppdragNamn());
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class WebCertUserServiceTest method testDeleteStoredAnvandarPreference.
@Test
public void testDeleteStoredAnvandarPreference() {
AnvandarPreference anvandarPreference = new AnvandarPreference("HSA-id", "key1", "value1");
WebCertUser user = createWebCertUser(false);
applyUserToThreadLocalCtx(user);
when(anvandarPreferenceRepository.findByHsaIdAndKey(user.getHsaId(), "key1")).thenReturn(anvandarPreference);
webcertUserService.deleteUserPreference("key1");
verify(anvandarPreferenceRepository, times(1)).findByHsaIdAndKey("HSA-id", "key1");
verify(anvandarPreferenceRepository, times(1)).delete(anvandarPreference);
}
Aggregations