use of org.keycloak.testsuite.console.page.clients.authorization.policy.UserPolicy in project keycloak by keycloak.
the class UserPolicyManagementTest method createPolicy.
private UserPolicyRepresentation createPolicy(UserPolicyRepresentation expected) {
UserPolicy policy = authorizationPage.authorizationTabs().policies().create(expected);
assertAlertSuccess();
return assertPolicy(expected, policy);
}
use of org.keycloak.testsuite.console.page.clients.authorization.policy.UserPolicy in project keycloak by keycloak.
the class UserPolicyManagementTest method testUpdate.
@Test
public void testUpdate() throws InterruptedException {
authorizationPage.navigateTo();
UserPolicyRepresentation expected = new UserPolicyRepresentation();
expected.setName("Test User Policy");
expected.setDescription("description");
expected.addUser("user a");
expected.addUser("user b");
expected.addUser("user c");
expected = createPolicy(expected);
String previousName = expected.getName();
expected.setName("Changed Test User Policy");
expected.setDescription("Changed description");
expected.setLogic(Logic.NEGATIVE);
expected.setUsers(expected.getUsers().stream().filter(user -> !user.equals("user b")).collect(Collectors.toSet()));
authorizationPage.navigateTo();
authorizationPage.authorizationTabs().policies().update(previousName, expected);
assertAlertSuccess();
authorizationPage.navigateTo();
UserPolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
assertPolicy(expected, actual);
}
Aggregations