Skip to content

Commit e8032e0

Browse files
committed
remove authtoken.TestRoleGrantsForToken
1 parent 893bad4 commit e8032e0

File tree

1 file changed

+0
-36
lines changed

1 file changed

+0
-36
lines changed

internal/authtoken/testing.go

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"github.com/hashicorp/boundary/internal/db"
1212
"github.com/hashicorp/boundary/internal/iam"
1313
"github.com/hashicorp/boundary/internal/kms"
14-
"github.com/hashicorp/go-uuid"
1514
"github.com/stretchr/testify/require"
1615
)
1716

@@ -47,38 +46,3 @@ func TestAuthToken(t testing.TB, conn *db.DB, kms *kms.Kms, scopeId string, opt
4746
require.NoError(t, err)
4847
return at
4948
}
50-
51-
// TestRoleGrantsForToken contains information used by TestAuthTokenWithRoles to create
52-
// roles and their associated grants (with grant scopes)
53-
type TestRoleGrantsForToken struct {
54-
RoleScopeId string
55-
GrantStrings []string
56-
GrantScopes []string
57-
}
58-
59-
// TestAuthTokenWithRoles creates auth token associated with roles as requested by the caller along
60-
// with any required resources to achieve said token
61-
func TestAuthTokenWithRoles(t testing.TB, conn *db.DB, kms *kms.Kms, scopeId string, roles []TestRoleGrantsForToken) *AuthToken {
62-
t.Helper()
63-
ctx := context.Background()
64-
rw := db.New(conn)
65-
atRepo, err := NewRepository(ctx, rw, rw, kms)
66-
require.NoError(t, err)
67-
68-
iamRepo, err := iam.NewRepository(ctx, rw, rw, kms)
69-
require.NoError(t, err)
70-
71-
authMethod := password.TestAuthMethods(t, conn, scopeId, 1)[0]
72-
73-
loginName, err := uuid.GenerateUUID()
74-
require.NoError(t, err)
75-
acct := password.TestAccount(t, conn, authMethod.GetPublicId(), loginName)
76-
user := iam.TestUser(t, iamRepo, scopeId, iam.WithAccountIds(acct.GetPublicId()))
77-
for _, r := range roles {
78-
role := iam.TestRoleWithGrants(t, conn, r.RoleScopeId, r.GrantScopes, r.GrantStrings)
79-
_ = iam.TestUserRole(t, conn, role.PublicId, user.PublicId)
80-
}
81-
fullGrantToken, err := atRepo.CreateAuthToken(ctx, user, acct.GetPublicId())
82-
require.NoError(t, err)
83-
return fullGrantToken
84-
}

0 commit comments

Comments
 (0)