Skip to content

Commit

Permalink
fixing linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pputman-clabs committed Jan 9, 2023
1 parent 3696898 commit 6397bc6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
52 changes: 26 additions & 26 deletions mockokta.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,41 +47,41 @@ func (client *MockClient) ListGroups(ctx context.Context, qp *query.Params) ([]*
return client.Group.ListGroups(ctx, qp)
}

func (client *MockClient) ListGroupUsers(ctx context.Context, groupId string, qp *query.Params) ([]*okta.User, *okta.Response, error) {
return client.Group.ListGroupUsers(ctx, groupId, qp)
func (client *MockClient) ListGroupUsers(ctx context.Context, groupID string, qp *query.Params) ([]*okta.User, *okta.Response, error) {
return client.Group.ListGroupUsers(ctx, groupID, qp)
}

func (client *MockClient) ListGroupAssignedRoles(ctx context.Context, groupId string, qp *query.Params) ([]*okta.Role, *okta.Response, error) {
return client.Group.ListGroupAssignedRoles(ctx, groupId, qp)
func (client *MockClient) ListGroupAssignedRoles(ctx context.Context, groupID string, qp *query.Params) ([]*okta.Role, *okta.Response, error) {
return client.Group.ListGroupAssignedRoles(ctx, groupID, qp)
}

func (client *MockClient) CreateGroup(ctx context.Context, group okta.Group) (*okta.Group, *okta.Response, error) {
return client.Group.CreateGroup(ctx, group)
}

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

func (client *MockClient) AssignRoleToGroup(ctx context.Context, groupId string, assignRoleRequest okta.AssignRoleRequest, qp *query.Params) (*okta.Role, *okta.Response, error) {
return client.Group.AssignRoleToGroup(ctx, groupId, assignRoleRequest, qp)
func (client *MockClient) AssignRoleToGroup(ctx context.Context, groupID string, assignRoleRequest okta.AssignRoleRequest, qp *query.Params) (*okta.Role, *okta.Response, error) {
return client.Group.AssignRoleToGroup(ctx, groupID, assignRoleRequest, qp)
}

func (client *MockClient) ListUsers(ctx context.Context, qp *query.Params) ([]*okta.User, *okta.Response, error) {
return client.User.ListUsers(ctx, qp)
}

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

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

func (g *GroupResource) DeleteGroup(ctx context.Context, groupId string) (*okta.Response, error) {
func (g *GroupResource) DeleteGroup(ctx context.Context, groupID string) (*okta.Response, error) {
for idx, group := range g.Groups {
if group.Id == groupId {
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]
Expand Down Expand Up @@ -122,8 +122,8 @@ func NewGroup(groupName string) *okta.Group {
}
}

func (g *GroupResource) AddUserToGroup(ctx context.Context, groupId string, userId string) (*okta.Response, error) {
group, err := g.GetGroupById(groupId)
func (g *GroupResource) AddUserToGroup(ctx context.Context, groupID string, userId string) (*okta.Response, error) {
group, err := g.GetGroupById(groupID)
if err != nil {
return nil, err
}
Expand All @@ -137,8 +137,8 @@ func (g *GroupResource) AddUserToGroup(ctx context.Context, groupId string, user
return nil, nil
}

func (g *GroupResource) RemoveUserFromGroup(ctx context.Context, groupId string, userId string) (*okta.Response, error) {
group, err := g.GetGroupById(groupId)
func (g *GroupResource) RemoveUserFromGroup(ctx context.Context, groupID string, userId string) (*okta.Response, error) {
group, err := g.GetGroupById(groupID)
if err != nil {
return nil, err
}
Expand All @@ -159,11 +159,11 @@ func (g *GroupResource) RemoveUserFromGroup(ctx context.Context, groupId string,
return nil, nil
}

func (g *GroupResource) AssignRoleToGroup(ctx context.Context, groupId string, assignRoleRequest okta.AssignRoleRequest, qp *query.Params) (*okta.Role, *okta.Response, error) {
func (g *GroupResource) AssignRoleToGroup(ctx context.Context, groupID string, assignRoleRequest okta.AssignRoleRequest, qp *query.Params) (*okta.Role, *okta.Response, error) {
if !SliceContainsString(adminRoles, assignRoleRequest.Type) {
return nil, nil, fmt.Errorf("invalid role")
}
group, err := g.GetGroupById(groupId)
group, err := g.GetGroupById(groupID)
if err != nil {
return nil, nil, err
}
Expand All @@ -178,8 +178,8 @@ func (g *GroupResource) AssignRoleToGroup(ctx context.Context, groupId string, a
return &role, nil, nil
}

func (g *GroupResource) ListGroupAssignedRoles(ctx context.Context, groupId string, qp *query.Params) ([]*okta.Role, *okta.Response, error) {
group, err := g.GetGroupById(groupId)
func (g *GroupResource) ListGroupAssignedRoles(ctx context.Context, groupID string, qp *query.Params) ([]*okta.Role, *okta.Response, error) {
group, err := g.GetGroupById(groupID)
if err != nil {
return nil, nil, err
}
Expand All @@ -197,8 +197,8 @@ func (g *GroupResource) GroupContainsRole(group okta.Group, roleType string) boo
return false
}

func (g *GroupResource) ListGroupUsers(ctx context.Context, groupId string, qp *query.Params) ([]*okta.User, *okta.Response, error) {
group, err := g.GetGroupById(groupId)
func (g *GroupResource) ListGroupUsers(ctx context.Context, groupID string, qp *query.Params) ([]*okta.User, *okta.Response, error) {
group, err := g.GetGroupById(groupID)
if err != nil {
return nil, nil, err
}
Expand All @@ -219,9 +219,9 @@ func (g *GroupResource) GroupContainsUser(group okta.Group, userEmail string) bo
return false
}

func (g *GroupResource) GetGroupById(groupId string) (*okta.Group, error) {
func (g *GroupResource) GetGroupById(groupID string) (*okta.Group, error) {
for _, group := range g.Groups {
if group.Id == groupId {
if group.Id == groupID {
return group, nil
}
}
Expand Down
8 changes: 4 additions & 4 deletions mockokta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ func TestGroupResource_AssignRoleToGroup(t *testing.T) {

func TestGroupResource_ListGroupAssignedRoles(t *testing.T) {
t.Run("should return error if the group doesn't exist", func(t *testing.T) {
groupIdArg := "NonexistentGroup"
groupIDArg := "NonexistentGroup"
roleRequest := RandAdminRoleRequest()

client := NewClient()
_, _, err := client.Group.AssignRoleToGroup(context.TODO(), groupIdArg, roleRequest, nil)
_, _, err := client.Group.AssignRoleToGroup(context.TODO(), groupIDArg, roleRequest, nil)

if err == nil {
t.Errorf("Expected err, but didn't get one")
Expand Down Expand Up @@ -316,11 +316,11 @@ func TestGroupResource_RemoveUserFromGroup(t *testing.T) {

func TestGroupResource_DeleteGroup(t *testing.T) {
t.Run("should err if group doesn't exist", func(t *testing.T) {
groupIdArg := "NonExistentId"
groupIDArg := "NonExistentId"

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 6397bc6

Please sign in to comment.