diff --git a/.generator/templates/api_application_test.go b/.generator/templates/api_application_test.go index 4582f0e1..3cdee61f 100644 --- a/.generator/templates/api_application_test.go +++ b/.generator/templates/api_application_test.go @@ -11,35 +11,35 @@ import ( ) func setupBasicAuthApplication(label string) (*ListApplications200ResponseInner, *APIResponse, error) { - req := apiClient.ApplicationApi.CreateApplication(apiClient.cfg.Context) + req := apiClient.ApplicationAPI.CreateApplication(apiClient.cfg.Context) req = req.Application(ListApplications200ResponseInner{BasicAuthApplication: testFactory.NewValidBasicAuthApplication(label)}) return req.Execute() } func setupOrg2OrgApplication(label string) (*ListApplications200ResponseInner, *APIResponse, error) { - req := apiClient.ApplicationApi.CreateApplication(apiClient.cfg.Context) + req := apiClient.ApplicationAPI.CreateApplication(apiClient.cfg.Context) req = req.Application(ListApplications200ResponseInner{SamlApplication: testFactory.NewValidOrg2OrgApplication(label)}) return req.Execute() } func setupBookmarkApplication(label string) (*ListApplications200ResponseInner, *APIResponse, error) { - req := apiClient.ApplicationApi.CreateApplication(apiClient.cfg.Context) + req := apiClient.ApplicationAPI.CreateApplication(apiClient.cfg.Context) req = req.Application(ListApplications200ResponseInner{BookmarkApplication: testFactory.NewValidBookmarkApplication(label)}) return req.Execute() } func setupOIDCApplication(label string) (*ListApplications200ResponseInner, *APIResponse, error) { - req := apiClient.ApplicationApi.CreateApplication(apiClient.cfg.Context) + req := apiClient.ApplicationAPI.CreateApplication(apiClient.cfg.Context) req = req.Application(ListApplications200ResponseInner{OpenIdConnectApplication: testFactory.NewValidOIDCApplication(label)}) return req.Execute() } func cleanUpApplication(appId string) error { - _, err := apiClient.ApplicationApi.DeactivateApplication(apiClient.cfg.Context, appId).Execute() + _, err := apiClient.ApplicationAPI.DeactivateApplication(apiClient.cfg.Context, appId).Execute() if err != nil { return err } - _, err = apiClient.ApplicationApi.DeleteApplication(apiClient.cfg.Context, appId).Execute() + _, err = apiClient.ApplicationAPI.DeleteApplication(apiClient.cfg.Context, appId).Execute() if err != nil { return err } @@ -50,7 +50,7 @@ func Test_Get_Applications(t *testing.T) { createdApp, _, err := setupBasicAuthApplication(randomTestString()) require.NoError(t, err, "Creating a new application should not error") t.Run("get applications by id", func(t *testing.T) { - app, _, err := apiClient.ApplicationApi.GetApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + app, _, err := apiClient.ApplicationAPI.GetApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not get app by ID") assert.Equal(t, createdApp.BasicAuthApplication.GetId(), app.BasicAuthApplication.GetId()) }) @@ -62,7 +62,7 @@ func Test_Get_List_Applications(t *testing.T) { createdApp, _, err := setupBasicAuthApplication(randomTestString()) require.NoError(t, err, "Creating a new application should not error") t.Run("get all applications", func(t *testing.T) { - apps, _, err := apiClient.ApplicationApi.ListApplications(apiClient.cfg.Context).Limit(100).Execute() + apps, _, err := apiClient.ApplicationAPI.ListApplications(apiClient.cfg.Context).Limit(100).Execute() require.NoError(t, err, "Could not get list apps") var createAppInList bool for _, a := range apps { @@ -85,7 +85,7 @@ func Test_Update_App(t *testing.T) { payload := testFactory.NewValidBasicAuthApplication(newName) payload.Settings.App.SetAuthURL("https://example.org/auth.html") payload.Settings.App.SetUrl("https://example.org/auth.html") - app, _, err := apiClient.ApplicationApi.ReplaceApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Application(ListApplications200ResponseInner{BasicAuthApplication: payload}).Execute() + app, _, err := apiClient.ApplicationAPI.ReplaceApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Application(ListApplications200ResponseInner{BasicAuthApplication: payload}).Execute() require.NoError(t, err, "Could not update apps") require.NotNil(t, app.BasicAuthApplication) assert.Equal(t, newName, app.BasicAuthApplication.GetLabel()) @@ -100,17 +100,17 @@ func Test_Activate_Application(t *testing.T) { createdApp, _, err := setupBasicAuthApplication(randomTestString()) require.NoError(t, err, "Creating a new application should not error") t.Run("deactivate applications", func(t *testing.T) { - _, err = apiClient.ApplicationApi.DeactivateApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + _, err = apiClient.ApplicationAPI.DeactivateApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not deactivate the app") - app, _, err := apiClient.ApplicationApi.GetApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + app, _, err := apiClient.ApplicationAPI.GetApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not get app by ID") assert.Equal(t, createdApp.BasicAuthApplication.GetId(), app.BasicAuthApplication.GetId()) assert.Equal(t, APPLICATIONLIFECYCLESTATUS_INACTIVE, app.BasicAuthApplication.GetStatus()) }) t.Run("activate applications", func(t *testing.T) { - _, err = apiClient.ApplicationApi.ActivateApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + _, err = apiClient.ApplicationAPI.ActivateApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not activate the app") - newapp, _, err := apiClient.ApplicationApi.GetApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + newapp, _, err := apiClient.ApplicationAPI.GetApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not get app by ID") assert.Equal(t, createdApp.BasicAuthApplication.GetId(), newapp.BasicAuthApplication.GetId()) assert.Equal(t, APPLICATIONLIFECYCLESTATUS_ACTIVE, newapp.BasicAuthApplication.GetStatus()) @@ -125,7 +125,7 @@ func Test_Application_Users_Operations(t *testing.T) { } createdApp, _, err := setupBasicAuthApplication(randomTestString()) require.NoError(t, err, "Creating a new application should not error") - appUserList, _, err := apiClient.ApplicationUsersApi.ListApplicationUsers(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + appUserList, _, err := apiClient.ApplicationUsersAPI.ListApplicationUsers(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not get list app users") require.Empty(t, appUserList, "App User List should be empty") user, _, _, err := setupUser(false) @@ -139,9 +139,9 @@ func Test_Application_Users_Operations(t *testing.T) { payload := AppUser{} payload.SetId(user.GetId()) payload.SetCredentials(credentials) - appUser, _, err := apiClient.ApplicationUsersApi.AssignUserToApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).AppUser(payload).Execute() + appUser, _, err := apiClient.ApplicationUsersAPI.AssignUserToApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).AppUser(payload).Execute() require.NoError(t, err, "Assigning user to application should not error") - appUserList, _, err := apiClient.ApplicationUsersApi.ListApplicationUsers(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + appUserList, _, err := apiClient.ApplicationUsersAPI.ListApplicationUsers(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not get list app users") require.NotEmpty(t, appUserList, "App User List should not be empty") var found bool @@ -154,12 +154,12 @@ func Test_Application_Users_Operations(t *testing.T) { assert.True(t, found) }) t.Run("get application user", func(t *testing.T) { - appUser, _, err := apiClient.ApplicationUsersApi.GetApplicationUser(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).Execute() + appUser, _, err := apiClient.ApplicationUsersAPI.GetApplicationUser(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).Execute() require.NoError(t, err, "Could not get app user") assert.Equal(t, user.GetId(), appUser.GetId()) }) t.Run("update application user", func(t *testing.T) { - appUser, _, err := apiClient.ApplicationUsersApi.GetApplicationUser(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).Execute() + appUser, _, err := apiClient.ApplicationUsersAPI.GetApplicationUser(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).Execute() require.NoError(t, err, "Could not get app user") oldUserName := appUser.Credentials.GetUserName() newUserName := randomTestString() @@ -169,15 +169,15 @@ func Test_Application_Users_Operations(t *testing.T) { credentials.SetPassword(pwcredentials) credentials.SetUserName(newUserName) appUser.SetCredentials(credentials) - updatedAppUser, _, err := apiClient.ApplicationUsersApi.UpdateApplicationUser(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).AppUser(*appUser).Execute() + updatedAppUser, _, err := apiClient.ApplicationUsersAPI.UpdateApplicationUser(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).AppUser(*appUser).Execute() require.NoError(t, err, "Could not update app user") assert.NotEqual(t, oldUserName, updatedAppUser.Credentials.GetUserName()) assert.Equal(t, newUserName, updatedAppUser.Credentials.GetUserName()) }) t.Run("remove application from user", func(t *testing.T) { - _, err = apiClient.ApplicationUsersApi.UnassignUserFromApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).Execute() + _, err = apiClient.ApplicationUsersAPI.UnassignUserFromApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), user.GetId()).Execute() require.NoError(t, err, "Delete user to application should not error") - appUserList, _, err := apiClient.ApplicationUsersApi.ListApplicationUsers(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + appUserList, _, err := apiClient.ApplicationUsersAPI.ListApplicationUsers(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not get list apps") require.Empty(t, appUserList, "App User List should be empty") }) @@ -198,24 +198,24 @@ func Test_Application_Groups_Operations(t *testing.T) { t.Run("assign group to application", func(t *testing.T) { payload := ApplicationGroupAssignment{} payload.SetPriority(5) - appGroup, _, err := apiClient.ApplicationGroupsApi.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).ApplicationGroupAssignment(payload).Execute() + appGroup, _, err := apiClient.ApplicationGroupsAPI.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).ApplicationGroupAssignment(payload).Execute() require.NoError(t, err, "Create app group assignment should not error") assert.NotNil(t, appGroup) }) t.Run("get application group", func(t *testing.T) { - appGroup, _, err := apiClient.ApplicationGroupsApi.GetApplicationGroupAssignment(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).Execute() + appGroup, _, err := apiClient.ApplicationGroupsAPI.GetApplicationGroupAssignment(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).Execute() require.NoError(t, err, "Get app group assignment should not error") assert.Equal(t, int32(5), appGroup.GetPriority()) }) t.Run("list application group", func(t *testing.T) { - appGroupList, _, err := apiClient.ApplicationGroupsApi.ListApplicationGroupAssignments(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + appGroupList, _, err := apiClient.ApplicationGroupsAPI.ListApplicationGroupAssignments(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Get list app group assignment should not error") assert.NotEmpty(t, appGroupList) }) t.Run("remove application from group", func(t *testing.T) { - _, err = apiClient.ApplicationGroupsApi.UnassignApplicationFromGroup(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).Execute() + _, err = apiClient.ApplicationGroupsAPI.UnassignApplicationFromGroup(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).Execute() require.NoError(t, err, "Delete app group assignment should not error") - _, _, err := apiClient.ApplicationGroupsApi.GetApplicationGroupAssignment(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).Execute() + _, _, err := apiClient.ApplicationGroupsAPI.GetApplicationGroupAssignment(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), group.GetId()).Execute() assert.Equal(t, "404 Not Found", err.Error()) }) err = cleanUpGroup(group.GetId()) @@ -232,21 +232,21 @@ func Test_CSR_For_Application(t *testing.T) { require.NoError(t, err, "Creating a new application should not error") var generatedCsr *Csr t.Run("generate csr", func(t *testing.T) { - generatedCsr, _, err = apiClient.ApplicationCredentialsApi.GenerateCsrForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Metadata(*testFactory.NewValidTestCSRMetadata()).Execute() + generatedCsr, _, err = apiClient.ApplicationCredentialsAPI.GenerateCsrForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Metadata(*testFactory.NewValidTestCSRMetadata()).Execute() require.NoError(t, err, "Generating a new csr should not error") assert.NotNil(t, generatedCsr) assert.Equal(t, "RSA", generatedCsr.GetKty()) assert.NotNil(t, generatedCsr.Csr) }) t.Run("get CSR by ID", func(t *testing.T) { - rcsr, _, err := apiClient.ApplicationCredentialsApi.GetCsrForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), generatedCsr.GetId()).Execute() + rcsr, _, err := apiClient.ApplicationCredentialsAPI.GetCsrForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), generatedCsr.GetId()).Execute() require.NoError(t, err, "Could not get csr by ID") assert.NotNil(t, rcsr) assert.Equal(t, generatedCsr.GetKty(), rcsr.GetKty()) assert.NotNil(t, generatedCsr.GetCsr(), rcsr.GetCsr()) }) t.Run("list CSR", func(t *testing.T) { - listCSRs, _, err := apiClient.ApplicationCredentialsApi.ListCsrsForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + listCSRs, _, err := apiClient.ApplicationCredentialsAPI.ListCsrsForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not list csr by app ID") assert.NotEmpty(t, listCSRs) var result bool @@ -259,9 +259,9 @@ func Test_CSR_For_Application(t *testing.T) { assert.True(t, result) }) t.Run("revoke csr", func(t *testing.T) { - _, err := apiClient.ApplicationCredentialsApi.RevokeCsrFromApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), generatedCsr.GetId()).Execute() + _, err := apiClient.ApplicationCredentialsAPI.RevokeCsrFromApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId(), generatedCsr.GetId()).Execute() require.NoError(t, err, "Unable to revoke csr") - listCSRs, _, err := apiClient.ApplicationCredentialsApi.ListCsrsForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() + listCSRs, _, err := apiClient.ApplicationCredentialsAPI.ListCsrsForApplication(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "Could not list csr by app ID") assert.Empty(t, listCSRs) }) @@ -276,7 +276,7 @@ func TestGetDefaultProvisioningConnectionForApplication(t *testing.T) { createdApp, _, err := setupOrg2OrgApplication(randomTestString()) require.NoError(t, err, "Creating a new application should not error") t.Run("get provisioning", func(t *testing.T) { - conn, _, err := apiClient.ApplicationConnectionsApi.GetDefaultProvisioningConnectionForApplication(apiClient.cfg.Context, createdApp.SamlApplication.GetId()).Execute() + conn, _, err := apiClient.ApplicationConnectionsAPI.GetDefaultProvisioningConnectionForApplication(apiClient.cfg.Context, createdApp.SamlApplication.GetId()).Execute() require.NoError(t, err, "getting default provisioning connection for application should not error.") assert.NotEmpty(t, conn.GetAuthScheme()) assert.NotEmpty(t, conn.GetStatus()) @@ -286,7 +286,7 @@ func TestGetDefaultProvisioningConnectionForApplication(t *testing.T) { profile.SetAuthScheme("TOKEN") profile.SetToken("TEST") payload := ProvisioningConnectionRequest{Profile: profile} - conn, _, err := apiClient.ApplicationConnectionsApi.UpdateDefaultProvisioningConnectionForApplication(apiClient.cfg.Context, createdApp.SamlApplication.GetId()).ProvisioningConnectionRequest(payload).Activate(false).Execute() + conn, _, err := apiClient.ApplicationConnectionsAPI.UpdateDefaultProvisioningConnectionForApplication(apiClient.cfg.Context, createdApp.SamlApplication.GetId()).ProvisioningConnectionRequest(payload).Activate(false).Execute() require.NoError(t, err, "setting default provisioning connection for application should not error.") assert.Equal(t, PROVISIONINGCONNECTIONAUTHSCHEME_TOKEN, conn.GetAuthScheme()) }) @@ -332,7 +332,7 @@ func Test_Upload_Application_Logo(t *testing.T) { filePath := path.Join(fileDir, fileName) file, err := os.Open(filePath) require.NoError(t, err, "opening application logo should not error.") - _, err = apiClient.ApplicationLogosApi.UploadApplicationLogo(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).File(file).Execute() + _, err = apiClient.ApplicationLogosAPI.UploadApplicationLogo(apiClient.cfg.Context, createdApp.BasicAuthApplication.GetId()).File(file).Execute() require.NoError(t, err, "uploading application logo should not error.") }) err = cleanUpApplication(createdApp.BasicAuthApplication.GetId()) @@ -349,18 +349,18 @@ func Test_Application_Key_Operation(t *testing.T) { require.NoError(t, err, "Creating a new application should not error") var createdKey *JsonWebKey t.Run("generate application key", func(t *testing.T) { - createdKey, _, err = apiClient.ApplicationCredentialsApi.GenerateApplicationKey(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId()).ValidityYears(2).Execute() + createdKey, _, err = apiClient.ApplicationCredentialsAPI.GenerateApplicationKey(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId()).ValidityYears(2).Execute() assert.Nil(t, err, "generate new application key should not error") }) t.Run("clone application key", func(t *testing.T) { - ckey, _, err := apiClient.ApplicationCredentialsApi.CloneApplicationKey(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId(), createdKey.GetKid()).TargetAid(createdApp2.BasicAuthApplication.GetId()).Execute() + ckey, _, err := apiClient.ApplicationCredentialsAPI.CloneApplicationKey(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId(), createdKey.GetKid()).TargetAid(createdApp2.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "clone application key should not error") assert.Equal(t, createdKey.GetKid(), ckey.GetKid()) assert.Equal(t, createdKey.GetExpiresAt(), ckey.GetExpiresAt()) assert.Equal(t, createdKey.GetX5c(), ckey.GetX5c()) }) t.Run("get application key credentials", func(t *testing.T) { - rkey, _, err := apiClient.ApplicationCredentialsApi.GetApplicationKey(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId(), createdKey.GetKid()).Execute() + rkey, _, err := apiClient.ApplicationCredentialsAPI.GetApplicationKey(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId(), createdKey.GetKid()).Execute() require.NoError(t, err, "get application key should not error") assert.Equal(t, createdKey.GetKid(), rkey.GetKid()) assert.Equal(t, createdKey.GetCreated(), rkey.GetCreated()) @@ -368,7 +368,7 @@ func Test_Application_Key_Operation(t *testing.T) { assert.Equal(t, createdKey.GetX5c(), rkey.GetX5c()) }) t.Run("list application key credentials", func(t *testing.T) { - rkeys, _, err := apiClient.ApplicationCredentialsApi.ListApplicationKeys(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId()).Execute() + rkeys, _, err := apiClient.ApplicationCredentialsAPI.ListApplicationKeys(apiClient.cfg.Context, createdApp1.BasicAuthApplication.GetId()).Execute() require.NoError(t, err, "get application key should not error") assert.Equal(t, 2, len(rkeys)) }) @@ -389,22 +389,22 @@ func Test_Scope_Consent_Grant_Operation_For_Application(t *testing.T) { payload := OAuth2ScopeConsentGrant{} payload.SetIssuer(apiClient.cfg.Okta.Client.OrgUrl) payload.SetScopeId("okta.users.read") - grant, _, err = apiClient.ApplicationGrantsApi.GrantConsentToScope(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId()).OAuth2ScopeConsentGrant(payload).Execute() + grant, _, err = apiClient.ApplicationGrantsAPI.GrantConsentToScope(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId()).OAuth2ScopeConsentGrant(payload).Execute() assert.Nil(t, err, "grant consent to scope should not error") }) t.Run("get scope consent grant", func(t *testing.T) { - rgrant, _, err := apiClient.ApplicationGrantsApi.GetScopeConsentGrant(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId(), grant.GetId()).Execute() + rgrant, _, err := apiClient.ApplicationGrantsAPI.GetScopeConsentGrant(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId(), grant.GetId()).Execute() require.NoError(t, err, "get scope consent grant should not error") assert.Equal(t, grant.GetId(), rgrant.GetId()) assert.Equal(t, grant.GetClientId(), rgrant.GetClientId()) }) t.Run("list scope consent grant", func(t *testing.T) { - rgrants, _, err := apiClient.ApplicationGrantsApi.ListScopeConsentGrants(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId()).Execute() + rgrants, _, err := apiClient.ApplicationGrantsAPI.ListScopeConsentGrants(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId()).Execute() require.NoError(t, err, "list scope consent grant should not error") assert.NotEmpty(t, rgrants) }) t.Run("revoke consent grant", func(t *testing.T) { - _, err = apiClient.ApplicationGrantsApi.RevokeScopeConsentGrant(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId(), grant.GetId()).Execute() + _, err = apiClient.ApplicationGrantsAPI.RevokeScopeConsentGrant(apiClient.cfg.Context, createdApp.OpenIdConnectApplication.GetId(), grant.GetId()).Execute() assert.Nil(t, err, "revoke consent to scope should not error") }) err = cleanUpApplication(createdApp.OpenIdConnectApplication.GetId()) diff --git a/.generator/templates/api_group_test.go b/.generator/templates/api_group_test.go index c526a4cd..333bd658 100644 --- a/.generator/templates/api_group_test.go +++ b/.generator/templates/api_group_test.go @@ -8,7 +8,7 @@ import ( ) func setupGroup(name string) (*Group, *APIResponse, error) { - req := apiClient.GroupApi.CreateGroup(apiClient.cfg.Context) + req := apiClient.GroupAPI.CreateGroup(apiClient.cfg.Context) gp := NewGroupProfile() gp.SetName(name) payload := Group{Profile: gp} @@ -17,12 +17,12 @@ func setupGroup(name string) (*Group, *APIResponse, error) { } func cleanUpGroup(groupId string) (err error) { - _, err = apiClient.GroupApi.DeleteGroup(apiClient.cfg.Context, groupId).Execute() + _, err = apiClient.GroupAPI.DeleteGroup(apiClient.cfg.Context, groupId).Execute() return } func cleanUpGroupRule(groupRuleId string) (err error) { - _, err = apiClient.GroupApi.DeleteGroupRule(apiClient.cfg.Context, groupRuleId).Execute() + _, err = apiClient.GroupAPI.DeleteGroupRule(apiClient.cfg.Context, groupRuleId).Execute() return } @@ -30,7 +30,7 @@ func Test_Get_Group(t *testing.T) { group, _, err := setupGroup(randomTestString()) require.NoError(t, err, "Creating a new group should not error") t.Run("get group by id", func(t *testing.T) { - gid, _, err := apiClient.GroupApi.GetGroup(apiClient.cfg.Context, group.GetId()).Execute() + gid, _, err := apiClient.GroupAPI.GetGroup(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err, "Could not get group by ID") assert.Equal(t, group.GetId(), gid.GetId()) }) @@ -42,7 +42,7 @@ func Test_Get_List_Group(t *testing.T) { group, _, err := setupGroup(randomTestString()) require.NoError(t, err, "Creating a new group should not error") t.Run("get list group", func(t *testing.T) { - gs, _, err := apiClient.GroupApi.ListGroups(apiClient.cfg.Context).Execute() + gs, _, err := apiClient.GroupAPI.ListGroups(apiClient.cfg.Context).Execute() require.NoError(t, err, "Could not get list group") var createdGroupInList bool for _, g := range gs { @@ -61,7 +61,7 @@ func Test_Search_Group(t *testing.T) { group, _, err := setupGroup(groupName) require.NoError(t, err, "Creating a new group should not error") t.Run("search group", func(t *testing.T) { - req := apiClient.GroupApi.ListGroups(apiClient.cfg.Context) + req := apiClient.GroupAPI.ListGroups(apiClient.cfg.Context) req = req.Q(groupName) gs, _, err := req.Execute() require.NoError(t, err, "Could not get result from search keyword") @@ -87,7 +87,7 @@ func Test_Update_Group(t *testing.T) { ngp.SetName(newGroupName) ng := Group{} ng.SetProfile(ngp) - req := apiClient.GroupApi.ReplaceGroup(apiClient.cfg.Context, group.GetId()) + req := apiClient.GroupAPI.ReplaceGroup(apiClient.cfg.Context, group.GetId()) req = req.Group(ng) g, _, err := req.Execute() require.NoError(t, err, "Could not update group") @@ -104,9 +104,9 @@ func Test_Group_User_Operation(t *testing.T) { user, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("add user to group", func(t *testing.T) { - _, err := apiClient.GroupApi.AssignUserToGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute() + _, err := apiClient.GroupAPI.AssignUserToGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute() require.NoError(t, err, "Could not add user to group") - users, _, err := apiClient.GroupApi.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute() + users, _, err := apiClient.GroupAPI.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err) found := false for _, u := range users { @@ -117,9 +117,9 @@ func Test_Group_User_Operation(t *testing.T) { assert.True(t, found, "Could not find user in group") }) t.Run("remove user from group", func(t *testing.T) { - _, err := apiClient.GroupApi.UnassignUserFromGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute() + _, err := apiClient.GroupAPI.UnassignUserFromGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute() require.NoError(t, err, "Could not remove user from group") - users, _, err := apiClient.GroupApi.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute() + users, _, err := apiClient.GroupAPI.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err) found := false for _, u := range users { @@ -154,14 +154,14 @@ func Test_Group_Rule_Operation(t *testing.T) { gr.SetConditions(*grc) gr.SetType("group_rule") gr.SetName(randomTestString()) - req := apiClient.GroupApi.CreateGroupRule(apiClient.cfg.Context) + req := apiClient.GroupAPI.CreateGroupRule(apiClient.cfg.Context) req = req.GroupRule(*gr) groupRule, _, err := req.Execute() require.NoError(t, err, "Creating a new group rule should not error") t.Run("activate group rule", func(t *testing.T) { - _, err = apiClient.GroupApi.ActivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute() + _, err = apiClient.GroupAPI.ActivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute() require.NoError(t, err, "Should not error when activating rule") - groupRules, _, err := apiClient.GroupApi.ListGroupRules(apiClient.cfg.Context).Execute() + groupRules, _, err := apiClient.GroupAPI.ListGroupRules(apiClient.cfg.Context).Execute() require.NoError(t, err, "Should not error when listing group rule") found := false for _, grs := range groupRules { @@ -172,7 +172,7 @@ func Test_Group_Rule_Operation(t *testing.T) { assert.True(t, found, "Found group rule in list") }) t.Run("deactivate group rule", func(t *testing.T) { - _, err = apiClient.GroupApi.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute() + _, err = apiClient.GroupAPI.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute() require.NoError(t, err, "Should not error when deactivating rule") }) t.Run("update group rule", func(t *testing.T) { @@ -190,13 +190,13 @@ func Test_Group_Rule_Operation(t *testing.T) { gr.SetConditions(*grc) gr.SetType("group_rule") gr.SetName(randomTestString()) - req := apiClient.GroupApi.ReplaceGroupRule(apiClient.cfg.Context, groupRule.GetId()) + req := apiClient.GroupAPI.ReplaceGroupRule(apiClient.cfg.Context, groupRule.GetId()) req = req.GroupRule(*gr) newGroupRule, _, err := req.Execute() require.NoError(t, err, "Should not error when updating rule") - _, err = apiClient.GroupApi.ActivateGroupRule(apiClient.cfg.Context, newGroupRule.GetId()).Execute() + _, err = apiClient.GroupAPI.ActivateGroupRule(apiClient.cfg.Context, newGroupRule.GetId()).Execute() require.NoError(t, err, "Should not error when activating rule") - _, err = apiClient.GroupApi.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute() + _, err = apiClient.GroupAPI.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute() require.NoError(t, err, "Should not error when deactivating rule") }) err = cleanUpUser(user.GetId()) @@ -212,16 +212,16 @@ func Test_List_Assigned_Applications_For_Group(t *testing.T) { require.NoError(t, err, "Creating a new group should not error") var createdApp *ListApplications200ResponseInner t.Run("get list assigned application for group", func(t *testing.T) { - apps, _, err := apiClient.GroupApi.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute() + apps, _, err := apiClient.GroupAPI.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err, "Should not error when listing assigned apps for group") assert.Equal(t, 0, len(apps), "there shouldn't be any apps assigned to group") createdApp, _, err = setupBookmarkApplication(randomTestString()) require.NoError(t, err, "Creating an application should not error") - aareq := apiClient.ApplicationGroupsApi.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BookmarkApplication.GetId(), group.GetId()) + aareq := apiClient.ApplicationGroupsAPI.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BookmarkApplication.GetId(), group.GetId()) aareq.applicationGroupAssignment = NewApplicationGroupAssignment() _, _, err = aareq.Execute() require.NoError(t, err, "Assigning application to group should not error") - apps, _, err = apiClient.GroupApi.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute() + apps, _, err = apiClient.GroupAPI.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err, "Should not error when listing assigned apps for group") assert.Equal(t, 1, len(apps), "there shouldn't be any apps assigned to group") }) @@ -236,13 +236,13 @@ func Test_Assigned_Role_To_Group_Operation(t *testing.T) { require.NoError(t, err, "Creating a new group should not error") var createdRole *Role t.Run("assigned role to group", func(t *testing.T) { - req := apiClient.RoleAssignmentApi.AssignRoleToGroup(apiClient.cfg.Context, group.GetId()) + req := apiClient.RoleAssignmentAPI.AssignRoleToGroup(apiClient.cfg.Context, group.GetId()) assignedRoleSA := NewAssignRoleRequest() assignedRoleSA.SetType("SUPER_ADMIN") req = req.AssignRoleRequest(*assignedRoleSA) createdRole, _, err = req.Execute() require.NoError(t, err, "Assigned role to group should not error") - roles, _, err := apiClient.RoleAssignmentApi.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute() + roles, _, err := apiClient.RoleAssignmentAPI.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err, "Listing group assigned role should not error") var found bool for _, r := range roles { @@ -253,9 +253,9 @@ func Test_Assigned_Role_To_Group_Operation(t *testing.T) { assert.True(t, found) }) t.Run("unassigned role to group", func(t *testing.T) { - _, err = apiClient.RoleAssignmentApi.UnassignRoleFromGroup(apiClient.cfg.Context, group.GetId(), createdRole.GetId()).Execute() + _, err = apiClient.RoleAssignmentAPI.UnassignRoleFromGroup(apiClient.cfg.Context, group.GetId(), createdRole.GetId()).Execute() require.NoError(t, err, "Unassigned role to group should not error") - roles, _, err := apiClient.RoleAssignmentApi.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute() + roles, _, err := apiClient.RoleAssignmentAPI.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute() require.NoError(t, err, "Listing group assigned role should not error") assert.Empty(t, roles) }) diff --git a/.generator/templates/api_idp_test.go b/.generator/templates/api_idp_test.go index f661d91e..2cfbebce 100644 --- a/.generator/templates/api_idp_test.go +++ b/.generator/templates/api_idp_test.go @@ -10,7 +10,7 @@ import ( ) func setupIdp(name string) (*IdentityProvider, *APIResponse, error) { - req := apiClient.IdentityProviderApi.CreateIdentityProvider(apiClient.cfg.Context) + req := apiClient.IdentityProviderAPI.CreateIdentityProvider(apiClient.cfg.Context) payload := testFactory.NewValidTestIdentityProvider() payload.SetName(name) req = req.IdentityProvider(*payload) @@ -18,7 +18,7 @@ func setupIdp(name string) (*IdentityProvider, *APIResponse, error) { } func cleanUpIdp(idpId string) (err error) { - _, err = apiClient.IdentityProviderApi.DeleteIdentityProvider(apiClient.cfg.Context, idpId).Execute() + _, err = apiClient.IdentityProviderAPI.DeleteIdentityProvider(apiClient.cfg.Context, idpId).Execute() return } @@ -26,14 +26,14 @@ func Test_Get_Identity_Provider(t *testing.T) { createdIdp, _, err := setupIdp(randomTestString()) require.NoError(t, err, "Creating a new idp should not error") t.Run("get idp by id", func(t *testing.T) { - ridp, _, err := apiClient.IdentityProviderApi.GetIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() + ridp, _, err := apiClient.IdentityProviderAPI.GetIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not get idp by ID") assert.Equal(t, createdIdp.GetId(), ridp.GetId()) assert.Equal(t, createdIdp.GetProtocol(), ridp.GetProtocol()) assert.Equal(t, createdIdp.GetPolicy(), ridp.GetPolicy()) }) t.Run("get list idp", func(t *testing.T) { - lidp, _, err := apiClient.IdentityProviderApi.ListIdentityProviders(apiClient.cfg.Context).Execute() + lidp, _, err := apiClient.IdentityProviderAPI.ListIdentityProviders(apiClient.cfg.Context).Execute() require.NoError(t, err, "Could not get list idp") var createdIdpInList bool for _, idp := range lidp { @@ -52,12 +52,12 @@ func Test_Activate_Identity_Provider(t *testing.T) { require.NoError(t, err, "Creating a new idp should not error") assert.Equal(t, LIFECYCLESTATUS_ACTIVE, createdIdp.GetStatus()) t.Run("deactivate idp", func(t *testing.T) { - didp, _, err := apiClient.IdentityProviderApi.DeactivateIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() + didp, _, err := apiClient.IdentityProviderAPI.DeactivateIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not deactivate idp") assert.Equal(t, LIFECYCLESTATUS_INACTIVE, didp.GetStatus()) }) t.Run("activate idp", func(t *testing.T) { - aidp, _, err := apiClient.IdentityProviderApi.ActivateIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() + aidp, _, err := apiClient.IdentityProviderAPI.ActivateIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not activate idp") assert.Equal(t, LIFECYCLESTATUS_ACTIVE, aidp.GetStatus()) }) @@ -69,7 +69,7 @@ func Test_Update_Identity_Provider(t *testing.T) { createdIdp, _, err := setupIdp(randomTestString()) require.NoError(t, err, "Creating a new idp should not error") t.Run("update idp", func(t *testing.T) { - req := apiClient.IdentityProviderApi.ReplaceIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()) + req := apiClient.IdentityProviderAPI.ReplaceIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()) createdIdp.SetName(fmt.Sprintf("%v%v", testPrefix, "Update")) req = req.IdentityProvider(*createdIdp) uidp, _, err := req.Execute() @@ -81,22 +81,22 @@ func Test_Update_Identity_Provider(t *testing.T) { } func Test_Get_Key(t *testing.T) { - req := apiClient.IdentityProviderApi.CreateIdentityProviderKey(apiClient.cfg.Context) + req := apiClient.IdentityProviderAPI.CreateIdentityProviderKey(apiClient.cfg.Context) payload := testFactory.NewValidTestJsonWebKey() req = req.JsonWebKey(*payload) createdKey, _, err := req.Execute() require.NoError(t, err, "Creating a new idp key should not error") t.Run("get idp key by id", func(t *testing.T) { - ridpk, _, err := apiClient.IdentityProviderApi.GetIdentityProviderKey(apiClient.cfg.Context, createdKey.GetKid()).Execute() + ridpk, _, err := apiClient.IdentityProviderAPI.GetIdentityProviderKey(apiClient.cfg.Context, createdKey.GetKid()).Execute() require.NoError(t, err, "Could not get idp key by ID") assert.Equal(t, createdKey.GetKid(), ridpk.GetKid()) }) t.Run("get list idp keys", func(t *testing.T) { - lidpk, _, err := apiClient.IdentityProviderApi.ListIdentityProviderKeys(apiClient.cfg.Context).Execute() + lidpk, _, err := apiClient.IdentityProviderAPI.ListIdentityProviderKeys(apiClient.cfg.Context).Execute() require.NoError(t, err, "Could not get list idp") assert.Equal(t, len(lidpk), 1) }) - _, err = apiClient.IdentityProviderApi.DeleteIdentityProviderKey(apiClient.cfg.Context, createdKey.GetKid()).Execute() + _, err = apiClient.IdentityProviderAPI.DeleteIdentityProviderKey(apiClient.cfg.Context, createdKey.GetKid()).Execute() require.NoError(t, err, "Clean up idp key should not error") } @@ -105,7 +105,7 @@ func Test_List_Signing_Keys(t *testing.T) { require.NoError(t, err, "Creating a new idp should not error") var generatedKey *JsonWebKey t.Run("generate signing key", func(t *testing.T) { - req := apiClient.IdentityProviderApi.GenerateIdentityProviderSigningKey(apiClient.cfg.Context, createdIdp.GetId()) + req := apiClient.IdentityProviderAPI.GenerateIdentityProviderSigningKey(apiClient.cfg.Context, createdIdp.GetId()) req = req.ValidityYears(int32(2)) generatedKey, _, err = req.Execute() require.NoError(t, err, "Generating a new signing key should not error") @@ -113,7 +113,7 @@ func Test_List_Signing_Keys(t *testing.T) { assert.NotEmpty(t, generatedKey.X5c) }) t.Run("list signing keys", func(t *testing.T) { - retrievedKeys, _, err := apiClient.IdentityProviderApi.ListIdentityProviderSigningKeys(apiClient.cfg.Context, createdIdp.GetId()).Execute() + retrievedKeys, _, err := apiClient.IdentityProviderAPI.ListIdentityProviderSigningKeys(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Retrieveing signing keys should not error") var result bool for _, v := range retrievedKeys { @@ -133,11 +133,11 @@ func Test_Clone_Signing_Key(t *testing.T) { createdIdp2, _, err := setupIdp(randomTestString()) require.NoError(t, err, "Creating a new idp should not error") t.Run("clone signing key", func(t *testing.T) { - greq := apiClient.IdentityProviderApi.GenerateIdentityProviderSigningKey(apiClient.cfg.Context, createdIdp1.GetId()) + greq := apiClient.IdentityProviderAPI.GenerateIdentityProviderSigningKey(apiClient.cfg.Context, createdIdp1.GetId()) greq = greq.ValidityYears(int32(2)) generatedKey, _, err := greq.Execute() require.NoError(t, err, "Generating a new signing key should not error") - creq := apiClient.IdentityProviderApi.CloneIdentityProviderKey(apiClient.cfg.Context, createdIdp1.GetId(), generatedKey.GetKid()) + creq := apiClient.IdentityProviderAPI.CloneIdentityProviderKey(apiClient.cfg.Context, createdIdp1.GetId(), generatedKey.GetKid()) creq = creq.TargetIdpId(createdIdp2.GetId()) clonedKey, _, err := creq.Execute() require.NoError(t, err, "Could not clone signing key") @@ -155,7 +155,7 @@ func Test_Get_CSR(t *testing.T) { require.NoError(t, err, "Creating a new idp should not error") var generatedCsr *Csr t.Run("generate CSR", func(t *testing.T) { - req := apiClient.IdentityProviderApi.GenerateCsrForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()) + req := apiClient.IdentityProviderAPI.GenerateCsrForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()) req = req.Metadata(*testFactory.NewValidTestCSRMetadata()) generatedCsr, _, err = req.Execute() require.NoError(t, err, "Generating a new csr should not error") @@ -164,14 +164,14 @@ func Test_Get_CSR(t *testing.T) { assert.NotNil(t, generatedCsr.Csr) }) t.Run("get CSR by ID", func(t *testing.T) { - rcsr, _, err := apiClient.IdentityProviderApi.GetCsrForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), generatedCsr.GetId()).Execute() + rcsr, _, err := apiClient.IdentityProviderAPI.GetCsrForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), generatedCsr.GetId()).Execute() require.NoError(t, err, "Could not get csr by ID") assert.NotNil(t, rcsr) assert.Equal(t, generatedCsr.GetKty(), rcsr.GetKty()) assert.NotNil(t, generatedCsr.GetCsr(), rcsr.GetCsr()) }) t.Run("list CSR", func(t *testing.T) { - listCSRs, _, err := apiClient.IdentityProviderApi.ListCsrsForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() + listCSRs, _, err := apiClient.IdentityProviderAPI.ListCsrsForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not list csr by idp ID") assert.NotEmpty(t, listCSRs) var result bool @@ -183,11 +183,11 @@ func Test_Get_CSR(t *testing.T) { assert.True(t, result) }) t.Run("revoke CSR", func(t *testing.T) { - _, err := apiClient.IdentityProviderApi.RevokeCsrForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), generatedCsr.GetId()).Execute() + _, err := apiClient.IdentityProviderAPI.RevokeCsrForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), generatedCsr.GetId()).Execute() require.NoError(t, err, "Unable to revoke csr") }) t.Run("list CSR", func(t *testing.T) { - listCSRs, _, err := apiClient.IdentityProviderApi.ListCsrsForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() + listCSRs, _, err := apiClient.IdentityProviderAPI.ListCsrsForIdentityProvider(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not list csr by idp ID") assert.Empty(t, listCSRs) }) @@ -201,14 +201,14 @@ func Test_Get_Linked_User(t *testing.T) { createdIdp, _, err := setupIdp(randomTestString()) require.NoError(t, err, "Creating a new idp should not error") t.Run("link idp to user", func(t *testing.T) { - req := apiClient.IdentityProviderApi.LinkUserToIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), createdUser.GetId()) + req := apiClient.IdentityProviderAPI.LinkUserToIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), createdUser.GetId()) externalId := "externalId" req = req.UserIdentityProviderLinkRequest(UserIdentityProviderLinkRequest{ExternalId: &externalId}) _, _, err := req.Execute() require.NoError(t, err, "Could not link user and idp") }) t.Run("get linked user for idps", func(t *testing.T) { - linkUser, _, err := apiClient.IdentityProviderApi.GetIdentityProviderApplicationUser(apiClient.cfg.Context, createdIdp.GetId(), createdUser.GetId()).Execute() + linkUser, _, err := apiClient.IdentityProviderAPI.GetIdentityProviderApplicationUser(apiClient.cfg.Context, createdIdp.GetId(), createdUser.GetId()).Execute() require.NoError(t, err, "Could not get user's idp") assert.Equal(t, createdUser.GetId(), linkUser.GetId()) var idpInLink bool @@ -224,16 +224,16 @@ func Test_Get_Linked_User(t *testing.T) { assert.True(t, idpInLink) }) t.Run("list linked idp user", func(t *testing.T) { - listIdp, _, err := apiClient.IdentityProviderApi.ListIdentityProviderApplicationUsers(apiClient.cfg.Context, createdIdp.GetId()).Execute() + listIdp, _, err := apiClient.IdentityProviderAPI.ListIdentityProviderApplicationUsers(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not list idp's user") assert.Equal(t, 1, len(listIdp)) }) t.Run("unlink idp from user", func(t *testing.T) { - _, err := apiClient.IdentityProviderApi.UnlinkUserFromIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), createdUser.GetId()).Execute() + _, err := apiClient.IdentityProviderAPI.UnlinkUserFromIdentityProvider(apiClient.cfg.Context, createdIdp.GetId(), createdUser.GetId()).Execute() require.NoError(t, err, "Could unlink idp and user") }) t.Run("list linked idp user", func(t *testing.T) { - listIdp, _, err := apiClient.IdentityProviderApi.ListIdentityProviderApplicationUsers(apiClient.cfg.Context, createdIdp.GetId()).Execute() + listIdp, _, err := apiClient.IdentityProviderAPI.ListIdentityProviderApplicationUsers(apiClient.cfg.Context, createdIdp.GetId()).Execute() require.NoError(t, err, "Could not list idp's user") assert.Empty(t, listIdp) }) diff --git a/.generator/templates/api_policy_test.go b/.generator/templates/api_policy_test.go index aed7d150..eb4e88d6 100644 --- a/.generator/templates/api_policy_test.go +++ b/.generator/templates/api_policy_test.go @@ -9,20 +9,23 @@ import ( ) func setupAccessPolicy(name string) (*ListPolicies200ResponseInner, *APIResponse, error) { - configuration := NewConfiguration() + configuration, err := NewConfiguration() + if err != nil { + return nil, nil, err + } configuration.Debug = true proxyClient := NewAPIClient(configuration) - req := proxyClient.PolicyApi.CreatePolicy(apiClient.cfg.Context) + req := proxyClient.PolicyAPI.CreatePolicy(apiClient.cfg.Context) req = req.Policy(ListPolicies200ResponseInner{AccessPolicy: testFactory.NewValidAccessPolicy(name)}) return req.Execute() } func cleanUpPolicy(policyId string) error { - _, err := apiClient.PolicyApi.DeactivatePolicy(apiClient.cfg.Context, policyId).Execute() + _, err := apiClient.PolicyAPI.DeactivatePolicy(apiClient.cfg.Context, policyId).Execute() if err != nil { return err } - _, err = apiClient.PolicyApi.DeletePolicy(apiClient.cfg.Context, policyId).Execute() + _, err = apiClient.PolicyAPI.DeletePolicy(apiClient.cfg.Context, policyId).Execute() if err != nil { return err } @@ -30,11 +33,11 @@ func cleanUpPolicy(policyId string) error { } func cleanUpPolicyRule(policyId, policyRuleId string) (err error) { - _, err = apiClient.PolicyApi.DeactivatePolicyRule(apiClient.cfg.Context, policyId, policyRuleId).Execute() + _, err = apiClient.PolicyAPI.DeactivatePolicyRule(apiClient.cfg.Context, policyId, policyRuleId).Execute() if err != nil { return err } - _, err = apiClient.PolicyApi.DeletePolicyRule(apiClient.cfg.Context, policyId, policyRuleId).Execute() + _, err = apiClient.PolicyAPI.DeletePolicyRule(apiClient.cfg.Context, policyId, policyRuleId).Execute() if err != nil { return err } @@ -45,7 +48,7 @@ func Test_Get_Policy(t *testing.T) { createdPolicy, _, err := setupAccessPolicy(randomTestString()) require.NoError(t, err, "Creating a new policy should not error") t.Run("get policy by id", func(t *testing.T) { - policy, _, err := apiClient.PolicyApi.GetPolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + policy, _, err := apiClient.PolicyAPI.GetPolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not get policy by ID") assert.Equal(t, createdPolicy.AccessPolicy.GetId(), policy.AccessPolicy.GetId()) }) @@ -57,7 +60,7 @@ func Test_Get_List_Policies(t *testing.T) { createdPolicy, _, err := setupAccessPolicy(randomTestString()) require.NoError(t, err, "Creating a new policy should not error") t.Run("get all policy", func(t *testing.T) { - policies, _, err := apiClient.PolicyApi.ListPolicies(apiClient.cfg.Context).Type_("ACCESS_POLICY").Execute() + policies, _, err := apiClient.PolicyAPI.ListPolicies(apiClient.cfg.Context).Type_("ACCESS_POLICY").Execute() require.NoError(t, err, "Could not get list policy") var createPolicyInList bool for _, p := range policies { @@ -77,7 +80,7 @@ func Test_Update_Policies(t *testing.T) { t.Run("update policy", func(t *testing.T) { newName := randomTestString() payload := testFactory.NewValidAccessPolicy(newName) - policy, _, err := apiClient.PolicyApi.ReplacePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Policy(ListPolicies200ResponseInner{AccessPolicy: payload}).Execute() + policy, _, err := apiClient.PolicyAPI.ReplacePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Policy(ListPolicies200ResponseInner{AccessPolicy: payload}).Execute() require.NoError(t, err, "Could not update policy") require.NotNil(t, policy.AccessPolicy) assert.Equal(t, newName, policy.AccessPolicy.GetName()) @@ -90,17 +93,17 @@ func Test_Activate_Policy(t *testing.T) { createdPolicy, _, err := setupAccessPolicy(randomTestString()) require.NoError(t, err, "Creating a new policy should not error") t.Run("deactivate policy", func(t *testing.T) { - _, err = apiClient.PolicyApi.DeactivatePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + _, err = apiClient.PolicyAPI.DeactivatePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not deactivate the policy") - policy, _, err := apiClient.PolicyApi.GetPolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + policy, _, err := apiClient.PolicyAPI.GetPolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not get policy by ID") assert.Equal(t, createdPolicy.AccessPolicy.GetId(), policy.AccessPolicy.GetId()) assert.Equal(t, LIFECYCLESTATUS_INACTIVE, policy.AccessPolicy.GetStatus()) }) t.Run("activate policy", func(t *testing.T) { - _, err = apiClient.PolicyApi.ActivatePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + _, err = apiClient.PolicyAPI.ActivatePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not activate the policy") - policy, _, err := apiClient.PolicyApi.GetPolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + policy, _, err := apiClient.PolicyAPI.GetPolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not get policy by ID") assert.Equal(t, createdPolicy.AccessPolicy.GetId(), policy.AccessPolicy.GetId()) assert.Equal(t, LIFECYCLESTATUS_ACTIVE, policy.AccessPolicy.GetStatus()) @@ -115,7 +118,7 @@ func Test_Clone_Policy(t *testing.T) { require.NoError(t, err, "Creating a new policy should not error") var policyID string t.Run("clone policy", func(t *testing.T) { - policy, _, err := apiClient.PolicyApi.ClonePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + policy, _, err := apiClient.PolicyAPI.ClonePolicy(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not get policy by ID") policyID = policy.AccessPolicy.GetId() assert.NotEqual(t, createdPolicy.AccessPolicy.GetId(), policy.AccessPolicy.GetId()) @@ -132,7 +135,8 @@ func Test_Clone_Policy(t *testing.T) { func Test_Policy_Rules_Operation(t *testing.T) { createdPolicy, _, err := setupAccessPolicy(randomTestString()) require.NoError(t, err, "Creating a new policy should not error") - configuration := NewConfiguration() + configuration, err := NewConfiguration() + require.NoError(t, err, "Creating a new config should not error") configuration.Debug = true proxyClient := NewAPIClient(configuration) accessPolicyRule := &AccessPolicyRule{} @@ -140,15 +144,15 @@ func Test_Policy_Rules_Operation(t *testing.T) { name := randomTestString() accessPolicyRule.SetName(name) payload := ListPolicyRules200ResponseInner{AccessPolicyRule: accessPolicyRule} - createdPolicyRule, _, err := proxyClient.PolicyApi.CreatePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).PolicyRule(payload).Execute() + createdPolicyRule, _, err := proxyClient.PolicyAPI.CreatePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).PolicyRule(payload).Execute() require.NoError(t, err, "Creating a new policy rule should not error") t.Run("get policy rule by id", func(t *testing.T) { - rpolicyRule, _, err := apiClient.PolicyApi.GetPolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() + rpolicyRule, _, err := apiClient.PolicyAPI.GetPolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() require.NoError(t, err, "Could not get policy rule by ID") assert.Equal(t, name, rpolicyRule.AccessPolicyRule.GetName()) }) t.Run("list policy rule", func(t *testing.T) { - rpolicyRules, _, err := apiClient.PolicyApi.ListPolicyRules(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() + rpolicyRules, _, err := apiClient.PolicyAPI.ListPolicyRules(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId()).Execute() require.NoError(t, err, "Could not listing policy rule by ID") found := false for _, pr := range rpolicyRules { @@ -161,23 +165,23 @@ func Test_Policy_Rules_Operation(t *testing.T) { t.Run("update policy rule", func(t *testing.T) { newName := randomTestString() createdPolicyRule.AccessPolicyRule.SetName(newName) - rpolicyRule, _, err := apiClient.PolicyApi.ReplacePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).PolicyRule(*createdPolicyRule).Execute() + rpolicyRule, _, err := apiClient.PolicyAPI.ReplacePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).PolicyRule(*createdPolicyRule).Execute() require.NoError(t, err, "Could not update policy rule") assert.NotEqual(t, name, rpolicyRule.AccessPolicyRule.GetName()) assert.Equal(t, newName, rpolicyRule.AccessPolicyRule.GetName()) }) t.Run("deactivate policy rule", func(t *testing.T) { - _, err = apiClient.PolicyApi.DeactivatePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() + _, err = apiClient.PolicyAPI.DeactivatePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() require.NoError(t, err, "Could not deactivate policy rule") - rpolicyRule, _, err := apiClient.PolicyApi.GetPolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() + rpolicyRule, _, err := apiClient.PolicyAPI.GetPolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() require.NoError(t, err, "Could not get policy rule by ID") assert.Equal(t, LIFECYCLESTATUS_INACTIVE, rpolicyRule.AccessPolicyRule.GetStatus()) }) t.Run("activate policy rule", func(t *testing.T) { - _, err = apiClient.PolicyApi.ActivatePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() + _, err = apiClient.PolicyAPI.ActivatePolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() require.NoError(t, err, "Could not activate policy rule") - rpolicyRule, _, err := apiClient.PolicyApi.GetPolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() + rpolicyRule, _, err := apiClient.PolicyAPI.GetPolicyRule(apiClient.cfg.Context, createdPolicy.AccessPolicy.GetId(), createdPolicyRule.AccessPolicyRule.GetId()).Execute() require.NoError(t, err, "Could not get policy rule by ID") assert.Equal(t, LIFECYCLESTATUS_ACTIVE, rpolicyRule.AccessPolicyRule.GetStatus()) }) diff --git a/.generator/templates/api_user_schema_test.go b/.generator/templates/api_user_schema_test.go index 92ffa99a..ef76bc38 100644 --- a/.generator/templates/api_user_schema_test.go +++ b/.generator/templates/api_user_schema_test.go @@ -9,7 +9,7 @@ import ( func Test_Get_User_Schema(t *testing.T) { t.Run("get default user schema", func(t *testing.T) { - schema, _, err := apiClient.SchemaApi.GetUserSchema(apiClient.cfg.Context, "default").Execute() + schema, _, err := apiClient.SchemaAPI.GetUserSchema(apiClient.cfg.Context, "default").Execute() require.NoError(t, err, "Could not get default user schema") assert.NotEmpty(t, schema, "User schema is empty") assert.Equal(t, "Username", schema.Definitions.Base.Properties.Login.GetTitle()) @@ -23,11 +23,11 @@ func Test_Get_User_Schema(t *testing.T) { } func Test_Update_Property_To_User_Schema(t *testing.T) { - schema, _, err := apiClient.SchemaApi.GetUserSchema(apiClient.cfg.Context, "default").Execute() + schema, _, err := apiClient.SchemaAPI.GetUserSchema(apiClient.cfg.Context, "default").Execute() require.NoError(t, err, "Could not get default user schema") assert.NotEmpty(t, schema, "User schema is empty") t.Run("get update user schema", func(t *testing.T) { - req := apiClient.SchemaApi.UpdateUserProfile(apiClient.cfg.Context, "default") + req := apiClient.SchemaAPI.UpdateUserProfile(apiClient.cfg.Context, "default") customAttributeName := testPrefix + randomTestString() customAttributeDetail := UserSchemaAttribute{} customAttributeDetail.SetTitle(customAttributeName) diff --git a/.generator/templates/api_user_test.go b/.generator/templates/api_user_test.go index ba5fb2e3..24f4851c 100644 --- a/.generator/templates/api_user_test.go +++ b/.generator/templates/api_user_test.go @@ -11,7 +11,7 @@ import ( ) func setupUser(activate bool) (*User, *APIResponse, CreateUserRequest, error) { - req := apiClient.UserApi.CreateUser(apiClient.cfg.Context) + req := apiClient.UserAPI.CreateUser(apiClient.cfg.Context) uc := testFactory.NewValidTestUserCredentialsWithPassword() profile := testFactory.NewValidTestUserProfile() body := CreateUserRequest{Credentials: uc, Profile: profile} @@ -22,15 +22,15 @@ func setupUser(activate bool) (*User, *APIResponse, CreateUserRequest, error) { } func cleanUpUser(userId string) error { - _, err := apiClient.UserApi.DeactivateUser(apiClient.cfg.Context, userId).Execute() + _, err := apiClient.UserAPI.DeactivateUser(apiClient.cfg.Context, userId).Execute() if err != nil { return err } - _, err = apiClient.UserApi.DeleteUser(apiClient.cfg.Context, userId).Execute() + _, err = apiClient.UserAPI.DeleteUser(apiClient.cfg.Context, userId).Execute() if err != nil { return err } - _, res, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, userId).Execute() + _, res, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, userId).Execute() if err != nil && res.StatusCode == http.StatusNotFound { err = nil } @@ -41,12 +41,12 @@ func Test_Get_User(t *testing.T) { user, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("get user by id", func(t *testing.T) { - ubid, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, user.GetId()).Execute() + ubid, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not get user by ID") assert.Equal(t, user.GetId(), ubid.GetId()) }) t.Run("get user by login", func(t *testing.T) { - ubid, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, *user.Profile.Login).Execute() + ubid, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, *user.Profile.Login).Execute() require.NoError(t, err, "Could not get user by login") assert.Equal(t, user.GetId(), ubid.GetId()) }) @@ -58,7 +58,7 @@ func Test_Activate_User(t *testing.T) { user, _, _, err := setupUser(false) require.NoError(t, err, "Creating a new user should not error") t.Run("activate users", func(t *testing.T) { - req := apiClient.UserApi.ActivateUser(apiClient.cfg.Context, user.GetId()) + req := apiClient.UserAPI.ActivateUser(apiClient.cfg.Context, user.GetId()) req = req.SendEmail(false) token, _, err := req.Execute() require.NoError(t, err, "Could not activate the user") @@ -66,7 +66,7 @@ func Test_Activate_User(t *testing.T) { assert.IsType(t, &UserActivationToken{}, token, "Activation did not return correct type") }) t.Run("get user by id", func(t *testing.T) { - crUser, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, user.GetId()).Execute() + crUser, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not get user by ID") assert.NotNil(t, crUser.Activated, "users activation time is missing") }) @@ -81,14 +81,14 @@ func Test_Update_User_Profile(t *testing.T) { t.Run("update user", func(t *testing.T) { newProfile := user.Profile newProfile.NickName = &nickName - req := apiClient.UserApi.UpdateUser(apiClient.cfg.Context, user.GetId()) + req := apiClient.UserAPI.UpdateUser(apiClient.cfg.Context, user.GetId()) body := UpdateUserRequest{Profile: newProfile} req = req.User(body) _, _, err := req.Execute() require.NoError(t, err, "Could not update user by ID") }) t.Run("get user", func(t *testing.T) { - updatedUser, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, user.GetId()).Execute() + updatedUser, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not get user by ID") assert.Equal(t, nickName, *updatedUser.Profile.NickName) }) @@ -100,9 +100,9 @@ func Test_Suspend_User(t *testing.T) { user, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("suspend user", func(t *testing.T) { - _, err := apiClient.UserApi.SuspendUser(apiClient.cfg.Context, user.GetId()).Execute() + _, err := apiClient.UserAPI.SuspendUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not suspend user") - susReq := apiClient.UserApi.ListUsers(apiClient.cfg.Context) + susReq := apiClient.UserAPI.ListUsers(apiClient.cfg.Context) susReq = susReq.Filter("status eq \"SUSPENDED\"") listUsers, _, err := susReq.Execute() require.NoError(t, err, "Could not get suspended user") @@ -116,9 +116,9 @@ func Test_Suspend_User(t *testing.T) { assert.True(t, found, "The user was not found") }) t.Run("unsuspend user", func(t *testing.T) { - _, err := apiClient.UserApi.UnsuspendUser(apiClient.cfg.Context, user.GetId()).Execute() + _, err := apiClient.UserAPI.UnsuspendUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not unsuspend user") - unsusReq := apiClient.UserApi.ListUsers(apiClient.cfg.Context) + unsusReq := apiClient.UserAPI.ListUsers(apiClient.cfg.Context) unsusReq = unsusReq.Filter("status eq \"ACTIVE\"") listUsers, _, err := unsusReq.Execute() require.NoError(t, err, "Could not get active user") @@ -140,7 +140,7 @@ func Test_Change_User_Password(t *testing.T) { require.NoError(t, err, "Creating a new user should not error") time.Sleep(1 * time.Second) t.Run("change users password", func(t *testing.T) { - req := apiClient.UserApi.ChangePassword(apiClient.cfg.Context, *user.Id) + req := apiClient.UserAPI.ChangePassword(apiClient.cfg.Context, *user.Id) newPassword := NewPasswordCredential() newPassword.SetValue(testPassword(10)) payload := ChangePasswordRequest{ @@ -150,7 +150,7 @@ func Test_Change_User_Password(t *testing.T) { req = req.ChangePasswordRequest(payload) _, _, err := req.Execute() require.NoError(t, err, "Could not change user password") - ubid, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, user.GetId()).Execute() + ubid, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not get user by ID") assert.Equal(t, user.GetId(), ubid.GetId()) assert.True(t, ubid.HasPasswordChanged()) @@ -164,7 +164,7 @@ func Test_Get_Reset_Password_Link_User(t *testing.T) { user, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("reset password", func(t *testing.T) { - req := apiClient.UserApi.GenerateResetPasswordToken(apiClient.cfg.Context, user.GetId()) + req := apiClient.UserAPI.GenerateResetPasswordToken(apiClient.cfg.Context, user.GetId()) req = req.SendEmail(false) rpt, _, err := req.Execute() require.NoError(t, err, "Could not reset password") @@ -179,7 +179,7 @@ func Test_Expire_Password_User_Get_Temp(t *testing.T) { user, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("expire password", func(t *testing.T) { - tp, _, err := apiClient.UserApi.ExpirePasswordAndGetTemporaryPassword(apiClient.cfg.Context, user.GetId()).Execute() + tp, _, err := apiClient.UserAPI.ExpirePasswordAndGetTemporaryPassword(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not reset password") assert.IsType(t, &TempPassword{}, tp) assert.NotEmpty(t, tp.TempPassword, "Temp Password not provided") @@ -192,7 +192,7 @@ func Test_Change_User_Recovery_Question(t *testing.T) { user, _, body, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("change recovery question", func(t *testing.T) { - req := apiClient.UserApi.ChangeRecoveryQuestion(apiClient.cfg.Context, user.GetId()) + req := apiClient.UserAPI.ChangeRecoveryQuestion(apiClient.cfg.Context, user.GetId()) payload := UserCredentials{ Password: body.GetCredentials().Password, RecoveryQuestion: testFactory.NewValidTestRecoveryQuestionCredential(), @@ -203,7 +203,7 @@ func Test_Change_User_Recovery_Question(t *testing.T) { assert.IsType(t, &UserCredentials{}, tmpuc) }) t.Run("update password using recovery question", func(t *testing.T) { - req := apiClient.UserApi.ForgotPasswordSetNewPassword(apiClient.cfg.Context, user.GetId()) + req := apiClient.UserAPI.ForgotPasswordSetNewPassword(apiClient.cfg.Context, user.GetId()) payload := UserCredentials{ Password: testFactory.NewValidTestPasswordCredential(), RecoveryQuestion: testFactory.NewValidTestRecoveryQuestionCredential(), @@ -211,7 +211,7 @@ func Test_Change_User_Recovery_Question(t *testing.T) { req = req.UserCredentials(payload) _, _, err := req.Execute() require.NoError(t, err, "Could not change password with recovery question") - ubid, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, user.GetId()).Execute() + ubid, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Could not get user by ID") assert.Equal(t, user.GetId(), ubid.GetId()) assert.True(t, ubid.GetPasswordChanged().After(user.GetPasswordChanged()), "Password change did not happen") @@ -226,14 +226,14 @@ func Test_Assign_User_To_A_Role(t *testing.T) { var roleId string role := ROLETYPE_USER_ADMIN t.Run("add role to user", func(t *testing.T) { - req := apiClient.RoleAssignmentApi.AssignRoleToUser(apiClient.cfg.Context, user.GetId()) + req := apiClient.RoleAssignmentAPI.AssignRoleToUser(apiClient.cfg.Context, user.GetId()) payload := AssignRoleRequest{ Type: &role, } req = req.AssignRoleRequest(payload) _, _, err = req.Execute() require.NoError(t, err, "Should not have had an error when adding role to user") - listRoles, _, err := apiClient.RoleAssignmentApi.ListAssignedRolesForUser(apiClient.cfg.Context, user.GetId()).Execute() + listRoles, _, err := apiClient.RoleAssignmentAPI.ListAssignedRolesForUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Should not have had an error when getting user's assigned role") var found bool for _, r := range listRoles { @@ -246,9 +246,9 @@ func Test_Assign_User_To_A_Role(t *testing.T) { assert.True(t, found, "Could not verify USER_ADMIN was added to the user") }) t.Run("remove role from user", func(t *testing.T) { - _, err = apiClient.RoleAssignmentApi.UnassignRoleFromUser(apiClient.cfg.Context, user.GetId(), roleId).Execute() + _, err = apiClient.RoleAssignmentAPI.UnassignRoleFromUser(apiClient.cfg.Context, user.GetId(), roleId).Execute() require.NoError(t, err, "Should not have had an error when removing role to user") - listRoles, _, err := apiClient.RoleAssignmentApi.ListAssignedRolesForUser(apiClient.cfg.Context, user.GetId()).Execute() + listRoles, _, err := apiClient.RoleAssignmentAPI.ListAssignedRolesForUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Should not have had an error when getting user's assigned role") var found bool for _, r := range listRoles { @@ -270,22 +270,22 @@ func Test_User_Group_Target_Role(t *testing.T) { var roleId string var newGroupId string t.Run("add group target to role", func(t *testing.T) { - greq := apiClient.GroupApi.CreateGroup(apiClient.cfg.Context) + greq := apiClient.GroupAPI.CreateGroup(apiClient.cfg.Context) gp := NewGroupProfile() gp.SetName("SDK_TEST Group-Target Test Group") gpayload := Group{Profile: gp} greq = greq.Group(gpayload) group, _, err := greq.Execute() require.NoError(t, err, "Creating an group should not error") - areq := apiClient.RoleAssignmentApi.AssignRoleToUser(apiClient.cfg.Context, user.GetId()) + areq := apiClient.RoleAssignmentAPI.AssignRoleToUser(apiClient.cfg.Context, user.GetId()) payload := NewAssignRoleRequest() payload.SetType("USER_ADMIN") areq = areq.AssignRoleRequest(*payload) role, _, err := areq.Execute() require.NoError(t, err, "Should not have had an error when adding role to user") - _, err = apiClient.RoleTargetApi.AssignGroupTargetToUserRole(apiClient.cfg.Context, user.GetId(), role.GetId(), group.GetId()).Execute() + _, err = apiClient.RoleTargetAPI.AssignGroupTargetToUserRole(apiClient.cfg.Context, user.GetId(), role.GetId(), group.GetId()).Execute() require.NoError(t, err, "Should not have had an error when adding group target to role") - groups, _, err := apiClient.RoleTargetApi.ListGroupTargetsForRole(apiClient.cfg.Context, user.GetId(), role.GetId()).Execute() + groups, _, err := apiClient.RoleTargetAPI.ListGroupTargetsForRole(apiClient.cfg.Context, user.GetId(), role.GetId()).Execute() require.NoError(t, err) var found bool for _, tmpgroup := range groups { @@ -299,7 +299,7 @@ func Test_User_Group_Target_Role(t *testing.T) { assert.True(t, found, "Could not verify group target") }) t.Run("remove group target from role", func(t *testing.T) { - greq := apiClient.GroupApi.CreateGroup(apiClient.cfg.Context) + greq := apiClient.GroupAPI.CreateGroup(apiClient.cfg.Context) gp := NewGroupProfile() gp.SetName("SDK_TEST Group TMP-Target Test Group") gpayload := Group{Profile: gp} @@ -307,9 +307,9 @@ func Test_User_Group_Target_Role(t *testing.T) { newGroup, _, err := greq.Execute() require.NoError(t, err, "Should not have had an error when adding role to user") newGroupId = newGroup.GetId() - _, err = apiClient.RoleTargetApi.AssignGroupTargetToUserRole(apiClient.cfg.Context, user.GetId(), roleId, newGroup.GetId()).Execute() + _, err = apiClient.RoleTargetAPI.AssignGroupTargetToUserRole(apiClient.cfg.Context, user.GetId(), roleId, newGroup.GetId()).Execute() require.NoError(t, err) - _, err = apiClient.RoleTargetApi.UnassignGroupTargetFromUserAdminRole(apiClient.cfg.Context, user.GetId(), roleId, groupId).Execute() + _, err = apiClient.RoleTargetAPI.UnassignGroupTargetFromUserAdminRole(apiClient.cfg.Context, user.GetId(), roleId, groupId).Execute() require.NoError(t, err, "Should not have had an error when removing group target to role") }) err = cleanUpUser(user.GetId()) @@ -321,14 +321,15 @@ func Test_User_Group_Target_Role(t *testing.T) { } func Test_Get_User_With_Cache_Enabled(t *testing.T) { - configuration := NewConfiguration() + configuration, err := NewConfiguration() + require.NoError(t, err, "Creating a new config should not error") configuration.Debug = true cachedApiClient := NewAPIClient(configuration) user, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") t.Run("get user with cache", func(t *testing.T) { for i := 0; i < 10; i++ { - u, resp, err := cachedApiClient.UserApi.GetUser(apiClient.cfg.Context, user.GetId()).Execute() + u, resp, err := cachedApiClient.UserAPI.GetUser(apiClient.cfg.Context, user.GetId()).Execute() assert.NoError(t, err, "Should not error when getting user") assert.NotNil(t, u, "user should not be nil") assert.NotNil(t, resp, "resp should not be nil") @@ -339,15 +340,15 @@ func Test_Get_User_With_Cache_Enabled(t *testing.T) { } func Test_List_User_Subscriptions(t *testing.T) { - user, _, err := apiClient.UserApi.GetUser(apiClient.cfg.Context, "me").Execute() + user, _, err := apiClient.UserAPI.GetUser(apiClient.cfg.Context, "me").Execute() require.NoError(t, err, "Getting the current user should not error") t.Run("get user subscription", func(t *testing.T) { - subscriptions, _, err := apiClient.SubscriptionApi.ListSubscriptionsUser(apiClient.cfg.Context, user.GetId()).Execute() + subscriptions, _, err := apiClient.SubscriptionAPI.ListSubscriptionsUser(apiClient.cfg.Context, user.GetId()).Execute() require.NoError(t, err, "Should not error listing user subscriptions") assert.True(t, len(subscriptions) > 0, "User should have subscriptions") }) t.Run("get user subscription by notification type", func(t *testing.T) { - subscription, _, err := apiClient.SubscriptionApi.GetSubscriptionsNotificationTypeUser(apiClient.cfg.Context, NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, user.GetId()).Execute() + subscription, _, err := apiClient.SubscriptionAPI.GetSubscriptionsNotificationTypeUser(apiClient.cfg.Context, NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, user.GetId()).Execute() require.NoError(t, err, "Should not error getting user subscription by notification types") assert.Equal(t, subscription.GetNotificationType(), NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, "User should have subscription notification type %q, got %q", NOTIFICATIONTYPE_OKTA_ANNOUNCEMENT, subscription.NotificationType) }) @@ -358,7 +359,7 @@ func TestCanPaginateAcrossUsers(t *testing.T) { require.NoError(t, err, "Creating a new user should not error") createdUser2, _, _, err := setupUser(true) require.NoError(t, err, "Creating a new user should not error") - user1, resp, err := apiClient.UserApi.ListUsers(apiClient.cfg.Context).Limit(1).Execute() + user1, resp, err := apiClient.UserAPI.ListUsers(apiClient.cfg.Context).Limit(1).Execute() require.NoError(t, err) assert.Equal(t, 1, len(user1), "User1 did not return 1 user") user1Profile := user1[0].GetProfile() diff --git a/.generator/templates/cache_test.go b/.generator/templates/cache_test.go index a955925a..56659c3d 100644 --- a/.generator/templates/cache_test.go +++ b/.generator/templates/cache_test.go @@ -79,7 +79,7 @@ func TestOAuthTokensAlwaysCached(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() WithCache(false) - cfg := NewConfiguration( + cfg, err := NewConfiguration( WithCache(false), WithOrgUrl("https://testing.oktapreview.com"), WithAuthorizationMode("PrivateKey"), @@ -97,6 +97,7 @@ v/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs `), WithScopes(([]string{"okta.users.read"})), ) + require.NoError(t, err, "Creating a new config should not error") client := NewAPIClient(cfg) @@ -135,14 +136,14 @@ v/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs httpmockDashboardRegex := `=~^https://testing\.oktapreview\.com/api/v1/apps?.*q\=Okta\+Dashboard.*\z` httpmock.RegisterResponder("GET", httpmockDashboardRegex, jsonResp) - _, _, err = client.ApplicationApi.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Admin Console").Execute() + _, _, err = client.ApplicationAPI.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Admin Console").Execute() require.NoError(t, err) - _, _, err = client.ApplicationApi.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Admin Console").Execute() + _, _, err = client.ApplicationAPI.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Admin Console").Execute() require.NoError(t, err) - _, _, err = client.ApplicationApi.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Dashboard").Execute() + _, _, err = client.ApplicationAPI.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Dashboard").Execute() require.NoError(t, err) - _, _, err = client.ApplicationApi.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Dashboard").Execute() + _, _, err = client.ApplicationAPI.ListApplications(cfg.Context).Limit(1).Filter("status eq ACTIVE").Q("Okta Dashboard").Execute() require.NoError(t, err) info := httpmock.GetCallCountInfo() diff --git a/.generator/templates/configuration.mustache b/.generator/templates/configuration.mustache index ca050810..278432db 100644 --- a/.generator/templates/configuration.mustache +++ b/.generator/templates/configuration.mustache @@ -163,7 +163,7 @@ type Configuration struct { } // NewConfiguration returns a new Configuration object -func NewConfiguration(conf ...ConfigSetter) *Configuration { +func NewConfiguration(conf ...ConfigSetter) (*Configuration, error) { cfg := &Configuration{ DefaultHeader: make(map[string]string), UserAgent: {{{httpUserAgent}}}{{^httpUserAgent}}fmt.Sprintf("okta-sdk-golang/%s golang/%s %s/%s", "{{{packageVersion}}}", runtime.Version(), runtime.GOOS, runtime.GOARCH){{/httpUserAgent}}, @@ -257,7 +257,10 @@ func NewConfiguration(conf ...ConfigSetter) *Configuration { confSetter(cfg) } - purl, _ := url.Parse(cfg.Okta.Client.OrgUrl) + purl, err := url.Parse(cfg.Okta.Client.OrgUrl) + if err != nil { + return nil, err + } cfg.Host = purl.Hostname() cfg.Scheme = purl.Scheme @@ -278,7 +281,7 @@ func NewConfiguration(conf ...ConfigSetter) *Configuration { cfg.Context = ctx - return cfg + return cfg, nil } func readConfigFromFile(location string, c Configuration) (*Configuration, error) { diff --git a/.generator/templates/configuration_test.go b/.generator/templates/configuration_test.go index ccbf4675..d39e60ef 100644 --- a/.generator/templates/configuration_test.go +++ b/.generator/templates/configuration_test.go @@ -1,19 +1,3 @@ -/* - * Copyright 2018 - Present Okta, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - package okta import ( @@ -24,15 +8,17 @@ import ( ) func TestUserAgent(t *testing.T) { - configuration := NewConfiguration() + configuration, err := NewConfiguration() + require.NoError(t, err, "Creating a new config should not error") userAgent := "okta-sdk-golang/" + VERSION + " golang/" + runtime.Version() + " " + runtime.GOOS + "/" + runtime.GOARCH require.Equal(t, userAgent, configuration.UserAgent) } func TestUserAgentWithExtra(t *testing.T) { - configuration := NewConfiguration( + configuration, err := NewConfiguration( WithUserAgentExtra("extra/info"), ) + require.NoError(t, err, "Creating a new config should not error") userAgent := "okta-sdk-golang/" + VERSION + " golang/" + runtime.Version() + " " + runtime.GOOS + "/" + runtime.GOARCH + " extra/info" require.Equal(t, userAgent, configuration.UserAgent) } diff --git a/.generator/templates/main_test.go b/.generator/templates/main_test.go index e5fd26de..b1bd0e04 100644 --- a/.generator/templates/main_test.go +++ b/.generator/templates/main_test.go @@ -11,7 +11,10 @@ import ( var apiClient *APIClient func init() { - configuration := NewConfiguration(WithCache(false)) + configuration, err := NewConfiguration(WithCache(false)) + if err != nil { + fmt.Printf("Create new config should not be error %v", err) + } configuration.Debug = false apiClient = NewAPIClient(configuration) @@ -53,7 +56,7 @@ func sweep() (err error) { } func sweepUsers() error { - req := apiClient.UserApi.ListUsers(apiClient.cfg.Context).Limit(200) + req := apiClient.UserAPI.ListUsers(apiClient.cfg.Context).Limit(200) req = req.Q("SDK_TEST_") users, resp, err := req.Execute() if err != nil { @@ -80,7 +83,7 @@ func sweepUsers() error { } func sweepGroups() error { - req := apiClient.GroupApi.ListGroups(apiClient.cfg.Context).Limit(200) + req := apiClient.GroupAPI.ListGroups(apiClient.cfg.Context).Limit(200) req = req.Q("SDK_TEST") groups, resp, err := req.Execute() if err != nil { @@ -107,7 +110,7 @@ func sweepGroups() error { } func sweepIdps() error { - req := apiClient.IdentityProviderApi.ListIdentityProviders(apiClient.cfg.Context).Limit(200) + req := apiClient.IdentityProviderAPI.ListIdentityProviders(apiClient.cfg.Context).Limit(200) req = req.Q("SDK_TEST") idps, resp, err := req.Execute() if err != nil { @@ -134,7 +137,7 @@ func sweepIdps() error { } func sweepGroupRules() error { - req := apiClient.GroupApi.ListGroupRules(apiClient.cfg.Context).Limit(200) + req := apiClient.GroupAPI.ListGroupRules(apiClient.cfg.Context).Limit(200) req = req.Search("SDK_TEST") groupRules, resp, err := req.Execute() if err != nil { @@ -142,7 +145,7 @@ func sweepGroupRules() error { } for _, gr := range groupRules { if gr.GetStatus() == "ACTIVE" { - _, err = apiClient.GroupApi.DeactivateGroupRule(apiClient.cfg.Context, gr.GetId()).Execute() + _, err = apiClient.GroupAPI.DeactivateGroupRule(apiClient.cfg.Context, gr.GetId()).Execute() if err != nil { return err } @@ -159,7 +162,7 @@ func sweepGroupRules() error { } for _, gr := range groupRules { if gr.GetStatus() == "ACTIVE" { - _, err = apiClient.GroupApi.DeactivateGroupRule(apiClient.cfg.Context, gr.GetId()).Execute() + _, err = apiClient.GroupAPI.DeactivateGroupRule(apiClient.cfg.Context, gr.GetId()).Execute() if err != nil { return err } @@ -173,7 +176,7 @@ func sweepGroupRules() error { } func sweepApps() error { - req := apiClient.ApplicationApi.ListApplications(apiClient.cfg.Context).Limit(200) + req := apiClient.ApplicationAPI.ListApplications(apiClient.cfg.Context).Limit(200) req = req.Q("SDK_TEST") apps, _, err := req.Execute() if err != nil { diff --git a/.generator/templates/private_key_test.go b/.generator/templates/private_key_test.go index 0ec3731a..aa96f1ee 100644 --- a/.generator/templates/private_key_test.go +++ b/.generator/templates/private_key_test.go @@ -12,12 +12,13 @@ func Test_Private_Key_Request_Can_Create_User(t *testing.T) { if os.Getenv("OKTA_CCI") != "yes" { t.Skip("Skipping testing not in CI environment") } - configuration := NewConfiguration(WithAuthorizationMode("PrivateKey"), WithScopes([]string{"okta.users.manage"})) + configuration, err := NewConfiguration(WithAuthorizationMode("PrivateKey"), WithScopes([]string{"okta.users.manage"})) + require.NoError(t, err, "Creating a new config should not error") client := NewAPIClient(configuration) uc := testFactory.NewValidTestUserCredentialsWithPassword() profile := testFactory.NewValidTestUserProfile() body := CreateUserRequest{Credentials: uc, Profile: profile} - user, _, err := client.UserApi.CreateUser(apiClient.cfg.Context).Body(body).Execute() + user, _, err := client.UserAPI.CreateUser(apiClient.cfg.Context).Body(body).Execute() require.NoError(t, err, "Creating a new user should not error") assert.NotNil(t, user, "User should not be nil") } @@ -26,7 +27,8 @@ func Test_JWT_Request_Can_Create_User(t *testing.T) { if os.Getenv("OKTA_CCI") != "yes" { t.Skip("Skipping testing not in CI environment") } - configuration := NewConfiguration(WithAuthorizationMode("JWT"), WithScopes([]string{"okta.users.manage"})) + configuration, err := NewConfiguration(WithAuthorizationMode("JWT"), WithScopes([]string{"okta.users.manage"})) + require.NoError(t, err, "Creating a new config should not error") privateKeySigner, err := createKeySigner(configuration.Okta.Client.PrivateKey, configuration.Okta.Client.PrivateKeyId) require.NoError(t, err) clientAssertion, err := createClientAssertion(configuration.Okta.Client.OrgUrl, configuration.Okta.Client.ClientId, privateKeySigner) @@ -36,7 +38,7 @@ func Test_JWT_Request_Can_Create_User(t *testing.T) { uc := testFactory.NewValidTestUserCredentialsWithPassword() profile := testFactory.NewValidTestUserProfile() body := CreateUserRequest{Credentials: uc, Profile: profile} - user, _, err := client.UserApi.CreateUser(apiClient.cfg.Context).Body(body).Execute() + user, _, err := client.UserAPI.CreateUser(apiClient.cfg.Context).Body(body).Execute() require.NoError(t, err, "Creating a new user should not error") assert.NotNil(t, user, "User should not be nil") } diff --git a/.generator/templates/proxy_test.go b/.generator/templates/proxy_test.go index 8ba26bae..202ba017 100644 --- a/.generator/templates/proxy_test.go +++ b/.generator/templates/proxy_test.go @@ -20,7 +20,8 @@ func Test_Config_Proxy(t *testing.T) { }) proxyServer := httptest.NewServer(mux) defer proxyServer.Close() - configuration := NewConfiguration() + configuration, err := NewConfiguration() + require.NoError(t, err, "Creating a new config should not error") configuration.Debug = false proxyURL, err := url.Parse(proxyServer.URL) require.NoError(t, err, "Parse url should not error") diff --git a/.generator/templates/retry_logic_test.go b/.generator/templates/retry_logic_test.go index d613cf8a..b24dfd32 100644 --- a/.generator/templates/retry_logic_test.go +++ b/.generator/templates/retry_logic_test.go @@ -14,7 +14,8 @@ import ( func Test_429_Will_Automatically_Retry(t *testing.T) { httpmock.Activate() defer httpmock.DeactivateAndReset() - configuration := NewConfiguration() + configuration, err := NewConfiguration() + require.NoError(t, err, "Creating a new config should not error") configuration.Okta.Client.RateLimit.MaxRetries = 2 configuration.Debug = true proxyClient := NewAPIClient(configuration) @@ -25,7 +26,7 @@ func Test_429_Will_Automatically_Retry(t *testing.T) { ), ) - _, resp, err := proxyClient.UserApi.ListUsers(apiClient.cfg.Context).Execute() + _, resp, err := proxyClient.UserAPI.ListUsers(apiClient.cfg.Context).Execute() require.Nil(t, err, "Error should have been nil") require.NotNil(t, resp, "Response was nil") diff --git a/.github/workflows/prepareReleaseBranch.yml b/.github/workflows/prepareReleaseBranch.yml index 33a233c7..32e0a77d 100644 --- a/.github/workflows/prepareReleaseBranch.yml +++ b/.github/workflows/prepareReleaseBranch.yml @@ -37,7 +37,7 @@ jobs: - name: Install openapi generator run: npm install @openapitools/openapi-generator-cli -g - name: Set openapi generator version - run: openapi-generator-cli version-manager set 6.6.0 + run: openapi-generator-cli version-manager set 7.0.1 - name: Generate go client run: make v3-generate - run: make fmt