Skip to content

Commit

Permalink
test: fix wrong response
Browse files Browse the repository at this point in the history
  • Loading branch information
ishanarya0 committed Jul 10, 2024
1 parent 1c30d4b commit 8d51441
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/api/v1beta1/servicedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/goto/shield/core/servicedata"
"github.com/goto/shield/core/user"
"github.com/goto/shield/internal/schema"
errPkg "github.com/goto/shield/pkg/errors"
shieldv1beta1 "github.com/goto/shield/proto/v1beta1"
grpczap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap/ctxzap"
"golang.org/x/exp/maps"
Expand Down Expand Up @@ -128,6 +129,8 @@ func (h Handler) UpsertUserServiceData(ctx context.Context, request *shieldv1bet
switch {
case errors.Is(err, user.ErrInvalidEmail), errors.Is(err, user.ErrMissingEmail):
return nil, grpcUnauthenticated
case errors.Is(err, errPkg.ErrForbidden):
return nil, grpcPermissionDenied
case errors.Is(err, project.ErrNotExist), errors.Is(err, servicedata.ErrInvalidDetail),
errors.Is(err, relation.ErrInvalidDetail), errors.Is(err, servicedata.ErrNotExist):
return nil, grpcBadBodyError
Expand Down
2 changes: 1 addition & 1 deletion test/e2e_test/regression/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ func (s *EndToEndAPIRegressionTestSuite) TestServiceDataAPI() {
},
},
})
s.Assert().Equal(codes.Unauthenticated, status.Convert(err).Code())
s.Assert().Equal(codes.PermissionDenied, status.Convert(err).Code())
})

s.Run("9. org admin update a group service data with invalid group id should return invalid argument error", func() {
Expand Down

0 comments on commit 8d51441

Please sign in to comment.