Chore: add more input parameters to serviceaccounts/test/common.go (#55994)

This commit is contained in:
Artur Wierzbicki
2022-09-29 12:11:53 +01:00
committed by GitHub
parent 27abc32608
commit 34f18aacd6
+12 -8
View File
@@ -20,14 +20,16 @@ type TestUser struct {
Role string
Login string
IsServiceAccount bool
OrgID int64
}
type TestApiKey struct {
Name string
Role org.RoleType
OrgId int64
Key string
IsExpired bool
Name string
Role org.RoleType
OrgId int64
Key string
IsExpired bool
ServiceAccountID *int64
}
func SetupUserServiceAccount(t *testing.T, sqlStore *sqlstore.SQLStore, testUser TestUser) *user.User {
@@ -41,6 +43,7 @@ func SetupUserServiceAccount(t *testing.T, sqlStore *sqlstore.SQLStore, testUser
IsServiceAccount: testUser.IsServiceAccount,
DefaultOrgRole: role,
Name: testUser.Name,
OrgID: testUser.OrgID,
})
require.NoError(t, err)
return u1
@@ -53,9 +56,10 @@ func SetupApiKey(t *testing.T, sqlStore *sqlstore.SQLStore, testKey TestApiKey)
}
addKeyCmd := &apikey.AddCommand{
Name: testKey.Name,
Role: role,
OrgId: testKey.OrgId,
Name: testKey.Name,
Role: role,
OrgId: testKey.OrgId,
ServiceAccountID: testKey.ServiceAccountID,
}
if testKey.Key != "" {