12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004 |
- // Code generated by http://github.com/gojuno/minimock (v3.3.14). DO NOT EDIT.
- package mocks
- //go:generate minimock -i git.dmitriygnatenko.ru/dima/homethings/internal/api/v1/auth.AuthService -o auth_service_minimock.go -n AuthServiceMock -p mocks
- import (
- "sync"
- mm_atomic "sync/atomic"
- mm_time "time"
- "git.dmitriygnatenko.ru/dima/homethings/internal/models"
- "github.com/gofiber/fiber/v2"
- "github.com/gojuno/minimock/v3"
- "github.com/golang-jwt/jwt/v4"
- )
- // AuthServiceMock implements auth.AuthService
- type AuthServiceMock struct {
- t minimock.Tester
- finishOnce sync.Once
- funcGenerateToken func(u1 models.User) (s1 string, err error)
- inspectFuncGenerateToken func(u1 models.User)
- afterGenerateTokenCounter uint64
- beforeGenerateTokenCounter uint64
- GenerateTokenMock mAuthServiceMockGenerateToken
- funcGetClaims func(cp1 *fiber.Ctx) (m1 jwt.MapClaims)
- inspectFuncGetClaims func(cp1 *fiber.Ctx)
- afterGetClaimsCounter uint64
- beforeGetClaimsCounter uint64
- GetClaimsMock mAuthServiceMockGetClaims
- funcIsCorrectPassword func(password string, hash string) (b1 bool)
- inspectFuncIsCorrectPassword func(password string, hash string)
- afterIsCorrectPasswordCounter uint64
- beforeIsCorrectPasswordCounter uint64
- IsCorrectPasswordMock mAuthServiceMockIsCorrectPassword
- }
- // NewAuthServiceMock returns a mock for auth.AuthService
- func NewAuthServiceMock(t minimock.Tester) *AuthServiceMock {
- m := &AuthServiceMock{t: t}
- if controller, ok := t.(minimock.MockController); ok {
- controller.RegisterMocker(m)
- }
- m.GenerateTokenMock = mAuthServiceMockGenerateToken{mock: m}
- m.GenerateTokenMock.callArgs = []*AuthServiceMockGenerateTokenParams{}
- m.GetClaimsMock = mAuthServiceMockGetClaims{mock: m}
- m.GetClaimsMock.callArgs = []*AuthServiceMockGetClaimsParams{}
- m.IsCorrectPasswordMock = mAuthServiceMockIsCorrectPassword{mock: m}
- m.IsCorrectPasswordMock.callArgs = []*AuthServiceMockIsCorrectPasswordParams{}
- t.Cleanup(m.MinimockFinish)
- return m
- }
- type mAuthServiceMockGenerateToken struct {
- optional bool
- mock *AuthServiceMock
- defaultExpectation *AuthServiceMockGenerateTokenExpectation
- expectations []*AuthServiceMockGenerateTokenExpectation
- callArgs []*AuthServiceMockGenerateTokenParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // AuthServiceMockGenerateTokenExpectation specifies expectation struct of the AuthService.GenerateToken
- type AuthServiceMockGenerateTokenExpectation struct {
- mock *AuthServiceMock
- params *AuthServiceMockGenerateTokenParams
- paramPtrs *AuthServiceMockGenerateTokenParamPtrs
- results *AuthServiceMockGenerateTokenResults
- Counter uint64
- }
- // AuthServiceMockGenerateTokenParams contains parameters of the AuthService.GenerateToken
- type AuthServiceMockGenerateTokenParams struct {
- u1 models.User
- }
- // AuthServiceMockGenerateTokenParamPtrs contains pointers to parameters of the AuthService.GenerateToken
- type AuthServiceMockGenerateTokenParamPtrs struct {
- u1 *models.User
- }
- // AuthServiceMockGenerateTokenResults contains results of the AuthService.GenerateToken
- type AuthServiceMockGenerateTokenResults struct {
- s1 string
- err error
- }
- // 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 (mmGenerateToken *mAuthServiceMockGenerateToken) Optional() *mAuthServiceMockGenerateToken {
- mmGenerateToken.optional = true
- return mmGenerateToken
- }
- // Expect sets up expected params for AuthService.GenerateToken
- func (mmGenerateToken *mAuthServiceMockGenerateToken) Expect(u1 models.User) *mAuthServiceMockGenerateToken {
- if mmGenerateToken.mock.funcGenerateToken != nil {
- mmGenerateToken.mock.t.Fatalf("AuthServiceMock.GenerateToken mock is already set by Set")
- }
- if mmGenerateToken.defaultExpectation == nil {
- mmGenerateToken.defaultExpectation = &AuthServiceMockGenerateTokenExpectation{}
- }
- if mmGenerateToken.defaultExpectation.paramPtrs != nil {
- mmGenerateToken.mock.t.Fatalf("AuthServiceMock.GenerateToken mock is already set by ExpectParams functions")
- }
- mmGenerateToken.defaultExpectation.params = &AuthServiceMockGenerateTokenParams{u1}
- for _, e := range mmGenerateToken.expectations {
- if minimock.Equal(e.params, mmGenerateToken.defaultExpectation.params) {
- mmGenerateToken.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGenerateToken.defaultExpectation.params)
- }
- }
- return mmGenerateToken
- }
- // ExpectU1Param1 sets up expected param u1 for AuthService.GenerateToken
- func (mmGenerateToken *mAuthServiceMockGenerateToken) ExpectU1Param1(u1 models.User) *mAuthServiceMockGenerateToken {
- if mmGenerateToken.mock.funcGenerateToken != nil {
- mmGenerateToken.mock.t.Fatalf("AuthServiceMock.GenerateToken mock is already set by Set")
- }
- if mmGenerateToken.defaultExpectation == nil {
- mmGenerateToken.defaultExpectation = &AuthServiceMockGenerateTokenExpectation{}
- }
- if mmGenerateToken.defaultExpectation.params != nil {
- mmGenerateToken.mock.t.Fatalf("AuthServiceMock.GenerateToken mock is already set by Expect")
- }
- if mmGenerateToken.defaultExpectation.paramPtrs == nil {
- mmGenerateToken.defaultExpectation.paramPtrs = &AuthServiceMockGenerateTokenParamPtrs{}
- }
- mmGenerateToken.defaultExpectation.paramPtrs.u1 = &u1
- return mmGenerateToken
- }
- // Inspect accepts an inspector function that has same arguments as the AuthService.GenerateToken
- func (mmGenerateToken *mAuthServiceMockGenerateToken) Inspect(f func(u1 models.User)) *mAuthServiceMockGenerateToken {
- if mmGenerateToken.mock.inspectFuncGenerateToken != nil {
- mmGenerateToken.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.GenerateToken")
- }
- mmGenerateToken.mock.inspectFuncGenerateToken = f
- return mmGenerateToken
- }
- // Return sets up results that will be returned by AuthService.GenerateToken
- func (mmGenerateToken *mAuthServiceMockGenerateToken) Return(s1 string, err error) *AuthServiceMock {
- if mmGenerateToken.mock.funcGenerateToken != nil {
- mmGenerateToken.mock.t.Fatalf("AuthServiceMock.GenerateToken mock is already set by Set")
- }
- if mmGenerateToken.defaultExpectation == nil {
- mmGenerateToken.defaultExpectation = &AuthServiceMockGenerateTokenExpectation{mock: mmGenerateToken.mock}
- }
- mmGenerateToken.defaultExpectation.results = &AuthServiceMockGenerateTokenResults{s1, err}
- return mmGenerateToken.mock
- }
- // Set uses given function f to mock the AuthService.GenerateToken method
- func (mmGenerateToken *mAuthServiceMockGenerateToken) Set(f func(u1 models.User) (s1 string, err error)) *AuthServiceMock {
- if mmGenerateToken.defaultExpectation != nil {
- mmGenerateToken.mock.t.Fatalf("Default expectation is already set for the AuthService.GenerateToken method")
- }
- if len(mmGenerateToken.expectations) > 0 {
- mmGenerateToken.mock.t.Fatalf("Some expectations are already set for the AuthService.GenerateToken method")
- }
- mmGenerateToken.mock.funcGenerateToken = f
- return mmGenerateToken.mock
- }
- // When sets expectation for the AuthService.GenerateToken which will trigger the result defined by the following
- // Then helper
- func (mmGenerateToken *mAuthServiceMockGenerateToken) When(u1 models.User) *AuthServiceMockGenerateTokenExpectation {
- if mmGenerateToken.mock.funcGenerateToken != nil {
- mmGenerateToken.mock.t.Fatalf("AuthServiceMock.GenerateToken mock is already set by Set")
- }
- expectation := &AuthServiceMockGenerateTokenExpectation{
- mock: mmGenerateToken.mock,
- params: &AuthServiceMockGenerateTokenParams{u1},
- }
- mmGenerateToken.expectations = append(mmGenerateToken.expectations, expectation)
- return expectation
- }
- // Then sets up AuthService.GenerateToken return parameters for the expectation previously defined by the When method
- func (e *AuthServiceMockGenerateTokenExpectation) Then(s1 string, err error) *AuthServiceMock {
- e.results = &AuthServiceMockGenerateTokenResults{s1, err}
- return e.mock
- }
- // Times sets number of times AuthService.GenerateToken should be invoked
- func (mmGenerateToken *mAuthServiceMockGenerateToken) Times(n uint64) *mAuthServiceMockGenerateToken {
- if n == 0 {
- mmGenerateToken.mock.t.Fatalf("Times of AuthServiceMock.GenerateToken mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGenerateToken.expectedInvocations, n)
- return mmGenerateToken
- }
- func (mmGenerateToken *mAuthServiceMockGenerateToken) invocationsDone() bool {
- if len(mmGenerateToken.expectations) == 0 && mmGenerateToken.defaultExpectation == nil && mmGenerateToken.mock.funcGenerateToken == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGenerateToken.mock.afterGenerateTokenCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGenerateToken.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // GenerateToken implements auth.AuthService
- func (mmGenerateToken *AuthServiceMock) GenerateToken(u1 models.User) (s1 string, err error) {
- mm_atomic.AddUint64(&mmGenerateToken.beforeGenerateTokenCounter, 1)
- defer mm_atomic.AddUint64(&mmGenerateToken.afterGenerateTokenCounter, 1)
- if mmGenerateToken.inspectFuncGenerateToken != nil {
- mmGenerateToken.inspectFuncGenerateToken(u1)
- }
- mm_params := AuthServiceMockGenerateTokenParams{u1}
- // Record call args
- mmGenerateToken.GenerateTokenMock.mutex.Lock()
- mmGenerateToken.GenerateTokenMock.callArgs = append(mmGenerateToken.GenerateTokenMock.callArgs, &mm_params)
- mmGenerateToken.GenerateTokenMock.mutex.Unlock()
- for _, e := range mmGenerateToken.GenerateTokenMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.s1, e.results.err
- }
- }
- if mmGenerateToken.GenerateTokenMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGenerateToken.GenerateTokenMock.defaultExpectation.Counter, 1)
- mm_want := mmGenerateToken.GenerateTokenMock.defaultExpectation.params
- mm_want_ptrs := mmGenerateToken.GenerateTokenMock.defaultExpectation.paramPtrs
- mm_got := AuthServiceMockGenerateTokenParams{u1}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.u1 != nil && !minimock.Equal(*mm_want_ptrs.u1, mm_got.u1) {
- mmGenerateToken.t.Errorf("AuthServiceMock.GenerateToken got unexpected parameter u1, want: %#v, got: %#v%s\n", *mm_want_ptrs.u1, mm_got.u1, minimock.Diff(*mm_want_ptrs.u1, mm_got.u1))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGenerateToken.t.Errorf("AuthServiceMock.GenerateToken got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGenerateToken.GenerateTokenMock.defaultExpectation.results
- if mm_results == nil {
- mmGenerateToken.t.Fatal("No results are set for the AuthServiceMock.GenerateToken")
- }
- return (*mm_results).s1, (*mm_results).err
- }
- if mmGenerateToken.funcGenerateToken != nil {
- return mmGenerateToken.funcGenerateToken(u1)
- }
- mmGenerateToken.t.Fatalf("Unexpected call to AuthServiceMock.GenerateToken. %v", u1)
- return
- }
- // GenerateTokenAfterCounter returns a count of finished AuthServiceMock.GenerateToken invocations
- func (mmGenerateToken *AuthServiceMock) GenerateTokenAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGenerateToken.afterGenerateTokenCounter)
- }
- // GenerateTokenBeforeCounter returns a count of AuthServiceMock.GenerateToken invocations
- func (mmGenerateToken *AuthServiceMock) GenerateTokenBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGenerateToken.beforeGenerateTokenCounter)
- }
- // Calls returns a list of arguments used in each call to AuthServiceMock.GenerateToken.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGenerateToken *mAuthServiceMockGenerateToken) Calls() []*AuthServiceMockGenerateTokenParams {
- mmGenerateToken.mutex.RLock()
- argCopy := make([]*AuthServiceMockGenerateTokenParams, len(mmGenerateToken.callArgs))
- copy(argCopy, mmGenerateToken.callArgs)
- mmGenerateToken.mutex.RUnlock()
- return argCopy
- }
- // MinimockGenerateTokenDone returns true if the count of the GenerateToken invocations corresponds
- // the number of defined expectations
- func (m *AuthServiceMock) MinimockGenerateTokenDone() bool {
- if m.GenerateTokenMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GenerateTokenMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GenerateTokenMock.invocationsDone()
- }
- // MinimockGenerateTokenInspect logs each unmet expectation
- func (m *AuthServiceMock) MinimockGenerateTokenInspect() {
- for _, e := range m.GenerateTokenMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to AuthServiceMock.GenerateToken with params: %#v", *e.params)
- }
- }
- afterGenerateTokenCounter := mm_atomic.LoadUint64(&m.afterGenerateTokenCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GenerateTokenMock.defaultExpectation != nil && afterGenerateTokenCounter < 1 {
- if m.GenerateTokenMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to AuthServiceMock.GenerateToken")
- } else {
- m.t.Errorf("Expected call to AuthServiceMock.GenerateToken with params: %#v", *m.GenerateTokenMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGenerateToken != nil && afterGenerateTokenCounter < 1 {
- m.t.Error("Expected call to AuthServiceMock.GenerateToken")
- }
- if !m.GenerateTokenMock.invocationsDone() && afterGenerateTokenCounter > 0 {
- m.t.Errorf("Expected %d calls to AuthServiceMock.GenerateToken but found %d calls",
- mm_atomic.LoadUint64(&m.GenerateTokenMock.expectedInvocations), afterGenerateTokenCounter)
- }
- }
- type mAuthServiceMockGetClaims struct {
- optional bool
- mock *AuthServiceMock
- defaultExpectation *AuthServiceMockGetClaimsExpectation
- expectations []*AuthServiceMockGetClaimsExpectation
- callArgs []*AuthServiceMockGetClaimsParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // AuthServiceMockGetClaimsExpectation specifies expectation struct of the AuthService.GetClaims
- type AuthServiceMockGetClaimsExpectation struct {
- mock *AuthServiceMock
- params *AuthServiceMockGetClaimsParams
- paramPtrs *AuthServiceMockGetClaimsParamPtrs
- results *AuthServiceMockGetClaimsResults
- Counter uint64
- }
- // AuthServiceMockGetClaimsParams contains parameters of the AuthService.GetClaims
- type AuthServiceMockGetClaimsParams struct {
- cp1 *fiber.Ctx
- }
- // AuthServiceMockGetClaimsParamPtrs contains pointers to parameters of the AuthService.GetClaims
- type AuthServiceMockGetClaimsParamPtrs struct {
- cp1 **fiber.Ctx
- }
- // AuthServiceMockGetClaimsResults contains results of the AuthService.GetClaims
- type AuthServiceMockGetClaimsResults struct {
- m1 jwt.MapClaims
- }
- // 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 (mmGetClaims *mAuthServiceMockGetClaims) Optional() *mAuthServiceMockGetClaims {
- mmGetClaims.optional = true
- return mmGetClaims
- }
- // Expect sets up expected params for AuthService.GetClaims
- func (mmGetClaims *mAuthServiceMockGetClaims) Expect(cp1 *fiber.Ctx) *mAuthServiceMockGetClaims {
- if mmGetClaims.mock.funcGetClaims != nil {
- mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set")
- }
- if mmGetClaims.defaultExpectation == nil {
- mmGetClaims.defaultExpectation = &AuthServiceMockGetClaimsExpectation{}
- }
- if mmGetClaims.defaultExpectation.paramPtrs != nil {
- mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by ExpectParams functions")
- }
- mmGetClaims.defaultExpectation.params = &AuthServiceMockGetClaimsParams{cp1}
- for _, e := range mmGetClaims.expectations {
- if minimock.Equal(e.params, mmGetClaims.defaultExpectation.params) {
- mmGetClaims.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetClaims.defaultExpectation.params)
- }
- }
- return mmGetClaims
- }
- // ExpectCp1Param1 sets up expected param cp1 for AuthService.GetClaims
- func (mmGetClaims *mAuthServiceMockGetClaims) ExpectCp1Param1(cp1 *fiber.Ctx) *mAuthServiceMockGetClaims {
- if mmGetClaims.mock.funcGetClaims != nil {
- mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set")
- }
- if mmGetClaims.defaultExpectation == nil {
- mmGetClaims.defaultExpectation = &AuthServiceMockGetClaimsExpectation{}
- }
- if mmGetClaims.defaultExpectation.params != nil {
- mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Expect")
- }
- if mmGetClaims.defaultExpectation.paramPtrs == nil {
- mmGetClaims.defaultExpectation.paramPtrs = &AuthServiceMockGetClaimsParamPtrs{}
- }
- mmGetClaims.defaultExpectation.paramPtrs.cp1 = &cp1
- return mmGetClaims
- }
- // Inspect accepts an inspector function that has same arguments as the AuthService.GetClaims
- func (mmGetClaims *mAuthServiceMockGetClaims) Inspect(f func(cp1 *fiber.Ctx)) *mAuthServiceMockGetClaims {
- if mmGetClaims.mock.inspectFuncGetClaims != nil {
- mmGetClaims.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.GetClaims")
- }
- mmGetClaims.mock.inspectFuncGetClaims = f
- return mmGetClaims
- }
- // Return sets up results that will be returned by AuthService.GetClaims
- func (mmGetClaims *mAuthServiceMockGetClaims) Return(m1 jwt.MapClaims) *AuthServiceMock {
- if mmGetClaims.mock.funcGetClaims != nil {
- mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set")
- }
- if mmGetClaims.defaultExpectation == nil {
- mmGetClaims.defaultExpectation = &AuthServiceMockGetClaimsExpectation{mock: mmGetClaims.mock}
- }
- mmGetClaims.defaultExpectation.results = &AuthServiceMockGetClaimsResults{m1}
- return mmGetClaims.mock
- }
- // Set uses given function f to mock the AuthService.GetClaims method
- func (mmGetClaims *mAuthServiceMockGetClaims) Set(f func(cp1 *fiber.Ctx) (m1 jwt.MapClaims)) *AuthServiceMock {
- if mmGetClaims.defaultExpectation != nil {
- mmGetClaims.mock.t.Fatalf("Default expectation is already set for the AuthService.GetClaims method")
- }
- if len(mmGetClaims.expectations) > 0 {
- mmGetClaims.mock.t.Fatalf("Some expectations are already set for the AuthService.GetClaims method")
- }
- mmGetClaims.mock.funcGetClaims = f
- return mmGetClaims.mock
- }
- // When sets expectation for the AuthService.GetClaims which will trigger the result defined by the following
- // Then helper
- func (mmGetClaims *mAuthServiceMockGetClaims) When(cp1 *fiber.Ctx) *AuthServiceMockGetClaimsExpectation {
- if mmGetClaims.mock.funcGetClaims != nil {
- mmGetClaims.mock.t.Fatalf("AuthServiceMock.GetClaims mock is already set by Set")
- }
- expectation := &AuthServiceMockGetClaimsExpectation{
- mock: mmGetClaims.mock,
- params: &AuthServiceMockGetClaimsParams{cp1},
- }
- mmGetClaims.expectations = append(mmGetClaims.expectations, expectation)
- return expectation
- }
- // Then sets up AuthService.GetClaims return parameters for the expectation previously defined by the When method
- func (e *AuthServiceMockGetClaimsExpectation) Then(m1 jwt.MapClaims) *AuthServiceMock {
- e.results = &AuthServiceMockGetClaimsResults{m1}
- return e.mock
- }
- // Times sets number of times AuthService.GetClaims should be invoked
- func (mmGetClaims *mAuthServiceMockGetClaims) Times(n uint64) *mAuthServiceMockGetClaims {
- if n == 0 {
- mmGetClaims.mock.t.Fatalf("Times of AuthServiceMock.GetClaims mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmGetClaims.expectedInvocations, n)
- return mmGetClaims
- }
- func (mmGetClaims *mAuthServiceMockGetClaims) invocationsDone() bool {
- if len(mmGetClaims.expectations) == 0 && mmGetClaims.defaultExpectation == nil && mmGetClaims.mock.funcGetClaims == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmGetClaims.mock.afterGetClaimsCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmGetClaims.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // GetClaims implements auth.AuthService
- func (mmGetClaims *AuthServiceMock) GetClaims(cp1 *fiber.Ctx) (m1 jwt.MapClaims) {
- mm_atomic.AddUint64(&mmGetClaims.beforeGetClaimsCounter, 1)
- defer mm_atomic.AddUint64(&mmGetClaims.afterGetClaimsCounter, 1)
- if mmGetClaims.inspectFuncGetClaims != nil {
- mmGetClaims.inspectFuncGetClaims(cp1)
- }
- mm_params := AuthServiceMockGetClaimsParams{cp1}
- // Record call args
- mmGetClaims.GetClaimsMock.mutex.Lock()
- mmGetClaims.GetClaimsMock.callArgs = append(mmGetClaims.GetClaimsMock.callArgs, &mm_params)
- mmGetClaims.GetClaimsMock.mutex.Unlock()
- for _, e := range mmGetClaims.GetClaimsMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.m1
- }
- }
- if mmGetClaims.GetClaimsMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmGetClaims.GetClaimsMock.defaultExpectation.Counter, 1)
- mm_want := mmGetClaims.GetClaimsMock.defaultExpectation.params
- mm_want_ptrs := mmGetClaims.GetClaimsMock.defaultExpectation.paramPtrs
- mm_got := AuthServiceMockGetClaimsParams{cp1}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.cp1 != nil && !minimock.Equal(*mm_want_ptrs.cp1, mm_got.cp1) {
- mmGetClaims.t.Errorf("AuthServiceMock.GetClaims got unexpected parameter cp1, want: %#v, got: %#v%s\n", *mm_want_ptrs.cp1, mm_got.cp1, minimock.Diff(*mm_want_ptrs.cp1, mm_got.cp1))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmGetClaims.t.Errorf("AuthServiceMock.GetClaims got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmGetClaims.GetClaimsMock.defaultExpectation.results
- if mm_results == nil {
- mmGetClaims.t.Fatal("No results are set for the AuthServiceMock.GetClaims")
- }
- return (*mm_results).m1
- }
- if mmGetClaims.funcGetClaims != nil {
- return mmGetClaims.funcGetClaims(cp1)
- }
- mmGetClaims.t.Fatalf("Unexpected call to AuthServiceMock.GetClaims. %v", cp1)
- return
- }
- // GetClaimsAfterCounter returns a count of finished AuthServiceMock.GetClaims invocations
- func (mmGetClaims *AuthServiceMock) GetClaimsAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetClaims.afterGetClaimsCounter)
- }
- // GetClaimsBeforeCounter returns a count of AuthServiceMock.GetClaims invocations
- func (mmGetClaims *AuthServiceMock) GetClaimsBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmGetClaims.beforeGetClaimsCounter)
- }
- // Calls returns a list of arguments used in each call to AuthServiceMock.GetClaims.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmGetClaims *mAuthServiceMockGetClaims) Calls() []*AuthServiceMockGetClaimsParams {
- mmGetClaims.mutex.RLock()
- argCopy := make([]*AuthServiceMockGetClaimsParams, len(mmGetClaims.callArgs))
- copy(argCopy, mmGetClaims.callArgs)
- mmGetClaims.mutex.RUnlock()
- return argCopy
- }
- // MinimockGetClaimsDone returns true if the count of the GetClaims invocations corresponds
- // the number of defined expectations
- func (m *AuthServiceMock) MinimockGetClaimsDone() bool {
- if m.GetClaimsMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.GetClaimsMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.GetClaimsMock.invocationsDone()
- }
- // MinimockGetClaimsInspect logs each unmet expectation
- func (m *AuthServiceMock) MinimockGetClaimsInspect() {
- for _, e := range m.GetClaimsMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to AuthServiceMock.GetClaims with params: %#v", *e.params)
- }
- }
- afterGetClaimsCounter := mm_atomic.LoadUint64(&m.afterGetClaimsCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.GetClaimsMock.defaultExpectation != nil && afterGetClaimsCounter < 1 {
- if m.GetClaimsMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to AuthServiceMock.GetClaims")
- } else {
- m.t.Errorf("Expected call to AuthServiceMock.GetClaims with params: %#v", *m.GetClaimsMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcGetClaims != nil && afterGetClaimsCounter < 1 {
- m.t.Error("Expected call to AuthServiceMock.GetClaims")
- }
- if !m.GetClaimsMock.invocationsDone() && afterGetClaimsCounter > 0 {
- m.t.Errorf("Expected %d calls to AuthServiceMock.GetClaims but found %d calls",
- mm_atomic.LoadUint64(&m.GetClaimsMock.expectedInvocations), afterGetClaimsCounter)
- }
- }
- type mAuthServiceMockIsCorrectPassword struct {
- optional bool
- mock *AuthServiceMock
- defaultExpectation *AuthServiceMockIsCorrectPasswordExpectation
- expectations []*AuthServiceMockIsCorrectPasswordExpectation
- callArgs []*AuthServiceMockIsCorrectPasswordParams
- mutex sync.RWMutex
- expectedInvocations uint64
- }
- // AuthServiceMockIsCorrectPasswordExpectation specifies expectation struct of the AuthService.IsCorrectPassword
- type AuthServiceMockIsCorrectPasswordExpectation struct {
- mock *AuthServiceMock
- params *AuthServiceMockIsCorrectPasswordParams
- paramPtrs *AuthServiceMockIsCorrectPasswordParamPtrs
- results *AuthServiceMockIsCorrectPasswordResults
- Counter uint64
- }
- // AuthServiceMockIsCorrectPasswordParams contains parameters of the AuthService.IsCorrectPassword
- type AuthServiceMockIsCorrectPasswordParams struct {
- password string
- hash string
- }
- // AuthServiceMockIsCorrectPasswordParamPtrs contains pointers to parameters of the AuthService.IsCorrectPassword
- type AuthServiceMockIsCorrectPasswordParamPtrs struct {
- password *string
- hash *string
- }
- // AuthServiceMockIsCorrectPasswordResults contains results of the AuthService.IsCorrectPassword
- type AuthServiceMockIsCorrectPasswordResults struct {
- b1 bool
- }
- // 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 (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Optional() *mAuthServiceMockIsCorrectPassword {
- mmIsCorrectPassword.optional = true
- return mmIsCorrectPassword
- }
- // Expect sets up expected params for AuthService.IsCorrectPassword
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Expect(password string, hash string) *mAuthServiceMockIsCorrectPassword {
- if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Set")
- }
- if mmIsCorrectPassword.defaultExpectation == nil {
- mmIsCorrectPassword.defaultExpectation = &AuthServiceMockIsCorrectPasswordExpectation{}
- }
- if mmIsCorrectPassword.defaultExpectation.paramPtrs != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by ExpectParams functions")
- }
- mmIsCorrectPassword.defaultExpectation.params = &AuthServiceMockIsCorrectPasswordParams{password, hash}
- for _, e := range mmIsCorrectPassword.expectations {
- if minimock.Equal(e.params, mmIsCorrectPassword.defaultExpectation.params) {
- mmIsCorrectPassword.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmIsCorrectPassword.defaultExpectation.params)
- }
- }
- return mmIsCorrectPassword
- }
- // ExpectPasswordParam1 sets up expected param password for AuthService.IsCorrectPassword
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) ExpectPasswordParam1(password string) *mAuthServiceMockIsCorrectPassword {
- if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Set")
- }
- if mmIsCorrectPassword.defaultExpectation == nil {
- mmIsCorrectPassword.defaultExpectation = &AuthServiceMockIsCorrectPasswordExpectation{}
- }
- if mmIsCorrectPassword.defaultExpectation.params != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Expect")
- }
- if mmIsCorrectPassword.defaultExpectation.paramPtrs == nil {
- mmIsCorrectPassword.defaultExpectation.paramPtrs = &AuthServiceMockIsCorrectPasswordParamPtrs{}
- }
- mmIsCorrectPassword.defaultExpectation.paramPtrs.password = &password
- return mmIsCorrectPassword
- }
- // ExpectHashParam2 sets up expected param hash for AuthService.IsCorrectPassword
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) ExpectHashParam2(hash string) *mAuthServiceMockIsCorrectPassword {
- if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Set")
- }
- if mmIsCorrectPassword.defaultExpectation == nil {
- mmIsCorrectPassword.defaultExpectation = &AuthServiceMockIsCorrectPasswordExpectation{}
- }
- if mmIsCorrectPassword.defaultExpectation.params != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Expect")
- }
- if mmIsCorrectPassword.defaultExpectation.paramPtrs == nil {
- mmIsCorrectPassword.defaultExpectation.paramPtrs = &AuthServiceMockIsCorrectPasswordParamPtrs{}
- }
- mmIsCorrectPassword.defaultExpectation.paramPtrs.hash = &hash
- return mmIsCorrectPassword
- }
- // Inspect accepts an inspector function that has same arguments as the AuthService.IsCorrectPassword
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Inspect(f func(password string, hash string)) *mAuthServiceMockIsCorrectPassword {
- if mmIsCorrectPassword.mock.inspectFuncIsCorrectPassword != nil {
- mmIsCorrectPassword.mock.t.Fatalf("Inspect function is already set for AuthServiceMock.IsCorrectPassword")
- }
- mmIsCorrectPassword.mock.inspectFuncIsCorrectPassword = f
- return mmIsCorrectPassword
- }
- // Return sets up results that will be returned by AuthService.IsCorrectPassword
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Return(b1 bool) *AuthServiceMock {
- if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Set")
- }
- if mmIsCorrectPassword.defaultExpectation == nil {
- mmIsCorrectPassword.defaultExpectation = &AuthServiceMockIsCorrectPasswordExpectation{mock: mmIsCorrectPassword.mock}
- }
- mmIsCorrectPassword.defaultExpectation.results = &AuthServiceMockIsCorrectPasswordResults{b1}
- return mmIsCorrectPassword.mock
- }
- // Set uses given function f to mock the AuthService.IsCorrectPassword method
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Set(f func(password string, hash string) (b1 bool)) *AuthServiceMock {
- if mmIsCorrectPassword.defaultExpectation != nil {
- mmIsCorrectPassword.mock.t.Fatalf("Default expectation is already set for the AuthService.IsCorrectPassword method")
- }
- if len(mmIsCorrectPassword.expectations) > 0 {
- mmIsCorrectPassword.mock.t.Fatalf("Some expectations are already set for the AuthService.IsCorrectPassword method")
- }
- mmIsCorrectPassword.mock.funcIsCorrectPassword = f
- return mmIsCorrectPassword.mock
- }
- // When sets expectation for the AuthService.IsCorrectPassword which will trigger the result defined by the following
- // Then helper
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) When(password string, hash string) *AuthServiceMockIsCorrectPasswordExpectation {
- if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
- mmIsCorrectPassword.mock.t.Fatalf("AuthServiceMock.IsCorrectPassword mock is already set by Set")
- }
- expectation := &AuthServiceMockIsCorrectPasswordExpectation{
- mock: mmIsCorrectPassword.mock,
- params: &AuthServiceMockIsCorrectPasswordParams{password, hash},
- }
- mmIsCorrectPassword.expectations = append(mmIsCorrectPassword.expectations, expectation)
- return expectation
- }
- // Then sets up AuthService.IsCorrectPassword return parameters for the expectation previously defined by the When method
- func (e *AuthServiceMockIsCorrectPasswordExpectation) Then(b1 bool) *AuthServiceMock {
- e.results = &AuthServiceMockIsCorrectPasswordResults{b1}
- return e.mock
- }
- // Times sets number of times AuthService.IsCorrectPassword should be invoked
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Times(n uint64) *mAuthServiceMockIsCorrectPassword {
- if n == 0 {
- mmIsCorrectPassword.mock.t.Fatalf("Times of AuthServiceMock.IsCorrectPassword mock can not be zero")
- }
- mm_atomic.StoreUint64(&mmIsCorrectPassword.expectedInvocations, n)
- return mmIsCorrectPassword
- }
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) invocationsDone() bool {
- if len(mmIsCorrectPassword.expectations) == 0 && mmIsCorrectPassword.defaultExpectation == nil && mmIsCorrectPassword.mock.funcIsCorrectPassword == nil {
- return true
- }
- totalInvocations := mm_atomic.LoadUint64(&mmIsCorrectPassword.mock.afterIsCorrectPasswordCounter)
- expectedInvocations := mm_atomic.LoadUint64(&mmIsCorrectPassword.expectedInvocations)
- return totalInvocations > 0 && (expectedInvocations == 0 || expectedInvocations == totalInvocations)
- }
- // IsCorrectPassword implements auth.AuthService
- func (mmIsCorrectPassword *AuthServiceMock) IsCorrectPassword(password string, hash string) (b1 bool) {
- mm_atomic.AddUint64(&mmIsCorrectPassword.beforeIsCorrectPasswordCounter, 1)
- defer mm_atomic.AddUint64(&mmIsCorrectPassword.afterIsCorrectPasswordCounter, 1)
- if mmIsCorrectPassword.inspectFuncIsCorrectPassword != nil {
- mmIsCorrectPassword.inspectFuncIsCorrectPassword(password, hash)
- }
- mm_params := AuthServiceMockIsCorrectPasswordParams{password, hash}
- // Record call args
- mmIsCorrectPassword.IsCorrectPasswordMock.mutex.Lock()
- mmIsCorrectPassword.IsCorrectPasswordMock.callArgs = append(mmIsCorrectPassword.IsCorrectPasswordMock.callArgs, &mm_params)
- mmIsCorrectPassword.IsCorrectPasswordMock.mutex.Unlock()
- for _, e := range mmIsCorrectPassword.IsCorrectPasswordMock.expectations {
- if minimock.Equal(*e.params, mm_params) {
- mm_atomic.AddUint64(&e.Counter, 1)
- return e.results.b1
- }
- }
- if mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation != nil {
- mm_atomic.AddUint64(&mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.Counter, 1)
- mm_want := mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.params
- mm_want_ptrs := mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.paramPtrs
- mm_got := AuthServiceMockIsCorrectPasswordParams{password, hash}
- if mm_want_ptrs != nil {
- if mm_want_ptrs.password != nil && !minimock.Equal(*mm_want_ptrs.password, mm_got.password) {
- mmIsCorrectPassword.t.Errorf("AuthServiceMock.IsCorrectPassword got unexpected parameter password, want: %#v, got: %#v%s\n", *mm_want_ptrs.password, mm_got.password, minimock.Diff(*mm_want_ptrs.password, mm_got.password))
- }
- if mm_want_ptrs.hash != nil && !minimock.Equal(*mm_want_ptrs.hash, mm_got.hash) {
- mmIsCorrectPassword.t.Errorf("AuthServiceMock.IsCorrectPassword got unexpected parameter hash, want: %#v, got: %#v%s\n", *mm_want_ptrs.hash, mm_got.hash, minimock.Diff(*mm_want_ptrs.hash, mm_got.hash))
- }
- } else if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
- mmIsCorrectPassword.t.Errorf("AuthServiceMock.IsCorrectPassword got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
- }
- mm_results := mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.results
- if mm_results == nil {
- mmIsCorrectPassword.t.Fatal("No results are set for the AuthServiceMock.IsCorrectPassword")
- }
- return (*mm_results).b1
- }
- if mmIsCorrectPassword.funcIsCorrectPassword != nil {
- return mmIsCorrectPassword.funcIsCorrectPassword(password, hash)
- }
- mmIsCorrectPassword.t.Fatalf("Unexpected call to AuthServiceMock.IsCorrectPassword. %v %v", password, hash)
- return
- }
- // IsCorrectPasswordAfterCounter returns a count of finished AuthServiceMock.IsCorrectPassword invocations
- func (mmIsCorrectPassword *AuthServiceMock) IsCorrectPasswordAfterCounter() uint64 {
- return mm_atomic.LoadUint64(&mmIsCorrectPassword.afterIsCorrectPasswordCounter)
- }
- // IsCorrectPasswordBeforeCounter returns a count of AuthServiceMock.IsCorrectPassword invocations
- func (mmIsCorrectPassword *AuthServiceMock) IsCorrectPasswordBeforeCounter() uint64 {
- return mm_atomic.LoadUint64(&mmIsCorrectPassword.beforeIsCorrectPasswordCounter)
- }
- // Calls returns a list of arguments used in each call to AuthServiceMock.IsCorrectPassword.
- // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
- func (mmIsCorrectPassword *mAuthServiceMockIsCorrectPassword) Calls() []*AuthServiceMockIsCorrectPasswordParams {
- mmIsCorrectPassword.mutex.RLock()
- argCopy := make([]*AuthServiceMockIsCorrectPasswordParams, len(mmIsCorrectPassword.callArgs))
- copy(argCopy, mmIsCorrectPassword.callArgs)
- mmIsCorrectPassword.mutex.RUnlock()
- return argCopy
- }
- // MinimockIsCorrectPasswordDone returns true if the count of the IsCorrectPassword invocations corresponds
- // the number of defined expectations
- func (m *AuthServiceMock) MinimockIsCorrectPasswordDone() bool {
- if m.IsCorrectPasswordMock.optional {
- // Optional methods provide '0 or more' call count restriction.
- return true
- }
- for _, e := range m.IsCorrectPasswordMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- return false
- }
- }
- return m.IsCorrectPasswordMock.invocationsDone()
- }
- // MinimockIsCorrectPasswordInspect logs each unmet expectation
- func (m *AuthServiceMock) MinimockIsCorrectPasswordInspect() {
- for _, e := range m.IsCorrectPasswordMock.expectations {
- if mm_atomic.LoadUint64(&e.Counter) < 1 {
- m.t.Errorf("Expected call to AuthServiceMock.IsCorrectPassword with params: %#v", *e.params)
- }
- }
- afterIsCorrectPasswordCounter := mm_atomic.LoadUint64(&m.afterIsCorrectPasswordCounter)
- // if default expectation was set then invocations count should be greater than zero
- if m.IsCorrectPasswordMock.defaultExpectation != nil && afterIsCorrectPasswordCounter < 1 {
- if m.IsCorrectPasswordMock.defaultExpectation.params == nil {
- m.t.Error("Expected call to AuthServiceMock.IsCorrectPassword")
- } else {
- m.t.Errorf("Expected call to AuthServiceMock.IsCorrectPassword with params: %#v", *m.IsCorrectPasswordMock.defaultExpectation.params)
- }
- }
- // if func was set then invocations count should be greater than zero
- if m.funcIsCorrectPassword != nil && afterIsCorrectPasswordCounter < 1 {
- m.t.Error("Expected call to AuthServiceMock.IsCorrectPassword")
- }
- if !m.IsCorrectPasswordMock.invocationsDone() && afterIsCorrectPasswordCounter > 0 {
- m.t.Errorf("Expected %d calls to AuthServiceMock.IsCorrectPassword but found %d calls",
- mm_atomic.LoadUint64(&m.IsCorrectPasswordMock.expectedInvocations), afterIsCorrectPasswordCounter)
- }
- }
- // MinimockFinish checks that all mocked methods have been called the expected number of times
- func (m *AuthServiceMock) MinimockFinish() {
- m.finishOnce.Do(func() {
- if !m.minimockDone() {
- m.MinimockGenerateTokenInspect()
- m.MinimockGetClaimsInspect()
- m.MinimockIsCorrectPasswordInspect()
- }
- })
- }
- // MinimockWait waits for all mocked methods to be called the expected number of times
- func (m *AuthServiceMock) MinimockWait(timeout mm_time.Duration) {
- timeoutCh := mm_time.After(timeout)
- for {
- if m.minimockDone() {
- return
- }
- select {
- case <-timeoutCh:
- m.MinimockFinish()
- return
- case <-mm_time.After(10 * mm_time.Millisecond):
- }
- }
- }
- func (m *AuthServiceMock) minimockDone() bool {
- done := true
- return done &&
- m.MinimockGenerateTokenDone() &&
- m.MinimockGetClaimsDone() &&
- m.MinimockIsCorrectPasswordDone()
- }
|