Skip to content

Commit

Permalink
fixed deletegroup function to match interface
Browse files Browse the repository at this point in the history
  • Loading branch information
pputman-clabs committed Jan 8, 2023
1 parent 4599ba9 commit 77a48cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions mockokta.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (client *MockClient) CreateGroup(ctx context.Context, group okta.Group) (*o
return client.Group.CreateGroup(ctx, group)
}

func (client *MockClient) DeleteGroup(ctx context.Context, groupId string) error {
func (client *MockClient) DeleteGroup(ctx context.Context, groupId string) (*okta.Response, error) {
return client.Group.DeleteGroup(ctx, groupId)
}

Expand All @@ -75,17 +75,17 @@ func (client *MockClient) RemoveUserFromGroup(ctx context.Context, groupId strin
return client.Group.RemoveUserFromGroup(ctx, groupId, userId)
}

func (g *GroupResource) DeleteGroup(ctx context.Context, groupId string) error {
func (g *GroupResource) DeleteGroup(ctx context.Context, groupId string) (*okta.Response, error) {
for idx, group := range g.Groups {
if group.Id == groupId {
g.Groups[idx] = g.Groups[len(g.Groups)-1]
g.Groups[len(g.Groups)-1] = &okta.Group{}
g.Groups = g.Groups[:len(g.Groups)-1]
return nil
return nil, nil
}
}

return fmt.Errorf("group not found")
return nil, fmt.Errorf("group not found")
}

func (g *GroupResource) CreateGroup(ctx context.Context, group okta.Group) (*okta.Group, *okta.Response, error) {
Expand Down
2 changes: 1 addition & 1 deletion mockokta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func TestGroupResource_DeleteGroup(t *testing.T) {

client := NewClient()

err := client.Group.DeleteGroup(context.TODO(), groupIdArg)
_, err := client.Group.DeleteGroup(context.TODO(), groupIdArg)

if err == nil {
t.Errorf("expected error but didn't get one")
Expand Down

0 comments on commit 77a48cd

Please sign in to comment.