Search in sources :

Example 1 with TimePolicy

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

the class TimePolicyManagementTest method testUpdate.

@Test
public void testUpdate() {
    authorizationPage.navigateTo();
    TimePolicyRepresentation expected = new TimePolicyRepresentation();
    expected.setName("Test Time Policy");
    expected.setDescription("description");
    expected.setNotBefore("2017-01-01 00:00:00");
    expected.setNotOnOrAfter("2018-01-01 00:00:00");
    expected.setDayMonth("1");
    expected.setDayMonthEnd("2");
    expected.setMonth("3");
    expected.setMonthEnd("4");
    expected.setYear("5");
    expected.setYearEnd("6");
    expected.setHour("7");
    expected.setHourEnd("8");
    expected.setMinute("9");
    expected.setMinuteEnd("10");
    expected = createPolicy(expected);
    String previousName = expected.getName();
    expected.setName("Changed Test Time Policy");
    expected.setDescription("Changed description");
    expected.setLogic(Logic.NEGATIVE);
    expected.setNotBefore("2018-01-01 00:00:00");
    expected.setNotOnOrAfter("2019-01-01 00:00:00");
    expected.setDayMonth("23");
    expected.setDayMonthEnd("25");
    expected.setMonth("11");
    expected.setMonthEnd("12");
    expected.setYear("2020");
    expected.setYearEnd("2021");
    expected.setHour("17");
    expected.setHourEnd("18");
    expected.setMinute("19");
    expected.setMinuteEnd("20");
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(previousName, expected);
    assertAlertSuccess();
    authorizationPage.navigateTo();
    TimePolicy actual = authorizationPage.authorizationTabs().policies().name(expected.getName());
    assertPolicy(expected, actual);
    expected.setNotBefore("");
    expected.setNotOnOrAfter("");
    authorizationPage.navigateTo();
    authorizationPage.authorizationTabs().policies().update(expected.getName(), expected);
    assertAlertSuccess();
}
Also used : TimePolicyRepresentation(org.keycloak.representations.idm.authorization.TimePolicyRepresentation) TimePolicy(org.keycloak.testsuite.console.page.clients.authorization.policy.TimePolicy) Test(org.junit.Test)

Example 2 with TimePolicy

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

the class TimePolicyManagementTest method createPolicy.

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

Aggregations

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