Ensure that the flow tested to be deleted is a built in flow
Closes https://github.com/keycloak/keycloak/issues/20763
This commit is contained in:
parent
ebe6e6c965
commit
ed1934d73a
1 changed files with 8 additions and 7 deletions
|
@ -104,13 +104,14 @@ public class FlowTest extends AbstractAuthenticationTest {
|
|||
|
||||
// test that built-in flow cannot be deleted
|
||||
List<AuthenticationFlowRepresentation> flows = authMgmtResource.getFlows();
|
||||
for (AuthenticationFlowRepresentation flow : flows) {
|
||||
AuthenticationFlowRepresentation builtInFlow = flows.stream().filter(AuthenticationFlowRepresentation::isBuiltIn).findAny().orElse(null);
|
||||
Assert.assertNotNull("No built in flow in the realm", builtInFlow);
|
||||
try {
|
||||
authMgmtResource.deleteFlow(flow.getId());
|
||||
authMgmtResource.deleteFlow(builtInFlow.getId());
|
||||
Assert.fail("deleteFlow should fail for built in flow");
|
||||
} catch (BadRequestException e) {
|
||||
break;
|
||||
}
|
||||
OAuth2ErrorRepresentation error = e.getResponse().readEntity(OAuth2ErrorRepresentation.class);
|
||||
Assert.assertEquals("Can't delete built in flow", error.getError());
|
||||
}
|
||||
|
||||
// try create new flow using alias of already existing flow
|
||||
|
|
Loading…
Reference in a new issue