Skip to content

Commit

Permalink
ran go fmt to fix other issues
Browse files Browse the repository at this point in the history
  • Loading branch information
snuggie12 committed Aug 25, 2022
1 parent 0ae55cb commit 3328d30
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion connector/google/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (c *googleConnector) createIdentity(ctx context.Context, identity connector
// getGroupsList returns a list of Groups from google
func (c *googleConnector) getGroupsList(email string, nextPageToken string) (*admin.Groups, error) {
groupsList, err := c.adminSrv.Groups.List().
UserKey(email).PageToken(nextPageToken).Do()
UserKey(email).PageToken(nextPageToken).Do()
return groupsList, err
}

Expand Down
26 changes: 10 additions & 16 deletions connector/google/google_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,35 @@ const (

// two represents a direct and indirect membership
// three leads to a multi-nested membership
var groupOne = &admin.Group {
var groupOne = &admin.Group{
Email: "one",
}

var groupTwo = &admin.Group {
var groupTwo = &admin.Group{
Email: "two",
}

var groupThree = &admin.Group {
var groupThree = &admin.Group{
Email: "three",
}

var groupFour = &admin.Group {
var groupFour = &admin.Group{
Email: "four",
}

var groupFive = &admin.Group {
var groupFive = &admin.Group{
Email: "five",
}

var groupSix = &admin.Group {
var groupSix = &admin.Group{
Email: "six",
}

var groupSeven = &admin.Group {
var groupSeven = &admin.Group{
Email: "seven",
}

var groupMemberships = map[string]*admin.Groups {
var groupMemberships = map[string]*admin.Groups{
"j.doe@example.com": {
Groups: []*admin.Group{groupOne, groupTwo, groupThree},
},
Expand Down Expand Up @@ -76,7 +76,6 @@ func TestGetGroupsNoTransitiveLength(t *testing.T) {
checkedGroups := make(map[string]struct{})
groups, err := getGroups(mockGetGroupsList, testUser, doTransitiveLookup, checkedGroups)


expectNil(t, err)
expectEquals(t, len(groups), 3)
}
Expand All @@ -88,7 +87,6 @@ func TestGetGroupsNoTransitiveContent(t *testing.T) {
checkedGroups := make(map[string]struct{})
groups, err := getGroups(mockGetGroupsList, testUser, doTransitiveLookup, checkedGroups)


expectNil(t, err)
expectEquals(t, groups, []string{
"one",
Expand All @@ -104,10 +102,9 @@ func TestGetGroupsNoTransitiveNumCalls(t *testing.T) {
checkedGroups := make(map[string]struct{})
_, err := getGroups(mockGetGroupsList, testUser, doTransitiveLookup, checkedGroups)


expectNil(t, err)

//numCalls should be 1 (single call for user's email)
// numCalls should be 1 (single call for user's email)
expectEquals(t, numCalls, 1)
}

Expand All @@ -118,7 +115,6 @@ func TestGetGroupsTransitiveLength(t *testing.T) {
checkedGroups := make(map[string]struct{})
groups, err := getGroups(mockGetGroupsList, testUser, doTransitiveLookup, checkedGroups)


expectNil(t, err)
expectEquals(t, len(groups), 7)
}
Expand All @@ -130,7 +126,6 @@ func TestGetGroupsTransitiveContent(t *testing.T) {
checkedGroups := make(map[string]struct{})
groups, err := getGroups(mockGetGroupsList, testUser, doTransitiveLookup, checkedGroups)


expectNil(t, err)

// Due to recursion, five, six, and seven will come before four
Expand All @@ -152,10 +147,9 @@ func TestGetGroupsTransitiveNumCalls(t *testing.T) {
checkedGroups := make(map[string]struct{})
_, err := getGroups(mockGetGroupsList, testUser, doTransitiveLookup, checkedGroups)


expectNil(t, err)

//numCalls should be 8: Original user plus a single transitive call for all 7 groups
// numCalls should be 8: Original user plus a single transitive call for all 7 groups
expectEquals(t, numCalls, 8)
}

Expand Down

0 comments on commit 3328d30

Please sign in to comment.