use of org.wso2.carbon.apimgt.impl.utils.StandaloneAuthorizationManagerClient in project carbon-apimgt by wso2.
the class StandaloneAuthorizationManagerClientTestCase method testGetRolesOfUser.
@Test
public void testGetRolesOfUser() throws Exception {
StandaloneAuthorizationManagerClient standaloneAuthorizationManagerClient = new StandaloneAuthorizationManagerClient();
standaloneAuthorizationManagerClient.getRolesOfUser("john");
Mockito.verify(userStoreManager, Mockito.times(1)).getRoleListOfUser("john");
}
use of org.wso2.carbon.apimgt.impl.utils.StandaloneAuthorizationManagerClient in project carbon-apimgt by wso2.
the class StandaloneAuthorizationManagerClientTestCase method testGetRolesOfUserException.
@Test(expected = APIManagementException.class)
public void testGetRolesOfUserException() throws Exception {
StandaloneAuthorizationManagerClient standaloneAuthorizationManagerClient = new StandaloneAuthorizationManagerClient();
Mockito.when(userStoreManager.getRoleListOfUser("john")).thenThrow(new UserStoreException());
standaloneAuthorizationManagerClient.getRolesOfUser("john");
}
use of org.wso2.carbon.apimgt.impl.utils.StandaloneAuthorizationManagerClient in project carbon-apimgt by wso2.
the class StandaloneAuthorizationManagerClientTestCase method testIsUserAuthorizedException.
@Test(expected = APIManagementException.class)
public void testIsUserAuthorizedException() throws Exception {
StandaloneAuthorizationManagerClient standaloneAuthorizationManagerClient = new StandaloneAuthorizationManagerClient();
Mockito.when(authorizationManager.isUserAuthorized("john", "create", CarbonConstants.UI_PERMISSION_ACTION)).thenThrow(new UserStoreException());
standaloneAuthorizationManagerClient.isUserAuthorized("john", "create");
}
use of org.wso2.carbon.apimgt.impl.utils.StandaloneAuthorizationManagerClient in project carbon-apimgt by wso2.
the class StandaloneAuthorizationManagerClientTestCase method testIsUserAuthorized.
@Test
public void testIsUserAuthorized() throws Exception {
StandaloneAuthorizationManagerClient standaloneAuthorizationManagerClient = new StandaloneAuthorizationManagerClient();
standaloneAuthorizationManagerClient.isUserAuthorized("john", "create");
Mockito.verify(authorizationManager, Mockito.times(1)).isUserAuthorized("john", "create", CarbonConstants.UI_PERMISSION_ACTION);
}
use of org.wso2.carbon.apimgt.impl.utils.StandaloneAuthorizationManagerClient in project carbon-apimgt by wso2.
the class StandaloneAuthorizationManagerClientTestCase method testGetRoleNames.
@Test
public void testGetRoleNames() throws Exception {
StandaloneAuthorizationManagerClient standaloneAuthorizationManagerClient = new StandaloneAuthorizationManagerClient();
standaloneAuthorizationManagerClient.getRoleNames();
Mockito.verify(userStoreManager, Mockito.times(1)).getRoleNames();
}
Aggregations