Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
anjaliagg9791 committed Sep 22, 2023
1 parent 5cb5626 commit 59ae437
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions api/handler/v1beta1/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ func (s *GrpcHandlersSuite) TestListResources() {
s.setup()
timeNow := time.Now()

ctx := context.Background()

req := &guardianv1beta1.ListResourcesRequest{
IsDeleted: true,
Type: "test-type",
Expand Down Expand Up @@ -85,9 +83,10 @@ func (s *GrpcHandlersSuite) TestListResources() {
Details: expectedDetails,
},
}
s.resourceService.EXPECT().Find(ctx, expectedFilters).Return(dummyResources, nil)
s.resourceService.EXPECT().GetResourcesTotalCount(ctx, expectedFilters).Return(int64(1), nil)
res, err := s.grpcServer.ListResources(ctx, req)
s.resourceService.EXPECT().Find(mock.AnythingOfType("*context.cancelCtx"), expectedFilters).Return(dummyResources, nil)
s.resourceService.EXPECT().GetResourcesTotalCount(mock.AnythingOfType("*context.cancelCtx"),
expectedFilters).Return(1, nil).Once()
res, err := s.grpcServer.ListResources(context.Background(), req)

s.NoError(err)
s.Equal(expectedResponse, res)
Expand Down

0 comments on commit 59ae437

Please sign in to comment.