@@ -11,7 +11,6 @@ import (
11
11
"github.com/hashicorp/boundary/internal/db"
12
12
"github.com/hashicorp/boundary/internal/iam"
13
13
"github.com/hashicorp/boundary/internal/kms"
14
- "github.com/hashicorp/go-uuid"
15
14
"github.com/stretchr/testify/require"
16
15
)
17
16
@@ -47,38 +46,3 @@ func TestAuthToken(t testing.TB, conn *db.DB, kms *kms.Kms, scopeId string, opt
47
46
require .NoError (t , err )
48
47
return at
49
48
}
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