mocks_test.go 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912
  1. // Code generated by go-mockgen 1.3.7; DO NOT EDIT.
  2. //
  3. // This file was generated by running `go-mockgen` at the root of this repository.
  4. // To add additional mocks to this or another package, add a new entry to the
  5. // mockgen.yaml file in the root of this repository.
  6. package database
  7. import "sync"
  8. // MockLoginSourceFileStore is a mock implementation of the
  9. // loginSourceFileStore interface (from the package
  10. // gogs.io/gogs/internal/database) used for unit testing.
  11. type MockLoginSourceFileStore struct {
  12. // SaveFunc is an instance of a mock function object controlling the
  13. // behavior of the method Save.
  14. SaveFunc *LoginSourceFileStoreSaveFunc
  15. // SetConfigFunc is an instance of a mock function object controlling
  16. // the behavior of the method SetConfig.
  17. SetConfigFunc *LoginSourceFileStoreSetConfigFunc
  18. // SetGeneralFunc is an instance of a mock function object controlling
  19. // the behavior of the method SetGeneral.
  20. SetGeneralFunc *LoginSourceFileStoreSetGeneralFunc
  21. }
  22. // NewMockLoginSourceFileStore creates a new mock of the
  23. // loginSourceFileStore interface. All methods return zero values for all
  24. // results, unless overwritten.
  25. func NewMockLoginSourceFileStore() *MockLoginSourceFileStore {
  26. return &MockLoginSourceFileStore{
  27. SaveFunc: &LoginSourceFileStoreSaveFunc{
  28. defaultHook: func() (r0 error) {
  29. return
  30. },
  31. },
  32. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  33. defaultHook: func(interface{}) (r0 error) {
  34. return
  35. },
  36. },
  37. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  38. defaultHook: func(string, string) {
  39. return
  40. },
  41. },
  42. }
  43. }
  44. // NewStrictMockLoginSourceFileStore creates a new mock of the
  45. // loginSourceFileStore interface. All methods panic on invocation, unless
  46. // overwritten.
  47. func NewStrictMockLoginSourceFileStore() *MockLoginSourceFileStore {
  48. return &MockLoginSourceFileStore{
  49. SaveFunc: &LoginSourceFileStoreSaveFunc{
  50. defaultHook: func() error {
  51. panic("unexpected invocation of MockLoginSourceFileStore.Save")
  52. },
  53. },
  54. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  55. defaultHook: func(interface{}) error {
  56. panic("unexpected invocation of MockLoginSourceFileStore.SetConfig")
  57. },
  58. },
  59. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  60. defaultHook: func(string, string) {
  61. panic("unexpected invocation of MockLoginSourceFileStore.SetGeneral")
  62. },
  63. },
  64. }
  65. }
  66. // surrogateMockLoginSourceFileStore is a copy of the loginSourceFileStore
  67. // interface (from the package gogs.io/gogs/internal/database). It is
  68. // redefined here as it is unexported in the source package.
  69. type surrogateMockLoginSourceFileStore interface {
  70. Save() error
  71. SetConfig(interface{}) error
  72. SetGeneral(string, string)
  73. }
  74. // NewMockLoginSourceFileStoreFrom creates a new mock of the
  75. // MockLoginSourceFileStore interface. All methods delegate to the given
  76. // implementation, unless overwritten.
  77. func NewMockLoginSourceFileStoreFrom(i surrogateMockLoginSourceFileStore) *MockLoginSourceFileStore {
  78. return &MockLoginSourceFileStore{
  79. SaveFunc: &LoginSourceFileStoreSaveFunc{
  80. defaultHook: i.Save,
  81. },
  82. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  83. defaultHook: i.SetConfig,
  84. },
  85. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  86. defaultHook: i.SetGeneral,
  87. },
  88. }
  89. }
  90. // LoginSourceFileStoreSaveFunc describes the behavior when the Save method
  91. // of the parent MockLoginSourceFileStore instance is invoked.
  92. type LoginSourceFileStoreSaveFunc struct {
  93. defaultHook func() error
  94. hooks []func() error
  95. history []LoginSourceFileStoreSaveFuncCall
  96. mutex sync.Mutex
  97. }
  98. // Save delegates to the next hook function in the queue and stores the
  99. // parameter and result values of this invocation.
  100. func (m *MockLoginSourceFileStore) Save() error {
  101. r0 := m.SaveFunc.nextHook()()
  102. m.SaveFunc.appendCall(LoginSourceFileStoreSaveFuncCall{r0})
  103. return r0
  104. }
  105. // SetDefaultHook sets function that is called when the Save method of the
  106. // parent MockLoginSourceFileStore instance is invoked and the hook queue is
  107. // empty.
  108. func (f *LoginSourceFileStoreSaveFunc) SetDefaultHook(hook func() error) {
  109. f.defaultHook = hook
  110. }
  111. // PushHook adds a function to the end of hook queue. Each invocation of the
  112. // Save method of the parent MockLoginSourceFileStore instance invokes the
  113. // hook at the front of the queue and discards it. After the queue is empty,
  114. // the default hook function is invoked for any future action.
  115. func (f *LoginSourceFileStoreSaveFunc) PushHook(hook func() error) {
  116. f.mutex.Lock()
  117. f.hooks = append(f.hooks, hook)
  118. f.mutex.Unlock()
  119. }
  120. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  121. // given values.
  122. func (f *LoginSourceFileStoreSaveFunc) SetDefaultReturn(r0 error) {
  123. f.SetDefaultHook(func() error {
  124. return r0
  125. })
  126. }
  127. // PushReturn calls PushHook with a function that returns the given values.
  128. func (f *LoginSourceFileStoreSaveFunc) PushReturn(r0 error) {
  129. f.PushHook(func() error {
  130. return r0
  131. })
  132. }
  133. func (f *LoginSourceFileStoreSaveFunc) nextHook() func() error {
  134. f.mutex.Lock()
  135. defer f.mutex.Unlock()
  136. if len(f.hooks) == 0 {
  137. return f.defaultHook
  138. }
  139. hook := f.hooks[0]
  140. f.hooks = f.hooks[1:]
  141. return hook
  142. }
  143. func (f *LoginSourceFileStoreSaveFunc) appendCall(r0 LoginSourceFileStoreSaveFuncCall) {
  144. f.mutex.Lock()
  145. f.history = append(f.history, r0)
  146. f.mutex.Unlock()
  147. }
  148. // History returns a sequence of LoginSourceFileStoreSaveFuncCall objects
  149. // describing the invocations of this function.
  150. func (f *LoginSourceFileStoreSaveFunc) History() []LoginSourceFileStoreSaveFuncCall {
  151. f.mutex.Lock()
  152. history := make([]LoginSourceFileStoreSaveFuncCall, len(f.history))
  153. copy(history, f.history)
  154. f.mutex.Unlock()
  155. return history
  156. }
  157. // LoginSourceFileStoreSaveFuncCall is an object that describes an
  158. // invocation of method Save on an instance of MockLoginSourceFileStore.
  159. type LoginSourceFileStoreSaveFuncCall struct {
  160. // Result0 is the value of the 1st result returned from this method
  161. // invocation.
  162. Result0 error
  163. }
  164. // Args returns an interface slice containing the arguments of this
  165. // invocation.
  166. func (c LoginSourceFileStoreSaveFuncCall) Args() []interface{} {
  167. return []interface{}{}
  168. }
  169. // Results returns an interface slice containing the results of this
  170. // invocation.
  171. func (c LoginSourceFileStoreSaveFuncCall) Results() []interface{} {
  172. return []interface{}{c.Result0}
  173. }
  174. // LoginSourceFileStoreSetConfigFunc describes the behavior when the
  175. // SetConfig method of the parent MockLoginSourceFileStore instance is
  176. // invoked.
  177. type LoginSourceFileStoreSetConfigFunc struct {
  178. defaultHook func(interface{}) error
  179. hooks []func(interface{}) error
  180. history []LoginSourceFileStoreSetConfigFuncCall
  181. mutex sync.Mutex
  182. }
  183. // SetConfig delegates to the next hook function in the queue and stores the
  184. // parameter and result values of this invocation.
  185. func (m *MockLoginSourceFileStore) SetConfig(v0 interface{}) error {
  186. r0 := m.SetConfigFunc.nextHook()(v0)
  187. m.SetConfigFunc.appendCall(LoginSourceFileStoreSetConfigFuncCall{v0, r0})
  188. return r0
  189. }
  190. // SetDefaultHook sets function that is called when the SetConfig method of
  191. // the parent MockLoginSourceFileStore instance is invoked and the hook
  192. // queue is empty.
  193. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultHook(hook func(interface{}) error) {
  194. f.defaultHook = hook
  195. }
  196. // PushHook adds a function to the end of hook queue. Each invocation of the
  197. // SetConfig method of the parent MockLoginSourceFileStore instance invokes
  198. // the hook at the front of the queue and discards it. After the queue is
  199. // empty, the default hook function is invoked for any future action.
  200. func (f *LoginSourceFileStoreSetConfigFunc) PushHook(hook func(interface{}) error) {
  201. f.mutex.Lock()
  202. f.hooks = append(f.hooks, hook)
  203. f.mutex.Unlock()
  204. }
  205. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  206. // given values.
  207. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultReturn(r0 error) {
  208. f.SetDefaultHook(func(interface{}) error {
  209. return r0
  210. })
  211. }
  212. // PushReturn calls PushHook with a function that returns the given values.
  213. func (f *LoginSourceFileStoreSetConfigFunc) PushReturn(r0 error) {
  214. f.PushHook(func(interface{}) error {
  215. return r0
  216. })
  217. }
  218. func (f *LoginSourceFileStoreSetConfigFunc) nextHook() func(interface{}) error {
  219. f.mutex.Lock()
  220. defer f.mutex.Unlock()
  221. if len(f.hooks) == 0 {
  222. return f.defaultHook
  223. }
  224. hook := f.hooks[0]
  225. f.hooks = f.hooks[1:]
  226. return hook
  227. }
  228. func (f *LoginSourceFileStoreSetConfigFunc) appendCall(r0 LoginSourceFileStoreSetConfigFuncCall) {
  229. f.mutex.Lock()
  230. f.history = append(f.history, r0)
  231. f.mutex.Unlock()
  232. }
  233. // History returns a sequence of LoginSourceFileStoreSetConfigFuncCall
  234. // objects describing the invocations of this function.
  235. func (f *LoginSourceFileStoreSetConfigFunc) History() []LoginSourceFileStoreSetConfigFuncCall {
  236. f.mutex.Lock()
  237. history := make([]LoginSourceFileStoreSetConfigFuncCall, len(f.history))
  238. copy(history, f.history)
  239. f.mutex.Unlock()
  240. return history
  241. }
  242. // LoginSourceFileStoreSetConfigFuncCall is an object that describes an
  243. // invocation of method SetConfig on an instance of
  244. // MockLoginSourceFileStore.
  245. type LoginSourceFileStoreSetConfigFuncCall struct {
  246. // Arg0 is the value of the 1st argument passed to this method
  247. // invocation.
  248. Arg0 interface{}
  249. // Result0 is the value of the 1st result returned from this method
  250. // invocation.
  251. Result0 error
  252. }
  253. // Args returns an interface slice containing the arguments of this
  254. // invocation.
  255. func (c LoginSourceFileStoreSetConfigFuncCall) Args() []interface{} {
  256. return []interface{}{c.Arg0}
  257. }
  258. // Results returns an interface slice containing the results of this
  259. // invocation.
  260. func (c LoginSourceFileStoreSetConfigFuncCall) Results() []interface{} {
  261. return []interface{}{c.Result0}
  262. }
  263. // LoginSourceFileStoreSetGeneralFunc describes the behavior when the
  264. // SetGeneral method of the parent MockLoginSourceFileStore instance is
  265. // invoked.
  266. type LoginSourceFileStoreSetGeneralFunc struct {
  267. defaultHook func(string, string)
  268. hooks []func(string, string)
  269. history []LoginSourceFileStoreSetGeneralFuncCall
  270. mutex sync.Mutex
  271. }
  272. // SetGeneral delegates to the next hook function in the queue and stores
  273. // the parameter and result values of this invocation.
  274. func (m *MockLoginSourceFileStore) SetGeneral(v0 string, v1 string) {
  275. m.SetGeneralFunc.nextHook()(v0, v1)
  276. m.SetGeneralFunc.appendCall(LoginSourceFileStoreSetGeneralFuncCall{v0, v1})
  277. return
  278. }
  279. // SetDefaultHook sets function that is called when the SetGeneral method of
  280. // the parent MockLoginSourceFileStore instance is invoked and the hook
  281. // queue is empty.
  282. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultHook(hook func(string, string)) {
  283. f.defaultHook = hook
  284. }
  285. // PushHook adds a function to the end of hook queue. Each invocation of the
  286. // SetGeneral method of the parent MockLoginSourceFileStore instance invokes
  287. // the hook at the front of the queue and discards it. After the queue is
  288. // empty, the default hook function is invoked for any future action.
  289. func (f *LoginSourceFileStoreSetGeneralFunc) PushHook(hook func(string, string)) {
  290. f.mutex.Lock()
  291. f.hooks = append(f.hooks, hook)
  292. f.mutex.Unlock()
  293. }
  294. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  295. // given values.
  296. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultReturn() {
  297. f.SetDefaultHook(func(string, string) {
  298. return
  299. })
  300. }
  301. // PushReturn calls PushHook with a function that returns the given values.
  302. func (f *LoginSourceFileStoreSetGeneralFunc) PushReturn() {
  303. f.PushHook(func(string, string) {
  304. return
  305. })
  306. }
  307. func (f *LoginSourceFileStoreSetGeneralFunc) nextHook() func(string, string) {
  308. f.mutex.Lock()
  309. defer f.mutex.Unlock()
  310. if len(f.hooks) == 0 {
  311. return f.defaultHook
  312. }
  313. hook := f.hooks[0]
  314. f.hooks = f.hooks[1:]
  315. return hook
  316. }
  317. func (f *LoginSourceFileStoreSetGeneralFunc) appendCall(r0 LoginSourceFileStoreSetGeneralFuncCall) {
  318. f.mutex.Lock()
  319. f.history = append(f.history, r0)
  320. f.mutex.Unlock()
  321. }
  322. // History returns a sequence of LoginSourceFileStoreSetGeneralFuncCall
  323. // objects describing the invocations of this function.
  324. func (f *LoginSourceFileStoreSetGeneralFunc) History() []LoginSourceFileStoreSetGeneralFuncCall {
  325. f.mutex.Lock()
  326. history := make([]LoginSourceFileStoreSetGeneralFuncCall, len(f.history))
  327. copy(history, f.history)
  328. f.mutex.Unlock()
  329. return history
  330. }
  331. // LoginSourceFileStoreSetGeneralFuncCall is an object that describes an
  332. // invocation of method SetGeneral on an instance of
  333. // MockLoginSourceFileStore.
  334. type LoginSourceFileStoreSetGeneralFuncCall struct {
  335. // Arg0 is the value of the 1st argument passed to this method
  336. // invocation.
  337. Arg0 string
  338. // Arg1 is the value of the 2nd argument passed to this method
  339. // invocation.
  340. Arg1 string
  341. }
  342. // Args returns an interface slice containing the arguments of this
  343. // invocation.
  344. func (c LoginSourceFileStoreSetGeneralFuncCall) Args() []interface{} {
  345. return []interface{}{c.Arg0, c.Arg1}
  346. }
  347. // Results returns an interface slice containing the results of this
  348. // invocation.
  349. func (c LoginSourceFileStoreSetGeneralFuncCall) Results() []interface{} {
  350. return []interface{}{}
  351. }
  352. // MockLoginSourceFilesStore is a mock implementation of the
  353. // loginSourceFilesStore interface (from the package
  354. // gogs.io/gogs/internal/database) used for unit testing.
  355. type MockLoginSourceFilesStore struct {
  356. // GetByIDFunc is an instance of a mock function object controlling the
  357. // behavior of the method GetByID.
  358. GetByIDFunc *LoginSourceFilesStoreGetByIDFunc
  359. // LenFunc is an instance of a mock function object controlling the
  360. // behavior of the method Len.
  361. LenFunc *LoginSourceFilesStoreLenFunc
  362. // ListFunc is an instance of a mock function object controlling the
  363. // behavior of the method List.
  364. ListFunc *LoginSourceFilesStoreListFunc
  365. // UpdateFunc is an instance of a mock function object controlling the
  366. // behavior of the method Update.
  367. UpdateFunc *LoginSourceFilesStoreUpdateFunc
  368. }
  369. // NewMockLoginSourceFilesStore creates a new mock of the
  370. // loginSourceFilesStore interface. All methods return zero values for all
  371. // results, unless overwritten.
  372. func NewMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  373. return &MockLoginSourceFilesStore{
  374. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  375. defaultHook: func(int64) (r0 *LoginSource, r1 error) {
  376. return
  377. },
  378. },
  379. LenFunc: &LoginSourceFilesStoreLenFunc{
  380. defaultHook: func() (r0 int) {
  381. return
  382. },
  383. },
  384. ListFunc: &LoginSourceFilesStoreListFunc{
  385. defaultHook: func(ListLoginSourceOptions) (r0 []*LoginSource) {
  386. return
  387. },
  388. },
  389. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  390. defaultHook: func(*LoginSource) {
  391. return
  392. },
  393. },
  394. }
  395. }
  396. // NewStrictMockLoginSourceFilesStore creates a new mock of the
  397. // loginSourceFilesStore interface. All methods panic on invocation, unless
  398. // overwritten.
  399. func NewStrictMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  400. return &MockLoginSourceFilesStore{
  401. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  402. defaultHook: func(int64) (*LoginSource, error) {
  403. panic("unexpected invocation of MockLoginSourceFilesStore.GetByID")
  404. },
  405. },
  406. LenFunc: &LoginSourceFilesStoreLenFunc{
  407. defaultHook: func() int {
  408. panic("unexpected invocation of MockLoginSourceFilesStore.Len")
  409. },
  410. },
  411. ListFunc: &LoginSourceFilesStoreListFunc{
  412. defaultHook: func(ListLoginSourceOptions) []*LoginSource {
  413. panic("unexpected invocation of MockLoginSourceFilesStore.List")
  414. },
  415. },
  416. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  417. defaultHook: func(*LoginSource) {
  418. panic("unexpected invocation of MockLoginSourceFilesStore.Update")
  419. },
  420. },
  421. }
  422. }
  423. // surrogateMockLoginSourceFilesStore is a copy of the loginSourceFilesStore
  424. // interface (from the package gogs.io/gogs/internal/database). It is
  425. // redefined here as it is unexported in the source package.
  426. type surrogateMockLoginSourceFilesStore interface {
  427. GetByID(int64) (*LoginSource, error)
  428. Len() int
  429. List(ListLoginSourceOptions) []*LoginSource
  430. Update(*LoginSource)
  431. }
  432. // NewMockLoginSourceFilesStoreFrom creates a new mock of the
  433. // MockLoginSourceFilesStore interface. All methods delegate to the given
  434. // implementation, unless overwritten.
  435. func NewMockLoginSourceFilesStoreFrom(i surrogateMockLoginSourceFilesStore) *MockLoginSourceFilesStore {
  436. return &MockLoginSourceFilesStore{
  437. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  438. defaultHook: i.GetByID,
  439. },
  440. LenFunc: &LoginSourceFilesStoreLenFunc{
  441. defaultHook: i.Len,
  442. },
  443. ListFunc: &LoginSourceFilesStoreListFunc{
  444. defaultHook: i.List,
  445. },
  446. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  447. defaultHook: i.Update,
  448. },
  449. }
  450. }
  451. // LoginSourceFilesStoreGetByIDFunc describes the behavior when the GetByID
  452. // method of the parent MockLoginSourceFilesStore instance is invoked.
  453. type LoginSourceFilesStoreGetByIDFunc struct {
  454. defaultHook func(int64) (*LoginSource, error)
  455. hooks []func(int64) (*LoginSource, error)
  456. history []LoginSourceFilesStoreGetByIDFuncCall
  457. mutex sync.Mutex
  458. }
  459. // GetByID delegates to the next hook function in the queue and stores the
  460. // parameter and result values of this invocation.
  461. func (m *MockLoginSourceFilesStore) GetByID(v0 int64) (*LoginSource, error) {
  462. r0, r1 := m.GetByIDFunc.nextHook()(v0)
  463. m.GetByIDFunc.appendCall(LoginSourceFilesStoreGetByIDFuncCall{v0, r0, r1})
  464. return r0, r1
  465. }
  466. // SetDefaultHook sets function that is called when the GetByID method of
  467. // the parent MockLoginSourceFilesStore instance is invoked and the hook
  468. // queue is empty.
  469. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultHook(hook func(int64) (*LoginSource, error)) {
  470. f.defaultHook = hook
  471. }
  472. // PushHook adds a function to the end of hook queue. Each invocation of the
  473. // GetByID method of the parent MockLoginSourceFilesStore instance invokes
  474. // the hook at the front of the queue and discards it. After the queue is
  475. // empty, the default hook function is invoked for any future action.
  476. func (f *LoginSourceFilesStoreGetByIDFunc) PushHook(hook func(int64) (*LoginSource, error)) {
  477. f.mutex.Lock()
  478. f.hooks = append(f.hooks, hook)
  479. f.mutex.Unlock()
  480. }
  481. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  482. // given values.
  483. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  484. f.SetDefaultHook(func(int64) (*LoginSource, error) {
  485. return r0, r1
  486. })
  487. }
  488. // PushReturn calls PushHook with a function that returns the given values.
  489. func (f *LoginSourceFilesStoreGetByIDFunc) PushReturn(r0 *LoginSource, r1 error) {
  490. f.PushHook(func(int64) (*LoginSource, error) {
  491. return r0, r1
  492. })
  493. }
  494. func (f *LoginSourceFilesStoreGetByIDFunc) nextHook() func(int64) (*LoginSource, error) {
  495. f.mutex.Lock()
  496. defer f.mutex.Unlock()
  497. if len(f.hooks) == 0 {
  498. return f.defaultHook
  499. }
  500. hook := f.hooks[0]
  501. f.hooks = f.hooks[1:]
  502. return hook
  503. }
  504. func (f *LoginSourceFilesStoreGetByIDFunc) appendCall(r0 LoginSourceFilesStoreGetByIDFuncCall) {
  505. f.mutex.Lock()
  506. f.history = append(f.history, r0)
  507. f.mutex.Unlock()
  508. }
  509. // History returns a sequence of LoginSourceFilesStoreGetByIDFuncCall
  510. // objects describing the invocations of this function.
  511. func (f *LoginSourceFilesStoreGetByIDFunc) History() []LoginSourceFilesStoreGetByIDFuncCall {
  512. f.mutex.Lock()
  513. history := make([]LoginSourceFilesStoreGetByIDFuncCall, len(f.history))
  514. copy(history, f.history)
  515. f.mutex.Unlock()
  516. return history
  517. }
  518. // LoginSourceFilesStoreGetByIDFuncCall is an object that describes an
  519. // invocation of method GetByID on an instance of MockLoginSourceFilesStore.
  520. type LoginSourceFilesStoreGetByIDFuncCall struct {
  521. // Arg0 is the value of the 1st argument passed to this method
  522. // invocation.
  523. Arg0 int64
  524. // Result0 is the value of the 1st result returned from this method
  525. // invocation.
  526. Result0 *LoginSource
  527. // Result1 is the value of the 2nd result returned from this method
  528. // invocation.
  529. Result1 error
  530. }
  531. // Args returns an interface slice containing the arguments of this
  532. // invocation.
  533. func (c LoginSourceFilesStoreGetByIDFuncCall) Args() []interface{} {
  534. return []interface{}{c.Arg0}
  535. }
  536. // Results returns an interface slice containing the results of this
  537. // invocation.
  538. func (c LoginSourceFilesStoreGetByIDFuncCall) Results() []interface{} {
  539. return []interface{}{c.Result0, c.Result1}
  540. }
  541. // LoginSourceFilesStoreLenFunc describes the behavior when the Len method
  542. // of the parent MockLoginSourceFilesStore instance is invoked.
  543. type LoginSourceFilesStoreLenFunc struct {
  544. defaultHook func() int
  545. hooks []func() int
  546. history []LoginSourceFilesStoreLenFuncCall
  547. mutex sync.Mutex
  548. }
  549. // Len delegates to the next hook function in the queue and stores the
  550. // parameter and result values of this invocation.
  551. func (m *MockLoginSourceFilesStore) Len() int {
  552. r0 := m.LenFunc.nextHook()()
  553. m.LenFunc.appendCall(LoginSourceFilesStoreLenFuncCall{r0})
  554. return r0
  555. }
  556. // SetDefaultHook sets function that is called when the Len method of the
  557. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  558. // is empty.
  559. func (f *LoginSourceFilesStoreLenFunc) SetDefaultHook(hook func() int) {
  560. f.defaultHook = hook
  561. }
  562. // PushHook adds a function to the end of hook queue. Each invocation of the
  563. // Len method of the parent MockLoginSourceFilesStore instance invokes the
  564. // hook at the front of the queue and discards it. After the queue is empty,
  565. // the default hook function is invoked for any future action.
  566. func (f *LoginSourceFilesStoreLenFunc) PushHook(hook func() int) {
  567. f.mutex.Lock()
  568. f.hooks = append(f.hooks, hook)
  569. f.mutex.Unlock()
  570. }
  571. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  572. // given values.
  573. func (f *LoginSourceFilesStoreLenFunc) SetDefaultReturn(r0 int) {
  574. f.SetDefaultHook(func() int {
  575. return r0
  576. })
  577. }
  578. // PushReturn calls PushHook with a function that returns the given values.
  579. func (f *LoginSourceFilesStoreLenFunc) PushReturn(r0 int) {
  580. f.PushHook(func() int {
  581. return r0
  582. })
  583. }
  584. func (f *LoginSourceFilesStoreLenFunc) nextHook() func() int {
  585. f.mutex.Lock()
  586. defer f.mutex.Unlock()
  587. if len(f.hooks) == 0 {
  588. return f.defaultHook
  589. }
  590. hook := f.hooks[0]
  591. f.hooks = f.hooks[1:]
  592. return hook
  593. }
  594. func (f *LoginSourceFilesStoreLenFunc) appendCall(r0 LoginSourceFilesStoreLenFuncCall) {
  595. f.mutex.Lock()
  596. f.history = append(f.history, r0)
  597. f.mutex.Unlock()
  598. }
  599. // History returns a sequence of LoginSourceFilesStoreLenFuncCall objects
  600. // describing the invocations of this function.
  601. func (f *LoginSourceFilesStoreLenFunc) History() []LoginSourceFilesStoreLenFuncCall {
  602. f.mutex.Lock()
  603. history := make([]LoginSourceFilesStoreLenFuncCall, len(f.history))
  604. copy(history, f.history)
  605. f.mutex.Unlock()
  606. return history
  607. }
  608. // LoginSourceFilesStoreLenFuncCall is an object that describes an
  609. // invocation of method Len on an instance of MockLoginSourceFilesStore.
  610. type LoginSourceFilesStoreLenFuncCall struct {
  611. // Result0 is the value of the 1st result returned from this method
  612. // invocation.
  613. Result0 int
  614. }
  615. // Args returns an interface slice containing the arguments of this
  616. // invocation.
  617. func (c LoginSourceFilesStoreLenFuncCall) Args() []interface{} {
  618. return []interface{}{}
  619. }
  620. // Results returns an interface slice containing the results of this
  621. // invocation.
  622. func (c LoginSourceFilesStoreLenFuncCall) Results() []interface{} {
  623. return []interface{}{c.Result0}
  624. }
  625. // LoginSourceFilesStoreListFunc describes the behavior when the List method
  626. // of the parent MockLoginSourceFilesStore instance is invoked.
  627. type LoginSourceFilesStoreListFunc struct {
  628. defaultHook func(ListLoginSourceOptions) []*LoginSource
  629. hooks []func(ListLoginSourceOptions) []*LoginSource
  630. history []LoginSourceFilesStoreListFuncCall
  631. mutex sync.Mutex
  632. }
  633. // List delegates to the next hook function in the queue and stores the
  634. // parameter and result values of this invocation.
  635. func (m *MockLoginSourceFilesStore) List(v0 ListLoginSourceOptions) []*LoginSource {
  636. r0 := m.ListFunc.nextHook()(v0)
  637. m.ListFunc.appendCall(LoginSourceFilesStoreListFuncCall{v0, r0})
  638. return r0
  639. }
  640. // SetDefaultHook sets function that is called when the List method of the
  641. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  642. // is empty.
  643. func (f *LoginSourceFilesStoreListFunc) SetDefaultHook(hook func(ListLoginSourceOptions) []*LoginSource) {
  644. f.defaultHook = hook
  645. }
  646. // PushHook adds a function to the end of hook queue. Each invocation of the
  647. // List method of the parent MockLoginSourceFilesStore instance invokes the
  648. // hook at the front of the queue and discards it. After the queue is empty,
  649. // the default hook function is invoked for any future action.
  650. func (f *LoginSourceFilesStoreListFunc) PushHook(hook func(ListLoginSourceOptions) []*LoginSource) {
  651. f.mutex.Lock()
  652. f.hooks = append(f.hooks, hook)
  653. f.mutex.Unlock()
  654. }
  655. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  656. // given values.
  657. func (f *LoginSourceFilesStoreListFunc) SetDefaultReturn(r0 []*LoginSource) {
  658. f.SetDefaultHook(func(ListLoginSourceOptions) []*LoginSource {
  659. return r0
  660. })
  661. }
  662. // PushReturn calls PushHook with a function that returns the given values.
  663. func (f *LoginSourceFilesStoreListFunc) PushReturn(r0 []*LoginSource) {
  664. f.PushHook(func(ListLoginSourceOptions) []*LoginSource {
  665. return r0
  666. })
  667. }
  668. func (f *LoginSourceFilesStoreListFunc) nextHook() func(ListLoginSourceOptions) []*LoginSource {
  669. f.mutex.Lock()
  670. defer f.mutex.Unlock()
  671. if len(f.hooks) == 0 {
  672. return f.defaultHook
  673. }
  674. hook := f.hooks[0]
  675. f.hooks = f.hooks[1:]
  676. return hook
  677. }
  678. func (f *LoginSourceFilesStoreListFunc) appendCall(r0 LoginSourceFilesStoreListFuncCall) {
  679. f.mutex.Lock()
  680. f.history = append(f.history, r0)
  681. f.mutex.Unlock()
  682. }
  683. // History returns a sequence of LoginSourceFilesStoreListFuncCall objects
  684. // describing the invocations of this function.
  685. func (f *LoginSourceFilesStoreListFunc) History() []LoginSourceFilesStoreListFuncCall {
  686. f.mutex.Lock()
  687. history := make([]LoginSourceFilesStoreListFuncCall, len(f.history))
  688. copy(history, f.history)
  689. f.mutex.Unlock()
  690. return history
  691. }
  692. // LoginSourceFilesStoreListFuncCall is an object that describes an
  693. // invocation of method List on an instance of MockLoginSourceFilesStore.
  694. type LoginSourceFilesStoreListFuncCall struct {
  695. // Arg0 is the value of the 1st argument passed to this method
  696. // invocation.
  697. Arg0 ListLoginSourceOptions
  698. // Result0 is the value of the 1st result returned from this method
  699. // invocation.
  700. Result0 []*LoginSource
  701. }
  702. // Args returns an interface slice containing the arguments of this
  703. // invocation.
  704. func (c LoginSourceFilesStoreListFuncCall) Args() []interface{} {
  705. return []interface{}{c.Arg0}
  706. }
  707. // Results returns an interface slice containing the results of this
  708. // invocation.
  709. func (c LoginSourceFilesStoreListFuncCall) Results() []interface{} {
  710. return []interface{}{c.Result0}
  711. }
  712. // LoginSourceFilesStoreUpdateFunc describes the behavior when the Update
  713. // method of the parent MockLoginSourceFilesStore instance is invoked.
  714. type LoginSourceFilesStoreUpdateFunc struct {
  715. defaultHook func(*LoginSource)
  716. hooks []func(*LoginSource)
  717. history []LoginSourceFilesStoreUpdateFuncCall
  718. mutex sync.Mutex
  719. }
  720. // Update delegates to the next hook function in the queue and stores the
  721. // parameter and result values of this invocation.
  722. func (m *MockLoginSourceFilesStore) Update(v0 *LoginSource) {
  723. m.UpdateFunc.nextHook()(v0)
  724. m.UpdateFunc.appendCall(LoginSourceFilesStoreUpdateFuncCall{v0})
  725. return
  726. }
  727. // SetDefaultHook sets function that is called when the Update method of the
  728. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  729. // is empty.
  730. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultHook(hook func(*LoginSource)) {
  731. f.defaultHook = hook
  732. }
  733. // PushHook adds a function to the end of hook queue. Each invocation of the
  734. // Update method of the parent MockLoginSourceFilesStore instance invokes
  735. // the hook at the front of the queue and discards it. After the queue is
  736. // empty, the default hook function is invoked for any future action.
  737. func (f *LoginSourceFilesStoreUpdateFunc) PushHook(hook func(*LoginSource)) {
  738. f.mutex.Lock()
  739. f.hooks = append(f.hooks, hook)
  740. f.mutex.Unlock()
  741. }
  742. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  743. // given values.
  744. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultReturn() {
  745. f.SetDefaultHook(func(*LoginSource) {
  746. return
  747. })
  748. }
  749. // PushReturn calls PushHook with a function that returns the given values.
  750. func (f *LoginSourceFilesStoreUpdateFunc) PushReturn() {
  751. f.PushHook(func(*LoginSource) {
  752. return
  753. })
  754. }
  755. func (f *LoginSourceFilesStoreUpdateFunc) nextHook() func(*LoginSource) {
  756. f.mutex.Lock()
  757. defer f.mutex.Unlock()
  758. if len(f.hooks) == 0 {
  759. return f.defaultHook
  760. }
  761. hook := f.hooks[0]
  762. f.hooks = f.hooks[1:]
  763. return hook
  764. }
  765. func (f *LoginSourceFilesStoreUpdateFunc) appendCall(r0 LoginSourceFilesStoreUpdateFuncCall) {
  766. f.mutex.Lock()
  767. f.history = append(f.history, r0)
  768. f.mutex.Unlock()
  769. }
  770. // History returns a sequence of LoginSourceFilesStoreUpdateFuncCall objects
  771. // describing the invocations of this function.
  772. func (f *LoginSourceFilesStoreUpdateFunc) History() []LoginSourceFilesStoreUpdateFuncCall {
  773. f.mutex.Lock()
  774. history := make([]LoginSourceFilesStoreUpdateFuncCall, len(f.history))
  775. copy(history, f.history)
  776. f.mutex.Unlock()
  777. return history
  778. }
  779. // LoginSourceFilesStoreUpdateFuncCall is an object that describes an
  780. // invocation of method Update on an instance of MockLoginSourceFilesStore.
  781. type LoginSourceFilesStoreUpdateFuncCall struct {
  782. // Arg0 is the value of the 1st argument passed to this method
  783. // invocation.
  784. Arg0 *LoginSource
  785. }
  786. // Args returns an interface slice containing the arguments of this
  787. // invocation.
  788. func (c LoginSourceFilesStoreUpdateFuncCall) Args() []interface{} {
  789. return []interface{}{c.Arg0}
  790. }
  791. // Results returns an interface slice containing the results of this
  792. // invocation.
  793. func (c LoginSourceFilesStoreUpdateFuncCall) Results() []interface{} {
  794. return []interface{}{}
  795. }