add service
All checks were successful
Deploy Smart Search Backend / deploy (push) Successful in 1m47s
All checks were successful
Deploy Smart Search Backend / deploy (push) Successful in 1m47s
This commit is contained in:
@@ -32,7 +32,7 @@ type AuthServiceMock struct {
|
||||
beforeLogoutCounter uint64
|
||||
LogoutMock mAuthServiceMockLogout
|
||||
|
||||
funcRefresh func(ctx context.Context, refreshToken string) (s1 string, err error)
|
||||
funcRefresh func(ctx context.Context, refreshToken string) (newAccessToken string, newRefreshToken string, err error)
|
||||
funcRefreshOrigin string
|
||||
inspectFuncRefresh func(ctx context.Context, refreshToken string)
|
||||
afterRefreshCounter uint64
|
||||
@@ -899,8 +899,9 @@ type AuthServiceMockRefreshParamPtrs struct {
|
||||
|
||||
// AuthServiceMockRefreshResults contains results of the AuthService.Refresh
|
||||
type AuthServiceMockRefreshResults struct {
|
||||
s1 string
|
||||
err error
|
||||
newAccessToken string
|
||||
newRefreshToken string
|
||||
err error
|
||||
}
|
||||
|
||||
// AuthServiceMockRefreshOrigins contains origins of expectations of the AuthService.Refresh
|
||||
@@ -1003,7 +1004,7 @@ func (mmRefresh *mAuthServiceMockRefresh) Inspect(f func(ctx context.Context, re
|
||||
}
|
||||
|
||||
// Return sets up results that will be returned by AuthService.Refresh
|
||||
func (mmRefresh *mAuthServiceMockRefresh) Return(s1 string, err error) *AuthServiceMock {
|
||||
func (mmRefresh *mAuthServiceMockRefresh) Return(newAccessToken string, newRefreshToken string, err error) *AuthServiceMock {
|
||||
if mmRefresh.mock.funcRefresh != nil {
|
||||
mmRefresh.mock.t.Fatalf("AuthServiceMock.Refresh mock is already set by Set")
|
||||
}
|
||||
@@ -1011,13 +1012,13 @@ func (mmRefresh *mAuthServiceMockRefresh) Return(s1 string, err error) *AuthServ
|
||||
if mmRefresh.defaultExpectation == nil {
|
||||
mmRefresh.defaultExpectation = &AuthServiceMockRefreshExpectation{mock: mmRefresh.mock}
|
||||
}
|
||||
mmRefresh.defaultExpectation.results = &AuthServiceMockRefreshResults{s1, err}
|
||||
mmRefresh.defaultExpectation.results = &AuthServiceMockRefreshResults{newAccessToken, newRefreshToken, err}
|
||||
mmRefresh.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
|
||||
return mmRefresh.mock
|
||||
}
|
||||
|
||||
// Set uses given function f to mock the AuthService.Refresh method
|
||||
func (mmRefresh *mAuthServiceMockRefresh) Set(f func(ctx context.Context, refreshToken string) (s1 string, err error)) *AuthServiceMock {
|
||||
func (mmRefresh *mAuthServiceMockRefresh) Set(f func(ctx context.Context, refreshToken string) (newAccessToken string, newRefreshToken string, err error)) *AuthServiceMock {
|
||||
if mmRefresh.defaultExpectation != nil {
|
||||
mmRefresh.mock.t.Fatalf("Default expectation is already set for the AuthService.Refresh method")
|
||||
}
|
||||
@@ -1048,8 +1049,8 @@ func (mmRefresh *mAuthServiceMockRefresh) When(ctx context.Context, refreshToken
|
||||
}
|
||||
|
||||
// Then sets up AuthService.Refresh return parameters for the expectation previously defined by the When method
|
||||
func (e *AuthServiceMockRefreshExpectation) Then(s1 string, err error) *AuthServiceMock {
|
||||
e.results = &AuthServiceMockRefreshResults{s1, err}
|
||||
func (e *AuthServiceMockRefreshExpectation) Then(newAccessToken string, newRefreshToken string, err error) *AuthServiceMock {
|
||||
e.results = &AuthServiceMockRefreshResults{newAccessToken, newRefreshToken, err}
|
||||
return e.mock
|
||||
}
|
||||
|
||||
@@ -1075,7 +1076,7 @@ func (mmRefresh *mAuthServiceMockRefresh) invocationsDone() bool {
|
||||
}
|
||||
|
||||
// Refresh implements mm_service.AuthService
|
||||
func (mmRefresh *AuthServiceMock) Refresh(ctx context.Context, refreshToken string) (s1 string, err error) {
|
||||
func (mmRefresh *AuthServiceMock) Refresh(ctx context.Context, refreshToken string) (newAccessToken string, newRefreshToken string, err error) {
|
||||
mm_atomic.AddUint64(&mmRefresh.beforeRefreshCounter, 1)
|
||||
defer mm_atomic.AddUint64(&mmRefresh.afterRefreshCounter, 1)
|
||||
|
||||
@@ -1095,7 +1096,7 @@ func (mmRefresh *AuthServiceMock) Refresh(ctx context.Context, refreshToken stri
|
||||
for _, e := range mmRefresh.RefreshMock.expectations {
|
||||
if minimock.Equal(*e.params, mm_params) {
|
||||
mm_atomic.AddUint64(&e.Counter, 1)
|
||||
return e.results.s1, e.results.err
|
||||
return e.results.newAccessToken, e.results.newRefreshToken, e.results.err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1127,7 +1128,7 @@ func (mmRefresh *AuthServiceMock) Refresh(ctx context.Context, refreshToken stri
|
||||
if mm_results == nil {
|
||||
mmRefresh.t.Fatal("No results are set for the AuthServiceMock.Refresh")
|
||||
}
|
||||
return (*mm_results).s1, (*mm_results).err
|
||||
return (*mm_results).newAccessToken, (*mm_results).newRefreshToken, (*mm_results).err
|
||||
}
|
||||
if mmRefresh.funcRefresh != nil {
|
||||
return mmRefresh.funcRefresh(ctx, refreshToken)
|
||||
|
||||
@@ -67,6 +67,13 @@ type SessionRepositoryMock struct {
|
||||
afterUpdateAccessTokenCounter uint64
|
||||
beforeUpdateAccessTokenCounter uint64
|
||||
UpdateAccessTokenMock mSessionRepositoryMockUpdateAccessToken
|
||||
|
||||
funcUpdateTokens func(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string) (err error)
|
||||
funcUpdateTokensOrigin string
|
||||
inspectFuncUpdateTokens func(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string)
|
||||
afterUpdateTokensCounter uint64
|
||||
beforeUpdateTokensCounter uint64
|
||||
UpdateTokensMock mSessionRepositoryMockUpdateTokens
|
||||
}
|
||||
|
||||
// NewSessionRepositoryMock returns a mock for mm_repository.SessionRepository
|
||||
@@ -98,6 +105,9 @@ func NewSessionRepositoryMock(t minimock.Tester) *SessionRepositoryMock {
|
||||
m.UpdateAccessTokenMock = mSessionRepositoryMockUpdateAccessToken{mock: m}
|
||||
m.UpdateAccessTokenMock.callArgs = []*SessionRepositoryMockUpdateAccessTokenParams{}
|
||||
|
||||
m.UpdateTokensMock = mSessionRepositoryMockUpdateTokens{mock: m}
|
||||
m.UpdateTokensMock.callArgs = []*SessionRepositoryMockUpdateTokensParams{}
|
||||
|
||||
t.Cleanup(m.MinimockFinish)
|
||||
|
||||
return m
|
||||
@@ -2500,6 +2510,410 @@ func (m *SessionRepositoryMock) MinimockUpdateAccessTokenInspect() {
|
||||
}
|
||||
}
|
||||
|
||||
type mSessionRepositoryMockUpdateTokens struct {
|
||||
optional bool
|
||||
mock *SessionRepositoryMock
|
||||
defaultExpectation *SessionRepositoryMockUpdateTokensExpectation
|
||||
expectations []*SessionRepositoryMockUpdateTokensExpectation
|
||||
|
||||
callArgs []*SessionRepositoryMockUpdateTokensParams
|
||||
mutex sync.RWMutex
|
||||
|
||||
expectedInvocations uint64
|
||||
expectedInvocationsOrigin string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockUpdateTokensExpectation specifies expectation struct of the SessionRepository.UpdateTokens
|
||||
type SessionRepositoryMockUpdateTokensExpectation struct {
|
||||
mock *SessionRepositoryMock
|
||||
params *SessionRepositoryMockUpdateTokensParams
|
||||
paramPtrs *SessionRepositoryMockUpdateTokensParamPtrs
|
||||
expectationOrigins SessionRepositoryMockUpdateTokensExpectationOrigins
|
||||
results *SessionRepositoryMockUpdateTokensResults
|
||||
returnOrigin string
|
||||
Counter uint64
|
||||
}
|
||||
|
||||
// SessionRepositoryMockUpdateTokensParams contains parameters of the SessionRepository.UpdateTokens
|
||||
type SessionRepositoryMockUpdateTokensParams struct {
|
||||
ctx context.Context
|
||||
oldRefreshToken string
|
||||
newAccessToken string
|
||||
newRefreshToken string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockUpdateTokensParamPtrs contains pointers to parameters of the SessionRepository.UpdateTokens
|
||||
type SessionRepositoryMockUpdateTokensParamPtrs struct {
|
||||
ctx *context.Context
|
||||
oldRefreshToken *string
|
||||
newAccessToken *string
|
||||
newRefreshToken *string
|
||||
}
|
||||
|
||||
// SessionRepositoryMockUpdateTokensResults contains results of the SessionRepository.UpdateTokens
|
||||
type SessionRepositoryMockUpdateTokensResults struct {
|
||||
err error
|
||||
}
|
||||
|
||||
// SessionRepositoryMockUpdateTokensOrigins contains origins of expectations of the SessionRepository.UpdateTokens
|
||||
type SessionRepositoryMockUpdateTokensExpectationOrigins struct {
|
||||
origin string
|
||||
originCtx string
|
||||
originOldRefreshToken string
|
||||
originNewAccessToken string
|
||||
originNewRefreshToken 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 (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Optional() *mSessionRepositoryMockUpdateTokens {
|
||||
mmUpdateTokens.optional = true
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// Expect sets up expected params for SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Expect(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string) *mSessionRepositoryMockUpdateTokens {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation == nil {
|
||||
mmUpdateTokens.defaultExpectation = &SessionRepositoryMockUpdateTokensExpectation{}
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.paramPtrs != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by ExpectParams functions")
|
||||
}
|
||||
|
||||
mmUpdateTokens.defaultExpectation.params = &SessionRepositoryMockUpdateTokensParams{ctx, oldRefreshToken, newAccessToken, newRefreshToken}
|
||||
mmUpdateTokens.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
|
||||
for _, e := range mmUpdateTokens.expectations {
|
||||
if minimock.Equal(e.params, mmUpdateTokens.defaultExpectation.params) {
|
||||
mmUpdateTokens.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmUpdateTokens.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// ExpectCtxParam1 sets up expected param ctx for SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) ExpectCtxParam1(ctx context.Context) *mSessionRepositoryMockUpdateTokens {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation == nil {
|
||||
mmUpdateTokens.defaultExpectation = &SessionRepositoryMockUpdateTokensExpectation{}
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.params != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.paramPtrs == nil {
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs = &SessionRepositoryMockUpdateTokensParamPtrs{}
|
||||
}
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs.ctx = &ctx
|
||||
mmUpdateTokens.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
|
||||
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// ExpectOldRefreshTokenParam2 sets up expected param oldRefreshToken for SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) ExpectOldRefreshTokenParam2(oldRefreshToken string) *mSessionRepositoryMockUpdateTokens {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation == nil {
|
||||
mmUpdateTokens.defaultExpectation = &SessionRepositoryMockUpdateTokensExpectation{}
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.params != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.paramPtrs == nil {
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs = &SessionRepositoryMockUpdateTokensParamPtrs{}
|
||||
}
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs.oldRefreshToken = &oldRefreshToken
|
||||
mmUpdateTokens.defaultExpectation.expectationOrigins.originOldRefreshToken = minimock.CallerInfo(1)
|
||||
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// ExpectNewAccessTokenParam3 sets up expected param newAccessToken for SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) ExpectNewAccessTokenParam3(newAccessToken string) *mSessionRepositoryMockUpdateTokens {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation == nil {
|
||||
mmUpdateTokens.defaultExpectation = &SessionRepositoryMockUpdateTokensExpectation{}
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.params != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.paramPtrs == nil {
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs = &SessionRepositoryMockUpdateTokensParamPtrs{}
|
||||
}
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs.newAccessToken = &newAccessToken
|
||||
mmUpdateTokens.defaultExpectation.expectationOrigins.originNewAccessToken = minimock.CallerInfo(1)
|
||||
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// ExpectNewRefreshTokenParam4 sets up expected param newRefreshToken for SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) ExpectNewRefreshTokenParam4(newRefreshToken string) *mSessionRepositoryMockUpdateTokens {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation == nil {
|
||||
mmUpdateTokens.defaultExpectation = &SessionRepositoryMockUpdateTokensExpectation{}
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.params != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation.paramPtrs == nil {
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs = &SessionRepositoryMockUpdateTokensParamPtrs{}
|
||||
}
|
||||
mmUpdateTokens.defaultExpectation.paramPtrs.newRefreshToken = &newRefreshToken
|
||||
mmUpdateTokens.defaultExpectation.expectationOrigins.originNewRefreshToken = minimock.CallerInfo(1)
|
||||
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// Inspect accepts an inspector function that has same arguments as the SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Inspect(f func(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string)) *mSessionRepositoryMockUpdateTokens {
|
||||
if mmUpdateTokens.mock.inspectFuncUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("Inspect function is already set for SessionRepositoryMock.UpdateTokens")
|
||||
}
|
||||
|
||||
mmUpdateTokens.mock.inspectFuncUpdateTokens = f
|
||||
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
// Return sets up results that will be returned by SessionRepository.UpdateTokens
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Return(err error) *SessionRepositoryMock {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmUpdateTokens.defaultExpectation == nil {
|
||||
mmUpdateTokens.defaultExpectation = &SessionRepositoryMockUpdateTokensExpectation{mock: mmUpdateTokens.mock}
|
||||
}
|
||||
mmUpdateTokens.defaultExpectation.results = &SessionRepositoryMockUpdateTokensResults{err}
|
||||
mmUpdateTokens.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
|
||||
return mmUpdateTokens.mock
|
||||
}
|
||||
|
||||
// Set uses given function f to mock the SessionRepository.UpdateTokens method
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Set(f func(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string) (err error)) *SessionRepositoryMock {
|
||||
if mmUpdateTokens.defaultExpectation != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("Default expectation is already set for the SessionRepository.UpdateTokens method")
|
||||
}
|
||||
|
||||
if len(mmUpdateTokens.expectations) > 0 {
|
||||
mmUpdateTokens.mock.t.Fatalf("Some expectations are already set for the SessionRepository.UpdateTokens method")
|
||||
}
|
||||
|
||||
mmUpdateTokens.mock.funcUpdateTokens = f
|
||||
mmUpdateTokens.mock.funcUpdateTokensOrigin = minimock.CallerInfo(1)
|
||||
return mmUpdateTokens.mock
|
||||
}
|
||||
|
||||
// When sets expectation for the SessionRepository.UpdateTokens which will trigger the result defined by the following
|
||||
// Then helper
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) When(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string) *SessionRepositoryMockUpdateTokensExpectation {
|
||||
if mmUpdateTokens.mock.funcUpdateTokens != nil {
|
||||
mmUpdateTokens.mock.t.Fatalf("SessionRepositoryMock.UpdateTokens mock is already set by Set")
|
||||
}
|
||||
|
||||
expectation := &SessionRepositoryMockUpdateTokensExpectation{
|
||||
mock: mmUpdateTokens.mock,
|
||||
params: &SessionRepositoryMockUpdateTokensParams{ctx, oldRefreshToken, newAccessToken, newRefreshToken},
|
||||
expectationOrigins: SessionRepositoryMockUpdateTokensExpectationOrigins{origin: minimock.CallerInfo(1)},
|
||||
}
|
||||
mmUpdateTokens.expectations = append(mmUpdateTokens.expectations, expectation)
|
||||
return expectation
|
||||
}
|
||||
|
||||
// Then sets up SessionRepository.UpdateTokens return parameters for the expectation previously defined by the When method
|
||||
func (e *SessionRepositoryMockUpdateTokensExpectation) Then(err error) *SessionRepositoryMock {
|
||||
e.results = &SessionRepositoryMockUpdateTokensResults{err}
|
||||
return e.mock
|
||||
}
|
||||
|
||||
// Times sets number of times SessionRepository.UpdateTokens should be invoked
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Times(n uint64) *mSessionRepositoryMockUpdateTokens {
|
||||
if n == 0 {
|
||||
mmUpdateTokens.mock.t.Fatalf("Times of SessionRepositoryMock.UpdateTokens mock can not be zero")
|
||||
}
|
||||
mm_atomic.StoreUint64(&mmUpdateTokens.expectedInvocations, n)
|
||||
mmUpdateTokens.expectedInvocationsOrigin = minimock.CallerInfo(1)
|
||||
return mmUpdateTokens
|
||||
}
|
||||
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) invocationsDone() bool {
|
||||
if len(mmUpdateTokens.expectations) == 0 && mmUpdateTokens.defaultExpectation == nil && mmUpdateTokens.mock.funcUpdateTokens == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
totalInvocations := mm_atomic.LoadUint64(&mmUpdateTokens.mock.afterUpdateTokensCounter)
|
||||
expectedInvocations := mm_atomic.LoadUint64(&mmUpdateTokens.expectedInvocations)
|
||||
|
||||
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
||||
}
|
||||
|
||||
// UpdateTokens implements mm_repository.SessionRepository
|
||||
func (mmUpdateTokens *SessionRepositoryMock) UpdateTokens(ctx context.Context, oldRefreshToken string, newAccessToken string, newRefreshToken string) (err error) {
|
||||
mm_atomic.AddUint64(&mmUpdateTokens.beforeUpdateTokensCounter, 1)
|
||||
defer mm_atomic.AddUint64(&mmUpdateTokens.afterUpdateTokensCounter, 1)
|
||||
|
||||
mmUpdateTokens.t.Helper()
|
||||
|
||||
if mmUpdateTokens.inspectFuncUpdateTokens != nil {
|
||||
mmUpdateTokens.inspectFuncUpdateTokens(ctx, oldRefreshToken, newAccessToken, newRefreshToken)
|
||||
}
|
||||
|
||||
mm_params := SessionRepositoryMockUpdateTokensParams{ctx, oldRefreshToken, newAccessToken, newRefreshToken}
|
||||
|
||||
// Record call args
|
||||
mmUpdateTokens.UpdateTokensMock.mutex.Lock()
|
||||
mmUpdateTokens.UpdateTokensMock.callArgs = append(mmUpdateTokens.UpdateTokensMock.callArgs, &mm_params)
|
||||
mmUpdateTokens.UpdateTokensMock.mutex.Unlock()
|
||||
|
||||
for _, e := range mmUpdateTokens.UpdateTokensMock.expectations {
|
||||
if minimock.Equal(*e.params, mm_params) {
|
||||
mm_atomic.AddUint64(&e.Counter, 1)
|
||||
return e.results.err
|
||||
}
|
||||
}
|
||||
|
||||
if mmUpdateTokens.UpdateTokensMock.defaultExpectation != nil {
|
||||
mm_atomic.AddUint64(&mmUpdateTokens.UpdateTokensMock.defaultExpectation.Counter, 1)
|
||||
mm_want := mmUpdateTokens.UpdateTokensMock.defaultExpectation.params
|
||||
mm_want_ptrs := mmUpdateTokens.UpdateTokensMock.defaultExpectation.paramPtrs
|
||||
|
||||
mm_got := SessionRepositoryMockUpdateTokensParams{ctx, oldRefreshToken, newAccessToken, newRefreshToken}
|
||||
|
||||
if mm_want_ptrs != nil {
|
||||
|
||||
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
||||
mmUpdateTokens.t.Errorf("SessionRepositoryMock.UpdateTokens got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmUpdateTokens.UpdateTokensMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.oldRefreshToken != nil && !minimock.Equal(*mm_want_ptrs.oldRefreshToken, mm_got.oldRefreshToken) {
|
||||
mmUpdateTokens.t.Errorf("SessionRepositoryMock.UpdateTokens got unexpected parameter oldRefreshToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmUpdateTokens.UpdateTokensMock.defaultExpectation.expectationOrigins.originOldRefreshToken, *mm_want_ptrs.oldRefreshToken, mm_got.oldRefreshToken, minimock.Diff(*mm_want_ptrs.oldRefreshToken, mm_got.oldRefreshToken))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.newAccessToken != nil && !minimock.Equal(*mm_want_ptrs.newAccessToken, mm_got.newAccessToken) {
|
||||
mmUpdateTokens.t.Errorf("SessionRepositoryMock.UpdateTokens got unexpected parameter newAccessToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmUpdateTokens.UpdateTokensMock.defaultExpectation.expectationOrigins.originNewAccessToken, *mm_want_ptrs.newAccessToken, mm_got.newAccessToken, minimock.Diff(*mm_want_ptrs.newAccessToken, mm_got.newAccessToken))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.newRefreshToken != nil && !minimock.Equal(*mm_want_ptrs.newRefreshToken, mm_got.newRefreshToken) {
|
||||
mmUpdateTokens.t.Errorf("SessionRepositoryMock.UpdateTokens got unexpected parameter newRefreshToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmUpdateTokens.UpdateTokensMock.defaultExpectation.expectationOrigins.originNewRefreshToken, *mm_want_ptrs.newRefreshToken, mm_got.newRefreshToken, minimock.Diff(*mm_want_ptrs.newRefreshToken, mm_got.newRefreshToken))
|
||||
}
|
||||
|
||||
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
||||
mmUpdateTokens.t.Errorf("SessionRepositoryMock.UpdateTokens got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmUpdateTokens.UpdateTokensMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
||||
}
|
||||
|
||||
mm_results := mmUpdateTokens.UpdateTokensMock.defaultExpectation.results
|
||||
if mm_results == nil {
|
||||
mmUpdateTokens.t.Fatal("No results are set for the SessionRepositoryMock.UpdateTokens")
|
||||
}
|
||||
return (*mm_results).err
|
||||
}
|
||||
if mmUpdateTokens.funcUpdateTokens != nil {
|
||||
return mmUpdateTokens.funcUpdateTokens(ctx, oldRefreshToken, newAccessToken, newRefreshToken)
|
||||
}
|
||||
mmUpdateTokens.t.Fatalf("Unexpected call to SessionRepositoryMock.UpdateTokens. %v %v %v %v", ctx, oldRefreshToken, newAccessToken, newRefreshToken)
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateTokensAfterCounter returns a count of finished SessionRepositoryMock.UpdateTokens invocations
|
||||
func (mmUpdateTokens *SessionRepositoryMock) UpdateTokensAfterCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmUpdateTokens.afterUpdateTokensCounter)
|
||||
}
|
||||
|
||||
// UpdateTokensBeforeCounter returns a count of SessionRepositoryMock.UpdateTokens invocations
|
||||
func (mmUpdateTokens *SessionRepositoryMock) UpdateTokensBeforeCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmUpdateTokens.beforeUpdateTokensCounter)
|
||||
}
|
||||
|
||||
// Calls returns a list of arguments used in each call to SessionRepositoryMock.UpdateTokens.
|
||||
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
||||
func (mmUpdateTokens *mSessionRepositoryMockUpdateTokens) Calls() []*SessionRepositoryMockUpdateTokensParams {
|
||||
mmUpdateTokens.mutex.RLock()
|
||||
|
||||
argCopy := make([]*SessionRepositoryMockUpdateTokensParams, len(mmUpdateTokens.callArgs))
|
||||
copy(argCopy, mmUpdateTokens.callArgs)
|
||||
|
||||
mmUpdateTokens.mutex.RUnlock()
|
||||
|
||||
return argCopy
|
||||
}
|
||||
|
||||
// MinimockUpdateTokensDone returns true if the count of the UpdateTokens invocations corresponds
|
||||
// the number of defined expectations
|
||||
func (m *SessionRepositoryMock) MinimockUpdateTokensDone() bool {
|
||||
if m.UpdateTokensMock.optional {
|
||||
// Optional methods provide '0 or more' call count restriction.
|
||||
return true
|
||||
}
|
||||
|
||||
for _, e := range m.UpdateTokensMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return m.UpdateTokensMock.invocationsDone()
|
||||
}
|
||||
|
||||
// MinimockUpdateTokensInspect logs each unmet expectation
|
||||
func (m *SessionRepositoryMock) MinimockUpdateTokensInspect() {
|
||||
for _, e := range m.UpdateTokensMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.UpdateTokens at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
|
||||
}
|
||||
}
|
||||
|
||||
afterUpdateTokensCounter := mm_atomic.LoadUint64(&m.afterUpdateTokensCounter)
|
||||
// if default expectation was set then invocations count should be greater than zero
|
||||
if m.UpdateTokensMock.defaultExpectation != nil && afterUpdateTokensCounter < 1 {
|
||||
if m.UpdateTokensMock.defaultExpectation.params == nil {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.UpdateTokens at\n%s", m.UpdateTokensMock.defaultExpectation.returnOrigin)
|
||||
} else {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.UpdateTokens at\n%s with params: %#v", m.UpdateTokensMock.defaultExpectation.expectationOrigins.origin, *m.UpdateTokensMock.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
// if func was set then invocations count should be greater than zero
|
||||
if m.funcUpdateTokens != nil && afterUpdateTokensCounter < 1 {
|
||||
m.t.Errorf("Expected call to SessionRepositoryMock.UpdateTokens at\n%s", m.funcUpdateTokensOrigin)
|
||||
}
|
||||
|
||||
if !m.UpdateTokensMock.invocationsDone() && afterUpdateTokensCounter > 0 {
|
||||
m.t.Errorf("Expected %d calls to SessionRepositoryMock.UpdateTokens at\n%s but found %d calls",
|
||||
mm_atomic.LoadUint64(&m.UpdateTokensMock.expectedInvocations), m.UpdateTokensMock.expectedInvocationsOrigin, afterUpdateTokensCounter)
|
||||
}
|
||||
}
|
||||
|
||||
// MinimockFinish checks that all mocked methods have been called the expected number of times
|
||||
func (m *SessionRepositoryMock) MinimockFinish() {
|
||||
m.finishOnce.Do(func() {
|
||||
@@ -2517,6 +2931,8 @@ func (m *SessionRepositoryMock) MinimockFinish() {
|
||||
m.MinimockRevokeByAccessTokenInspect()
|
||||
|
||||
m.MinimockUpdateAccessTokenInspect()
|
||||
|
||||
m.MinimockUpdateTokensInspect()
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -2546,5 +2962,6 @@ func (m *SessionRepositoryMock) minimockDone() bool {
|
||||
m.MinimockIsAccessTokenValidDone() &&
|
||||
m.MinimockRevokeDone() &&
|
||||
m.MinimockRevokeByAccessTokenDone() &&
|
||||
m.MinimockUpdateAccessTokenDone()
|
||||
m.MinimockUpdateAccessTokenDone() &&
|
||||
m.MinimockUpdateTokensDone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user