Fix ResetOtpTest
closes #32615 Signed-off-by: mposolda <mposolda@gmail.com>
This commit is contained in:
parent
b88ecc0237
commit
03e0fb0601
1 changed files with 16 additions and 0 deletions
|
@ -3,10 +3,12 @@ package org.keycloak.testsuite.forms;
|
||||||
import static org.wildfly.common.Assert.assertTrue;
|
import static org.wildfly.common.Assert.assertTrue;
|
||||||
|
|
||||||
import org.jboss.arquillian.graphene.page.Page;
|
import org.jboss.arquillian.graphene.page.Page;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.keycloak.admin.client.CreatedResponseUtil;
|
import org.keycloak.admin.client.CreatedResponseUtil;
|
||||||
import org.keycloak.admin.client.resource.RealmResource;
|
import org.keycloak.admin.client.resource.RealmResource;
|
||||||
import org.keycloak.models.AuthenticationExecutionModel;
|
import org.keycloak.models.AuthenticationExecutionModel;
|
||||||
|
import org.keycloak.models.utils.DefaultAuthenticationFlows;
|
||||||
import org.keycloak.representations.idm.AuthenticationExecutionRepresentation;
|
import org.keycloak.representations.idm.AuthenticationExecutionRepresentation;
|
||||||
import org.keycloak.representations.idm.AuthenticationFlowRepresentation;
|
import org.keycloak.representations.idm.AuthenticationFlowRepresentation;
|
||||||
import org.keycloak.representations.idm.AuthenticatorConfigRepresentation;
|
import org.keycloak.representations.idm.AuthenticatorConfigRepresentation;
|
||||||
|
@ -37,6 +39,7 @@ public class ResetOtpTest extends AbstractTestRealmKeycloakTest {
|
||||||
private static String resetOtpExecutionId;
|
private static String resetOtpExecutionId;
|
||||||
private static String resetOtpConfigId;
|
private static String resetOtpConfigId;
|
||||||
private static String flowId;
|
private static String flowId;
|
||||||
|
private static String origResetCredentialsFlowId;
|
||||||
|
|
||||||
private static final String FLOW_ALIAS = "otpResetTestFlow";
|
private static final String FLOW_ALIAS = "otpResetTestFlow";
|
||||||
private static final String RESET_OTP_TEST_USER_REMOVE_NONE = "reset-otp-test-user-remove-none";
|
private static final String RESET_OTP_TEST_USER_REMOVE_NONE = "reset-otp-test-user-remove-none";
|
||||||
|
@ -106,6 +109,17 @@ public class ResetOtpTest extends AbstractTestRealmKeycloakTest {
|
||||||
realmResource = adminClient.realm(testRealm.getRealm());
|
realmResource = adminClient.realm(testRealm.getRealm());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void afterTest() {
|
||||||
|
var realmRep = realmResource.toRepresentation();
|
||||||
|
realmRep.setResetCredentialsFlow(DefaultAuthenticationFlows.RESET_CREDENTIALS_FLOW);
|
||||||
|
realmResource.update(realmRep);
|
||||||
|
|
||||||
|
flowId = null;
|
||||||
|
resetOtpExecutionId = null;
|
||||||
|
resetOtpConfigId = null;
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void noOtpIsRemovedOnResetWithoutConfig_LegacyBehaviour() {
|
public void noOtpIsRemovedOnResetWithoutConfig_LegacyBehaviour() {
|
||||||
createOrChangeResetOtpFlowConfig(null);
|
createOrChangeResetOtpFlowConfig(null);
|
||||||
|
@ -273,5 +287,7 @@ public class ResetOtpTest extends AbstractTestRealmKeycloakTest {
|
||||||
else {
|
else {
|
||||||
realmResource.flows().updateAuthenticatorConfig(resetOtpConfigId, resetOtpAuthConfigRep);
|
realmResource.flows().updateAuthenticatorConfig(resetOtpConfigId, resetOtpAuthConfigRep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCleanup().addAuthenticationFlowId(flowId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue