Search in sources :

Example 11 with SimbaUserR

use of org.simbasecurity.dwclient.gateway.representations.SimbaUserR in project simba-os by cegeka.

the class SimbaRoleServiceTest method removeRoleFromUser_WhenRoleIsNull_ThrowsIllegalArgumentException.

@Test
public void removeRoleFromUser_WhenRoleIsNull_ThrowsIllegalArgumentException() throws Exception {
    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("Role cannot be null.");
    simbaRoleService.removeRoleFromUser(getValidSSOToken(), null, new SimbaUserR());
}
Also used : SimbaUserR(org.simbasecurity.dwclient.gateway.representations.SimbaUserR) Test(org.junit.Test)

Example 12 with SimbaUserR

use of org.simbasecurity.dwclient.gateway.representations.SimbaUserR in project simba-os by cegeka.

the class SimbaRoleServiceTest method addRoleToUser_WhenBothRoleAndUserExist_UserHasRole.

@Test
public void addRoleToUser_WhenBothRoleAndUserExist_UserHasRole() throws Exception {
    String anExistingRolename = "simba-manager";
    SimbaRoleR simbaRole = simbaRoleService.findRoleByName(getValidSSOToken(), anExistingRolename);
    SimbaUserR user = simbaUserService.findUserByName(getValidSSOToken(), DUMMY_TEST_USER);
    simbaRoleService.addRoleToUser(getValidSSOToken(), simbaRole, user);
    simbaDatabaseRule.assertUserRoleExistsAndCleanUp(DUMMY_TEST_USER, anExistingRolename);
}
Also used : SimbaRoleR(org.simbasecurity.dwclient.gateway.representations.SimbaRoleR) SimbaUserR(org.simbasecurity.dwclient.gateway.representations.SimbaUserR) Test(org.junit.Test)

Aggregations

SimbaUserR (org.simbasecurity.dwclient.gateway.representations.SimbaUserR)12 Test (org.junit.Test)9 SimbaRoleR (org.simbasecurity.dwclient.gateway.representations.SimbaRoleR)6 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 Cookie (javax.ws.rs.core.Cookie)1