This commit is contained in:
@@ -2,15 +2,15 @@
|
||||
|
||||
package mocks
|
||||
|
||||
//go:generate minimock -i smart-search-back/internal/repository.SessionRepository -o session_repository_mock.go -n SessionRepositoryMock -p mocks
|
||||
//go:generate minimock -i git.techease.ru/Smart-search/smart-search-back/internal/repository.SessionRepository -o session_repository_mock.go -n SessionRepositoryMock -p mocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"smart-search-back/internal/model"
|
||||
"sync"
|
||||
mm_atomic "sync/atomic"
|
||||
mm_time "time"
|
||||
|
||||
"git.techease.ru/Smart-search/smart-search-back/internal/model"
|
||||
"github.com/gojuno/minimock/v3"
|
||||
)
|
||||
|
||||
@@ -40,6 +40,13 @@ type SessionRepositoryMock struct {
|
||||
beforeFindByRefreshTokenCounter uint64
|
||||
FindByRefreshTokenMock mSessionRepositoryMockFindByRefreshToken
|
||||
|
||||
funcIsAccessTokenValid func(ctx context.Context, accessToken string) (b1 bool, err error)
|
||||
funcIsAccessTokenValidOrigin string
|
||||
inspectFuncIsAccessTokenValid func(ctx context.Context, accessToken string)
|
||||
afterIsAccessTokenValidCounter uint64
|
||||
beforeIsAccessTokenValidCounter uint64
|
||||
IsAccessTokenValidMock mSessionRepositoryMockIsAccessTokenValid
|
||||
|
||||
funcRevoke func(ctx context.Context, refreshToken string) (err error)
|
||||
funcRevokeOrigin string
|
||||
inspectFuncRevoke func(ctx context.Context, refreshToken string)
|
||||
@@ -47,6 +54,13 @@ type SessionRepositoryMock struct {
|
||||
beforeRevokeCounter uint64
|
||||
RevokeMock mSessionRepositoryMockRevoke
|
||||
|
||||
funcRevokeByAccessToken func(ctx context.Context, accessToken string) (err error)
|
||||
funcRevokeByAccessTokenOrigin string
|
||||
inspectFuncRevokeByAccessToken func(ctx context.Context, accessToken string)
|
||||
afterRevokeByAccessTokenCounter uint64
|
||||
beforeRevokeByAccessTokenCounter uint64
|
||||
RevokeByAccessTokenMock mSessionRepositoryMockRevokeByAccessToken
|
||||
|
||||
funcUpdateAccessToken func(ctx context.Context, refreshToken string, newAccessToken string) (err error)
|
||||
funcUpdateAccessTokenOrigin string
|
||||
inspectFuncUpdateAccessToken func(ctx context.Context, refreshToken string, newAccessToken string)
|
||||
@@ -72,9 +86,15 @@ func NewSessionRepositoryMock(t minimock.Tester) *SessionRepositoryMock {
|
||||
m.FindByRefreshTokenMock = mSessionRepositoryMockFindByRefreshToken{mock: m}
|
||||
m.FindByRefreshTokenMock.callArgs = []*SessionRepositoryMockFindByRefreshTokenParams{}
|
||||
|
||||
m.IsAccessTokenValidMock = mSessionRepositoryMockIsAccessTokenValid{mock: m}
|
||||
m.IsAccessTokenValidMock.callArgs = []*SessionRepositoryMockIsAccessTokenValidParams{}
|
||||
|
||||
m.RevokeMock = mSessionRepositoryMockRevoke{mock: m}
|
||||
m.RevokeMock.callArgs = []*SessionRepositoryMockRevokeParams{}
|
||||
|
||||
m.RevokeByAccessTokenMock = mSessionRepositoryMockRevokeByAccessToken{mock: m}
|
||||
m.RevokeByAccessTokenMock.callArgs = []*SessionRepositoryMockRevokeByAccessTokenParams{}
|
||||
|
||||
m.UpdateAccessTokenMock = mSessionRepositoryMockUpdateAccessToken{mock: m}
|
||||
m.UpdateAccessTokenMock.callArgs = []*SessionRepositoryMockUpdateAccessTokenParams{}
|
||||
|
||||
@@ -1080,6 +1100,349 @@ func (m *SessionRepositoryMock) MinimockFindByRefreshTokenInspect() {
|
||||
}
|
||||
}
|
||||
|
||||
type mSessionRepositoryMockIsAccessTokenValid struct {
|
||||
optional bool
|
||||
mock *SessionRepositoryMock
|
||||
defaultExpectation *SessionRepositoryMockIsAccessTokenValidExpectation
|
||||
expectations []*SessionRepositoryMockIsAccessTokenValidExpectation
|
||||
|
||||
callArgs []*SessionRepositoryMockIsAccessTokenValidParams
|
||||
mutex sync.RWMutex
|
||||
|
||||
expectedInvocations uint64
|
||||
expectedInvocationsOrigin string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockIsAccessTokenValidExpectation specifies expectation struct of the SessionRepository.IsAccessTokenValid
|
||||
type SessionRepositoryMockIsAccessTokenValidExpectation struct {
|
||||
mock *SessionRepositoryMock
|
||||
params *SessionRepositoryMockIsAccessTokenValidParams
|
||||
paramPtrs *SessionRepositoryMockIsAccessTokenValidParamPtrs
|
||||
expectationOrigins SessionRepositoryMockIsAccessTokenValidExpectationOrigins
|
||||
results *SessionRepositoryMockIsAccessTokenValidResults
|
||||
returnOrigin string
|
||||
Counter uint64
|
||||
}
|
||||
|
||||
// SessionRepositoryMockIsAccessTokenValidParams contains parameters of the SessionRepository.IsAccessTokenValid
|
||||
type SessionRepositoryMockIsAccessTokenValidParams struct {
|
||||
ctx context.Context
|
||||
accessToken string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockIsAccessTokenValidParamPtrs contains pointers to parameters of the SessionRepository.IsAccessTokenValid
|
||||
type SessionRepositoryMockIsAccessTokenValidParamPtrs struct {
|
||||
ctx *context.Context
|
||||
accessToken *string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockIsAccessTokenValidResults contains results of the SessionRepository.IsAccessTokenValid
|
||||
type SessionRepositoryMockIsAccessTokenValidResults struct {
|
||||
b1 bool
|
||||
err error
|
||||
}
|
||||
|
||||
// SessionRepositoryMockIsAccessTokenValidOrigins contains origins of expectations of the SessionRepository.IsAccessTokenValid
|
||||
type SessionRepositoryMockIsAccessTokenValidExpectationOrigins struct {
|
||||
origin string
|
||||
originCtx string
|
||||
originAccessToken string
|
||||
}
|
||||
|
||||
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
|
||||
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
|
||||
// Optional() makes method check to work in '0 or more' mode.
|
||||
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
|
||||
// catch the problems when the expected method call is totally skipped during test run.
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Optional() *mSessionRepositoryMockIsAccessTokenValid {
|
||||
mmIsAccessTokenValid.optional = true
|
||||
return mmIsAccessTokenValid
|
||||
}
|
||||
|
||||
// Expect sets up expected params for SessionRepository.IsAccessTokenValid
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Expect(ctx context.Context, accessToken string) *mSessionRepositoryMockIsAccessTokenValid {
|
||||
if mmIsAccessTokenValid.mock.funcIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation == nil {
|
||||
mmIsAccessTokenValid.defaultExpectation = &SessionRepositoryMockIsAccessTokenValidExpectation{}
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation.paramPtrs != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by ExpectParams functions")
|
||||
}
|
||||
|
||||
mmIsAccessTokenValid.defaultExpectation.params = &SessionRepositoryMockIsAccessTokenValidParams{ctx, accessToken}
|
||||
mmIsAccessTokenValid.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
|
||||
for _, e := range mmIsAccessTokenValid.expectations {
|
||||
if minimock.Equal(e.params, mmIsAccessTokenValid.defaultExpectation.params) {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmIsAccessTokenValid.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
|
||||
return mmIsAccessTokenValid
|
||||
}
|
||||
|
||||
// ExpectCtxParam1 sets up expected param ctx for SessionRepository.IsAccessTokenValid
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) ExpectCtxParam1(ctx context.Context) *mSessionRepositoryMockIsAccessTokenValid {
|
||||
if mmIsAccessTokenValid.mock.funcIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation == nil {
|
||||
mmIsAccessTokenValid.defaultExpectation = &SessionRepositoryMockIsAccessTokenValidExpectation{}
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation.params != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation.paramPtrs == nil {
|
||||
mmIsAccessTokenValid.defaultExpectation.paramPtrs = &SessionRepositoryMockIsAccessTokenValidParamPtrs{}
|
||||
}
|
||||
mmIsAccessTokenValid.defaultExpectation.paramPtrs.ctx = &ctx
|
||||
mmIsAccessTokenValid.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
|
||||
|
||||
return mmIsAccessTokenValid
|
||||
}
|
||||
|
||||
// ExpectAccessTokenParam2 sets up expected param accessToken for SessionRepository.IsAccessTokenValid
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) ExpectAccessTokenParam2(accessToken string) *mSessionRepositoryMockIsAccessTokenValid {
|
||||
if mmIsAccessTokenValid.mock.funcIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation == nil {
|
||||
mmIsAccessTokenValid.defaultExpectation = &SessionRepositoryMockIsAccessTokenValidExpectation{}
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation.params != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation.paramPtrs == nil {
|
||||
mmIsAccessTokenValid.defaultExpectation.paramPtrs = &SessionRepositoryMockIsAccessTokenValidParamPtrs{}
|
||||
}
|
||||
mmIsAccessTokenValid.defaultExpectation.paramPtrs.accessToken = &accessToken
|
||||
mmIsAccessTokenValid.defaultExpectation.expectationOrigins.originAccessToken = minimock.CallerInfo(1)
|
||||
|
||||
return mmIsAccessTokenValid
|
||||
}
|
||||
|
||||
// Inspect accepts an inspector function that has same arguments as the SessionRepository.IsAccessTokenValid
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Inspect(f func(ctx context.Context, accessToken string)) *mSessionRepositoryMockIsAccessTokenValid {
|
||||
if mmIsAccessTokenValid.mock.inspectFuncIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("Inspect function is already set for SessionRepositoryMock.IsAccessTokenValid")
|
||||
}
|
||||
|
||||
mmIsAccessTokenValid.mock.inspectFuncIsAccessTokenValid = f
|
||||
|
||||
return mmIsAccessTokenValid
|
||||
}
|
||||
|
||||
// Return sets up results that will be returned by SessionRepository.IsAccessTokenValid
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Return(b1 bool, err error) *SessionRepositoryMock {
|
||||
if mmIsAccessTokenValid.mock.funcIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.defaultExpectation == nil {
|
||||
mmIsAccessTokenValid.defaultExpectation = &SessionRepositoryMockIsAccessTokenValidExpectation{mock: mmIsAccessTokenValid.mock}
|
||||
}
|
||||
mmIsAccessTokenValid.defaultExpectation.results = &SessionRepositoryMockIsAccessTokenValidResults{b1, err}
|
||||
mmIsAccessTokenValid.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
|
||||
return mmIsAccessTokenValid.mock
|
||||
}
|
||||
|
||||
// Set uses given function f to mock the SessionRepository.IsAccessTokenValid method
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Set(f func(ctx context.Context, accessToken string) (b1 bool, err error)) *SessionRepositoryMock {
|
||||
if mmIsAccessTokenValid.defaultExpectation != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("Default expectation is already set for the SessionRepository.IsAccessTokenValid method")
|
||||
}
|
||||
|
||||
if len(mmIsAccessTokenValid.expectations) > 0 {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("Some expectations are already set for the SessionRepository.IsAccessTokenValid method")
|
||||
}
|
||||
|
||||
mmIsAccessTokenValid.mock.funcIsAccessTokenValid = f
|
||||
mmIsAccessTokenValid.mock.funcIsAccessTokenValidOrigin = minimock.CallerInfo(1)
|
||||
return mmIsAccessTokenValid.mock
|
||||
}
|
||||
|
||||
// When sets expectation for the SessionRepository.IsAccessTokenValid which will trigger the result defined by the following
|
||||
// Then helper
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) When(ctx context.Context, accessToken string) *SessionRepositoryMockIsAccessTokenValidExpectation {
|
||||
if mmIsAccessTokenValid.mock.funcIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("SessionRepositoryMock.IsAccessTokenValid mock is already set by Set")
|
||||
}
|
||||
|
||||
expectation := &SessionRepositoryMockIsAccessTokenValidExpectation{
|
||||
mock: mmIsAccessTokenValid.mock,
|
||||
params: &SessionRepositoryMockIsAccessTokenValidParams{ctx, accessToken},
|
||||
expectationOrigins: SessionRepositoryMockIsAccessTokenValidExpectationOrigins{origin: minimock.CallerInfo(1)},
|
||||
}
|
||||
mmIsAccessTokenValid.expectations = append(mmIsAccessTokenValid.expectations, expectation)
|
||||
return expectation
|
||||
}
|
||||
|
||||
// Then sets up SessionRepository.IsAccessTokenValid return parameters for the expectation previously defined by the When method
|
||||
func (e *SessionRepositoryMockIsAccessTokenValidExpectation) Then(b1 bool, err error) *SessionRepositoryMock {
|
||||
e.results = &SessionRepositoryMockIsAccessTokenValidResults{b1, err}
|
||||
return e.mock
|
||||
}
|
||||
|
||||
// Times sets number of times SessionRepository.IsAccessTokenValid should be invoked
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Times(n uint64) *mSessionRepositoryMockIsAccessTokenValid {
|
||||
if n == 0 {
|
||||
mmIsAccessTokenValid.mock.t.Fatalf("Times of SessionRepositoryMock.IsAccessTokenValid mock can not be zero")
|
||||
}
|
||||
mm_atomic.StoreUint64(&mmIsAccessTokenValid.expectedInvocations, n)
|
||||
mmIsAccessTokenValid.expectedInvocationsOrigin = minimock.CallerInfo(1)
|
||||
return mmIsAccessTokenValid
|
||||
}
|
||||
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) invocationsDone() bool {
|
||||
if len(mmIsAccessTokenValid.expectations) == 0 && mmIsAccessTokenValid.defaultExpectation == nil && mmIsAccessTokenValid.mock.funcIsAccessTokenValid == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
totalInvocations := mm_atomic.LoadUint64(&mmIsAccessTokenValid.mock.afterIsAccessTokenValidCounter)
|
||||
expectedInvocations := mm_atomic.LoadUint64(&mmIsAccessTokenValid.expectedInvocations)
|
||||
|
||||
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
||||
}
|
||||
|
||||
// IsAccessTokenValid implements mm_repository.SessionRepository
|
||||
func (mmIsAccessTokenValid *SessionRepositoryMock) IsAccessTokenValid(ctx context.Context, accessToken string) (b1 bool, err error) {
|
||||
mm_atomic.AddUint64(&mmIsAccessTokenValid.beforeIsAccessTokenValidCounter, 1)
|
||||
defer mm_atomic.AddUint64(&mmIsAccessTokenValid.afterIsAccessTokenValidCounter, 1)
|
||||
|
||||
mmIsAccessTokenValid.t.Helper()
|
||||
|
||||
if mmIsAccessTokenValid.inspectFuncIsAccessTokenValid != nil {
|
||||
mmIsAccessTokenValid.inspectFuncIsAccessTokenValid(ctx, accessToken)
|
||||
}
|
||||
|
||||
mm_params := SessionRepositoryMockIsAccessTokenValidParams{ctx, accessToken}
|
||||
|
||||
// Record call args
|
||||
mmIsAccessTokenValid.IsAccessTokenValidMock.mutex.Lock()
|
||||
mmIsAccessTokenValid.IsAccessTokenValidMock.callArgs = append(mmIsAccessTokenValid.IsAccessTokenValidMock.callArgs, &mm_params)
|
||||
mmIsAccessTokenValid.IsAccessTokenValidMock.mutex.Unlock()
|
||||
|
||||
for _, e := range mmIsAccessTokenValid.IsAccessTokenValidMock.expectations {
|
||||
if minimock.Equal(*e.params, mm_params) {
|
||||
mm_atomic.AddUint64(&e.Counter, 1)
|
||||
return e.results.b1, e.results.err
|
||||
}
|
||||
}
|
||||
|
||||
if mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation != nil {
|
||||
mm_atomic.AddUint64(&mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.Counter, 1)
|
||||
mm_want := mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.params
|
||||
mm_want_ptrs := mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.paramPtrs
|
||||
|
||||
mm_got := SessionRepositoryMockIsAccessTokenValidParams{ctx, accessToken}
|
||||
|
||||
if mm_want_ptrs != nil {
|
||||
|
||||
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
||||
mmIsAccessTokenValid.t.Errorf("SessionRepositoryMock.IsAccessTokenValid got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.accessToken != nil && !minimock.Equal(*mm_want_ptrs.accessToken, mm_got.accessToken) {
|
||||
mmIsAccessTokenValid.t.Errorf("SessionRepositoryMock.IsAccessTokenValid got unexpected parameter accessToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.expectationOrigins.originAccessToken, *mm_want_ptrs.accessToken, mm_got.accessToken, minimock.Diff(*mm_want_ptrs.accessToken, mm_got.accessToken))
|
||||
}
|
||||
|
||||
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
||||
mmIsAccessTokenValid.t.Errorf("SessionRepositoryMock.IsAccessTokenValid got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
||||
}
|
||||
|
||||
mm_results := mmIsAccessTokenValid.IsAccessTokenValidMock.defaultExpectation.results
|
||||
if mm_results == nil {
|
||||
mmIsAccessTokenValid.t.Fatal("No results are set for the SessionRepositoryMock.IsAccessTokenValid")
|
||||
}
|
||||
return (*mm_results).b1, (*mm_results).err
|
||||
}
|
||||
if mmIsAccessTokenValid.funcIsAccessTokenValid != nil {
|
||||
return mmIsAccessTokenValid.funcIsAccessTokenValid(ctx, accessToken)
|
||||
}
|
||||
mmIsAccessTokenValid.t.Fatalf("Unexpected call to SessionRepositoryMock.IsAccessTokenValid. %v %v", ctx, accessToken)
|
||||
return
|
||||
}
|
||||
|
||||
// IsAccessTokenValidAfterCounter returns a count of finished SessionRepositoryMock.IsAccessTokenValid invocations
|
||||
func (mmIsAccessTokenValid *SessionRepositoryMock) IsAccessTokenValidAfterCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmIsAccessTokenValid.afterIsAccessTokenValidCounter)
|
||||
}
|
||||
|
||||
// IsAccessTokenValidBeforeCounter returns a count of SessionRepositoryMock.IsAccessTokenValid invocations
|
||||
func (mmIsAccessTokenValid *SessionRepositoryMock) IsAccessTokenValidBeforeCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmIsAccessTokenValid.beforeIsAccessTokenValidCounter)
|
||||
}
|
||||
|
||||
// Calls returns a list of arguments used in each call to SessionRepositoryMock.IsAccessTokenValid.
|
||||
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
||||
func (mmIsAccessTokenValid *mSessionRepositoryMockIsAccessTokenValid) Calls() []*SessionRepositoryMockIsAccessTokenValidParams {
|
||||
mmIsAccessTokenValid.mutex.RLock()
|
||||
|
||||
argCopy := make([]*SessionRepositoryMockIsAccessTokenValidParams, len(mmIsAccessTokenValid.callArgs))
|
||||
copy(argCopy, mmIsAccessTokenValid.callArgs)
|
||||
|
||||
mmIsAccessTokenValid.mutex.RUnlock()
|
||||
|
||||
return argCopy
|
||||
}
|
||||
|
||||
// MinimockIsAccessTokenValidDone returns true if the count of the IsAccessTokenValid invocations corresponds
|
||||
// the number of defined expectations
|
||||
func (m *SessionRepositoryMock) MinimockIsAccessTokenValidDone() bool {
|
||||
if m.IsAccessTokenValidMock.optional {
|
||||
// Optional methods provide '0 or more' call count restriction.
|
||||
return true
|
||||
}
|
||||
|
||||
for _, e := range m.IsAccessTokenValidMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return m.IsAccessTokenValidMock.invocationsDone()
|
||||
}
|
||||
|
||||
// MinimockIsAccessTokenValidInspect logs each unmet expectation
|
||||
func (m *SessionRepositoryMock) MinimockIsAccessTokenValidInspect() {
|
||||
for _, e := range m.IsAccessTokenValidMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.IsAccessTokenValid at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
|
||||
}
|
||||
}
|
||||
|
||||
afterIsAccessTokenValidCounter := mm_atomic.LoadUint64(&m.afterIsAccessTokenValidCounter)
|
||||
// if default expectation was set then invocations count should be greater than zero
|
||||
if m.IsAccessTokenValidMock.defaultExpectation != nil && afterIsAccessTokenValidCounter < 1 {
|
||||
if m.IsAccessTokenValidMock.defaultExpectation.params == nil {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.IsAccessTokenValid at\n%s", m.IsAccessTokenValidMock.defaultExpectation.returnOrigin)
|
||||
} else {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.IsAccessTokenValid at\n%s with params: %#v", m.IsAccessTokenValidMock.defaultExpectation.expectationOrigins.origin, *m.IsAccessTokenValidMock.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
// if func was set then invocations count should be greater than zero
|
||||
if m.funcIsAccessTokenValid != nil && afterIsAccessTokenValidCounter < 1 {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.IsAccessTokenValid at\n%s", m.funcIsAccessTokenValidOrigin)
|
||||
}
|
||||
|
||||
if !m.IsAccessTokenValidMock.invocationsDone() && afterIsAccessTokenValidCounter > 0 {
|
||||
m.t.Errorf("Expected %d calls to SessionRepositoryMock.IsAccessTokenValid at\n%s but found %d calls",
|
||||
mm_atomic.LoadUint64(&m.IsAccessTokenValidMock.expectedInvocations), m.IsAccessTokenValidMock.expectedInvocationsOrigin, afterIsAccessTokenValidCounter)
|
||||
}
|
||||
}
|
||||
|
||||
type mSessionRepositoryMockRevoke struct {
|
||||
optional bool
|
||||
mock *SessionRepositoryMock
|
||||
@@ -1422,6 +1785,348 @@ func (m *SessionRepositoryMock) MinimockRevokeInspect() {
|
||||
}
|
||||
}
|
||||
|
||||
type mSessionRepositoryMockRevokeByAccessToken struct {
|
||||
optional bool
|
||||
mock *SessionRepositoryMock
|
||||
defaultExpectation *SessionRepositoryMockRevokeByAccessTokenExpectation
|
||||
expectations []*SessionRepositoryMockRevokeByAccessTokenExpectation
|
||||
|
||||
callArgs []*SessionRepositoryMockRevokeByAccessTokenParams
|
||||
mutex sync.RWMutex
|
||||
|
||||
expectedInvocations uint64
|
||||
expectedInvocationsOrigin string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockRevokeByAccessTokenExpectation specifies expectation struct of the SessionRepository.RevokeByAccessToken
|
||||
type SessionRepositoryMockRevokeByAccessTokenExpectation struct {
|
||||
mock *SessionRepositoryMock
|
||||
params *SessionRepositoryMockRevokeByAccessTokenParams
|
||||
paramPtrs *SessionRepositoryMockRevokeByAccessTokenParamPtrs
|
||||
expectationOrigins SessionRepositoryMockRevokeByAccessTokenExpectationOrigins
|
||||
results *SessionRepositoryMockRevokeByAccessTokenResults
|
||||
returnOrigin string
|
||||
Counter uint64
|
||||
}
|
||||
|
||||
// SessionRepositoryMockRevokeByAccessTokenParams contains parameters of the SessionRepository.RevokeByAccessToken
|
||||
type SessionRepositoryMockRevokeByAccessTokenParams struct {
|
||||
ctx context.Context
|
||||
accessToken string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockRevokeByAccessTokenParamPtrs contains pointers to parameters of the SessionRepository.RevokeByAccessToken
|
||||
type SessionRepositoryMockRevokeByAccessTokenParamPtrs struct {
|
||||
ctx *context.Context
|
||||
accessToken *string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockRevokeByAccessTokenResults contains results of the SessionRepository.RevokeByAccessToken
|
||||
type SessionRepositoryMockRevokeByAccessTokenResults struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// SessionRepositoryMockRevokeByAccessTokenOrigins contains origins of expectations of the SessionRepository.RevokeByAccessToken
|
||||
type SessionRepositoryMockRevokeByAccessTokenExpectationOrigins struct {
|
||||
origin string
|
||||
originCtx string
|
||||
originAccessToken string
|
||||
}
|
||||
|
||||
// Marks this method to be optional. The default behavior of any method with Return() is '1 or more', meaning
|
||||
// the test will fail minimock's automatic final call check if the mocked method was not called at least once.
|
||||
// Optional() makes method check to work in '0 or more' mode.
|
||||
// It is NOT RECOMMENDED to use this option unless you really need it, as default behaviour helps to
|
||||
// catch the problems when the expected method call is totally skipped during test run.
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Optional() *mSessionRepositoryMockRevokeByAccessToken {
|
||||
mmRevokeByAccessToken.optional = true
|
||||
return mmRevokeByAccessToken
|
||||
}
|
||||
|
||||
// Expect sets up expected params for SessionRepository.RevokeByAccessToken
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Expect(ctx context.Context, accessToken string) *mSessionRepositoryMockRevokeByAccessToken {
|
||||
if mmRevokeByAccessToken.mock.funcRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation == nil {
|
||||
mmRevokeByAccessToken.defaultExpectation = &SessionRepositoryMockRevokeByAccessTokenExpectation{}
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation.paramPtrs != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by ExpectParams functions")
|
||||
}
|
||||
|
||||
mmRevokeByAccessToken.defaultExpectation.params = &SessionRepositoryMockRevokeByAccessTokenParams{ctx, accessToken}
|
||||
mmRevokeByAccessToken.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
|
||||
for _, e := range mmRevokeByAccessToken.expectations {
|
||||
if minimock.Equal(e.params, mmRevokeByAccessToken.defaultExpectation.params) {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmRevokeByAccessToken.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
|
||||
return mmRevokeByAccessToken
|
||||
}
|
||||
|
||||
// ExpectCtxParam1 sets up expected param ctx for SessionRepository.RevokeByAccessToken
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) ExpectCtxParam1(ctx context.Context) *mSessionRepositoryMockRevokeByAccessToken {
|
||||
if mmRevokeByAccessToken.mock.funcRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation == nil {
|
||||
mmRevokeByAccessToken.defaultExpectation = &SessionRepositoryMockRevokeByAccessTokenExpectation{}
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation.params != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation.paramPtrs == nil {
|
||||
mmRevokeByAccessToken.defaultExpectation.paramPtrs = &SessionRepositoryMockRevokeByAccessTokenParamPtrs{}
|
||||
}
|
||||
mmRevokeByAccessToken.defaultExpectation.paramPtrs.ctx = &ctx
|
||||
mmRevokeByAccessToken.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
|
||||
|
||||
return mmRevokeByAccessToken
|
||||
}
|
||||
|
||||
// ExpectAccessTokenParam2 sets up expected param accessToken for SessionRepository.RevokeByAccessToken
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) ExpectAccessTokenParam2(accessToken string) *mSessionRepositoryMockRevokeByAccessToken {
|
||||
if mmRevokeByAccessToken.mock.funcRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation == nil {
|
||||
mmRevokeByAccessToken.defaultExpectation = &SessionRepositoryMockRevokeByAccessTokenExpectation{}
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation.params != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation.paramPtrs == nil {
|
||||
mmRevokeByAccessToken.defaultExpectation.paramPtrs = &SessionRepositoryMockRevokeByAccessTokenParamPtrs{}
|
||||
}
|
||||
mmRevokeByAccessToken.defaultExpectation.paramPtrs.accessToken = &accessToken
|
||||
mmRevokeByAccessToken.defaultExpectation.expectationOrigins.originAccessToken = minimock.CallerInfo(1)
|
||||
|
||||
return mmRevokeByAccessToken
|
||||
}
|
||||
|
||||
// Inspect accepts an inspector function that has same arguments as the SessionRepository.RevokeByAccessToken
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Inspect(f func(ctx context.Context, accessToken string)) *mSessionRepositoryMockRevokeByAccessToken {
|
||||
if mmRevokeByAccessToken.mock.inspectFuncRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("Inspect function is already set for SessionRepositoryMock.RevokeByAccessToken")
|
||||
}
|
||||
|
||||
mmRevokeByAccessToken.mock.inspectFuncRevokeByAccessToken = f
|
||||
|
||||
return mmRevokeByAccessToken
|
||||
}
|
||||
|
||||
// Return sets up results that will be returned by SessionRepository.RevokeByAccessToken
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Return(err error) *SessionRepositoryMock {
|
||||
if mmRevokeByAccessToken.mock.funcRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.defaultExpectation == nil {
|
||||
mmRevokeByAccessToken.defaultExpectation = &SessionRepositoryMockRevokeByAccessTokenExpectation{mock: mmRevokeByAccessToken.mock}
|
||||
}
|
||||
mmRevokeByAccessToken.defaultExpectation.results = &SessionRepositoryMockRevokeByAccessTokenResults{err}
|
||||
mmRevokeByAccessToken.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
|
||||
return mmRevokeByAccessToken.mock
|
||||
}
|
||||
|
||||
// Set uses given function f to mock the SessionRepository.RevokeByAccessToken method
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Set(f func(ctx context.Context, accessToken string) (err error)) *SessionRepositoryMock {
|
||||
if mmRevokeByAccessToken.defaultExpectation != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("Default expectation is already set for the SessionRepository.RevokeByAccessToken method")
|
||||
}
|
||||
|
||||
if len(mmRevokeByAccessToken.expectations) > 0 {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("Some expectations are already set for the SessionRepository.RevokeByAccessToken method")
|
||||
}
|
||||
|
||||
mmRevokeByAccessToken.mock.funcRevokeByAccessToken = f
|
||||
mmRevokeByAccessToken.mock.funcRevokeByAccessTokenOrigin = minimock.CallerInfo(1)
|
||||
return mmRevokeByAccessToken.mock
|
||||
}
|
||||
|
||||
// When sets expectation for the SessionRepository.RevokeByAccessToken which will trigger the result defined by the following
|
||||
// Then helper
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) When(ctx context.Context, accessToken string) *SessionRepositoryMockRevokeByAccessTokenExpectation {
|
||||
if mmRevokeByAccessToken.mock.funcRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("SessionRepositoryMock.RevokeByAccessToken mock is already set by Set")
|
||||
}
|
||||
|
||||
expectation := &SessionRepositoryMockRevokeByAccessTokenExpectation{
|
||||
mock: mmRevokeByAccessToken.mock,
|
||||
params: &SessionRepositoryMockRevokeByAccessTokenParams{ctx, accessToken},
|
||||
expectationOrigins: SessionRepositoryMockRevokeByAccessTokenExpectationOrigins{origin: minimock.CallerInfo(1)},
|
||||
}
|
||||
mmRevokeByAccessToken.expectations = append(mmRevokeByAccessToken.expectations, expectation)
|
||||
return expectation
|
||||
}
|
||||
|
||||
// Then sets up SessionRepository.RevokeByAccessToken return parameters for the expectation previously defined by the When method
|
||||
func (e *SessionRepositoryMockRevokeByAccessTokenExpectation) Then(err error) *SessionRepositoryMock {
|
||||
e.results = &SessionRepositoryMockRevokeByAccessTokenResults{err}
|
||||
return e.mock
|
||||
}
|
||||
|
||||
// Times sets number of times SessionRepository.RevokeByAccessToken should be invoked
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Times(n uint64) *mSessionRepositoryMockRevokeByAccessToken {
|
||||
if n == 0 {
|
||||
mmRevokeByAccessToken.mock.t.Fatalf("Times of SessionRepositoryMock.RevokeByAccessToken mock can not be zero")
|
||||
}
|
||||
mm_atomic.StoreUint64(&mmRevokeByAccessToken.expectedInvocations, n)
|
||||
mmRevokeByAccessToken.expectedInvocationsOrigin = minimock.CallerInfo(1)
|
||||
return mmRevokeByAccessToken
|
||||
}
|
||||
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) invocationsDone() bool {
|
||||
if len(mmRevokeByAccessToken.expectations) == 0 && mmRevokeByAccessToken.defaultExpectation == nil && mmRevokeByAccessToken.mock.funcRevokeByAccessToken == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
totalInvocations := mm_atomic.LoadUint64(&mmRevokeByAccessToken.mock.afterRevokeByAccessTokenCounter)
|
||||
expectedInvocations := mm_atomic.LoadUint64(&mmRevokeByAccessToken.expectedInvocations)
|
||||
|
||||
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
||||
}
|
||||
|
||||
// RevokeByAccessToken implements mm_repository.SessionRepository
|
||||
func (mmRevokeByAccessToken *SessionRepositoryMock) RevokeByAccessToken(ctx context.Context, accessToken string) (err error) {
|
||||
mm_atomic.AddUint64(&mmRevokeByAccessToken.beforeRevokeByAccessTokenCounter, 1)
|
||||
defer mm_atomic.AddUint64(&mmRevokeByAccessToken.afterRevokeByAccessTokenCounter, 1)
|
||||
|
||||
mmRevokeByAccessToken.t.Helper()
|
||||
|
||||
if mmRevokeByAccessToken.inspectFuncRevokeByAccessToken != nil {
|
||||
mmRevokeByAccessToken.inspectFuncRevokeByAccessToken(ctx, accessToken)
|
||||
}
|
||||
|
||||
mm_params := SessionRepositoryMockRevokeByAccessTokenParams{ctx, accessToken}
|
||||
|
||||
// Record call args
|
||||
mmRevokeByAccessToken.RevokeByAccessTokenMock.mutex.Lock()
|
||||
mmRevokeByAccessToken.RevokeByAccessTokenMock.callArgs = append(mmRevokeByAccessToken.RevokeByAccessTokenMock.callArgs, &mm_params)
|
||||
mmRevokeByAccessToken.RevokeByAccessTokenMock.mutex.Unlock()
|
||||
|
||||
for _, e := range mmRevokeByAccessToken.RevokeByAccessTokenMock.expectations {
|
||||
if minimock.Equal(*e.params, mm_params) {
|
||||
mm_atomic.AddUint64(&e.Counter, 1)
|
||||
return e.results.err
|
||||
}
|
||||
}
|
||||
|
||||
if mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation != nil {
|
||||
mm_atomic.AddUint64(&mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.Counter, 1)
|
||||
mm_want := mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.params
|
||||
mm_want_ptrs := mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.paramPtrs
|
||||
|
||||
mm_got := SessionRepositoryMockRevokeByAccessTokenParams{ctx, accessToken}
|
||||
|
||||
if mm_want_ptrs != nil {
|
||||
|
||||
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
||||
mmRevokeByAccessToken.t.Errorf("SessionRepositoryMock.RevokeByAccessToken got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.accessToken != nil && !minimock.Equal(*mm_want_ptrs.accessToken, mm_got.accessToken) {
|
||||
mmRevokeByAccessToken.t.Errorf("SessionRepositoryMock.RevokeByAccessToken got unexpected parameter accessToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.expectationOrigins.originAccessToken, *mm_want_ptrs.accessToken, mm_got.accessToken, minimock.Diff(*mm_want_ptrs.accessToken, mm_got.accessToken))
|
||||
}
|
||||
|
||||
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
||||
mmRevokeByAccessToken.t.Errorf("SessionRepositoryMock.RevokeByAccessToken got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
||||
}
|
||||
|
||||
mm_results := mmRevokeByAccessToken.RevokeByAccessTokenMock.defaultExpectation.results
|
||||
if mm_results == nil {
|
||||
mmRevokeByAccessToken.t.Fatal("No results are set for the SessionRepositoryMock.RevokeByAccessToken")
|
||||
}
|
||||
return (*mm_results).err
|
||||
}
|
||||
if mmRevokeByAccessToken.funcRevokeByAccessToken != nil {
|
||||
return mmRevokeByAccessToken.funcRevokeByAccessToken(ctx, accessToken)
|
||||
}
|
||||
mmRevokeByAccessToken.t.Fatalf("Unexpected call to SessionRepositoryMock.RevokeByAccessToken. %v %v", ctx, accessToken)
|
||||
return
|
||||
}
|
||||
|
||||
// RevokeByAccessTokenAfterCounter returns a count of finished SessionRepositoryMock.RevokeByAccessToken invocations
|
||||
func (mmRevokeByAccessToken *SessionRepositoryMock) RevokeByAccessTokenAfterCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmRevokeByAccessToken.afterRevokeByAccessTokenCounter)
|
||||
}
|
||||
|
||||
// RevokeByAccessTokenBeforeCounter returns a count of SessionRepositoryMock.RevokeByAccessToken invocations
|
||||
func (mmRevokeByAccessToken *SessionRepositoryMock) RevokeByAccessTokenBeforeCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmRevokeByAccessToken.beforeRevokeByAccessTokenCounter)
|
||||
}
|
||||
|
||||
// Calls returns a list of arguments used in each call to SessionRepositoryMock.RevokeByAccessToken.
|
||||
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
||||
func (mmRevokeByAccessToken *mSessionRepositoryMockRevokeByAccessToken) Calls() []*SessionRepositoryMockRevokeByAccessTokenParams {
|
||||
mmRevokeByAccessToken.mutex.RLock()
|
||||
|
||||
argCopy := make([]*SessionRepositoryMockRevokeByAccessTokenParams, len(mmRevokeByAccessToken.callArgs))
|
||||
copy(argCopy, mmRevokeByAccessToken.callArgs)
|
||||
|
||||
mmRevokeByAccessToken.mutex.RUnlock()
|
||||
|
||||
return argCopy
|
||||
}
|
||||
|
||||
// MinimockRevokeByAccessTokenDone returns true if the count of the RevokeByAccessToken invocations corresponds
|
||||
// the number of defined expectations
|
||||
func (m *SessionRepositoryMock) MinimockRevokeByAccessTokenDone() bool {
|
||||
if m.RevokeByAccessTokenMock.optional {
|
||||
// Optional methods provide '0 or more' call count restriction.
|
||||
return true
|
||||
}
|
||||
|
||||
for _, e := range m.RevokeByAccessTokenMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return m.RevokeByAccessTokenMock.invocationsDone()
|
||||
}
|
||||
|
||||
// MinimockRevokeByAccessTokenInspect logs each unmet expectation
|
||||
func (m *SessionRepositoryMock) MinimockRevokeByAccessTokenInspect() {
|
||||
for _, e := range m.RevokeByAccessTokenMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.RevokeByAccessToken at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
|
||||
}
|
||||
}
|
||||
|
||||
afterRevokeByAccessTokenCounter := mm_atomic.LoadUint64(&m.afterRevokeByAccessTokenCounter)
|
||||
// if default expectation was set then invocations count should be greater than zero
|
||||
if m.RevokeByAccessTokenMock.defaultExpectation != nil && afterRevokeByAccessTokenCounter < 1 {
|
||||
if m.RevokeByAccessTokenMock.defaultExpectation.params == nil {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.RevokeByAccessToken at\n%s", m.RevokeByAccessTokenMock.defaultExpectation.returnOrigin)
|
||||
} else {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.RevokeByAccessToken at\n%s with params: %#v", m.RevokeByAccessTokenMock.defaultExpectation.expectationOrigins.origin, *m.RevokeByAccessTokenMock.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
// if func was set then invocations count should be greater than zero
|
||||
if m.funcRevokeByAccessToken != nil && afterRevokeByAccessTokenCounter < 1 {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.RevokeByAccessToken at\n%s", m.funcRevokeByAccessTokenOrigin)
|
||||
}
|
||||
|
||||
if !m.RevokeByAccessTokenMock.invocationsDone() && afterRevokeByAccessTokenCounter > 0 {
|
||||
m.t.Errorf("Expected %d calls to SessionRepositoryMock.RevokeByAccessToken at\n%s but found %d calls",
|
||||
mm_atomic.LoadUint64(&m.RevokeByAccessTokenMock.expectedInvocations), m.RevokeByAccessTokenMock.expectedInvocationsOrigin, afterRevokeByAccessTokenCounter)
|
||||
}
|
||||
}
|
||||
|
||||
type mSessionRepositoryMockUpdateAccessToken struct {
|
||||
optional bool
|
||||
mock *SessionRepositoryMock
|
||||
@@ -1805,8 +2510,12 @@ func (m *SessionRepositoryMock) MinimockFinish() {
|
||||
|
||||
m.MinimockFindByRefreshTokenInspect()
|
||||
|
||||
m.MinimockIsAccessTokenValidInspect()
|
||||
|
||||
m.MinimockRevokeInspect()
|
||||
|
||||
m.MinimockRevokeByAccessTokenInspect()
|
||||
|
||||
m.MinimockUpdateAccessTokenInspect()
|
||||
}
|
||||
})
|
||||
@@ -1834,6 +2543,8 @@ func (m *SessionRepositoryMock) minimockDone() bool {
|
||||
m.MinimockCreateDone() &&
|
||||
m.MinimockDeleteExpiredDone() &&
|
||||
m.MinimockFindByRefreshTokenDone() &&
|
||||
m.MinimockIsAccessTokenValidDone() &&
|
||||
m.MinimockRevokeDone() &&
|
||||
m.MinimockRevokeByAccessTokenDone() &&
|
||||
m.MinimockUpdateAccessTokenDone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user