Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
feat(warden): added team-name & product-group-name
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudheer Pal committed Oct 16, 2023
1 parent 97f59b2 commit e885442
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 14 additions & 8 deletions internal/server/v1/iam/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,21 @@ func TestHandlerUpdateGroup(t *testing.T) {
dexGroupMetadataResponse := `{
"privacy": "public",
"product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f",
"team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b"
"team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b",
"team-name": "data_fabric",
"product-group-name": "data_engineering"
}`
groupID := "e38527ee-a8cd-40f9-98a7-1f0bbd20909f"
metaData, _ := structpb.NewStruct(map[string]any{
"privacy": "public",
})

updatedMetaData, _ := structpb.NewStruct(map[string]any{
"privacy": "public",
"team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b",
"product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f",
"privacy": "public",
"team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b",
"team-name": "data_fabric",
"product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f",
"product-group-name": "data_engineering",
})

wardenClient := mocks.NewWardenClient(t)
Expand Down Expand Up @@ -265,7 +269,7 @@ func TestHandlerUpdateGroup(t *testing.T) {
assert.JSONEq(t, dexGroupMetadataResponse, resp.Body.String())
})

t.Run("ShielUpdateGroupFailure", func(t *testing.T) {
t.Run("ShieldUpdateGroupFailure", func(t *testing.T) {
// response returned by shield client
dexGroupMetadataResponse := `{"code":"internal_error", "message":"Some unexpected error occurred", "op":"", "status":500}`
groupID := "e38527ee-a8cd-40f9-98a7-1f0bbd20909f"
Expand All @@ -274,9 +278,11 @@ func TestHandlerUpdateGroup(t *testing.T) {
})

updatedMetaData, _ := structpb.NewStruct(map[string]any{
"privacy": "public",
"team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b",
"product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f",
"privacy": "public",
"team-id": "b5aea046-dab3-4dac-b1ea-e1eef423226b",
"team-name": "data_fabric",
"product-group-id": "2079834a-05c4-420d-bfc8-44b934adea9f",
"product-group-name": "data_engineering",
})

wardenClient := mocks.NewWardenClient(t)
Expand Down
2 changes: 2 additions & 0 deletions internal/server/v1/iam/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ func (svc *Service) UpdateGroupMetadata(ctx context.Context, groupID, wardenTeam
}

metaData["team-id"] = team.Identifier
metaData["team-name"] = team.Name
metaData["product-group-id"] = team.ProductGroupID
metaData["product-group-name"] = team.ProductGroupName

updatedMetaData, err := structpb.NewStruct(metaData)
if err != nil {
Expand Down

0 comments on commit e885442

Please sign in to comment.