Skip to content

Commit b0af645

Browse files
committed
fix: lint issues
1 parent fdb63f3 commit b0af645

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

internal/store/postgres/grant_repository_test.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/goto/guardian/internal/store/postgres"
1515
"github.com/goto/guardian/pkg/log"
1616
"github.com/goto/guardian/pkg/postgrestest"
17+
"github.com/ory/dockertest/v3"
1718
"github.com/stretchr/testify/suite"
1819
)
1920

@@ -394,6 +395,21 @@ func (s *GrantRepositoryTestSuite) TestList() {
394395
s.Run("should handle WithApprovals filter", func() {
395396
ctx := context.Background()
396397

398+
// Create a grant for the test with different role to avoid unique constraint violation
399+
testGrant := &domain.Grant{
400+
Status: domain.GrantStatusActive,
401+
AppealID: s.dummyAppeal.ID,
402+
AccountID: s.dummyAppeal.AccountID,
403+
AccountType: s.dummyAppeal.AccountType,
404+
ResourceID: s.dummyAppeal.ResourceID,
405+
Role: "test-role-with-approvals",
406+
Permissions: []string{"test-role-with-approvals"},
407+
CreatedBy: s.dummyAppeal.CreatedBy,
408+
Source: domain.GrantSourceImport,
409+
}
410+
err := s.repository.BulkInsert(ctx, []*domain.Grant{testGrant})
411+
s.Require().NoError(err)
412+
397413
// Create approvers
398414
approver1 := &domain.Approver{
399415
ID: uuid.NewString(),
@@ -426,7 +442,7 @@ func (s *GrantRepositoryTestSuite) TestList() {
426442

427443
// Insert approvals
428444
approvalRepository := postgres.NewApprovalRepository(s.store.DB())
429-
err := approvalRepository.BulkInsert(ctx, []*domain.Approval{approval1, approval2})
445+
err = approvalRepository.BulkInsert(ctx, []*domain.Approval{approval1, approval2})
430446
s.Require().NoError(err)
431447

432448
// Test with WithApprovals = true

0 commit comments

Comments
 (0)