Search in sources :

Example 41 with AuthenticationFlowRepresentation

use of org.keycloak.representations.idm.AuthenticationFlowRepresentation in project keycloak by keycloak.

the class FlowsTest method createDeleteExecutionTest.

@Test
public void createDeleteExecutionTest() {
    // Adding new execution within testFlow
    flowsPage.clickNew();
    createFlowPage.form().setValues("testFlow", "testDesc", CreateFlowForm.FlowType.GENERIC);
    flowsPage.clickAddExecution();
    createExecutionPage.form().selectProviderOption(CreateExecutionForm.ProviderOption.RESET_PASSWORD);
    createExecutionPage.form().save();
    assertAlertSuccess();
    // REST
    AuthenticationFlowRepresentation flowRest = getFlowFromREST("testFlow");
    assertEquals(1, flowRest.getAuthenticationExecutions().size());
    assertEquals("reset-password", flowRest.getAuthenticationExecutions().get(0).getAuthenticator());
    // UI
    assertEquals("TestFlow", flowsPage.getFlowSelectValue());
    assertEquals(1, flowsPage.table().getFlowsAliasesWithRequirements().size());
    assertTrue(flowsPage.table().getFlowsAliasesWithRequirements().keySet().contains("Reset Password"));
    // Deletion
    flowsPage.clickDelete();
    modalDialog.confirmDeletion();
    assertAlertSuccess();
    assertThat(flowsPage.getFlowAllValues(), not(hasItem("TestFlow")));
}
Also used : AuthenticationFlowRepresentation(org.keycloak.representations.idm.AuthenticationFlowRepresentation) Test(org.junit.Test) AbstractConsoleTest(org.keycloak.testsuite.console.AbstractConsoleTest)

Example 42 with AuthenticationFlowRepresentation

use of org.keycloak.representations.idm.AuthenticationFlowRepresentation in project keycloak by keycloak.

the class FlowsTest method createDeleteFlowTest.

@Test
public void createDeleteFlowTest() {
    // Adding new flow
    flowsPage.clickNew();
    createFlowPage.form().setValues("testFlow", "testDesc", CreateFlowForm.FlowType.GENERIC);
    assertAlertSuccess();
    // Checking if test flow is created via rest
    AuthenticationFlowRepresentation testFlow = getFlowFromREST("testFlow");
    assertEquals("testFlow", testFlow.getAlias());
    // Checking if testFlow is selected in UI
    assertEquals("TestFlow", flowsPage.getFlowSelectValue());
    // Adding new execution flow within testFlow
    flowsPage.clickAddFlow();
    createFlowPage.form().setValues("testExecution", "executionDesc", CreateFlowForm.FlowType.GENERIC);
    assertAlertSuccess();
    // Checking if execution flow is created via rest
    testFlow = getFlowFromREST("testFlow");
    assertEquals("testExecution", testFlow.getAuthenticationExecutions().get(0).getFlowAlias());
    // Checking if testFlow is selected in UI
    assertEquals("TestFlow", flowsPage.getFlowSelectValue());
    // Deleting test flow
    flowsPage.clickDelete();
    modalDialog.confirmDeletion();
    assertAlertSuccess();
    // Checking if both test flow and execution flow is removed via UI
    assertThat(flowsPage.getFlowAllValues(), not(hasItem("TestFlow")));
    // Checking if both test flow and execution flow is removed via rest
    assertThat(testRealmResource().flows().getFlows(), not(hasItem(testFlow)));
}
Also used : AuthenticationFlowRepresentation(org.keycloak.representations.idm.AuthenticationFlowRepresentation) Test(org.junit.Test) AbstractConsoleTest(org.keycloak.testsuite.console.AbstractConsoleTest)

Aggregations

AuthenticationFlowRepresentation (org.keycloak.representations.idm.AuthenticationFlowRepresentation)42 Test (org.junit.Test)17 HashMap (java.util.HashMap)15 Response (javax.ws.rs.core.Response)14 AuthenticationExecutionInfoRepresentation (org.keycloak.representations.idm.AuthenticationExecutionInfoRepresentation)10 AuthenticationExecutionRepresentation (org.keycloak.representations.idm.AuthenticationExecutionRepresentation)8 Before (org.junit.Before)7 RealmRepresentation (org.keycloak.representations.idm.RealmRepresentation)7 BadRequestException (javax.ws.rs.BadRequestException)5 NotFoundException (javax.ws.rs.NotFoundException)5 RealmResource (org.keycloak.admin.client.resource.RealmResource)5 ClientErrorException (javax.ws.rs.ClientErrorException)4 Matchers.containsString (org.hamcrest.Matchers.containsString)4 AuthenticationExecutionExportRepresentation (org.keycloak.representations.idm.AuthenticationExecutionExportRepresentation)4 AuthenticatorConfigRepresentation (org.keycloak.representations.idm.AuthenticatorConfigRepresentation)4 IdentityProviderRepresentation (org.keycloak.representations.idm.IdentityProviderRepresentation)4 LinkedList (java.util.LinkedList)3 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)3 AuthenticationManagementResource (org.keycloak.admin.client.resource.AuthenticationManagementResource)3 IdentityProviderResource (org.keycloak.admin.client.resource.IdentityProviderResource)2