Skip to content

Commit

Permalink
fix: test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
utsav14nov committed Oct 7, 2024
1 parent de5a211 commit 297fecb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions plugins/providers/shield/client_new_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (s *ShieldNewClientTestSuite) getTestRequest(method, path string, body inte
}

func (s *ShieldNewClientTestSuite) TestShieldNewGetGroups() {
s.Run("should get teams and nil error on success", func() {
s.Run("should get groups and nil error on success", func() {
s.setup()

testRequest, err := s.getTestRequest(http.MethodGet, "/admin/v1beta1/groups", nil, "")
Expand Down Expand Up @@ -357,7 +357,7 @@ func (s *ShieldNewClientTestSuite) TestShieldNewGetOrganizations() {
}

func (s *ShieldNewClientTestSuite) TestShieldNewGrantGroupAccess() {
s.Run("should grant access to team and nil error on success", func() {
s.Run("should grant access to group and nil error on success", func() {
s.setup()

testUserId := "test_user_id"
Expand Down Expand Up @@ -459,7 +459,7 @@ func (s *ShieldNewClientTestSuite) TestShieldNewGrantOrganizationAccess() {
}

func (s *ShieldNewClientTestSuite) TestShieldNewRevokeGroupAccess() {
s.Run("should revoke access to team and nil error on success", func() {
s.Run("should revoke access to group and nil error on success", func() {
s.setup()
testUserId := "test_user_id"

Expand Down
13 changes: 6 additions & 7 deletions plugins/providers/shield/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (s *ClientTestSuite) getTestRequest(method, path string, body interface{},
}

func (s *ClientTestSuite) TestGetGroups() {
s.Run("should get teams and nil error on success", func() {
s.Run("should get groups and nil error on success", func() {
s.setup()

testRequest, err := s.getTestRequest(http.MethodGet, "/admin/v1beta1/groups", nil, "")
Expand Down Expand Up @@ -355,17 +355,16 @@ func (s *ClientTestSuite) TestGetOrganizations() {
})
}

func (s *ClientTestSuite) TestGrantGroupAccess() {
s.Run("should grant access to team and nil error on success", func() {
func (s *ClientTestSuite) TestGrantShieldGroupAccess() {
s.Run("should grant access to group and nil error on success", func() {
s.setup()

testUserId := "test_user_id"

body := make(map[string][]string)
body["userIds"] = append(body["userIds"], testUserId)

var teamObj *shield.Group
teamObj = new(shield.Group)
teamObj := new(shield.Group)
teamObj.ID = "test_team_id"

role := "users"
Expand Down Expand Up @@ -471,8 +470,8 @@ func (s *ClientTestSuite) TestGrantOrganizationAccess() {
})
}

func (s *ClientTestSuite) TestRevokeGroupAccess() {
s.Run("should revoke access to team and nil error on success", func() {
func (s *ClientTestSuite) TestRevokeShieldGroupAccess() {
s.Run("should revoke access to group and nil error on success", func() {
s.setup()
testUserId := "test_user_id"

Expand Down
4 changes: 2 additions & 2 deletions plugins/providers/shield/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func TestGetResources(t *testing.T) {
},
}
expectedError := errors.New("client error")
client.On("GetTeams", mock.Anything).Return(nil, expectedError).Once()
client.On("GetGroups", mock.Anything).Return(nil, expectedError).Once()

actualResources, actualError := p.GetResources(context.TODO(), pc)

Expand Down Expand Up @@ -306,7 +306,7 @@ func TestGetResources(t *testing.T) {
Admins: []string{"[email protected]"},
},
}
client.On("GetTeams", mock.Anything).Return(expectedTeams, nil).Once()
client.On("GetGroups", mock.Anything).Return(expectedTeams, nil).Once()

expectedProjects := []*shield.Project{
{
Expand Down

0 comments on commit 297fecb

Please sign in to comment.