add service
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m24s
All checks were successful
Deploy Smart Search Backend Test / deploy (push) Successful in 1m24s
This commit is contained in:
@@ -39,6 +39,13 @@ type AuthServiceMock struct {
|
||||
beforeRefreshCounter uint64
|
||||
RefreshMock mAuthServiceMockRefresh
|
||||
|
||||
funcRegister func(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string) (accessToken string, refreshToken string, err error)
|
||||
funcRegisterOrigin string
|
||||
inspectFuncRegister func(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string)
|
||||
afterRegisterCounter uint64
|
||||
beforeRegisterCounter uint64
|
||||
RegisterMock mAuthServiceMockRegister
|
||||
|
||||
funcValidate func(ctx context.Context, accessToken string) (i1 int, err error)
|
||||
funcValidateOrigin string
|
||||
inspectFuncValidate func(ctx context.Context, accessToken string)
|
||||
@@ -64,6 +71,9 @@ func NewAuthServiceMock(t minimock.Tester) *AuthServiceMock {
|
||||
m.RefreshMock = mAuthServiceMockRefresh{mock: m}
|
||||
m.RefreshMock.callArgs = []*AuthServiceMockRefreshParams{}
|
||||
|
||||
m.RegisterMock = mAuthServiceMockRegister{mock: m}
|
||||
m.RegisterMock.callArgs = []*AuthServiceMockRegisterParams{}
|
||||
|
||||
m.ValidateMock = mAuthServiceMockValidate{mock: m}
|
||||
m.ValidateMock.callArgs = []*AuthServiceMockValidateParams{}
|
||||
|
||||
@@ -1194,6 +1204,536 @@ func (m *AuthServiceMock) MinimockRefreshInspect() {
|
||||
}
|
||||
}
|
||||
|
||||
type mAuthServiceMockRegister struct {
|
||||
optional bool
|
||||
mock *AuthServiceMock
|
||||
defaultExpectation *AuthServiceMockRegisterExpectation
|
||||
expectations []*AuthServiceMockRegisterExpectation
|
||||
|
||||
callArgs []*AuthServiceMockRegisterParams
|
||||
mutex sync.RWMutex
|
||||
|
||||
expectedInvocations uint64
|
||||
expectedInvocationsOrigin string
|
||||
}
|
||||
|
||||
// AuthServiceMockRegisterExpectation specifies expectation struct of the AuthService.Register
|
||||
type AuthServiceMockRegisterExpectation struct {
|
||||
mock *AuthServiceMock
|
||||
params *AuthServiceMockRegisterParams
|
||||
paramPtrs *AuthServiceMockRegisterParamPtrs
|
||||
expectationOrigins AuthServiceMockRegisterExpectationOrigins
|
||||
results *AuthServiceMockRegisterResults
|
||||
returnOrigin string
|
||||
Counter uint64
|
||||
}
|
||||
|
||||
// AuthServiceMockRegisterParams contains parameters of the AuthService.Register
|
||||
type AuthServiceMockRegisterParams struct {
|
||||
ctx context.Context
|
||||
email string
|
||||
password string
|
||||
name string
|
||||
phone string
|
||||
inviteCode int64
|
||||
ip string
|
||||
userAgent string
|
||||
}
|
||||
|
||||
// AuthServiceMockRegisterParamPtrs contains pointers to parameters of the AuthService.Register
|
||||
type AuthServiceMockRegisterParamPtrs struct {
|
||||
ctx *context.Context
|
||||
email *string
|
||||
password *string
|
||||
name *string
|
||||
phone *string
|
||||
inviteCode *int64
|
||||
ip *string
|
||||
userAgent *string
|
||||
}
|
||||
|
||||
// AuthServiceMockRegisterResults contains results of the AuthService.Register
|
||||
type AuthServiceMockRegisterResults struct {
|
||||
accessToken string
|
||||
refreshToken string
|
||||
err error
|
||||
}
|
||||
|
||||
// AuthServiceMockRegisterOrigins contains origins of expectations of the AuthService.Register
|
||||
type AuthServiceMockRegisterExpectationOrigins struct {
|
||||
origin string
|
||||
originCtx string
|
||||
originEmail string
|
||||
originPassword string
|
||||
originName string
|
||||
originPhone string
|
||||
originInviteCode string
|
||||
originIp string
|
||||
originUserAgent 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 (mmRegister *mAuthServiceMockRegister) Optional() *mAuthServiceMockRegister {
|
||||
mmRegister.optional = true
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// Expect sets up expected params for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) Expect(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by ExpectParams functions")
|
||||
}
|
||||
|
||||
mmRegister.defaultExpectation.params = &AuthServiceMockRegisterParams{ctx, email, password, name, phone, inviteCode, ip, userAgent}
|
||||
mmRegister.defaultExpectation.expectationOrigins.origin = minimock.CallerInfo(1)
|
||||
for _, e := range mmRegister.expectations {
|
||||
if minimock.Equal(e.params, mmRegister.defaultExpectation.params) {
|
||||
mmRegister.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmRegister.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectCtxParam1 sets up expected param ctx for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectCtxParam1(ctx context.Context) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.ctx = &ctx
|
||||
mmRegister.defaultExpectation.expectationOrigins.originCtx = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectEmailParam2 sets up expected param email for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectEmailParam2(email string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.email = &email
|
||||
mmRegister.defaultExpectation.expectationOrigins.originEmail = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectPasswordParam3 sets up expected param password for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectPasswordParam3(password string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.password = &password
|
||||
mmRegister.defaultExpectation.expectationOrigins.originPassword = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectNameParam4 sets up expected param name for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectNameParam4(name string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.name = &name
|
||||
mmRegister.defaultExpectation.expectationOrigins.originName = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectPhoneParam5 sets up expected param phone for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectPhoneParam5(phone string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.phone = &phone
|
||||
mmRegister.defaultExpectation.expectationOrigins.originPhone = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectInviteCodeParam6 sets up expected param inviteCode for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectInviteCodeParam6(inviteCode int64) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.inviteCode = &inviteCode
|
||||
mmRegister.defaultExpectation.expectationOrigins.originInviteCode = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectIpParam7 sets up expected param ip for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectIpParam7(ip string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.ip = &ip
|
||||
mmRegister.defaultExpectation.expectationOrigins.originIp = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// ExpectUserAgentParam8 sets up expected param userAgent for AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) ExpectUserAgentParam8(userAgent string) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{}
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.params != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Expect")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation.paramPtrs == nil {
|
||||
mmRegister.defaultExpectation.paramPtrs = &AuthServiceMockRegisterParamPtrs{}
|
||||
}
|
||||
mmRegister.defaultExpectation.paramPtrs.userAgent = &userAgent
|
||||
mmRegister.defaultExpectation.expectationOrigins.originUserAgent = minimock.CallerInfo(1)
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// Inspect accepts an inspector function that has same arguments as the AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) Inspect(f func(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string)) *mAuthServiceMockRegister {
|
||||
if mmRegister.mock.inspectFuncRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.Register")
|
||||
}
|
||||
|
||||
mmRegister.mock.inspectFuncRegister = f
|
||||
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
// Return sets up results that will be returned by AuthService.Register
|
||||
func (mmRegister *mAuthServiceMockRegister) Return(accessToken string, refreshToken string, err error) *AuthServiceMock {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
if mmRegister.defaultExpectation == nil {
|
||||
mmRegister.defaultExpectation = &AuthServiceMockRegisterExpectation{mock: mmRegister.mock}
|
||||
}
|
||||
mmRegister.defaultExpectation.results = &AuthServiceMockRegisterResults{accessToken, refreshToken, err}
|
||||
mmRegister.defaultExpectation.returnOrigin = minimock.CallerInfo(1)
|
||||
return mmRegister.mock
|
||||
}
|
||||
|
||||
// Set uses given function f to mock the AuthService.Register method
|
||||
func (mmRegister *mAuthServiceMockRegister) Set(f func(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string) (accessToken string, refreshToken string, err error)) *AuthServiceMock {
|
||||
if mmRegister.defaultExpectation != nil {
|
||||
mmRegister.mock.t.Fatalf("Default expectation is already set for the AuthService.Register method")
|
||||
}
|
||||
|
||||
if len(mmRegister.expectations) > 0 {
|
||||
mmRegister.mock.t.Fatalf("Some expectations are already set for the AuthService.Register method")
|
||||
}
|
||||
|
||||
mmRegister.mock.funcRegister = f
|
||||
mmRegister.mock.funcRegisterOrigin = minimock.CallerInfo(1)
|
||||
return mmRegister.mock
|
||||
}
|
||||
|
||||
// When sets expectation for the AuthService.Register which will trigger the result defined by the following
|
||||
// Then helper
|
||||
func (mmRegister *mAuthServiceMockRegister) When(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string) *AuthServiceMockRegisterExpectation {
|
||||
if mmRegister.mock.funcRegister != nil {
|
||||
mmRegister.mock.t.Fatalf("AuthServiceMock.Register mock is already set by Set")
|
||||
}
|
||||
|
||||
expectation := &AuthServiceMockRegisterExpectation{
|
||||
mock: mmRegister.mock,
|
||||
params: &AuthServiceMockRegisterParams{ctx, email, password, name, phone, inviteCode, ip, userAgent},
|
||||
expectationOrigins: AuthServiceMockRegisterExpectationOrigins{origin: minimock.CallerInfo(1)},
|
||||
}
|
||||
mmRegister.expectations = append(mmRegister.expectations, expectation)
|
||||
return expectation
|
||||
}
|
||||
|
||||
// Then sets up AuthService.Register return parameters for the expectation previously defined by the When method
|
||||
func (e *AuthServiceMockRegisterExpectation) Then(accessToken string, refreshToken string, err error) *AuthServiceMock {
|
||||
e.results = &AuthServiceMockRegisterResults{accessToken, refreshToken, err}
|
||||
return e.mock
|
||||
}
|
||||
|
||||
// Times sets number of times AuthService.Register should be invoked
|
||||
func (mmRegister *mAuthServiceMockRegister) Times(n uint64) *mAuthServiceMockRegister {
|
||||
if n == 0 {
|
||||
mmRegister.mock.t.Fatalf("Times of AuthServiceMock.Register mock can not be zero")
|
||||
}
|
||||
mm_atomic.StoreUint64(&mmRegister.expectedInvocations, n)
|
||||
mmRegister.expectedInvocationsOrigin = minimock.CallerInfo(1)
|
||||
return mmRegister
|
||||
}
|
||||
|
||||
func (mmRegister *mAuthServiceMockRegister) invocationsDone() bool {
|
||||
if len(mmRegister.expectations) == 0 && mmRegister.defaultExpectation == nil && mmRegister.mock.funcRegister == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
totalInvocations := mm_atomic.LoadUint64(&mmRegister.mock.afterRegisterCounter)
|
||||
expectedInvocations := mm_atomic.LoadUint64(&mmRegister.expectedInvocations)
|
||||
|
||||
return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
|
||||
}
|
||||
|
||||
// Register implements mm_service.AuthService
|
||||
func (mmRegister *AuthServiceMock) Register(ctx context.Context, email string, password string, name string, phone string, inviteCode int64, ip string, userAgent string) (accessToken string, refreshToken string, err error) {
|
||||
mm_atomic.AddUint64(&mmRegister.beforeRegisterCounter, 1)
|
||||
defer mm_atomic.AddUint64(&mmRegister.afterRegisterCounter, 1)
|
||||
|
||||
mmRegister.t.Helper()
|
||||
|
||||
if mmRegister.inspectFuncRegister != nil {
|
||||
mmRegister.inspectFuncRegister(ctx, email, password, name, phone, inviteCode, ip, userAgent)
|
||||
}
|
||||
|
||||
mm_params := AuthServiceMockRegisterParams{ctx, email, password, name, phone, inviteCode, ip, userAgent}
|
||||
|
||||
// Record call args
|
||||
mmRegister.RegisterMock.mutex.Lock()
|
||||
mmRegister.RegisterMock.callArgs = append(mmRegister.RegisterMock.callArgs, &mm_params)
|
||||
mmRegister.RegisterMock.mutex.Unlock()
|
||||
|
||||
for _, e := range mmRegister.RegisterMock.expectations {
|
||||
if minimock.Equal(*e.params, mm_params) {
|
||||
mm_atomic.AddUint64(&e.Counter, 1)
|
||||
return e.results.accessToken, e.results.refreshToken, e.results.err
|
||||
}
|
||||
}
|
||||
|
||||
if mmRegister.RegisterMock.defaultExpectation != nil {
|
||||
mm_atomic.AddUint64(&mmRegister.RegisterMock.defaultExpectation.Counter, 1)
|
||||
mm_want := mmRegister.RegisterMock.defaultExpectation.params
|
||||
mm_want_ptrs := mmRegister.RegisterMock.defaultExpectation.paramPtrs
|
||||
|
||||
mm_got := AuthServiceMockRegisterParams{ctx, email, password, name, phone, inviteCode, ip, userAgent}
|
||||
|
||||
if mm_want_ptrs != nil {
|
||||
|
||||
if mm_want_ptrs.ctx != nil && !minimock.Equal(*mm_want_ptrs.ctx, mm_got.ctx) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter ctx, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originCtx, *mm_want_ptrs.ctx, mm_got.ctx, minimock.Diff(*mm_want_ptrs.ctx, mm_got.ctx))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.email != nil && !minimock.Equal(*mm_want_ptrs.email, mm_got.email) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter email, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originEmail, *mm_want_ptrs.email, mm_got.email, minimock.Diff(*mm_want_ptrs.email, mm_got.email))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.password != nil && !minimock.Equal(*mm_want_ptrs.password, mm_got.password) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter password, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originPassword, *mm_want_ptrs.password, mm_got.password, minimock.Diff(*mm_want_ptrs.password, mm_got.password))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.name != nil && !minimock.Equal(*mm_want_ptrs.name, mm_got.name) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter name, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originName, *mm_want_ptrs.name, mm_got.name, minimock.Diff(*mm_want_ptrs.name, mm_got.name))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.phone != nil && !minimock.Equal(*mm_want_ptrs.phone, mm_got.phone) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter phone, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originPhone, *mm_want_ptrs.phone, mm_got.phone, minimock.Diff(*mm_want_ptrs.phone, mm_got.phone))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.inviteCode != nil && !minimock.Equal(*mm_want_ptrs.inviteCode, mm_got.inviteCode) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter inviteCode, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originInviteCode, *mm_want_ptrs.inviteCode, mm_got.inviteCode, minimock.Diff(*mm_want_ptrs.inviteCode, mm_got.inviteCode))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.ip != nil && !minimock.Equal(*mm_want_ptrs.ip, mm_got.ip) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter ip, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originIp, *mm_want_ptrs.ip, mm_got.ip, minimock.Diff(*mm_want_ptrs.ip, mm_got.ip))
|
||||
}
|
||||
|
||||
if mm_want_ptrs.userAgent != nil && !minimock.Equal(*mm_want_ptrs.userAgent, mm_got.userAgent) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameter userAgent, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.originUserAgent, *mm_want_ptrs.userAgent, mm_got.userAgent, minimock.Diff(*mm_want_ptrs.userAgent, mm_got.userAgent))
|
||||
}
|
||||
|
||||
} else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
|
||||
mmRegister.t.Errorf("AuthServiceMock.Register got unexpected parameters, expected at\n%s:\nwant: %#v\n got: %#v%s\n",
|
||||
mmRegister.RegisterMock.defaultExpectation.expectationOrigins.origin, *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
|
||||
}
|
||||
|
||||
mm_results := mmRegister.RegisterMock.defaultExpectation.results
|
||||
if mm_results == nil {
|
||||
mmRegister.t.Fatal("No results are set for the AuthServiceMock.Register")
|
||||
}
|
||||
return (*mm_results).accessToken, (*mm_results).refreshToken, (*mm_results).err
|
||||
}
|
||||
if mmRegister.funcRegister != nil {
|
||||
return mmRegister.funcRegister(ctx, email, password, name, phone, inviteCode, ip, userAgent)
|
||||
}
|
||||
mmRegister.t.Fatalf("Unexpected call to AuthServiceMock.Register. %v %v %v %v %v %v %v %v", ctx, email, password, name, phone, inviteCode, ip, userAgent)
|
||||
return
|
||||
}
|
||||
|
||||
// RegisterAfterCounter returns a count of finished AuthServiceMock.Register invocations
|
||||
func (mmRegister *AuthServiceMock) RegisterAfterCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmRegister.afterRegisterCounter)
|
||||
}
|
||||
|
||||
// RegisterBeforeCounter returns a count of AuthServiceMock.Register invocations
|
||||
func (mmRegister *AuthServiceMock) RegisterBeforeCounter() uint64 {
|
||||
return mm_atomic.LoadUint64(&mmRegister.beforeRegisterCounter)
|
||||
}
|
||||
|
||||
// Calls returns a list of arguments used in each call to AuthServiceMock.Register.
|
||||
// The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
||||
func (mmRegister *mAuthServiceMockRegister) Calls() []*AuthServiceMockRegisterParams {
|
||||
mmRegister.mutex.RLock()
|
||||
|
||||
argCopy := make([]*AuthServiceMockRegisterParams, len(mmRegister.callArgs))
|
||||
copy(argCopy, mmRegister.callArgs)
|
||||
|
||||
mmRegister.mutex.RUnlock()
|
||||
|
||||
return argCopy
|
||||
}
|
||||
|
||||
// MinimockRegisterDone returns true if the count of the Register invocations corresponds
|
||||
// the number of defined expectations
|
||||
func (m *AuthServiceMock) MinimockRegisterDone() bool {
|
||||
if m.RegisterMock.optional {
|
||||
// Optional methods provide '0 or more' call count restriction.
|
||||
return true
|
||||
}
|
||||
|
||||
for _, e := range m.RegisterMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return m.RegisterMock.invocationsDone()
|
||||
}
|
||||
|
||||
// MinimockRegisterInspect logs each unmet expectation
|
||||
func (m *AuthServiceMock) MinimockRegisterInspect() {
|
||||
for _, e := range m.RegisterMock.expectations {
|
||||
if mm_atomic.LoadUint64(&e.Counter) < 1 {
|
||||
m.t.Errorf("Expected call to AuthServiceMock.Register at\n%s with params: %#v", e.expectationOrigins.origin, *e.params)
|
||||
}
|
||||
}
|
||||
|
||||
afterRegisterCounter := mm_atomic.LoadUint64(&m.afterRegisterCounter)
|
||||
// if default expectation was set then invocations count should be greater than zero
|
||||
if m.RegisterMock.defaultExpectation != nil && afterRegisterCounter < 1 {
|
||||
if m.RegisterMock.defaultExpectation.params == nil {
|
||||
m.t.Errorf("Expected call to AuthServiceMock.Register at\n%s", m.RegisterMock.defaultExpectation.returnOrigin)
|
||||
} else {
|
||||
m.t.Errorf("Expected call to AuthServiceMock.Register at\n%s with params: %#v", m.RegisterMock.defaultExpectation.expectationOrigins.origin, *m.RegisterMock.defaultExpectation.params)
|
||||
}
|
||||
}
|
||||
// if func was set then invocations count should be greater than zero
|
||||
if m.funcRegister != nil && afterRegisterCounter < 1 {
|
||||
m.t.Errorf("Expected call to AuthServiceMock.Register at\n%s", m.funcRegisterOrigin)
|
||||
}
|
||||
|
||||
if !m.RegisterMock.invocationsDone() && afterRegisterCounter > 0 {
|
||||
m.t.Errorf("Expected %d calls to AuthServiceMock.Register at\n%s but found %d calls",
|
||||
mm_atomic.LoadUint64(&m.RegisterMock.expectedInvocations), m.RegisterMock.expectedInvocationsOrigin, afterRegisterCounter)
|
||||
}
|
||||
}
|
||||
|
||||
type mAuthServiceMockValidate struct {
|
||||
optional bool
|
||||
mock *AuthServiceMock
|
||||
@@ -1547,6 +2087,8 @@ func (m *AuthServiceMock) MinimockFinish() {
|
||||
|
||||
m.MinimockRefreshInspect()
|
||||
|
||||
m.MinimockRegisterInspect()
|
||||
|
||||
m.MinimockValidateInspect()
|
||||
}
|
||||
})
|
||||
@@ -1574,5 +2116,6 @@ func (m *AuthServiceMock) minimockDone() bool {
|
||||
m.MinimockLoginDone() &&
|
||||
m.MinimockLogoutDone() &&
|
||||
m.MinimockRefreshDone() &&
|
||||
m.MinimockRegisterDone() &&
|
||||
m.MinimockValidateDone()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user