Skip to content

Commit

Permalink
chore: remove empty fields
Browse files Browse the repository at this point in the history
  • Loading branch information
scortier committed May 30, 2022
1 parent 34a8450 commit 062956c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 37 deletions.
13 changes: 4 additions & 9 deletions plugins/extractors/shield/shield.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,10 @@ func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) error {
Type: "user",
Description: user.GetSlug(),
},
Email: user.GetEmail(),
Username: user.GetId(),
FullName: user.GetName(),
DisplayName: "",
Title: "",
Status: "active",
ManagerEmail: "",
Profiles: nil,
Email: user.GetEmail(),
Username: user.GetId(),
FullName: user.GetName(),
Status: "active",
Memberships: []*assetsv1beta1.Membership{
{
GroupUrn: fmt.Sprintf("%s:%s", grp.Group.GetName(), grp.Group.GetId()),
Expand All @@ -115,7 +111,6 @@ func (e *Extractor) Extract(ctx context.Context, emit plugins.Emit) error {
CreateTime: user.GetCreatedAt(),
UpdateTime: user.GetUpdatedAt(),
},
Event: nil,
}))
}

Expand Down
36 changes: 8 additions & 28 deletions plugins/extractors/shield/shield_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,55 +143,35 @@ func setupExtractExpectation(ctx context.Context, client *mockClient) {
Id: "user-A",
}, mock.Anything).Return(&sh.GetRoleResponse{
Role: &sh.Role{
Id: "user-A",
Name: "role-A",
Types: nil,
Namespace: nil,
Metadata: nil,
CreatedAt: nil,
UpdatedAt: nil,
Id: "user-A",
Name: "role-A",
},
}, nil).Once()

client.On("GetRole", ctx, &sh.GetRoleRequest{
Id: "user-B",
}, mock.Anything).Return(&sh.GetRoleResponse{
Role: &sh.Role{
Id: "user-B",
Name: "role-B",
Types: nil,
Namespace: nil,
Metadata: nil,
CreatedAt: nil,
UpdatedAt: nil,
Id: "user-B",
Name: "role-B",
},
}, nil).Once()

client.On("GetGroup", ctx, &sh.GetGroupRequest{
Id: "user-A",
}, mock.Anything).Return(&sh.GetGroupResponse{
Group: &sh.Group{
Id: "grpId-A",
Name: "grpname-A",
Slug: "",
OrgId: "",
Metadata: nil,
CreatedAt: nil,
UpdatedAt: nil,
Id: "grpId-A",
Name: "grpname-A",
},
}, nil).Once()

client.On("GetGroup", ctx, &sh.GetGroupRequest{
Id: "user-B",
}, mock.Anything).Return(&sh.GetGroupResponse{
Group: &sh.Group{
Id: "grpId-B",
Name: "grpname-B",
Slug: "",
OrgId: "",
Metadata: nil,
CreatedAt: nil,
UpdatedAt: nil,
Id: "grpId-B",
Name: "grpname-B",
},
}, nil).Once()
}

0 comments on commit 062956c

Please sign in to comment.