From 03e0fb0601b26e54f3b839e61088397be89d4c24 Mon Sep 17 00:00:00 2001 From: mposolda Date: Fri, 6 Sep 2024 20:22:14 +0200 Subject: [PATCH] Fix ResetOtpTest closes #32615 Signed-off-by: mposolda --- .../keycloak/testsuite/forms/ResetOtpTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/ResetOtpTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/ResetOtpTest.java index 2d68969f87..bd197cca2f 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/ResetOtpTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/forms/ResetOtpTest.java @@ -3,10 +3,12 @@ package org.keycloak.testsuite.forms; import static org.wildfly.common.Assert.assertTrue; import org.jboss.arquillian.graphene.page.Page; +import org.junit.After; import org.junit.Test; import org.keycloak.admin.client.CreatedResponseUtil; import org.keycloak.admin.client.resource.RealmResource; import org.keycloak.models.AuthenticationExecutionModel; +import org.keycloak.models.utils.DefaultAuthenticationFlows; import org.keycloak.representations.idm.AuthenticationExecutionRepresentation; import org.keycloak.representations.idm.AuthenticationFlowRepresentation; import org.keycloak.representations.idm.AuthenticatorConfigRepresentation; @@ -37,6 +39,7 @@ public class ResetOtpTest extends AbstractTestRealmKeycloakTest { private static String resetOtpExecutionId; private static String resetOtpConfigId; private static String flowId; + private static String origResetCredentialsFlowId; private static final String FLOW_ALIAS = "otpResetTestFlow"; 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()); } + @After + public void afterTest() { + var realmRep = realmResource.toRepresentation(); + realmRep.setResetCredentialsFlow(DefaultAuthenticationFlows.RESET_CREDENTIALS_FLOW); + realmResource.update(realmRep); + + flowId = null; + resetOtpExecutionId = null; + resetOtpConfigId = null; + } + @Test public void noOtpIsRemovedOnResetWithoutConfig_LegacyBehaviour() { createOrChangeResetOtpFlowConfig(null); @@ -273,5 +287,7 @@ public class ResetOtpTest extends AbstractTestRealmKeycloakTest { else { realmResource.flows().updateAuthenticatorConfig(resetOtpConfigId, resetOtpAuthConfigRep); } + + getCleanup().addAuthenticationFlowId(flowId); } }