Skip to content

Commit 621d4ee

Browse files
Merge pull request #411 from okta/OKTA-663100-orgurl-malformed
fix orgurl malformed
2 parents 7bb75d0 + edbaa30 commit 621d4ee

14 files changed

+200
-198
lines changed

.generator/templates/api_application_test.go

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

.generator/templates/api_group_test.go

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
func setupGroup(name string) (*Group, *APIResponse, error) {
11-
req := apiClient.GroupApi.CreateGroup(apiClient.cfg.Context)
11+
req := apiClient.GroupAPI.CreateGroup(apiClient.cfg.Context)
1212
gp := NewGroupProfile()
1313
gp.SetName(name)
1414
payload := Group{Profile: gp}
@@ -17,20 +17,20 @@ func setupGroup(name string) (*Group, *APIResponse, error) {
1717
}
1818

1919
func cleanUpGroup(groupId string) (err error) {
20-
_, err = apiClient.GroupApi.DeleteGroup(apiClient.cfg.Context, groupId).Execute()
20+
_, err = apiClient.GroupAPI.DeleteGroup(apiClient.cfg.Context, groupId).Execute()
2121
return
2222
}
2323

2424
func cleanUpGroupRule(groupRuleId string) (err error) {
25-
_, err = apiClient.GroupApi.DeleteGroupRule(apiClient.cfg.Context, groupRuleId).Execute()
25+
_, err = apiClient.GroupAPI.DeleteGroupRule(apiClient.cfg.Context, groupRuleId).Execute()
2626
return
2727
}
2828

2929
func Test_Get_Group(t *testing.T) {
3030
group, _, err := setupGroup(randomTestString())
3131
require.NoError(t, err, "Creating a new group should not error")
3232
t.Run("get group by id", func(t *testing.T) {
33-
gid, _, err := apiClient.GroupApi.GetGroup(apiClient.cfg.Context, group.GetId()).Execute()
33+
gid, _, err := apiClient.GroupAPI.GetGroup(apiClient.cfg.Context, group.GetId()).Execute()
3434
require.NoError(t, err, "Could not get group by ID")
3535
assert.Equal(t, group.GetId(), gid.GetId())
3636
})
@@ -42,7 +42,7 @@ func Test_Get_List_Group(t *testing.T) {
4242
group, _, err := setupGroup(randomTestString())
4343
require.NoError(t, err, "Creating a new group should not error")
4444
t.Run("get list group", func(t *testing.T) {
45-
gs, _, err := apiClient.GroupApi.ListGroups(apiClient.cfg.Context).Execute()
45+
gs, _, err := apiClient.GroupAPI.ListGroups(apiClient.cfg.Context).Execute()
4646
require.NoError(t, err, "Could not get list group")
4747
var createdGroupInList bool
4848
for _, g := range gs {
@@ -61,7 +61,7 @@ func Test_Search_Group(t *testing.T) {
6161
group, _, err := setupGroup(groupName)
6262
require.NoError(t, err, "Creating a new group should not error")
6363
t.Run("search group", func(t *testing.T) {
64-
req := apiClient.GroupApi.ListGroups(apiClient.cfg.Context)
64+
req := apiClient.GroupAPI.ListGroups(apiClient.cfg.Context)
6565
req = req.Q(groupName)
6666
gs, _, err := req.Execute()
6767
require.NoError(t, err, "Could not get result from search keyword")
@@ -87,7 +87,7 @@ func Test_Update_Group(t *testing.T) {
8787
ngp.SetName(newGroupName)
8888
ng := Group{}
8989
ng.SetProfile(ngp)
90-
req := apiClient.GroupApi.ReplaceGroup(apiClient.cfg.Context, group.GetId())
90+
req := apiClient.GroupAPI.ReplaceGroup(apiClient.cfg.Context, group.GetId())
9191
req = req.Group(ng)
9292
g, _, err := req.Execute()
9393
require.NoError(t, err, "Could not update group")
@@ -104,9 +104,9 @@ func Test_Group_User_Operation(t *testing.T) {
104104
user, _, _, err := setupUser(true)
105105
require.NoError(t, err, "Creating a new user should not error")
106106
t.Run("add user to group", func(t *testing.T) {
107-
_, err := apiClient.GroupApi.AssignUserToGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute()
107+
_, err := apiClient.GroupAPI.AssignUserToGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute()
108108
require.NoError(t, err, "Could not add user to group")
109-
users, _, err := apiClient.GroupApi.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute()
109+
users, _, err := apiClient.GroupAPI.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute()
110110
require.NoError(t, err)
111111
found := false
112112
for _, u := range users {
@@ -117,9 +117,9 @@ func Test_Group_User_Operation(t *testing.T) {
117117
assert.True(t, found, "Could not find user in group")
118118
})
119119
t.Run("remove user from group", func(t *testing.T) {
120-
_, err := apiClient.GroupApi.UnassignUserFromGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute()
120+
_, err := apiClient.GroupAPI.UnassignUserFromGroup(apiClient.cfg.Context, group.GetId(), user.GetId()).Execute()
121121
require.NoError(t, err, "Could not remove user from group")
122-
users, _, err := apiClient.GroupApi.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute()
122+
users, _, err := apiClient.GroupAPI.ListGroupUsers(apiClient.cfg.Context, group.GetId()).Execute()
123123
require.NoError(t, err)
124124
found := false
125125
for _, u := range users {
@@ -154,14 +154,14 @@ func Test_Group_Rule_Operation(t *testing.T) {
154154
gr.SetConditions(*grc)
155155
gr.SetType("group_rule")
156156
gr.SetName(randomTestString())
157-
req := apiClient.GroupApi.CreateGroupRule(apiClient.cfg.Context)
157+
req := apiClient.GroupAPI.CreateGroupRule(apiClient.cfg.Context)
158158
req = req.GroupRule(*gr)
159159
groupRule, _, err := req.Execute()
160160
require.NoError(t, err, "Creating a new group rule should not error")
161161
t.Run("activate group rule", func(t *testing.T) {
162-
_, err = apiClient.GroupApi.ActivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute()
162+
_, err = apiClient.GroupAPI.ActivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute()
163163
require.NoError(t, err, "Should not error when activating rule")
164-
groupRules, _, err := apiClient.GroupApi.ListGroupRules(apiClient.cfg.Context).Execute()
164+
groupRules, _, err := apiClient.GroupAPI.ListGroupRules(apiClient.cfg.Context).Execute()
165165
require.NoError(t, err, "Should not error when listing group rule")
166166
found := false
167167
for _, grs := range groupRules {
@@ -172,7 +172,7 @@ func Test_Group_Rule_Operation(t *testing.T) {
172172
assert.True(t, found, "Found group rule in list")
173173
})
174174
t.Run("deactivate group rule", func(t *testing.T) {
175-
_, err = apiClient.GroupApi.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute()
175+
_, err = apiClient.GroupAPI.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute()
176176
require.NoError(t, err, "Should not error when deactivating rule")
177177
})
178178
t.Run("update group rule", func(t *testing.T) {
@@ -190,13 +190,13 @@ func Test_Group_Rule_Operation(t *testing.T) {
190190
gr.SetConditions(*grc)
191191
gr.SetType("group_rule")
192192
gr.SetName(randomTestString())
193-
req := apiClient.GroupApi.ReplaceGroupRule(apiClient.cfg.Context, groupRule.GetId())
193+
req := apiClient.GroupAPI.ReplaceGroupRule(apiClient.cfg.Context, groupRule.GetId())
194194
req = req.GroupRule(*gr)
195195
newGroupRule, _, err := req.Execute()
196196
require.NoError(t, err, "Should not error when updating rule")
197-
_, err = apiClient.GroupApi.ActivateGroupRule(apiClient.cfg.Context, newGroupRule.GetId()).Execute()
197+
_, err = apiClient.GroupAPI.ActivateGroupRule(apiClient.cfg.Context, newGroupRule.GetId()).Execute()
198198
require.NoError(t, err, "Should not error when activating rule")
199-
_, err = apiClient.GroupApi.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute()
199+
_, err = apiClient.GroupAPI.DeactivateGroupRule(apiClient.cfg.Context, groupRule.GetId()).Execute()
200200
require.NoError(t, err, "Should not error when deactivating rule")
201201
})
202202
err = cleanUpUser(user.GetId())
@@ -212,16 +212,16 @@ func Test_List_Assigned_Applications_For_Group(t *testing.T) {
212212
require.NoError(t, err, "Creating a new group should not error")
213213
var createdApp *ListApplications200ResponseInner
214214
t.Run("get list assigned application for group", func(t *testing.T) {
215-
apps, _, err := apiClient.GroupApi.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute()
215+
apps, _, err := apiClient.GroupAPI.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute()
216216
require.NoError(t, err, "Should not error when listing assigned apps for group")
217217
assert.Equal(t, 0, len(apps), "there shouldn't be any apps assigned to group")
218218
createdApp, _, err = setupBookmarkApplication(randomTestString())
219219
require.NoError(t, err, "Creating an application should not error")
220-
aareq := apiClient.ApplicationGroupsApi.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BookmarkApplication.GetId(), group.GetId())
220+
aareq := apiClient.ApplicationGroupsAPI.AssignGroupToApplication(apiClient.cfg.Context, createdApp.BookmarkApplication.GetId(), group.GetId())
221221
aareq.applicationGroupAssignment = NewApplicationGroupAssignment()
222222
_, _, err = aareq.Execute()
223223
require.NoError(t, err, "Assigning application to group should not error")
224-
apps, _, err = apiClient.GroupApi.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute()
224+
apps, _, err = apiClient.GroupAPI.ListAssignedApplicationsForGroup(apiClient.cfg.Context, group.GetId()).Execute()
225225
require.NoError(t, err, "Should not error when listing assigned apps for group")
226226
assert.Equal(t, 1, len(apps), "there shouldn't be any apps assigned to group")
227227
})
@@ -236,13 +236,13 @@ func Test_Assigned_Role_To_Group_Operation(t *testing.T) {
236236
require.NoError(t, err, "Creating a new group should not error")
237237
var createdRole *Role
238238
t.Run("assigned role to group", func(t *testing.T) {
239-
req := apiClient.RoleAssignmentApi.AssignRoleToGroup(apiClient.cfg.Context, group.GetId())
239+
req := apiClient.RoleAssignmentAPI.AssignRoleToGroup(apiClient.cfg.Context, group.GetId())
240240
assignedRoleSA := NewAssignRoleRequest()
241241
assignedRoleSA.SetType("SUPER_ADMIN")
242242
req = req.AssignRoleRequest(*assignedRoleSA)
243243
createdRole, _, err = req.Execute()
244244
require.NoError(t, err, "Assigned role to group should not error")
245-
roles, _, err := apiClient.RoleAssignmentApi.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute()
245+
roles, _, err := apiClient.RoleAssignmentAPI.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute()
246246
require.NoError(t, err, "Listing group assigned role should not error")
247247
var found bool
248248
for _, r := range roles {
@@ -253,9 +253,9 @@ func Test_Assigned_Role_To_Group_Operation(t *testing.T) {
253253
assert.True(t, found)
254254
})
255255
t.Run("unassigned role to group", func(t *testing.T) {
256-
_, err = apiClient.RoleAssignmentApi.UnassignRoleFromGroup(apiClient.cfg.Context, group.GetId(), createdRole.GetId()).Execute()
256+
_, err = apiClient.RoleAssignmentAPI.UnassignRoleFromGroup(apiClient.cfg.Context, group.GetId(), createdRole.GetId()).Execute()
257257
require.NoError(t, err, "Unassigned role to group should not error")
258-
roles, _, err := apiClient.RoleAssignmentApi.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute()
258+
roles, _, err := apiClient.RoleAssignmentAPI.ListGroupAssignedRoles(apiClient.cfg.Context, group.GetId()).Execute()
259259
require.NoError(t, err, "Listing group assigned role should not error")
260260
assert.Empty(t, roles)
261261
})

0 commit comments

Comments
 (0)