Search in sources :

Example 1 with JSPolicy

use of org.keycloak.testsuite.console.page.clients.authorization.policy.JSPolicy in project keycloak by keycloak.

the class JSPolicyManagementTest method testUpdate.

@Test
public void testUpdate() throws InterruptedException {
    authorizationPage.navigateTo();
    JSPolicyRepresentation expected = new JSPolicyRepresentation();
    expected.setName("Test JS Policy");
    expected.setDescription("description");
    expected.setCode("$evaluation.grant();");
    expected = createPolicy(expected);
    String previousName = expected.getName();
    expected.setName("Changed Test JS Policy");
    expected.setDescription("Changed description");
    expected.setLogic(Logic.NEGATIVE);
    expected.setCode("$evaluation.deny();");
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(previousName, expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    JSPolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
}
Also used : JSPolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.JSPolicy) JSPolicyRepresentation(org.keycloak.representations.idm.authorization.JSPolicyRepresentation) Test(org.junit.Test)

Example 2 with JSPolicy

use of org.keycloak.testsuite.console.page.clients.authorization.policy.JSPolicy in project keycloak by keycloak.

the class JSPolicyManagementTest method createPolicy.

private JSPolicyRepresentation createPolicy(JSPolicyRepresentation expected) {
    JSPolicy policy = authorizationPage.authorizationTabs().policies().create(expected);
    assertAlertSuccess();
    return assertPolicy(expected, policy);
}
Also used : JSPolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.JSPolicy)

Aggregations

JSPolicy (org.keycloak.testsuite.console.page.clients.authorization.policy.JSPolicy)2 Test (org.junit.Test)1 JSPolicyRepresentation (org.keycloak.representations.idm.authorization.JSPolicyRepresentation)1