mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Testing: Include BatchRevoke for all tokens in the fake. (#17728)
This commit is contained in:
parent
e7c3d0ed97
commit
d71043609e
@ -15,6 +15,7 @@ type FakeUserAuthTokenService struct {
|
|||||||
ActiveAuthTokenCount func(ctx context.Context) (int64, error)
|
ActiveAuthTokenCount func(ctx context.Context) (int64, error)
|
||||||
GetUserTokenProvider func(ctx context.Context, userId, userTokenId int64) (*models.UserToken, error)
|
GetUserTokenProvider func(ctx context.Context, userId, userTokenId int64) (*models.UserToken, error)
|
||||||
GetUserTokensProvider func(ctx context.Context, userId int64) ([]*models.UserToken, error)
|
GetUserTokensProvider func(ctx context.Context, userId int64) ([]*models.UserToken, error)
|
||||||
|
BatchRevokedTokenProvider func(ctx context.Context, userIds []int64) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFakeUserAuthTokenService() *FakeUserAuthTokenService {
|
func NewFakeUserAuthTokenService() *FakeUserAuthTokenService {
|
||||||
@ -40,6 +41,9 @@ func NewFakeUserAuthTokenService() *FakeUserAuthTokenService {
|
|||||||
RevokeAllUserTokensProvider: func(ctx context.Context, userId int64) error {
|
RevokeAllUserTokensProvider: func(ctx context.Context, userId int64) error {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
BatchRevokedTokenProvider: func(ctx context.Context, userIds []int64) error {
|
||||||
|
return nil
|
||||||
|
},
|
||||||
ActiveAuthTokenCount: func(ctx context.Context) (int64, error) {
|
ActiveAuthTokenCount: func(ctx context.Context) (int64, error) {
|
||||||
return 10, nil
|
return 10, nil
|
||||||
},
|
},
|
||||||
@ -83,3 +87,7 @@ func (s *FakeUserAuthTokenService) GetUserToken(ctx context.Context, userId, use
|
|||||||
func (s *FakeUserAuthTokenService) GetUserTokens(ctx context.Context, userId int64) ([]*models.UserToken, error) {
|
func (s *FakeUserAuthTokenService) GetUserTokens(ctx context.Context, userId int64) ([]*models.UserToken, error) {
|
||||||
return s.GetUserTokensProvider(context.Background(), userId)
|
return s.GetUserTokensProvider(context.Background(), userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *FakeUserAuthTokenService) BatchRevokeAllUserTokens(ctx context.Context, userIds []int64) error {
|
||||||
|
return s.BatchRevokedTokenProvider(ctx, userIds)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user