This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
package mocks
|
||||
|
||||
//go:generate minimock -i smart-search-back/internal/service.AuthService -o auth_service_mock.go -n AuthServiceMock -p mocks
|
||||
//go:generate minimock -i git.techease.ru/Smart-search/smart-search-back/internal/service.AuthService -o auth_service_mock.go -n AuthServiceMock -p mocks
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -25,9 +25,9 @@ type AuthServiceMock struct {
|
||||
beforeLoginCounter uint64
|
||||
LoginMock mAuthServiceMockLogin
|
||||
|
||||
funcLogout func(ctx context.Context, refreshToken string) (err error)
|
||||
funcLogout func(ctx context.Context, accessToken string) (err error)
|
||||
funcLogoutOrigin string
|
||||
inspectFuncLogout func(ctx context.Context, refreshToken string)
|
||||
inspectFuncLogout func(ctx context.Context, accessToken string)
|
||||
afterLogoutCounter uint64
|
||||
beforeLogoutCounter uint64
|
||||
LogoutMock mAuthServiceMockLogout
|
||||
@@ -535,14 +535,14 @@ type AuthServiceMockLogoutExpectation struct {
|
||||
|
||||
// AuthServiceMockLogoutParams contains parameters of the AuthService.Logout
|
||||
type AuthServiceMockLogoutParams struct {
|
||||
ctx context.Context
|
||||
refreshToken string
|
||||
ctx context.Context
|
||||
accessToken string
|
||||
}
|
||||
|
||||
// AuthServiceMockLogoutParamPtrs contains pointers to parameters of the AuthService.Logout
|
||||
type AuthServiceMockLogoutParamPtrs struct {
|
||||
ctx *context.Context
|
||||
refreshToken *string
|
||||
ctx *context.Context
|
||||
accessToken *string
|
||||
}
|
||||
|
||||
// AuthServiceMockLogoutResults contains results of the AuthService.Logout
|
||||
@@ -552,9 +552,9 @@ type AuthServiceMockLogoutResults struct {
|
||||
|
||||
// AuthServiceMockLogoutOrigins contains origins of expectations of the AuthService.Logout
|
||||
type AuthServiceMockLogoutExpectationOrigins struct {
|
||||
origin string
|
||||
originCtx string
|
||||
originRefreshToken string
|
||||
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
|
||||
@@ -568,7 +568,7 @@ func (mmLogout *mAuthServiceMockLogout) Optional() *mAuthServiceMockLogout {
|
||||
}
|
||||
|
||||
// Expect sets up expected params for AuthService.Logout
|
||||
func (mmLogout *mAuthServiceMockLogout) Expect(ctx context.Context, refreshToken string) *mAuthServiceMockLogout {
|
||||
func (mmLogout *mAuthServiceMockLogout) Expect(ctx context.Context, accessToken string) *mAuthServiceMockLogout {
|
||||
if mmLogout.mock.funcLogout != nil {
|
||||
mmLogout.mock.t.Fatalf("AuthServiceMock.Logout mock is already set by Set")
|
||||
}
|
||||
@@ -581,7 +581,7 @@ func (mmLogout *mAuthServiceMockLogout) Expect(ctx context.Context, refreshToken
|
||||
mmLogout.mock.t.Fatalf("AuthServiceMock.Logout mock is already set by ExpectParams functions")
|
||||
}
|
||||
|
||||
mmLogout.defaultExpectation.params = &AuthServiceMockLogoutParams{ctx, refreshToken}
|
||||
mmLogout.defaultExpectation.params = &AuthServiceMockLogoutParams{ctx, accessToken}
|
||||
mmLogout.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
|
||||
for _, e := range mmLogout.expectations {
|
||||
if minimock.Equal(e.params, mmLogout.defaultExpectation.params) {
|
||||
@@ -615,8 +615,8 @@ func (mmLogout *mAuthServiceMockLogout) ExpectCtxParam1(ctx context.Context) *mA
|
||||
return mmLogout
|
||||
}
|
||||
|
||||
// ExpectRefreshTokenParam2 sets up expected param refreshToken for AuthService.Logout
|
||||
func (mmLogout *mAuthServiceMockLogout) ExpectRefreshTokenParam2(refreshToken string) *mAuthServiceMockLogout {
|
||||
// ExpectAccessTokenParam2 sets up expected param accessToken for AuthService.Logout
|
||||
func (mmLogout *mAuthServiceMockLogout) ExpectAccessTokenParam2(accessToken string) *mAuthServiceMockLogout {
|
||||
if mmLogout.mock.funcLogout != nil {
|
||||
mmLogout.mock.t.Fatalf("AuthServiceMock.Logout mock is already set by Set")
|
||||
}
|
||||
@@ -632,14 +632,14 @@ func (mmLogout *mAuthServiceMockLogout) ExpectRefreshTokenParam2(refreshToken st
|
||||
if mmLogout.defaultExpectation.paramPtrs == nil {
|
||||
mmLogout.defaultExpectation.paramPtrs = &AuthServiceMockLogoutParamPtrs{}
|
||||
}
|
||||
mmLogout.defaultExpectation.paramPtrs.refreshToken = &refreshToken
|
||||
mmLogout.defaultExpectation.expectationOrigins.originRefreshToken = minimock.CallerInfo(1)
|
||||
mmLogout.defaultExpectation.paramPtrs.accessToken = &accessToken
|
||||
mmLogout.defaultExpectation.expectationOrigins.originAccessToken = minimock.CallerInfo(1)
|
||||
|
||||
return mmLogout
|
||||
}
|
||||
|
||||
// Inspect accepts an inspector function that has same arguments as the AuthService.Logout
|
||||
func (mmLogout *mAuthServiceMockLogout) Inspect(f func(ctx context.Context, refreshToken string)) *mAuthServiceMockLogout {
|
||||
func (mmLogout *mAuthServiceMockLogout) Inspect(f func(ctx context.Context, accessToken string)) *mAuthServiceMockLogout {
|
||||
if mmLogout.mock.inspectFuncLogout != nil {
|
||||
mmLogout.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.Logout")
|
||||
}
|
||||
@@ -664,7 +664,7 @@ func (mmLogout *mAuthServiceMockLogout) Return(err error) *AuthServiceMock {
|
||||
}
|
||||
|
||||
// Set uses given function f to mock the AuthService.Logout method
|
||||
func (mmLogout *mAuthServiceMockLogout) Set(f func(ctx context.Context, refreshToken string) (err error)) *AuthServiceMock {
|
||||
func (mmLogout *mAuthServiceMockLogout) Set(f func(ctx context.Context, accessToken string) (err error)) *AuthServiceMock {
|
||||
if mmLogout.defaultExpectation != nil {
|
||||
mmLogout.mock.t.Fatalf("Default expectation is already set for the AuthService.Logout method")
|
||||
}
|
||||
@@ -680,14 +680,14 @@ func (mmLogout *mAuthServiceMockLogout) Set(f func(ctx context.Context, refreshT
|
||||
|
||||
// When sets expectation for the AuthService.Logout which will trigger the result defined by the following
|
||||
// Then helper
|
||||
func (mmLogout *mAuthServiceMockLogout) When(ctx context.Context, refreshToken string) *AuthServiceMockLogoutExpectation {
|
||||
func (mmLogout *mAuthServiceMockLogout) When(ctx context.Context, accessToken string) *AuthServiceMockLogoutExpectation {
|
||||
if mmLogout.mock.funcLogout != nil {
|
||||
mmLogout.mock.t.Fatalf("AuthServiceMock.Logout mock is already set by Set")
|
||||
}
|
||||
|
||||
expectation := &AuthServiceMockLogoutExpectation{
|
||||
mock: mmLogout.mock,
|
||||
params: &AuthServiceMockLogoutParams{ctx, refreshToken},
|
||||
params: &AuthServiceMockLogoutParams{ctx, accessToken},
|
||||
expectationOrigins: AuthServiceMockLogoutExpectationOrigins{origin: minimock.CallerInfo(1)},
|
||||
}
|
||||
mmLogout.expectations = append(mmLogout.expectations, expectation)
|
||||
@@ -722,17 +722,17 @@ func (mmLogout *mAuthServiceMockLogout) invocationsDone() bool {
|
||||
}
|
||||
|
||||
// Logout implements mm_service.AuthService
|
||||
func (mmLogout *AuthServiceMock) Logout(ctx context.Context, refreshToken string) (err error) {
|
||||
func (mmLogout *AuthServiceMock) Logout(ctx context.Context, accessToken string) (err error) {
|
||||
mm_atomic.AddUint64(&mmLogout.beforeLogoutCounter, 1)
|
||||
defer mm_atomic.AddUint64(&mmLogout.afterLogoutCounter, 1)
|
||||
|
||||
mmLogout.t.Helper()
|
||||
|
||||
if mmLogout.inspectFuncLogout != nil {
|
||||
mmLogout.inspectFuncLogout(ctx, refreshToken)
|
||||
mmLogout.inspectFuncLogout(ctx, accessToken)
|
||||
}
|
||||
|
||||
mm_params := AuthServiceMockLogoutParams{ctx, refreshToken}
|
||||
mm_params := AuthServiceMockLogoutParams{ctx, accessToken}
|
||||
|
||||
// Record call args
|
||||
mmLogout.LogoutMock.mutex.Lock()
|
||||
@@ -751,7 +751,7 @@ func (mmLogout *AuthServiceMock) Logout(ctx context.Context, refreshToken string
|
||||
mm_want := mmLogout.LogoutMock.defaultExpectation.params
|
||||
mm_want_ptrs := mmLogout.LogoutMock.defaultExpectation.paramPtrs
|
||||
|
||||
mm_got := AuthServiceMockLogoutParams{ctx, refreshToken}
|
||||
mm_got := AuthServiceMockLogoutParams{ctx, accessToken}
|
||||
|
||||
if mm_want_ptrs != nil {
|
||||
|
||||
@@ -760,9 +760,9 @@ func (mmLogout *AuthServiceMock) Logout(ctx context.Context, refreshToken string
|
||||
mmLogout.LogoutMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.refreshToken != nil && !minimock.Equal(*mm_want_ptrs.refreshToken, mm_got.refreshToken) {
|
||||
mmLogout.t.Errorf("AuthServiceMock.Logout got unexpected parameter refreshToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmLogout.LogoutMock.defaultExpectation.expectationOrigins.originRefreshToken, *mm_want_ptrs.refreshToken, mm_got.refreshToken, minimock.Diff(*mm_want_ptrs.refreshToken, mm_got.refreshToken))
|
||||
if mm_want_ptrs.accessToken != nil && !minimock.Equal(*mm_want_ptrs.accessToken, mm_got.accessToken) {
|
||||
mmLogout.t.Errorf("AuthServiceMock.Logout got unexpected parameter accessToken, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmLogout.LogoutMock.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) {
|
||||
@@ -777,9 +777,9 @@ func (mmLogout *AuthServiceMock) Logout(ctx context.Context, refreshToken string
|
||||
return (*mm_results).err
|
||||
}
|
||||
if mmLogout.funcLogout != nil {
|
||||
return mmLogout.funcLogout(ctx, refreshToken)
|
||||
return mmLogout.funcLogout(ctx, accessToken)
|
||||
}
|
||||
mmLogout.t.Fatalf("Unexpected call to AuthServiceMock.Logout. %v %v", ctx, refreshToken)
|
||||
mmLogout.t.Fatalf("Unexpected call to AuthServiceMock.Logout. %v %v", ctx, accessToken)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user