use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testMustNotHavePrevilegeFails.
@Test
public void testMustNotHavePrevilegeFails() {
WebCertUser user = createDefaultUser();
thrown.expect(AuthoritiesException.class);
validator.given(user).notPrivilege("p1").orThrow();
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testMustNotHaveAnyFeatureFails.
@Test
public void testMustNotHaveAnyFeatureFails() {
WebCertUser user = createDefaultUser();
user.setFeatures(Stream.of(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, AuthoritiesConstants.FEATURE_HANTERA_FRAGOR).collect(Collectors.toMap(Function.identity(), s -> {
Feature feature = new Feature();
feature.setName(s);
feature.setIntygstyper(Collections.singletonList("fk7263"));
return feature;
})));
assertFalse(validator.given(user, "fk7263").notFeatures(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, AuthoritiesConstants.FEATURE_FORNYA_INTYG).isVerified());
thrown.expect(AuthoritiesException.class);
validator.given(user, "fk7263").notFeatures(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, AuthoritiesConstants.FEATURE_FORNYA_INTYG).orThrow();
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testMustNotHaveAnyFeature.
@Test
public void testMustNotHaveAnyFeature() {
WebCertUser user = createDefaultUser();
user.setFeatures(Stream.of(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST, AuthoritiesConstants.FEATURE_HANTERA_FRAGOR).collect(Collectors.toMap(Function.identity(), s -> {
Feature feature = new Feature();
feature.setName(s);
feature.setIntygstyper(Collections.singletonList("fk7263"));
return feature;
})));
assertTrue(validator.given(user).notFeatures(AuthoritiesConstants.FEATURE_ARBETSGIVARUTSKRIFT, AuthoritiesConstants.FEATURE_FORNYA_INTYG).isVerified());
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testNotMustHaveAnyOfRole.
@Test
public void testNotMustHaveAnyOfRole() {
WebCertUser user = createDefaultUser();
assertTrue(validator.given(user).notRoles(AuthoritiesConstants.ROLE_TANDLAKARE, AuthoritiesConstants.ROLE_ADMIN).isVerified());
}
use of se.inera.intyg.webcert.web.service.user.dto.WebCertUser in project webcert by sklintyg.
the class AuthoritiesValidatorTest method testMustNotHaveFeatureFail.
@Test
public void testMustNotHaveFeatureFail() {
WebCertUser user = createDefaultUser();
assertFalse(validator.given(user, "fk7263").notFeatures(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).isVerified());
thrown.expect(AuthoritiesException.class);
validator.given(user, "fk7263").notFeatures(AuthoritiesConstants.FEATURE_HANTERA_INTYGSUTKAST).orThrow();
}
Aggregations