auth_minimock.go 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  1. package mocks
  2. // Code generated by http://github.com/gojuno/minimock (dev). DO NOT EDIT.
  3. //go:generate minimock -i git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/interfaces.Auth -o ./mocks/auth_minimock.go -n AuthMock
  4. import (
  5. "sync"
  6. mm_atomic "sync/atomic"
  7. mm_time "time"
  8. "git.dmitriygnatenko.ru/dima/dmitriygnatenko-v2/internal/models"
  9. "github.com/gofiber/fiber/v2"
  10. "github.com/gojuno/minimock/v3"
  11. "github.com/golang-jwt/jwt/v4"
  12. )
  13. // AuthMock implements interfaces.Auth
  14. type AuthMock struct {
  15. t minimock.Tester
  16. funcGeneratePasswordHash func(password string) (s1 string, err error)
  17. inspectFuncGeneratePasswordHash func(password string)
  18. afterGeneratePasswordHashCounter uint64
  19. beforeGeneratePasswordHashCounter uint64
  20. GeneratePasswordHashMock mAuthMockGeneratePasswordHash
  21. funcGenerateToken func(user models.User) (s1 string, err error)
  22. inspectFuncGenerateToken func(user models.User)
  23. afterGenerateTokenCounter uint64
  24. beforeGenerateTokenCounter uint64
  25. GenerateTokenMock mAuthMockGenerateToken
  26. funcGetClaims func(fctx *fiber.Ctx) (m1 jwt.MapClaims)
  27. inspectFuncGetClaims func(fctx *fiber.Ctx)
  28. afterGetClaimsCounter uint64
  29. beforeGetClaimsCounter uint64
  30. GetClaimsMock mAuthMockGetClaims
  31. funcIsCorrectPassword func(password string, hash string) (b1 bool)
  32. inspectFuncIsCorrectPassword func(password string, hash string)
  33. afterIsCorrectPasswordCounter uint64
  34. beforeIsCorrectPasswordCounter uint64
  35. IsCorrectPasswordMock mAuthMockIsCorrectPassword
  36. }
  37. // NewAuthMock returns a mock for interfaces.Auth
  38. func NewAuthMock(t minimock.Tester) *AuthMock {
  39. m := &AuthMock{t: t}
  40. if controller, ok := t.(minimock.MockController); ok {
  41. controller.RegisterMocker(m)
  42. }
  43. m.GeneratePasswordHashMock = mAuthMockGeneratePasswordHash{mock: m}
  44. m.GeneratePasswordHashMock.callArgs = []*AuthMockGeneratePasswordHashParams{}
  45. m.GenerateTokenMock = mAuthMockGenerateToken{mock: m}
  46. m.GenerateTokenMock.callArgs = []*AuthMockGenerateTokenParams{}
  47. m.GetClaimsMock = mAuthMockGetClaims{mock: m}
  48. m.GetClaimsMock.callArgs = []*AuthMockGetClaimsParams{}
  49. m.IsCorrectPasswordMock = mAuthMockIsCorrectPassword{mock: m}
  50. m.IsCorrectPasswordMock.callArgs = []*AuthMockIsCorrectPasswordParams{}
  51. return m
  52. }
  53. type mAuthMockGeneratePasswordHash struct {
  54. mock *AuthMock
  55. defaultExpectation *AuthMockGeneratePasswordHashExpectation
  56. expectations []*AuthMockGeneratePasswordHashExpectation
  57. callArgs []*AuthMockGeneratePasswordHashParams
  58. mutex sync.RWMutex
  59. }
  60. // AuthMockGeneratePasswordHashExpectation specifies expectation struct of the Auth.GeneratePasswordHash
  61. type AuthMockGeneratePasswordHashExpectation struct {
  62. mock *AuthMock
  63. params *AuthMockGeneratePasswordHashParams
  64. results *AuthMockGeneratePasswordHashResults
  65. Counter uint64
  66. }
  67. // AuthMockGeneratePasswordHashParams contains parameters of the Auth.GeneratePasswordHash
  68. type AuthMockGeneratePasswordHashParams struct {
  69. password string
  70. }
  71. // AuthMockGeneratePasswordHashResults contains results of the Auth.GeneratePasswordHash
  72. type AuthMockGeneratePasswordHashResults struct {
  73. s1 string
  74. err error
  75. }
  76. // Expect sets up expected params for Auth.GeneratePasswordHash
  77. func (mmGeneratePasswordHash *mAuthMockGeneratePasswordHash) Expect(password string) *mAuthMockGeneratePasswordHash {
  78. if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil {
  79. mmGeneratePasswordHash.mock.t.Fatalf("AuthMock.GeneratePasswordHash mock is already set by Set")
  80. }
  81. if mmGeneratePasswordHash.defaultExpectation == nil {
  82. mmGeneratePasswordHash.defaultExpectation = &AuthMockGeneratePasswordHashExpectation{}
  83. }
  84. mmGeneratePasswordHash.defaultExpectation.params = &AuthMockGeneratePasswordHashParams{password}
  85. for _, e := range mmGeneratePasswordHash.expectations {
  86. if minimock.Equal(e.params, mmGeneratePasswordHash.defaultExpectation.params) {
  87. mmGeneratePasswordHash.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGeneratePasswordHash.defaultExpectation.params)
  88. }
  89. }
  90. return mmGeneratePasswordHash
  91. }
  92. // Inspect accepts an inspector function that has same arguments as the Auth.GeneratePasswordHash
  93. func (mmGeneratePasswordHash *mAuthMockGeneratePasswordHash) Inspect(f func(password string)) *mAuthMockGeneratePasswordHash {
  94. if mmGeneratePasswordHash.mock.inspectFuncGeneratePasswordHash != nil {
  95. mmGeneratePasswordHash.mock.t.Fatalf("Inspect function is already set for AuthMock.GeneratePasswordHash")
  96. }
  97. mmGeneratePasswordHash.mock.inspectFuncGeneratePasswordHash = f
  98. return mmGeneratePasswordHash
  99. }
  100. // Return sets up results that will be returned by Auth.GeneratePasswordHash
  101. func (mmGeneratePasswordHash *mAuthMockGeneratePasswordHash) Return(s1 string, err error) *AuthMock {
  102. if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil {
  103. mmGeneratePasswordHash.mock.t.Fatalf("AuthMock.GeneratePasswordHash mock is already set by Set")
  104. }
  105. if mmGeneratePasswordHash.defaultExpectation == nil {
  106. mmGeneratePasswordHash.defaultExpectation = &AuthMockGeneratePasswordHashExpectation{mock: mmGeneratePasswordHash.mock}
  107. }
  108. mmGeneratePasswordHash.defaultExpectation.results = &AuthMockGeneratePasswordHashResults{s1, err}
  109. return mmGeneratePasswordHash.mock
  110. }
  111. // Set uses given function f to mock the Auth.GeneratePasswordHash method
  112. func (mmGeneratePasswordHash *mAuthMockGeneratePasswordHash) Set(f func(password string) (s1 string, err error)) *AuthMock {
  113. if mmGeneratePasswordHash.defaultExpectation != nil {
  114. mmGeneratePasswordHash.mock.t.Fatalf("Default expectation is already set for the Auth.GeneratePasswordHash method")
  115. }
  116. if len(mmGeneratePasswordHash.expectations) > 0 {
  117. mmGeneratePasswordHash.mock.t.Fatalf("Some expectations are already set for the Auth.GeneratePasswordHash method")
  118. }
  119. mmGeneratePasswordHash.mock.funcGeneratePasswordHash = f
  120. return mmGeneratePasswordHash.mock
  121. }
  122. // When sets expectation for the Auth.GeneratePasswordHash which will trigger the result defined by the following
  123. // Then helper
  124. func (mmGeneratePasswordHash *mAuthMockGeneratePasswordHash) When(password string) *AuthMockGeneratePasswordHashExpectation {
  125. if mmGeneratePasswordHash.mock.funcGeneratePasswordHash != nil {
  126. mmGeneratePasswordHash.mock.t.Fatalf("AuthMock.GeneratePasswordHash mock is already set by Set")
  127. }
  128. expectation := &AuthMockGeneratePasswordHashExpectation{
  129. mock: mmGeneratePasswordHash.mock,
  130. params: &AuthMockGeneratePasswordHashParams{password},
  131. }
  132. mmGeneratePasswordHash.expectations = append(mmGeneratePasswordHash.expectations, expectation)
  133. return expectation
  134. }
  135. // Then sets up Auth.GeneratePasswordHash return parameters for the expectation previously defined by the When method
  136. func (e *AuthMockGeneratePasswordHashExpectation) Then(s1 string, err error) *AuthMock {
  137. e.results = &AuthMockGeneratePasswordHashResults{s1, err}
  138. return e.mock
  139. }
  140. // GeneratePasswordHash implements interfaces.Auth
  141. func (mmGeneratePasswordHash *AuthMock) GeneratePasswordHash(password string) (s1 string, err error) {
  142. mm_atomic.AddUint64(&mmGeneratePasswordHash.beforeGeneratePasswordHashCounter, 1)
  143. defer mm_atomic.AddUint64(&mmGeneratePasswordHash.afterGeneratePasswordHashCounter, 1)
  144. if mmGeneratePasswordHash.inspectFuncGeneratePasswordHash != nil {
  145. mmGeneratePasswordHash.inspectFuncGeneratePasswordHash(password)
  146. }
  147. mm_params := &AuthMockGeneratePasswordHashParams{password}
  148. // Record call args
  149. mmGeneratePasswordHash.GeneratePasswordHashMock.mutex.Lock()
  150. mmGeneratePasswordHash.GeneratePasswordHashMock.callArgs = append(mmGeneratePasswordHash.GeneratePasswordHashMock.callArgs, mm_params)
  151. mmGeneratePasswordHash.GeneratePasswordHashMock.mutex.Unlock()
  152. for _, e := range mmGeneratePasswordHash.GeneratePasswordHashMock.expectations {
  153. if minimock.Equal(e.params, mm_params) {
  154. mm_atomic.AddUint64(&e.Counter, 1)
  155. return e.results.s1, e.results.err
  156. }
  157. }
  158. if mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation != nil {
  159. mm_atomic.AddUint64(&mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.Counter, 1)
  160. mm_want := mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.params
  161. mm_got := AuthMockGeneratePasswordHashParams{password}
  162. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  163. mmGeneratePasswordHash.t.Errorf("AuthMock.GeneratePasswordHash got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  164. }
  165. mm_results := mmGeneratePasswordHash.GeneratePasswordHashMock.defaultExpectation.results
  166. if mm_results == nil {
  167. mmGeneratePasswordHash.t.Fatal("No results are set for the AuthMock.GeneratePasswordHash")
  168. }
  169. return (*mm_results).s1, (*mm_results).err
  170. }
  171. if mmGeneratePasswordHash.funcGeneratePasswordHash != nil {
  172. return mmGeneratePasswordHash.funcGeneratePasswordHash(password)
  173. }
  174. mmGeneratePasswordHash.t.Fatalf("Unexpected call to AuthMock.GeneratePasswordHash. %v", password)
  175. return
  176. }
  177. // GeneratePasswordHashAfterCounter returns a count of finished AuthMock.GeneratePasswordHash invocations
  178. func (mmGeneratePasswordHash *AuthMock) GeneratePasswordHashAfterCounter() uint64 {
  179. return mm_atomic.LoadUint64(&mmGeneratePasswordHash.afterGeneratePasswordHashCounter)
  180. }
  181. // GeneratePasswordHashBeforeCounter returns a count of AuthMock.GeneratePasswordHash invocations
  182. func (mmGeneratePasswordHash *AuthMock) GeneratePasswordHashBeforeCounter() uint64 {
  183. return mm_atomic.LoadUint64(&mmGeneratePasswordHash.beforeGeneratePasswordHashCounter)
  184. }
  185. // Calls returns a list of arguments used in each call to AuthMock.GeneratePasswordHash.
  186. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  187. func (mmGeneratePasswordHash *mAuthMockGeneratePasswordHash) Calls() []*AuthMockGeneratePasswordHashParams {
  188. mmGeneratePasswordHash.mutex.RLock()
  189. argCopy := make([]*AuthMockGeneratePasswordHashParams, len(mmGeneratePasswordHash.callArgs))
  190. copy(argCopy, mmGeneratePasswordHash.callArgs)
  191. mmGeneratePasswordHash.mutex.RUnlock()
  192. return argCopy
  193. }
  194. // MinimockGeneratePasswordHashDone returns true if the count of the GeneratePasswordHash invocations corresponds
  195. // the number of defined expectations
  196. func (m *AuthMock) MinimockGeneratePasswordHashDone() bool {
  197. for _, e := range m.GeneratePasswordHashMock.expectations {
  198. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  199. return false
  200. }
  201. }
  202. // if default expectation was set then invocations count should be greater than zero
  203. if m.GeneratePasswordHashMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGeneratePasswordHashCounter) < 1 {
  204. return false
  205. }
  206. // if func was set then invocations count should be greater than zero
  207. if m.funcGeneratePasswordHash != nil && mm_atomic.LoadUint64(&m.afterGeneratePasswordHashCounter) < 1 {
  208. return false
  209. }
  210. return true
  211. }
  212. // MinimockGeneratePasswordHashInspect logs each unmet expectation
  213. func (m *AuthMock) MinimockGeneratePasswordHashInspect() {
  214. for _, e := range m.GeneratePasswordHashMock.expectations {
  215. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  216. m.t.Errorf("Expected call to AuthMock.GeneratePasswordHash with params: %#v", *e.params)
  217. }
  218. }
  219. // if default expectation was set then invocations count should be greater than zero
  220. if m.GeneratePasswordHashMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGeneratePasswordHashCounter) < 1 {
  221. if m.GeneratePasswordHashMock.defaultExpectation.params == nil {
  222. m.t.Error("Expected call to AuthMock.GeneratePasswordHash")
  223. } else {
  224. m.t.Errorf("Expected call to AuthMock.GeneratePasswordHash with params: %#v", *m.GeneratePasswordHashMock.defaultExpectation.params)
  225. }
  226. }
  227. // if func was set then invocations count should be greater than zero
  228. if m.funcGeneratePasswordHash != nil && mm_atomic.LoadUint64(&m.afterGeneratePasswordHashCounter) < 1 {
  229. m.t.Error("Expected call to AuthMock.GeneratePasswordHash")
  230. }
  231. }
  232. type mAuthMockGenerateToken struct {
  233. mock *AuthMock
  234. defaultExpectation *AuthMockGenerateTokenExpectation
  235. expectations []*AuthMockGenerateTokenExpectation
  236. callArgs []*AuthMockGenerateTokenParams
  237. mutex sync.RWMutex
  238. }
  239. // AuthMockGenerateTokenExpectation specifies expectation struct of the Auth.GenerateToken
  240. type AuthMockGenerateTokenExpectation struct {
  241. mock *AuthMock
  242. params *AuthMockGenerateTokenParams
  243. results *AuthMockGenerateTokenResults
  244. Counter uint64
  245. }
  246. // AuthMockGenerateTokenParams contains parameters of the Auth.GenerateToken
  247. type AuthMockGenerateTokenParams struct {
  248. user models.User
  249. }
  250. // AuthMockGenerateTokenResults contains results of the Auth.GenerateToken
  251. type AuthMockGenerateTokenResults struct {
  252. s1 string
  253. err error
  254. }
  255. // Expect sets up expected params for Auth.GenerateToken
  256. func (mmGenerateToken *mAuthMockGenerateToken) Expect(user models.User) *mAuthMockGenerateToken {
  257. if mmGenerateToken.mock.funcGenerateToken != nil {
  258. mmGenerateToken.mock.t.Fatalf("AuthMock.GenerateToken mock is already set by Set")
  259. }
  260. if mmGenerateToken.defaultExpectation == nil {
  261. mmGenerateToken.defaultExpectation = &AuthMockGenerateTokenExpectation{}
  262. }
  263. mmGenerateToken.defaultExpectation.params = &AuthMockGenerateTokenParams{user}
  264. for _, e := range mmGenerateToken.expectations {
  265. if minimock.Equal(e.params, mmGenerateToken.defaultExpectation.params) {
  266. mmGenerateToken.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGenerateToken.defaultExpectation.params)
  267. }
  268. }
  269. return mmGenerateToken
  270. }
  271. // Inspect accepts an inspector function that has same arguments as the Auth.GenerateToken
  272. func (mmGenerateToken *mAuthMockGenerateToken) Inspect(f func(user models.User)) *mAuthMockGenerateToken {
  273. if mmGenerateToken.mock.inspectFuncGenerateToken != nil {
  274. mmGenerateToken.mock.t.Fatalf("Inspect function is already set for AuthMock.GenerateToken")
  275. }
  276. mmGenerateToken.mock.inspectFuncGenerateToken = f
  277. return mmGenerateToken
  278. }
  279. // Return sets up results that will be returned by Auth.GenerateToken
  280. func (mmGenerateToken *mAuthMockGenerateToken) Return(s1 string, err error) *AuthMock {
  281. if mmGenerateToken.mock.funcGenerateToken != nil {
  282. mmGenerateToken.mock.t.Fatalf("AuthMock.GenerateToken mock is already set by Set")
  283. }
  284. if mmGenerateToken.defaultExpectation == nil {
  285. mmGenerateToken.defaultExpectation = &AuthMockGenerateTokenExpectation{mock: mmGenerateToken.mock}
  286. }
  287. mmGenerateToken.defaultExpectation.results = &AuthMockGenerateTokenResults{s1, err}
  288. return mmGenerateToken.mock
  289. }
  290. // Set uses given function f to mock the Auth.GenerateToken method
  291. func (mmGenerateToken *mAuthMockGenerateToken) Set(f func(user models.User) (s1 string, err error)) *AuthMock {
  292. if mmGenerateToken.defaultExpectation != nil {
  293. mmGenerateToken.mock.t.Fatalf("Default expectation is already set for the Auth.GenerateToken method")
  294. }
  295. if len(mmGenerateToken.expectations) > 0 {
  296. mmGenerateToken.mock.t.Fatalf("Some expectations are already set for the Auth.GenerateToken method")
  297. }
  298. mmGenerateToken.mock.funcGenerateToken = f
  299. return mmGenerateToken.mock
  300. }
  301. // When sets expectation for the Auth.GenerateToken which will trigger the result defined by the following
  302. // Then helper
  303. func (mmGenerateToken *mAuthMockGenerateToken) When(user models.User) *AuthMockGenerateTokenExpectation {
  304. if mmGenerateToken.mock.funcGenerateToken != nil {
  305. mmGenerateToken.mock.t.Fatalf("AuthMock.GenerateToken mock is already set by Set")
  306. }
  307. expectation := &AuthMockGenerateTokenExpectation{
  308. mock: mmGenerateToken.mock,
  309. params: &AuthMockGenerateTokenParams{user},
  310. }
  311. mmGenerateToken.expectations = append(mmGenerateToken.expectations, expectation)
  312. return expectation
  313. }
  314. // Then sets up Auth.GenerateToken return parameters for the expectation previously defined by the When method
  315. func (e *AuthMockGenerateTokenExpectation) Then(s1 string, err error) *AuthMock {
  316. e.results = &AuthMockGenerateTokenResults{s1, err}
  317. return e.mock
  318. }
  319. // GenerateToken implements interfaces.Auth
  320. func (mmGenerateToken *AuthMock) GenerateToken(user models.User) (s1 string, err error) {
  321. mm_atomic.AddUint64(&mmGenerateToken.beforeGenerateTokenCounter, 1)
  322. defer mm_atomic.AddUint64(&mmGenerateToken.afterGenerateTokenCounter, 1)
  323. if mmGenerateToken.inspectFuncGenerateToken != nil {
  324. mmGenerateToken.inspectFuncGenerateToken(user)
  325. }
  326. mm_params := &AuthMockGenerateTokenParams{user}
  327. // Record call args
  328. mmGenerateToken.GenerateTokenMock.mutex.Lock()
  329. mmGenerateToken.GenerateTokenMock.callArgs = append(mmGenerateToken.GenerateTokenMock.callArgs, mm_params)
  330. mmGenerateToken.GenerateTokenMock.mutex.Unlock()
  331. for _, e := range mmGenerateToken.GenerateTokenMock.expectations {
  332. if minimock.Equal(e.params, mm_params) {
  333. mm_atomic.AddUint64(&e.Counter, 1)
  334. return e.results.s1, e.results.err
  335. }
  336. }
  337. if mmGenerateToken.GenerateTokenMock.defaultExpectation != nil {
  338. mm_atomic.AddUint64(&mmGenerateToken.GenerateTokenMock.defaultExpectation.Counter, 1)
  339. mm_want := mmGenerateToken.GenerateTokenMock.defaultExpectation.params
  340. mm_got := AuthMockGenerateTokenParams{user}
  341. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  342. mmGenerateToken.t.Errorf("AuthMock.GenerateToken got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  343. }
  344. mm_results := mmGenerateToken.GenerateTokenMock.defaultExpectation.results
  345. if mm_results == nil {
  346. mmGenerateToken.t.Fatal("No results are set for the AuthMock.GenerateToken")
  347. }
  348. return (*mm_results).s1, (*mm_results).err
  349. }
  350. if mmGenerateToken.funcGenerateToken != nil {
  351. return mmGenerateToken.funcGenerateToken(user)
  352. }
  353. mmGenerateToken.t.Fatalf("Unexpected call to AuthMock.GenerateToken. %v", user)
  354. return
  355. }
  356. // GenerateTokenAfterCounter returns a count of finished AuthMock.GenerateToken invocations
  357. func (mmGenerateToken *AuthMock) GenerateTokenAfterCounter() uint64 {
  358. return mm_atomic.LoadUint64(&mmGenerateToken.afterGenerateTokenCounter)
  359. }
  360. // GenerateTokenBeforeCounter returns a count of AuthMock.GenerateToken invocations
  361. func (mmGenerateToken *AuthMock) GenerateTokenBeforeCounter() uint64 {
  362. return mm_atomic.LoadUint64(&mmGenerateToken.beforeGenerateTokenCounter)
  363. }
  364. // Calls returns a list of arguments used in each call to AuthMock.GenerateToken.
  365. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  366. func (mmGenerateToken *mAuthMockGenerateToken) Calls() []*AuthMockGenerateTokenParams {
  367. mmGenerateToken.mutex.RLock()
  368. argCopy := make([]*AuthMockGenerateTokenParams, len(mmGenerateToken.callArgs))
  369. copy(argCopy, mmGenerateToken.callArgs)
  370. mmGenerateToken.mutex.RUnlock()
  371. return argCopy
  372. }
  373. // MinimockGenerateTokenDone returns true if the count of the GenerateToken invocations corresponds
  374. // the number of defined expectations
  375. func (m *AuthMock) MinimockGenerateTokenDone() bool {
  376. for _, e := range m.GenerateTokenMock.expectations {
  377. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  378. return false
  379. }
  380. }
  381. // if default expectation was set then invocations count should be greater than zero
  382. if m.GenerateTokenMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGenerateTokenCounter) < 1 {
  383. return false
  384. }
  385. // if func was set then invocations count should be greater than zero
  386. if m.funcGenerateToken != nil && mm_atomic.LoadUint64(&m.afterGenerateTokenCounter) < 1 {
  387. return false
  388. }
  389. return true
  390. }
  391. // MinimockGenerateTokenInspect logs each unmet expectation
  392. func (m *AuthMock) MinimockGenerateTokenInspect() {
  393. for _, e := range m.GenerateTokenMock.expectations {
  394. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  395. m.t.Errorf("Expected call to AuthMock.GenerateToken with params: %#v", *e.params)
  396. }
  397. }
  398. // if default expectation was set then invocations count should be greater than zero
  399. if m.GenerateTokenMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGenerateTokenCounter) < 1 {
  400. if m.GenerateTokenMock.defaultExpectation.params == nil {
  401. m.t.Error("Expected call to AuthMock.GenerateToken")
  402. } else {
  403. m.t.Errorf("Expected call to AuthMock.GenerateToken with params: %#v", *m.GenerateTokenMock.defaultExpectation.params)
  404. }
  405. }
  406. // if func was set then invocations count should be greater than zero
  407. if m.funcGenerateToken != nil && mm_atomic.LoadUint64(&m.afterGenerateTokenCounter) < 1 {
  408. m.t.Error("Expected call to AuthMock.GenerateToken")
  409. }
  410. }
  411. type mAuthMockGetClaims struct {
  412. mock *AuthMock
  413. defaultExpectation *AuthMockGetClaimsExpectation
  414. expectations []*AuthMockGetClaimsExpectation
  415. callArgs []*AuthMockGetClaimsParams
  416. mutex sync.RWMutex
  417. }
  418. // AuthMockGetClaimsExpectation specifies expectation struct of the Auth.GetClaims
  419. type AuthMockGetClaimsExpectation struct {
  420. mock *AuthMock
  421. params *AuthMockGetClaimsParams
  422. results *AuthMockGetClaimsResults
  423. Counter uint64
  424. }
  425. // AuthMockGetClaimsParams contains parameters of the Auth.GetClaims
  426. type AuthMockGetClaimsParams struct {
  427. fctx *fiber.Ctx
  428. }
  429. // AuthMockGetClaimsResults contains results of the Auth.GetClaims
  430. type AuthMockGetClaimsResults struct {
  431. m1 jwt.MapClaims
  432. }
  433. // Expect sets up expected params for Auth.GetClaims
  434. func (mmGetClaims *mAuthMockGetClaims) Expect(fctx *fiber.Ctx) *mAuthMockGetClaims {
  435. if mmGetClaims.mock.funcGetClaims != nil {
  436. mmGetClaims.mock.t.Fatalf("AuthMock.GetClaims mock is already set by Set")
  437. }
  438. if mmGetClaims.defaultExpectation == nil {
  439. mmGetClaims.defaultExpectation = &AuthMockGetClaimsExpectation{}
  440. }
  441. mmGetClaims.defaultExpectation.params = &AuthMockGetClaimsParams{fctx}
  442. for _, e := range mmGetClaims.expectations {
  443. if minimock.Equal(e.params, mmGetClaims.defaultExpectation.params) {
  444. mmGetClaims.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmGetClaims.defaultExpectation.params)
  445. }
  446. }
  447. return mmGetClaims
  448. }
  449. // Inspect accepts an inspector function that has same arguments as the Auth.GetClaims
  450. func (mmGetClaims *mAuthMockGetClaims) Inspect(f func(fctx *fiber.Ctx)) *mAuthMockGetClaims {
  451. if mmGetClaims.mock.inspectFuncGetClaims != nil {
  452. mmGetClaims.mock.t.Fatalf("Inspect function is already set for AuthMock.GetClaims")
  453. }
  454. mmGetClaims.mock.inspectFuncGetClaims = f
  455. return mmGetClaims
  456. }
  457. // Return sets up results that will be returned by Auth.GetClaims
  458. func (mmGetClaims *mAuthMockGetClaims) Return(m1 jwt.MapClaims) *AuthMock {
  459. if mmGetClaims.mock.funcGetClaims != nil {
  460. mmGetClaims.mock.t.Fatalf("AuthMock.GetClaims mock is already set by Set")
  461. }
  462. if mmGetClaims.defaultExpectation == nil {
  463. mmGetClaims.defaultExpectation = &AuthMockGetClaimsExpectation{mock: mmGetClaims.mock}
  464. }
  465. mmGetClaims.defaultExpectation.results = &AuthMockGetClaimsResults{m1}
  466. return mmGetClaims.mock
  467. }
  468. // Set uses given function f to mock the Auth.GetClaims method
  469. func (mmGetClaims *mAuthMockGetClaims) Set(f func(fctx *fiber.Ctx) (m1 jwt.MapClaims)) *AuthMock {
  470. if mmGetClaims.defaultExpectation != nil {
  471. mmGetClaims.mock.t.Fatalf("Default expectation is already set for the Auth.GetClaims method")
  472. }
  473. if len(mmGetClaims.expectations) > 0 {
  474. mmGetClaims.mock.t.Fatalf("Some expectations are already set for the Auth.GetClaims method")
  475. }
  476. mmGetClaims.mock.funcGetClaims = f
  477. return mmGetClaims.mock
  478. }
  479. // When sets expectation for the Auth.GetClaims which will trigger the result defined by the following
  480. // Then helper
  481. func (mmGetClaims *mAuthMockGetClaims) When(fctx *fiber.Ctx) *AuthMockGetClaimsExpectation {
  482. if mmGetClaims.mock.funcGetClaims != nil {
  483. mmGetClaims.mock.t.Fatalf("AuthMock.GetClaims mock is already set by Set")
  484. }
  485. expectation := &AuthMockGetClaimsExpectation{
  486. mock: mmGetClaims.mock,
  487. params: &AuthMockGetClaimsParams{fctx},
  488. }
  489. mmGetClaims.expectations = append(mmGetClaims.expectations, expectation)
  490. return expectation
  491. }
  492. // Then sets up Auth.GetClaims return parameters for the expectation previously defined by the When method
  493. func (e *AuthMockGetClaimsExpectation) Then(m1 jwt.MapClaims) *AuthMock {
  494. e.results = &AuthMockGetClaimsResults{m1}
  495. return e.mock
  496. }
  497. // GetClaims implements interfaces.Auth
  498. func (mmGetClaims *AuthMock) GetClaims(fctx *fiber.Ctx) (m1 jwt.MapClaims) {
  499. mm_atomic.AddUint64(&mmGetClaims.beforeGetClaimsCounter, 1)
  500. defer mm_atomic.AddUint64(&mmGetClaims.afterGetClaimsCounter, 1)
  501. if mmGetClaims.inspectFuncGetClaims != nil {
  502. mmGetClaims.inspectFuncGetClaims(fctx)
  503. }
  504. mm_params := &AuthMockGetClaimsParams{fctx}
  505. // Record call args
  506. mmGetClaims.GetClaimsMock.mutex.Lock()
  507. mmGetClaims.GetClaimsMock.callArgs = append(mmGetClaims.GetClaimsMock.callArgs, mm_params)
  508. mmGetClaims.GetClaimsMock.mutex.Unlock()
  509. for _, e := range mmGetClaims.GetClaimsMock.expectations {
  510. if minimock.Equal(e.params, mm_params) {
  511. mm_atomic.AddUint64(&e.Counter, 1)
  512. return e.results.m1
  513. }
  514. }
  515. if mmGetClaims.GetClaimsMock.defaultExpectation != nil {
  516. mm_atomic.AddUint64(&mmGetClaims.GetClaimsMock.defaultExpectation.Counter, 1)
  517. mm_want := mmGetClaims.GetClaimsMock.defaultExpectation.params
  518. mm_got := AuthMockGetClaimsParams{fctx}
  519. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  520. mmGetClaims.t.Errorf("AuthMock.GetClaims got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  521. }
  522. mm_results := mmGetClaims.GetClaimsMock.defaultExpectation.results
  523. if mm_results == nil {
  524. mmGetClaims.t.Fatal("No results are set for the AuthMock.GetClaims")
  525. }
  526. return (*mm_results).m1
  527. }
  528. if mmGetClaims.funcGetClaims != nil {
  529. return mmGetClaims.funcGetClaims(fctx)
  530. }
  531. mmGetClaims.t.Fatalf("Unexpected call to AuthMock.GetClaims. %v", fctx)
  532. return
  533. }
  534. // GetClaimsAfterCounter returns a count of finished AuthMock.GetClaims invocations
  535. func (mmGetClaims *AuthMock) GetClaimsAfterCounter() uint64 {
  536. return mm_atomic.LoadUint64(&mmGetClaims.afterGetClaimsCounter)
  537. }
  538. // GetClaimsBeforeCounter returns a count of AuthMock.GetClaims invocations
  539. func (mmGetClaims *AuthMock) GetClaimsBeforeCounter() uint64 {
  540. return mm_atomic.LoadUint64(&mmGetClaims.beforeGetClaimsCounter)
  541. }
  542. // Calls returns a list of arguments used in each call to AuthMock.GetClaims.
  543. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  544. func (mmGetClaims *mAuthMockGetClaims) Calls() []*AuthMockGetClaimsParams {
  545. mmGetClaims.mutex.RLock()
  546. argCopy := make([]*AuthMockGetClaimsParams, len(mmGetClaims.callArgs))
  547. copy(argCopy, mmGetClaims.callArgs)
  548. mmGetClaims.mutex.RUnlock()
  549. return argCopy
  550. }
  551. // MinimockGetClaimsDone returns true if the count of the GetClaims invocations corresponds
  552. // the number of defined expectations
  553. func (m *AuthMock) MinimockGetClaimsDone() bool {
  554. for _, e := range m.GetClaimsMock.expectations {
  555. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  556. return false
  557. }
  558. }
  559. // if default expectation was set then invocations count should be greater than zero
  560. if m.GetClaimsMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetClaimsCounter) < 1 {
  561. return false
  562. }
  563. // if func was set then invocations count should be greater than zero
  564. if m.funcGetClaims != nil && mm_atomic.LoadUint64(&m.afterGetClaimsCounter) < 1 {
  565. return false
  566. }
  567. return true
  568. }
  569. // MinimockGetClaimsInspect logs each unmet expectation
  570. func (m *AuthMock) MinimockGetClaimsInspect() {
  571. for _, e := range m.GetClaimsMock.expectations {
  572. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  573. m.t.Errorf("Expected call to AuthMock.GetClaims with params: %#v", *e.params)
  574. }
  575. }
  576. // if default expectation was set then invocations count should be greater than zero
  577. if m.GetClaimsMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterGetClaimsCounter) < 1 {
  578. if m.GetClaimsMock.defaultExpectation.params == nil {
  579. m.t.Error("Expected call to AuthMock.GetClaims")
  580. } else {
  581. m.t.Errorf("Expected call to AuthMock.GetClaims with params: %#v", *m.GetClaimsMock.defaultExpectation.params)
  582. }
  583. }
  584. // if func was set then invocations count should be greater than zero
  585. if m.funcGetClaims != nil && mm_atomic.LoadUint64(&m.afterGetClaimsCounter) < 1 {
  586. m.t.Error("Expected call to AuthMock.GetClaims")
  587. }
  588. }
  589. type mAuthMockIsCorrectPassword struct {
  590. mock *AuthMock
  591. defaultExpectation *AuthMockIsCorrectPasswordExpectation
  592. expectations []*AuthMockIsCorrectPasswordExpectation
  593. callArgs []*AuthMockIsCorrectPasswordParams
  594. mutex sync.RWMutex
  595. }
  596. // AuthMockIsCorrectPasswordExpectation specifies expectation struct of the Auth.IsCorrectPassword
  597. type AuthMockIsCorrectPasswordExpectation struct {
  598. mock *AuthMock
  599. params *AuthMockIsCorrectPasswordParams
  600. results *AuthMockIsCorrectPasswordResults
  601. Counter uint64
  602. }
  603. // AuthMockIsCorrectPasswordParams contains parameters of the Auth.IsCorrectPassword
  604. type AuthMockIsCorrectPasswordParams struct {
  605. password string
  606. hash string
  607. }
  608. // AuthMockIsCorrectPasswordResults contains results of the Auth.IsCorrectPassword
  609. type AuthMockIsCorrectPasswordResults struct {
  610. b1 bool
  611. }
  612. // Expect sets up expected params for Auth.IsCorrectPassword
  613. func (mmIsCorrectPassword *mAuthMockIsCorrectPassword) Expect(password string, hash string) *mAuthMockIsCorrectPassword {
  614. if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
  615. mmIsCorrectPassword.mock.t.Fatalf("AuthMock.IsCorrectPassword mock is already set by Set")
  616. }
  617. if mmIsCorrectPassword.defaultExpectation == nil {
  618. mmIsCorrectPassword.defaultExpectation = &AuthMockIsCorrectPasswordExpectation{}
  619. }
  620. mmIsCorrectPassword.defaultExpectation.params = &AuthMockIsCorrectPasswordParams{password, hash}
  621. for _, e := range mmIsCorrectPassword.expectations {
  622. if minimock.Equal(e.params, mmIsCorrectPassword.defaultExpectation.params) {
  623. mmIsCorrectPassword.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmIsCorrectPassword.defaultExpectation.params)
  624. }
  625. }
  626. return mmIsCorrectPassword
  627. }
  628. // Inspect accepts an inspector function that has same arguments as the Auth.IsCorrectPassword
  629. func (mmIsCorrectPassword *mAuthMockIsCorrectPassword) Inspect(f func(password string, hash string)) *mAuthMockIsCorrectPassword {
  630. if mmIsCorrectPassword.mock.inspectFuncIsCorrectPassword != nil {
  631. mmIsCorrectPassword.mock.t.Fatalf("Inspect function is already set for AuthMock.IsCorrectPassword")
  632. }
  633. mmIsCorrectPassword.mock.inspectFuncIsCorrectPassword = f
  634. return mmIsCorrectPassword
  635. }
  636. // Return sets up results that will be returned by Auth.IsCorrectPassword
  637. func (mmIsCorrectPassword *mAuthMockIsCorrectPassword) Return(b1 bool) *AuthMock {
  638. if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
  639. mmIsCorrectPassword.mock.t.Fatalf("AuthMock.IsCorrectPassword mock is already set by Set")
  640. }
  641. if mmIsCorrectPassword.defaultExpectation == nil {
  642. mmIsCorrectPassword.defaultExpectation = &AuthMockIsCorrectPasswordExpectation{mock: mmIsCorrectPassword.mock}
  643. }
  644. mmIsCorrectPassword.defaultExpectation.results = &AuthMockIsCorrectPasswordResults{b1}
  645. return mmIsCorrectPassword.mock
  646. }
  647. // Set uses given function f to mock the Auth.IsCorrectPassword method
  648. func (mmIsCorrectPassword *mAuthMockIsCorrectPassword) Set(f func(password string, hash string) (b1 bool)) *AuthMock {
  649. if mmIsCorrectPassword.defaultExpectation != nil {
  650. mmIsCorrectPassword.mock.t.Fatalf("Default expectation is already set for the Auth.IsCorrectPassword method")
  651. }
  652. if len(mmIsCorrectPassword.expectations) > 0 {
  653. mmIsCorrectPassword.mock.t.Fatalf("Some expectations are already set for the Auth.IsCorrectPassword method")
  654. }
  655. mmIsCorrectPassword.mock.funcIsCorrectPassword = f
  656. return mmIsCorrectPassword.mock
  657. }
  658. // When sets expectation for the Auth.IsCorrectPassword which will trigger the result defined by the following
  659. // Then helper
  660. func (mmIsCorrectPassword *mAuthMockIsCorrectPassword) When(password string, hash string) *AuthMockIsCorrectPasswordExpectation {
  661. if mmIsCorrectPassword.mock.funcIsCorrectPassword != nil {
  662. mmIsCorrectPassword.mock.t.Fatalf("AuthMock.IsCorrectPassword mock is already set by Set")
  663. }
  664. expectation := &AuthMockIsCorrectPasswordExpectation{
  665. mock: mmIsCorrectPassword.mock,
  666. params: &AuthMockIsCorrectPasswordParams{password, hash},
  667. }
  668. mmIsCorrectPassword.expectations = append(mmIsCorrectPassword.expectations, expectation)
  669. return expectation
  670. }
  671. // Then sets up Auth.IsCorrectPassword return parameters for the expectation previously defined by the When method
  672. func (e *AuthMockIsCorrectPasswordExpectation) Then(b1 bool) *AuthMock {
  673. e.results = &AuthMockIsCorrectPasswordResults{b1}
  674. return e.mock
  675. }
  676. // IsCorrectPassword implements interfaces.Auth
  677. func (mmIsCorrectPassword *AuthMock) IsCorrectPassword(password string, hash string) (b1 bool) {
  678. mm_atomic.AddUint64(&mmIsCorrectPassword.beforeIsCorrectPasswordCounter, 1)
  679. defer mm_atomic.AddUint64(&mmIsCorrectPassword.afterIsCorrectPasswordCounter, 1)
  680. if mmIsCorrectPassword.inspectFuncIsCorrectPassword != nil {
  681. mmIsCorrectPassword.inspectFuncIsCorrectPassword(password, hash)
  682. }
  683. mm_params := &AuthMockIsCorrectPasswordParams{password, hash}
  684. // Record call args
  685. mmIsCorrectPassword.IsCorrectPasswordMock.mutex.Lock()
  686. mmIsCorrectPassword.IsCorrectPasswordMock.callArgs = append(mmIsCorrectPassword.IsCorrectPasswordMock.callArgs, mm_params)
  687. mmIsCorrectPassword.IsCorrectPasswordMock.mutex.Unlock()
  688. for _, e := range mmIsCorrectPassword.IsCorrectPasswordMock.expectations {
  689. if minimock.Equal(e.params, mm_params) {
  690. mm_atomic.AddUint64(&e.Counter, 1)
  691. return e.results.b1
  692. }
  693. }
  694. if mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation != nil {
  695. mm_atomic.AddUint64(&mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.Counter, 1)
  696. mm_want := mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.params
  697. mm_got := AuthMockIsCorrectPasswordParams{password, hash}
  698. if mm_want != nil && !minimock.Equal(*mm_want, mm_got) {
  699. mmIsCorrectPassword.t.Errorf("AuthMock.IsCorrectPassword got unexpected parameters, want: %#v, got: %#v%s\n", *mm_want, mm_got, minimock.Diff(*mm_want, mm_got))
  700. }
  701. mm_results := mmIsCorrectPassword.IsCorrectPasswordMock.defaultExpectation.results
  702. if mm_results == nil {
  703. mmIsCorrectPassword.t.Fatal("No results are set for the AuthMock.IsCorrectPassword")
  704. }
  705. return (*mm_results).b1
  706. }
  707. if mmIsCorrectPassword.funcIsCorrectPassword != nil {
  708. return mmIsCorrectPassword.funcIsCorrectPassword(password, hash)
  709. }
  710. mmIsCorrectPassword.t.Fatalf("Unexpected call to AuthMock.IsCorrectPassword. %v %v", password, hash)
  711. return
  712. }
  713. // IsCorrectPasswordAfterCounter returns a count of finished AuthMock.IsCorrectPassword invocations
  714. func (mmIsCorrectPassword *AuthMock) IsCorrectPasswordAfterCounter() uint64 {
  715. return mm_atomic.LoadUint64(&mmIsCorrectPassword.afterIsCorrectPasswordCounter)
  716. }
  717. // IsCorrectPasswordBeforeCounter returns a count of AuthMock.IsCorrectPassword invocations
  718. func (mmIsCorrectPassword *AuthMock) IsCorrectPasswordBeforeCounter() uint64 {
  719. return mm_atomic.LoadUint64(&mmIsCorrectPassword.beforeIsCorrectPasswordCounter)
  720. }
  721. // Calls returns a list of arguments used in each call to AuthMock.IsCorrectPassword.
  722. // The list is in the same order as the calls were made (i.e. recent calls have a higher index)
  723. func (mmIsCorrectPassword *mAuthMockIsCorrectPassword) Calls() []*AuthMockIsCorrectPasswordParams {
  724. mmIsCorrectPassword.mutex.RLock()
  725. argCopy := make([]*AuthMockIsCorrectPasswordParams, len(mmIsCorrectPassword.callArgs))
  726. copy(argCopy, mmIsCorrectPassword.callArgs)
  727. mmIsCorrectPassword.mutex.RUnlock()
  728. return argCopy
  729. }
  730. // MinimockIsCorrectPasswordDone returns true if the count of the IsCorrectPassword invocations corresponds
  731. // the number of defined expectations
  732. func (m *AuthMock) MinimockIsCorrectPasswordDone() bool {
  733. for _, e := range m.IsCorrectPasswordMock.expectations {
  734. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  735. return false
  736. }
  737. }
  738. // if default expectation was set then invocations count should be greater than zero
  739. if m.IsCorrectPasswordMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterIsCorrectPasswordCounter) < 1 {
  740. return false
  741. }
  742. // if func was set then invocations count should be greater than zero
  743. if m.funcIsCorrectPassword != nil && mm_atomic.LoadUint64(&m.afterIsCorrectPasswordCounter) < 1 {
  744. return false
  745. }
  746. return true
  747. }
  748. // MinimockIsCorrectPasswordInspect logs each unmet expectation
  749. func (m *AuthMock) MinimockIsCorrectPasswordInspect() {
  750. for _, e := range m.IsCorrectPasswordMock.expectations {
  751. if mm_atomic.LoadUint64(&e.Counter) < 1 {
  752. m.t.Errorf("Expected call to AuthMock.IsCorrectPassword with params: %#v", *e.params)
  753. }
  754. }
  755. // if default expectation was set then invocations count should be greater than zero
  756. if m.IsCorrectPasswordMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterIsCorrectPasswordCounter) < 1 {
  757. if m.IsCorrectPasswordMock.defaultExpectation.params == nil {
  758. m.t.Error("Expected call to AuthMock.IsCorrectPassword")
  759. } else {
  760. m.t.Errorf("Expected call to AuthMock.IsCorrectPassword with params: %#v", *m.IsCorrectPasswordMock.defaultExpectation.params)
  761. }
  762. }
  763. // if func was set then invocations count should be greater than zero
  764. if m.funcIsCorrectPassword != nil && mm_atomic.LoadUint64(&m.afterIsCorrectPasswordCounter) < 1 {
  765. m.t.Error("Expected call to AuthMock.IsCorrectPassword")
  766. }
  767. }
  768. // MinimockFinish checks that all mocked methods have been called the expected number of times
  769. func (m *AuthMock) MinimockFinish() {
  770. if !m.minimockDone() {
  771. m.MinimockGeneratePasswordHashInspect()
  772. m.MinimockGenerateTokenInspect()
  773. m.MinimockGetClaimsInspect()
  774. m.MinimockIsCorrectPasswordInspect()
  775. m.t.FailNow()
  776. }
  777. }
  778. // MinimockWait waits for all mocked methods to be called the expected number of times
  779. func (m *AuthMock) MinimockWait(timeout mm_time.Duration) {
  780. timeoutCh := mm_time.After(timeout)
  781. for {
  782. if m.minimockDone() {
  783. return
  784. }
  785. select {
  786. case <-timeoutCh:
  787. m.MinimockFinish()
  788. return
  789. case <-mm_time.After(10 * mm_time.Millisecond):
  790. }
  791. }
  792. }
  793. func (m *AuthMock) minimockDone() bool {
  794. done := true
  795. return done &&
  796. m.MinimockGeneratePasswordHashDone() &&
  797. m.MinimockGenerateTokenDone() &&
  798. m.MinimockGetClaimsDone() &&
  799. m.MinimockIsCorrectPasswordDone()
  800. }