@@ -6534,6 +6534,7 @@ func TestGocloak_CreateAuthenticationFlowsAndCreateAuthenticationExecutionAndFlo
6534
6534
Description : gocloak .StringP ("my test description" ),
6535
6535
TopLevel : gocloak .BoolP (true ),
6536
6536
ProviderID : gocloak .StringP ("basic-flow" ),
6537
+ ID : gocloak .StringP ("testauthflow2id" ),
6537
6538
}
6538
6539
6539
6540
authExecFlow := gocloak.CreateAuthenticationExecutionFlowRepresentation {
@@ -6632,23 +6633,34 @@ func TestGocloak_CreateAuthenticationFlowsAndCreateAuthenticationExecutionAndFlo
6632
6633
require .True (t , execDeleted , "Failed to delete authentication execution, no execution was deleted" )
6633
6634
require .True (t , execFlowFound , "Failed to find authentication execution flow" )
6634
6635
6635
- flows , err := client .GetAuthenticationFlows (context .Background (), token .AccessToken , cfg .GoCloak .Realm )
6636
- require .NoError (t , err , "Failed to get authentication flows" )
6637
- deleted := false
6638
- for _ , flow := range flows {
6639
- if flow .Alias != nil && * flow .Alias == "testauthflow2" {
6640
- err = client .DeleteAuthenticationFlow (
6641
- context .Background (),
6642
- token .AccessToken ,
6643
- cfg .GoCloak .Realm ,
6644
- * flow .ID ,
6645
- )
6646
- require .NoError (t , err , "Failed to delete authentication flow" )
6647
- deleted = true
6648
- break
6649
- }
6650
- }
6651
- require .True (t , deleted , "Failed to delete authentication flow, no flow was deleted" )
6636
+ authFlow .Description = gocloak .StringP ("my-new-description" )
6637
+ _ , err = client .UpdateAuthenticationFlow (
6638
+ context .Background (),
6639
+ token .AccessToken ,
6640
+ cfg .GoCloak .Realm ,
6641
+ authFlow ,
6642
+ * authFlow .ID ,
6643
+ )
6644
+
6645
+ require .NoError (t , err , "Failed to update authentication flow" )
6646
+ t .Logf ("updated authentication flow: %+v" , authFlow )
6647
+
6648
+ retrievedAuthFlow , err := client .GetAuthenticationFlow (
6649
+ context .Background (),
6650
+ token .AccessToken ,
6651
+ cfg .GoCloak .Realm ,
6652
+ * authFlow .ID ,
6653
+ )
6654
+ require .NoError (t , err , "Failed to fetch authentication flow" )
6655
+ t .Logf ("retrieved authentication flow: %+v" , retrievedAuthFlow )
6656
+ require .Equal (t , "my-new-description" , gocloak .PString (retrievedAuthFlow .Description ))
6657
+ err = client .DeleteAuthenticationFlow (
6658
+ context .Background (),
6659
+ token .AccessToken ,
6660
+ cfg .GoCloak .Realm ,
6661
+ * retrievedAuthFlow .ID ,
6662
+ )
6663
+ require .NoError (t , err , "Failed to delete authentication flow" )
6652
6664
}
6653
6665
6654
6666
func TestGocloak_CreateAndGetRequiredAction (t * testing.T ) {
0 commit comments