Search in sources :

Example 1 with WebUserFeaturesRequest

use of se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest in project webcert by sklintyg.

the class UserApiControllerTest method testUserFeaturesDisableDisabled.

@Test
public void testUserFeaturesDisableDisabled() {
    // Given
    final WebUserFeaturesRequest webUserFeaturesRequest = new WebUserFeaturesRequest();
    webUserFeaturesRequest.setJsLoggning(false);
    final HashMap<String, Feature> features = new HashMap<>();
    when(webCertUser.getFeatures()).thenReturn(features);
    // When
    userApiController.userFeatures(webUserFeaturesRequest);
    // Then
    Mockito.verify(webCertUser, times(1)).setFeatures(captor.capture());
    assertFalse(captor.getValue().containsKey(AuthoritiesConstants.FEATURE_JS_LOGGNING));
}
Also used : WebUserFeaturesRequest(se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest) HashMap(java.util.HashMap) Feature(se.inera.intyg.infra.security.common.model.Feature) Test(org.junit.Test)

Example 2 with WebUserFeaturesRequest

use of se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest in project webcert by sklintyg.

the class UserApiControllerTest method testUserFeaturesDisableEnabled.

@Test
public void testUserFeaturesDisableEnabled() {
    // Given
    final WebUserFeaturesRequest webUserFeaturesRequest = new WebUserFeaturesRequest();
    webUserFeaturesRequest.setJsLoggning(false);
    final HashMap<String, Feature> features = new HashMap<>();
    Feature f1 = new Feature();
    f1.setName(AuthoritiesConstants.FEATURE_JS_LOGGNING);
    features.put(f1.getName(), f1);
    when(webCertUser.getFeatures()).thenReturn(features);
    // When
    userApiController.userFeatures(webUserFeaturesRequest);
    // Then
    Mockito.verify(webCertUser, times(1)).setFeatures(captor.capture());
    assertFalse(captor.getValue().containsKey(AuthoritiesConstants.FEATURE_JS_LOGGNING));
}
Also used : WebUserFeaturesRequest(se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest) HashMap(java.util.HashMap) Feature(se.inera.intyg.infra.security.common.model.Feature) Test(org.junit.Test)

Example 3 with WebUserFeaturesRequest

use of se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest in project webcert by sklintyg.

the class UserApiControllerTest method testUserFeaturesEnableEnabled.

@Test
public void testUserFeaturesEnableEnabled() {
    // Given
    final WebUserFeaturesRequest webUserFeaturesRequest = new WebUserFeaturesRequest();
    webUserFeaturesRequest.setJsLoggning(true);
    final HashMap<String, Feature> features = new HashMap<>();
    Feature f1 = new Feature();
    f1.setName(AuthoritiesConstants.FEATURE_JS_LOGGNING);
    features.put(f1.getName(), f1);
    when(webCertUser.getFeatures()).thenReturn(features);
    // When
    userApiController.userFeatures(webUserFeaturesRequest);
    // Then
    Mockito.verify(webCertUser, times(1)).setFeatures(captor.capture());
    assertTrue(captor.getValue().containsKey(AuthoritiesConstants.FEATURE_JS_LOGGNING));
}
Also used : WebUserFeaturesRequest(se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest) HashMap(java.util.HashMap) Feature(se.inera.intyg.infra.security.common.model.Feature) Test(org.junit.Test)

Example 4 with WebUserFeaturesRequest

use of se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest in project webcert by sklintyg.

the class UserApiControllerTest method testUserFeaturesEnableDisabled.

@Test
public void testUserFeaturesEnableDisabled() {
    // Given
    final WebUserFeaturesRequest webUserFeaturesRequest = new WebUserFeaturesRequest();
    webUserFeaturesRequest.setJsLoggning(true);
    final HashMap<String, Feature> features = new HashMap<>();
    when(webCertUser.getFeatures()).thenReturn(features);
    // When
    userApiController.userFeatures(webUserFeaturesRequest);
    // Then
    Mockito.verify(webCertUser, times(1)).setFeatures(captor.capture());
    assertTrue(captor.getValue().containsKey(AuthoritiesConstants.FEATURE_JS_LOGGNING));
}
Also used : WebUserFeaturesRequest(se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest) HashMap(java.util.HashMap) Feature(se.inera.intyg.infra.security.common.model.Feature) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)4 Test (org.junit.Test)4 Feature (se.inera.intyg.infra.security.common.model.Feature)4 WebUserFeaturesRequest (se.inera.intyg.webcert.web.web.controller.api.dto.WebUserFeaturesRequest)4