Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
d7104360
Unverified
Commit
d7104360
authored
Jul 02, 2019
by
Leonard Gram
Committed by
GitHub
Jul 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Testing: Include BatchRevoke for all tokens in the fake. (#17728)
parent
e7c3d0ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
pkg/services/auth/testing.go
+8
-0
No files found.
pkg/services/auth/testing.go
View file @
d7104360
...
@@ -15,6 +15,7 @@ type FakeUserAuthTokenService struct {
...
@@ -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 {
...
@@ -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
...
@@ -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
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment