mocks_test.go 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412
  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 db
  7. import (
  8. "context"
  9. "sync"
  10. auth "gogs.io/gogs/internal/auth"
  11. )
  12. // MockLoginSourcesStore is a mock implementation of the LoginSourcesStore
  13. // interface (from the package gogs.io/gogs/internal/db) used for unit
  14. // testing.
  15. type MockLoginSourcesStore struct {
  16. // CountFunc is an instance of a mock function object controlling the
  17. // behavior of the method Count.
  18. CountFunc *LoginSourcesStoreCountFunc
  19. // CreateFunc is an instance of a mock function object controlling the
  20. // behavior of the method Create.
  21. CreateFunc *LoginSourcesStoreCreateFunc
  22. // DeleteByIDFunc is an instance of a mock function object controlling
  23. // the behavior of the method DeleteByID.
  24. DeleteByIDFunc *LoginSourcesStoreDeleteByIDFunc
  25. // GetByIDFunc is an instance of a mock function object controlling the
  26. // behavior of the method GetByID.
  27. GetByIDFunc *LoginSourcesStoreGetByIDFunc
  28. // ListFunc is an instance of a mock function object controlling the
  29. // behavior of the method List.
  30. ListFunc *LoginSourcesStoreListFunc
  31. // ResetNonDefaultFunc is an instance of a mock function object
  32. // controlling the behavior of the method ResetNonDefault.
  33. ResetNonDefaultFunc *LoginSourcesStoreResetNonDefaultFunc
  34. // SaveFunc is an instance of a mock function object controlling the
  35. // behavior of the method Save.
  36. SaveFunc *LoginSourcesStoreSaveFunc
  37. }
  38. // NewMockLoginSourcesStore creates a new mock of the LoginSourcesStore
  39. // interface. All methods return zero values for all results, unless
  40. // overwritten.
  41. func NewMockLoginSourcesStore() *MockLoginSourcesStore {
  42. return &MockLoginSourcesStore{
  43. CountFunc: &LoginSourcesStoreCountFunc{
  44. defaultHook: func(context.Context) (r0 int64) {
  45. return
  46. },
  47. },
  48. CreateFunc: &LoginSourcesStoreCreateFunc{
  49. defaultHook: func(context.Context, CreateLoginSourceOptions) (r0 *LoginSource, r1 error) {
  50. return
  51. },
  52. },
  53. DeleteByIDFunc: &LoginSourcesStoreDeleteByIDFunc{
  54. defaultHook: func(context.Context, int64) (r0 error) {
  55. return
  56. },
  57. },
  58. GetByIDFunc: &LoginSourcesStoreGetByIDFunc{
  59. defaultHook: func(context.Context, int64) (r0 *LoginSource, r1 error) {
  60. return
  61. },
  62. },
  63. ListFunc: &LoginSourcesStoreListFunc{
  64. defaultHook: func(context.Context, ListLoginSourceOptions) (r0 []*LoginSource, r1 error) {
  65. return
  66. },
  67. },
  68. ResetNonDefaultFunc: &LoginSourcesStoreResetNonDefaultFunc{
  69. defaultHook: func(context.Context, *LoginSource) (r0 error) {
  70. return
  71. },
  72. },
  73. SaveFunc: &LoginSourcesStoreSaveFunc{
  74. defaultHook: func(context.Context, *LoginSource) (r0 error) {
  75. return
  76. },
  77. },
  78. }
  79. }
  80. // NewStrictMockLoginSourcesStore creates a new mock of the
  81. // LoginSourcesStore interface. All methods panic on invocation, unless
  82. // overwritten.
  83. func NewStrictMockLoginSourcesStore() *MockLoginSourcesStore {
  84. return &MockLoginSourcesStore{
  85. CountFunc: &LoginSourcesStoreCountFunc{
  86. defaultHook: func(context.Context) int64 {
  87. panic("unexpected invocation of MockLoginSourcesStore.Count")
  88. },
  89. },
  90. CreateFunc: &LoginSourcesStoreCreateFunc{
  91. defaultHook: func(context.Context, CreateLoginSourceOptions) (*LoginSource, error) {
  92. panic("unexpected invocation of MockLoginSourcesStore.Create")
  93. },
  94. },
  95. DeleteByIDFunc: &LoginSourcesStoreDeleteByIDFunc{
  96. defaultHook: func(context.Context, int64) error {
  97. panic("unexpected invocation of MockLoginSourcesStore.DeleteByID")
  98. },
  99. },
  100. GetByIDFunc: &LoginSourcesStoreGetByIDFunc{
  101. defaultHook: func(context.Context, int64) (*LoginSource, error) {
  102. panic("unexpected invocation of MockLoginSourcesStore.GetByID")
  103. },
  104. },
  105. ListFunc: &LoginSourcesStoreListFunc{
  106. defaultHook: func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error) {
  107. panic("unexpected invocation of MockLoginSourcesStore.List")
  108. },
  109. },
  110. ResetNonDefaultFunc: &LoginSourcesStoreResetNonDefaultFunc{
  111. defaultHook: func(context.Context, *LoginSource) error {
  112. panic("unexpected invocation of MockLoginSourcesStore.ResetNonDefault")
  113. },
  114. },
  115. SaveFunc: &LoginSourcesStoreSaveFunc{
  116. defaultHook: func(context.Context, *LoginSource) error {
  117. panic("unexpected invocation of MockLoginSourcesStore.Save")
  118. },
  119. },
  120. }
  121. }
  122. // NewMockLoginSourcesStoreFrom creates a new mock of the
  123. // MockLoginSourcesStore interface. All methods delegate to the given
  124. // implementation, unless overwritten.
  125. func NewMockLoginSourcesStoreFrom(i LoginSourcesStore) *MockLoginSourcesStore {
  126. return &MockLoginSourcesStore{
  127. CountFunc: &LoginSourcesStoreCountFunc{
  128. defaultHook: i.Count,
  129. },
  130. CreateFunc: &LoginSourcesStoreCreateFunc{
  131. defaultHook: i.Create,
  132. },
  133. DeleteByIDFunc: &LoginSourcesStoreDeleteByIDFunc{
  134. defaultHook: i.DeleteByID,
  135. },
  136. GetByIDFunc: &LoginSourcesStoreGetByIDFunc{
  137. defaultHook: i.GetByID,
  138. },
  139. ListFunc: &LoginSourcesStoreListFunc{
  140. defaultHook: i.List,
  141. },
  142. ResetNonDefaultFunc: &LoginSourcesStoreResetNonDefaultFunc{
  143. defaultHook: i.ResetNonDefault,
  144. },
  145. SaveFunc: &LoginSourcesStoreSaveFunc{
  146. defaultHook: i.Save,
  147. },
  148. }
  149. }
  150. // LoginSourcesStoreCountFunc describes the behavior when the Count method
  151. // of the parent MockLoginSourcesStore instance is invoked.
  152. type LoginSourcesStoreCountFunc struct {
  153. defaultHook func(context.Context) int64
  154. hooks []func(context.Context) int64
  155. history []LoginSourcesStoreCountFuncCall
  156. mutex sync.Mutex
  157. }
  158. // Count delegates to the next hook function in the queue and stores the
  159. // parameter and result values of this invocation.
  160. func (m *MockLoginSourcesStore) Count(v0 context.Context) int64 {
  161. r0 := m.CountFunc.nextHook()(v0)
  162. m.CountFunc.appendCall(LoginSourcesStoreCountFuncCall{v0, r0})
  163. return r0
  164. }
  165. // SetDefaultHook sets function that is called when the Count method of the
  166. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  167. // empty.
  168. func (f *LoginSourcesStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  169. f.defaultHook = hook
  170. }
  171. // PushHook adds a function to the end of hook queue. Each invocation of the
  172. // Count method of the parent MockLoginSourcesStore instance invokes the
  173. // hook at the front of the queue and discards it. After the queue is empty,
  174. // the default hook function is invoked for any future action.
  175. func (f *LoginSourcesStoreCountFunc) PushHook(hook func(context.Context) int64) {
  176. f.mutex.Lock()
  177. f.hooks = append(f.hooks, hook)
  178. f.mutex.Unlock()
  179. }
  180. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  181. // given values.
  182. func (f *LoginSourcesStoreCountFunc) SetDefaultReturn(r0 int64) {
  183. f.SetDefaultHook(func(context.Context) int64 {
  184. return r0
  185. })
  186. }
  187. // PushReturn calls PushHook with a function that returns the given values.
  188. func (f *LoginSourcesStoreCountFunc) PushReturn(r0 int64) {
  189. f.PushHook(func(context.Context) int64 {
  190. return r0
  191. })
  192. }
  193. func (f *LoginSourcesStoreCountFunc) nextHook() func(context.Context) int64 {
  194. f.mutex.Lock()
  195. defer f.mutex.Unlock()
  196. if len(f.hooks) == 0 {
  197. return f.defaultHook
  198. }
  199. hook := f.hooks[0]
  200. f.hooks = f.hooks[1:]
  201. return hook
  202. }
  203. func (f *LoginSourcesStoreCountFunc) appendCall(r0 LoginSourcesStoreCountFuncCall) {
  204. f.mutex.Lock()
  205. f.history = append(f.history, r0)
  206. f.mutex.Unlock()
  207. }
  208. // History returns a sequence of LoginSourcesStoreCountFuncCall objects
  209. // describing the invocations of this function.
  210. func (f *LoginSourcesStoreCountFunc) History() []LoginSourcesStoreCountFuncCall {
  211. f.mutex.Lock()
  212. history := make([]LoginSourcesStoreCountFuncCall, len(f.history))
  213. copy(history, f.history)
  214. f.mutex.Unlock()
  215. return history
  216. }
  217. // LoginSourcesStoreCountFuncCall is an object that describes an invocation
  218. // of method Count on an instance of MockLoginSourcesStore.
  219. type LoginSourcesStoreCountFuncCall struct {
  220. // Arg0 is the value of the 1st argument passed to this method
  221. // invocation.
  222. Arg0 context.Context
  223. // Result0 is the value of the 1st result returned from this method
  224. // invocation.
  225. Result0 int64
  226. }
  227. // Args returns an interface slice containing the arguments of this
  228. // invocation.
  229. func (c LoginSourcesStoreCountFuncCall) Args() []interface{} {
  230. return []interface{}{c.Arg0}
  231. }
  232. // Results returns an interface slice containing the results of this
  233. // invocation.
  234. func (c LoginSourcesStoreCountFuncCall) Results() []interface{} {
  235. return []interface{}{c.Result0}
  236. }
  237. // LoginSourcesStoreCreateFunc describes the behavior when the Create method
  238. // of the parent MockLoginSourcesStore instance is invoked.
  239. type LoginSourcesStoreCreateFunc struct {
  240. defaultHook func(context.Context, CreateLoginSourceOptions) (*LoginSource, error)
  241. hooks []func(context.Context, CreateLoginSourceOptions) (*LoginSource, error)
  242. history []LoginSourcesStoreCreateFuncCall
  243. mutex sync.Mutex
  244. }
  245. // Create delegates to the next hook function in the queue and stores the
  246. // parameter and result values of this invocation.
  247. func (m *MockLoginSourcesStore) Create(v0 context.Context, v1 CreateLoginSourceOptions) (*LoginSource, error) {
  248. r0, r1 := m.CreateFunc.nextHook()(v0, v1)
  249. m.CreateFunc.appendCall(LoginSourcesStoreCreateFuncCall{v0, v1, r0, r1})
  250. return r0, r1
  251. }
  252. // SetDefaultHook sets function that is called when the Create method of the
  253. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  254. // empty.
  255. func (f *LoginSourcesStoreCreateFunc) SetDefaultHook(hook func(context.Context, CreateLoginSourceOptions) (*LoginSource, error)) {
  256. f.defaultHook = hook
  257. }
  258. // PushHook adds a function to the end of hook queue. Each invocation of the
  259. // Create method of the parent MockLoginSourcesStore instance invokes the
  260. // hook at the front of the queue and discards it. After the queue is empty,
  261. // the default hook function is invoked for any future action.
  262. func (f *LoginSourcesStoreCreateFunc) PushHook(hook func(context.Context, CreateLoginSourceOptions) (*LoginSource, error)) {
  263. f.mutex.Lock()
  264. f.hooks = append(f.hooks, hook)
  265. f.mutex.Unlock()
  266. }
  267. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  268. // given values.
  269. func (f *LoginSourcesStoreCreateFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  270. f.SetDefaultHook(func(context.Context, CreateLoginSourceOptions) (*LoginSource, error) {
  271. return r0, r1
  272. })
  273. }
  274. // PushReturn calls PushHook with a function that returns the given values.
  275. func (f *LoginSourcesStoreCreateFunc) PushReturn(r0 *LoginSource, r1 error) {
  276. f.PushHook(func(context.Context, CreateLoginSourceOptions) (*LoginSource, error) {
  277. return r0, r1
  278. })
  279. }
  280. func (f *LoginSourcesStoreCreateFunc) nextHook() func(context.Context, CreateLoginSourceOptions) (*LoginSource, error) {
  281. f.mutex.Lock()
  282. defer f.mutex.Unlock()
  283. if len(f.hooks) == 0 {
  284. return f.defaultHook
  285. }
  286. hook := f.hooks[0]
  287. f.hooks = f.hooks[1:]
  288. return hook
  289. }
  290. func (f *LoginSourcesStoreCreateFunc) appendCall(r0 LoginSourcesStoreCreateFuncCall) {
  291. f.mutex.Lock()
  292. f.history = append(f.history, r0)
  293. f.mutex.Unlock()
  294. }
  295. // History returns a sequence of LoginSourcesStoreCreateFuncCall objects
  296. // describing the invocations of this function.
  297. func (f *LoginSourcesStoreCreateFunc) History() []LoginSourcesStoreCreateFuncCall {
  298. f.mutex.Lock()
  299. history := make([]LoginSourcesStoreCreateFuncCall, len(f.history))
  300. copy(history, f.history)
  301. f.mutex.Unlock()
  302. return history
  303. }
  304. // LoginSourcesStoreCreateFuncCall is an object that describes an invocation
  305. // of method Create on an instance of MockLoginSourcesStore.
  306. type LoginSourcesStoreCreateFuncCall struct {
  307. // Arg0 is the value of the 1st argument passed to this method
  308. // invocation.
  309. Arg0 context.Context
  310. // Arg1 is the value of the 2nd argument passed to this method
  311. // invocation.
  312. Arg1 CreateLoginSourceOptions
  313. // Result0 is the value of the 1st result returned from this method
  314. // invocation.
  315. Result0 *LoginSource
  316. // Result1 is the value of the 2nd result returned from this method
  317. // invocation.
  318. Result1 error
  319. }
  320. // Args returns an interface slice containing the arguments of this
  321. // invocation.
  322. func (c LoginSourcesStoreCreateFuncCall) Args() []interface{} {
  323. return []interface{}{c.Arg0, c.Arg1}
  324. }
  325. // Results returns an interface slice containing the results of this
  326. // invocation.
  327. func (c LoginSourcesStoreCreateFuncCall) Results() []interface{} {
  328. return []interface{}{c.Result0, c.Result1}
  329. }
  330. // LoginSourcesStoreDeleteByIDFunc describes the behavior when the
  331. // DeleteByID method of the parent MockLoginSourcesStore instance is
  332. // invoked.
  333. type LoginSourcesStoreDeleteByIDFunc struct {
  334. defaultHook func(context.Context, int64) error
  335. hooks []func(context.Context, int64) error
  336. history []LoginSourcesStoreDeleteByIDFuncCall
  337. mutex sync.Mutex
  338. }
  339. // DeleteByID delegates to the next hook function in the queue and stores
  340. // the parameter and result values of this invocation.
  341. func (m *MockLoginSourcesStore) DeleteByID(v0 context.Context, v1 int64) error {
  342. r0 := m.DeleteByIDFunc.nextHook()(v0, v1)
  343. m.DeleteByIDFunc.appendCall(LoginSourcesStoreDeleteByIDFuncCall{v0, v1, r0})
  344. return r0
  345. }
  346. // SetDefaultHook sets function that is called when the DeleteByID method of
  347. // the parent MockLoginSourcesStore instance is invoked and the hook queue
  348. // is empty.
  349. func (f *LoginSourcesStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  350. f.defaultHook = hook
  351. }
  352. // PushHook adds a function to the end of hook queue. Each invocation of the
  353. // DeleteByID method of the parent MockLoginSourcesStore instance invokes
  354. // the hook at the front of the queue and discards it. After the queue is
  355. // empty, the default hook function is invoked for any future action.
  356. func (f *LoginSourcesStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64) error) {
  357. f.mutex.Lock()
  358. f.hooks = append(f.hooks, hook)
  359. f.mutex.Unlock()
  360. }
  361. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  362. // given values.
  363. func (f *LoginSourcesStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  364. f.SetDefaultHook(func(context.Context, int64) error {
  365. return r0
  366. })
  367. }
  368. // PushReturn calls PushHook with a function that returns the given values.
  369. func (f *LoginSourcesStoreDeleteByIDFunc) PushReturn(r0 error) {
  370. f.PushHook(func(context.Context, int64) error {
  371. return r0
  372. })
  373. }
  374. func (f *LoginSourcesStoreDeleteByIDFunc) nextHook() func(context.Context, int64) error {
  375. f.mutex.Lock()
  376. defer f.mutex.Unlock()
  377. if len(f.hooks) == 0 {
  378. return f.defaultHook
  379. }
  380. hook := f.hooks[0]
  381. f.hooks = f.hooks[1:]
  382. return hook
  383. }
  384. func (f *LoginSourcesStoreDeleteByIDFunc) appendCall(r0 LoginSourcesStoreDeleteByIDFuncCall) {
  385. f.mutex.Lock()
  386. f.history = append(f.history, r0)
  387. f.mutex.Unlock()
  388. }
  389. // History returns a sequence of LoginSourcesStoreDeleteByIDFuncCall objects
  390. // describing the invocations of this function.
  391. func (f *LoginSourcesStoreDeleteByIDFunc) History() []LoginSourcesStoreDeleteByIDFuncCall {
  392. f.mutex.Lock()
  393. history := make([]LoginSourcesStoreDeleteByIDFuncCall, len(f.history))
  394. copy(history, f.history)
  395. f.mutex.Unlock()
  396. return history
  397. }
  398. // LoginSourcesStoreDeleteByIDFuncCall is an object that describes an
  399. // invocation of method DeleteByID on an instance of MockLoginSourcesStore.
  400. type LoginSourcesStoreDeleteByIDFuncCall struct {
  401. // Arg0 is the value of the 1st argument passed to this method
  402. // invocation.
  403. Arg0 context.Context
  404. // Arg1 is the value of the 2nd argument passed to this method
  405. // invocation.
  406. Arg1 int64
  407. // Result0 is the value of the 1st result returned from this method
  408. // invocation.
  409. Result0 error
  410. }
  411. // Args returns an interface slice containing the arguments of this
  412. // invocation.
  413. func (c LoginSourcesStoreDeleteByIDFuncCall) Args() []interface{} {
  414. return []interface{}{c.Arg0, c.Arg1}
  415. }
  416. // Results returns an interface slice containing the results of this
  417. // invocation.
  418. func (c LoginSourcesStoreDeleteByIDFuncCall) Results() []interface{} {
  419. return []interface{}{c.Result0}
  420. }
  421. // LoginSourcesStoreGetByIDFunc describes the behavior when the GetByID
  422. // method of the parent MockLoginSourcesStore instance is invoked.
  423. type LoginSourcesStoreGetByIDFunc struct {
  424. defaultHook func(context.Context, int64) (*LoginSource, error)
  425. hooks []func(context.Context, int64) (*LoginSource, error)
  426. history []LoginSourcesStoreGetByIDFuncCall
  427. mutex sync.Mutex
  428. }
  429. // GetByID delegates to the next hook function in the queue and stores the
  430. // parameter and result values of this invocation.
  431. func (m *MockLoginSourcesStore) GetByID(v0 context.Context, v1 int64) (*LoginSource, error) {
  432. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  433. m.GetByIDFunc.appendCall(LoginSourcesStoreGetByIDFuncCall{v0, v1, r0, r1})
  434. return r0, r1
  435. }
  436. // SetDefaultHook sets function that is called when the GetByID method of
  437. // the parent MockLoginSourcesStore instance is invoked and the hook queue
  438. // is empty.
  439. func (f *LoginSourcesStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*LoginSource, error)) {
  440. f.defaultHook = hook
  441. }
  442. // PushHook adds a function to the end of hook queue. Each invocation of the
  443. // GetByID method of the parent MockLoginSourcesStore instance invokes the
  444. // hook at the front of the queue and discards it. After the queue is empty,
  445. // the default hook function is invoked for any future action.
  446. func (f *LoginSourcesStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*LoginSource, error)) {
  447. f.mutex.Lock()
  448. f.hooks = append(f.hooks, hook)
  449. f.mutex.Unlock()
  450. }
  451. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  452. // given values.
  453. func (f *LoginSourcesStoreGetByIDFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  454. f.SetDefaultHook(func(context.Context, int64) (*LoginSource, error) {
  455. return r0, r1
  456. })
  457. }
  458. // PushReturn calls PushHook with a function that returns the given values.
  459. func (f *LoginSourcesStoreGetByIDFunc) PushReturn(r0 *LoginSource, r1 error) {
  460. f.PushHook(func(context.Context, int64) (*LoginSource, error) {
  461. return r0, r1
  462. })
  463. }
  464. func (f *LoginSourcesStoreGetByIDFunc) nextHook() func(context.Context, int64) (*LoginSource, error) {
  465. f.mutex.Lock()
  466. defer f.mutex.Unlock()
  467. if len(f.hooks) == 0 {
  468. return f.defaultHook
  469. }
  470. hook := f.hooks[0]
  471. f.hooks = f.hooks[1:]
  472. return hook
  473. }
  474. func (f *LoginSourcesStoreGetByIDFunc) appendCall(r0 LoginSourcesStoreGetByIDFuncCall) {
  475. f.mutex.Lock()
  476. f.history = append(f.history, r0)
  477. f.mutex.Unlock()
  478. }
  479. // History returns a sequence of LoginSourcesStoreGetByIDFuncCall objects
  480. // describing the invocations of this function.
  481. func (f *LoginSourcesStoreGetByIDFunc) History() []LoginSourcesStoreGetByIDFuncCall {
  482. f.mutex.Lock()
  483. history := make([]LoginSourcesStoreGetByIDFuncCall, len(f.history))
  484. copy(history, f.history)
  485. f.mutex.Unlock()
  486. return history
  487. }
  488. // LoginSourcesStoreGetByIDFuncCall is an object that describes an
  489. // invocation of method GetByID on an instance of MockLoginSourcesStore.
  490. type LoginSourcesStoreGetByIDFuncCall struct {
  491. // Arg0 is the value of the 1st argument passed to this method
  492. // invocation.
  493. Arg0 context.Context
  494. // Arg1 is the value of the 2nd argument passed to this method
  495. // invocation.
  496. Arg1 int64
  497. // Result0 is the value of the 1st result returned from this method
  498. // invocation.
  499. Result0 *LoginSource
  500. // Result1 is the value of the 2nd result returned from this method
  501. // invocation.
  502. Result1 error
  503. }
  504. // Args returns an interface slice containing the arguments of this
  505. // invocation.
  506. func (c LoginSourcesStoreGetByIDFuncCall) Args() []interface{} {
  507. return []interface{}{c.Arg0, c.Arg1}
  508. }
  509. // Results returns an interface slice containing the results of this
  510. // invocation.
  511. func (c LoginSourcesStoreGetByIDFuncCall) Results() []interface{} {
  512. return []interface{}{c.Result0, c.Result1}
  513. }
  514. // LoginSourcesStoreListFunc describes the behavior when the List method of
  515. // the parent MockLoginSourcesStore instance is invoked.
  516. type LoginSourcesStoreListFunc struct {
  517. defaultHook func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error)
  518. hooks []func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error)
  519. history []LoginSourcesStoreListFuncCall
  520. mutex sync.Mutex
  521. }
  522. // List delegates to the next hook function in the queue and stores the
  523. // parameter and result values of this invocation.
  524. func (m *MockLoginSourcesStore) List(v0 context.Context, v1 ListLoginSourceOptions) ([]*LoginSource, error) {
  525. r0, r1 := m.ListFunc.nextHook()(v0, v1)
  526. m.ListFunc.appendCall(LoginSourcesStoreListFuncCall{v0, v1, r0, r1})
  527. return r0, r1
  528. }
  529. // SetDefaultHook sets function that is called when the List method of the
  530. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  531. // empty.
  532. func (f *LoginSourcesStoreListFunc) SetDefaultHook(hook func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error)) {
  533. f.defaultHook = hook
  534. }
  535. // PushHook adds a function to the end of hook queue. Each invocation of the
  536. // List method of the parent MockLoginSourcesStore instance invokes the hook
  537. // at the front of the queue and discards it. After the queue is empty, the
  538. // default hook function is invoked for any future action.
  539. func (f *LoginSourcesStoreListFunc) PushHook(hook func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error)) {
  540. f.mutex.Lock()
  541. f.hooks = append(f.hooks, hook)
  542. f.mutex.Unlock()
  543. }
  544. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  545. // given values.
  546. func (f *LoginSourcesStoreListFunc) SetDefaultReturn(r0 []*LoginSource, r1 error) {
  547. f.SetDefaultHook(func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error) {
  548. return r0, r1
  549. })
  550. }
  551. // PushReturn calls PushHook with a function that returns the given values.
  552. func (f *LoginSourcesStoreListFunc) PushReturn(r0 []*LoginSource, r1 error) {
  553. f.PushHook(func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error) {
  554. return r0, r1
  555. })
  556. }
  557. func (f *LoginSourcesStoreListFunc) nextHook() func(context.Context, ListLoginSourceOptions) ([]*LoginSource, error) {
  558. f.mutex.Lock()
  559. defer f.mutex.Unlock()
  560. if len(f.hooks) == 0 {
  561. return f.defaultHook
  562. }
  563. hook := f.hooks[0]
  564. f.hooks = f.hooks[1:]
  565. return hook
  566. }
  567. func (f *LoginSourcesStoreListFunc) appendCall(r0 LoginSourcesStoreListFuncCall) {
  568. f.mutex.Lock()
  569. f.history = append(f.history, r0)
  570. f.mutex.Unlock()
  571. }
  572. // History returns a sequence of LoginSourcesStoreListFuncCall objects
  573. // describing the invocations of this function.
  574. func (f *LoginSourcesStoreListFunc) History() []LoginSourcesStoreListFuncCall {
  575. f.mutex.Lock()
  576. history := make([]LoginSourcesStoreListFuncCall, len(f.history))
  577. copy(history, f.history)
  578. f.mutex.Unlock()
  579. return history
  580. }
  581. // LoginSourcesStoreListFuncCall is an object that describes an invocation
  582. // of method List on an instance of MockLoginSourcesStore.
  583. type LoginSourcesStoreListFuncCall struct {
  584. // Arg0 is the value of the 1st argument passed to this method
  585. // invocation.
  586. Arg0 context.Context
  587. // Arg1 is the value of the 2nd argument passed to this method
  588. // invocation.
  589. Arg1 ListLoginSourceOptions
  590. // Result0 is the value of the 1st result returned from this method
  591. // invocation.
  592. Result0 []*LoginSource
  593. // Result1 is the value of the 2nd result returned from this method
  594. // invocation.
  595. Result1 error
  596. }
  597. // Args returns an interface slice containing the arguments of this
  598. // invocation.
  599. func (c LoginSourcesStoreListFuncCall) Args() []interface{} {
  600. return []interface{}{c.Arg0, c.Arg1}
  601. }
  602. // Results returns an interface slice containing the results of this
  603. // invocation.
  604. func (c LoginSourcesStoreListFuncCall) Results() []interface{} {
  605. return []interface{}{c.Result0, c.Result1}
  606. }
  607. // LoginSourcesStoreResetNonDefaultFunc describes the behavior when the
  608. // ResetNonDefault method of the parent MockLoginSourcesStore instance is
  609. // invoked.
  610. type LoginSourcesStoreResetNonDefaultFunc struct {
  611. defaultHook func(context.Context, *LoginSource) error
  612. hooks []func(context.Context, *LoginSource) error
  613. history []LoginSourcesStoreResetNonDefaultFuncCall
  614. mutex sync.Mutex
  615. }
  616. // ResetNonDefault delegates to the next hook function in the queue and
  617. // stores the parameter and result values of this invocation.
  618. func (m *MockLoginSourcesStore) ResetNonDefault(v0 context.Context, v1 *LoginSource) error {
  619. r0 := m.ResetNonDefaultFunc.nextHook()(v0, v1)
  620. m.ResetNonDefaultFunc.appendCall(LoginSourcesStoreResetNonDefaultFuncCall{v0, v1, r0})
  621. return r0
  622. }
  623. // SetDefaultHook sets function that is called when the ResetNonDefault
  624. // method of the parent MockLoginSourcesStore instance is invoked and the
  625. // hook queue is empty.
  626. func (f *LoginSourcesStoreResetNonDefaultFunc) SetDefaultHook(hook func(context.Context, *LoginSource) error) {
  627. f.defaultHook = hook
  628. }
  629. // PushHook adds a function to the end of hook queue. Each invocation of the
  630. // ResetNonDefault method of the parent MockLoginSourcesStore instance
  631. // invokes the hook at the front of the queue and discards it. After the
  632. // queue is empty, the default hook function is invoked for any future
  633. // action.
  634. func (f *LoginSourcesStoreResetNonDefaultFunc) PushHook(hook func(context.Context, *LoginSource) error) {
  635. f.mutex.Lock()
  636. f.hooks = append(f.hooks, hook)
  637. f.mutex.Unlock()
  638. }
  639. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  640. // given values.
  641. func (f *LoginSourcesStoreResetNonDefaultFunc) SetDefaultReturn(r0 error) {
  642. f.SetDefaultHook(func(context.Context, *LoginSource) error {
  643. return r0
  644. })
  645. }
  646. // PushReturn calls PushHook with a function that returns the given values.
  647. func (f *LoginSourcesStoreResetNonDefaultFunc) PushReturn(r0 error) {
  648. f.PushHook(func(context.Context, *LoginSource) error {
  649. return r0
  650. })
  651. }
  652. func (f *LoginSourcesStoreResetNonDefaultFunc) nextHook() func(context.Context, *LoginSource) error {
  653. f.mutex.Lock()
  654. defer f.mutex.Unlock()
  655. if len(f.hooks) == 0 {
  656. return f.defaultHook
  657. }
  658. hook := f.hooks[0]
  659. f.hooks = f.hooks[1:]
  660. return hook
  661. }
  662. func (f *LoginSourcesStoreResetNonDefaultFunc) appendCall(r0 LoginSourcesStoreResetNonDefaultFuncCall) {
  663. f.mutex.Lock()
  664. f.history = append(f.history, r0)
  665. f.mutex.Unlock()
  666. }
  667. // History returns a sequence of LoginSourcesStoreResetNonDefaultFuncCall
  668. // objects describing the invocations of this function.
  669. func (f *LoginSourcesStoreResetNonDefaultFunc) History() []LoginSourcesStoreResetNonDefaultFuncCall {
  670. f.mutex.Lock()
  671. history := make([]LoginSourcesStoreResetNonDefaultFuncCall, len(f.history))
  672. copy(history, f.history)
  673. f.mutex.Unlock()
  674. return history
  675. }
  676. // LoginSourcesStoreResetNonDefaultFuncCall is an object that describes an
  677. // invocation of method ResetNonDefault on an instance of
  678. // MockLoginSourcesStore.
  679. type LoginSourcesStoreResetNonDefaultFuncCall struct {
  680. // Arg0 is the value of the 1st argument passed to this method
  681. // invocation.
  682. Arg0 context.Context
  683. // Arg1 is the value of the 2nd argument passed to this method
  684. // invocation.
  685. Arg1 *LoginSource
  686. // Result0 is the value of the 1st result returned from this method
  687. // invocation.
  688. Result0 error
  689. }
  690. // Args returns an interface slice containing the arguments of this
  691. // invocation.
  692. func (c LoginSourcesStoreResetNonDefaultFuncCall) Args() []interface{} {
  693. return []interface{}{c.Arg0, c.Arg1}
  694. }
  695. // Results returns an interface slice containing the results of this
  696. // invocation.
  697. func (c LoginSourcesStoreResetNonDefaultFuncCall) Results() []interface{} {
  698. return []interface{}{c.Result0}
  699. }
  700. // LoginSourcesStoreSaveFunc describes the behavior when the Save method of
  701. // the parent MockLoginSourcesStore instance is invoked.
  702. type LoginSourcesStoreSaveFunc struct {
  703. defaultHook func(context.Context, *LoginSource) error
  704. hooks []func(context.Context, *LoginSource) error
  705. history []LoginSourcesStoreSaveFuncCall
  706. mutex sync.Mutex
  707. }
  708. // Save delegates to the next hook function in the queue and stores the
  709. // parameter and result values of this invocation.
  710. func (m *MockLoginSourcesStore) Save(v0 context.Context, v1 *LoginSource) error {
  711. r0 := m.SaveFunc.nextHook()(v0, v1)
  712. m.SaveFunc.appendCall(LoginSourcesStoreSaveFuncCall{v0, v1, r0})
  713. return r0
  714. }
  715. // SetDefaultHook sets function that is called when the Save method of the
  716. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  717. // empty.
  718. func (f *LoginSourcesStoreSaveFunc) SetDefaultHook(hook func(context.Context, *LoginSource) error) {
  719. f.defaultHook = hook
  720. }
  721. // PushHook adds a function to the end of hook queue. Each invocation of the
  722. // Save method of the parent MockLoginSourcesStore instance invokes the hook
  723. // at the front of the queue and discards it. After the queue is empty, the
  724. // default hook function is invoked for any future action.
  725. func (f *LoginSourcesStoreSaveFunc) PushHook(hook func(context.Context, *LoginSource) error) {
  726. f.mutex.Lock()
  727. f.hooks = append(f.hooks, hook)
  728. f.mutex.Unlock()
  729. }
  730. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  731. // given values.
  732. func (f *LoginSourcesStoreSaveFunc) SetDefaultReturn(r0 error) {
  733. f.SetDefaultHook(func(context.Context, *LoginSource) error {
  734. return r0
  735. })
  736. }
  737. // PushReturn calls PushHook with a function that returns the given values.
  738. func (f *LoginSourcesStoreSaveFunc) PushReturn(r0 error) {
  739. f.PushHook(func(context.Context, *LoginSource) error {
  740. return r0
  741. })
  742. }
  743. func (f *LoginSourcesStoreSaveFunc) nextHook() func(context.Context, *LoginSource) error {
  744. f.mutex.Lock()
  745. defer f.mutex.Unlock()
  746. if len(f.hooks) == 0 {
  747. return f.defaultHook
  748. }
  749. hook := f.hooks[0]
  750. f.hooks = f.hooks[1:]
  751. return hook
  752. }
  753. func (f *LoginSourcesStoreSaveFunc) appendCall(r0 LoginSourcesStoreSaveFuncCall) {
  754. f.mutex.Lock()
  755. f.history = append(f.history, r0)
  756. f.mutex.Unlock()
  757. }
  758. // History returns a sequence of LoginSourcesStoreSaveFuncCall objects
  759. // describing the invocations of this function.
  760. func (f *LoginSourcesStoreSaveFunc) History() []LoginSourcesStoreSaveFuncCall {
  761. f.mutex.Lock()
  762. history := make([]LoginSourcesStoreSaveFuncCall, len(f.history))
  763. copy(history, f.history)
  764. f.mutex.Unlock()
  765. return history
  766. }
  767. // LoginSourcesStoreSaveFuncCall is an object that describes an invocation
  768. // of method Save on an instance of MockLoginSourcesStore.
  769. type LoginSourcesStoreSaveFuncCall struct {
  770. // Arg0 is the value of the 1st argument passed to this method
  771. // invocation.
  772. Arg0 context.Context
  773. // Arg1 is the value of the 2nd argument passed to this method
  774. // invocation.
  775. Arg1 *LoginSource
  776. // Result0 is the value of the 1st result returned from this method
  777. // invocation.
  778. Result0 error
  779. }
  780. // Args returns an interface slice containing the arguments of this
  781. // invocation.
  782. func (c LoginSourcesStoreSaveFuncCall) Args() []interface{} {
  783. return []interface{}{c.Arg0, c.Arg1}
  784. }
  785. // Results returns an interface slice containing the results of this
  786. // invocation.
  787. func (c LoginSourcesStoreSaveFuncCall) Results() []interface{} {
  788. return []interface{}{c.Result0}
  789. }
  790. // MockLoginSourceFileStore is a mock implementation of the
  791. // loginSourceFileStore interface (from the package
  792. // gogs.io/gogs/internal/db) used for unit testing.
  793. type MockLoginSourceFileStore struct {
  794. // SaveFunc is an instance of a mock function object controlling the
  795. // behavior of the method Save.
  796. SaveFunc *LoginSourceFileStoreSaveFunc
  797. // SetConfigFunc is an instance of a mock function object controlling
  798. // the behavior of the method SetConfig.
  799. SetConfigFunc *LoginSourceFileStoreSetConfigFunc
  800. // SetGeneralFunc is an instance of a mock function object controlling
  801. // the behavior of the method SetGeneral.
  802. SetGeneralFunc *LoginSourceFileStoreSetGeneralFunc
  803. }
  804. // NewMockLoginSourceFileStore creates a new mock of the
  805. // loginSourceFileStore interface. All methods return zero values for all
  806. // results, unless overwritten.
  807. func NewMockLoginSourceFileStore() *MockLoginSourceFileStore {
  808. return &MockLoginSourceFileStore{
  809. SaveFunc: &LoginSourceFileStoreSaveFunc{
  810. defaultHook: func() (r0 error) {
  811. return
  812. },
  813. },
  814. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  815. defaultHook: func(interface{}) (r0 error) {
  816. return
  817. },
  818. },
  819. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  820. defaultHook: func(string, string) {
  821. return
  822. },
  823. },
  824. }
  825. }
  826. // NewStrictMockLoginSourceFileStore creates a new mock of the
  827. // loginSourceFileStore interface. All methods panic on invocation, unless
  828. // overwritten.
  829. func NewStrictMockLoginSourceFileStore() *MockLoginSourceFileStore {
  830. return &MockLoginSourceFileStore{
  831. SaveFunc: &LoginSourceFileStoreSaveFunc{
  832. defaultHook: func() error {
  833. panic("unexpected invocation of MockLoginSourceFileStore.Save")
  834. },
  835. },
  836. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  837. defaultHook: func(interface{}) error {
  838. panic("unexpected invocation of MockLoginSourceFileStore.SetConfig")
  839. },
  840. },
  841. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  842. defaultHook: func(string, string) {
  843. panic("unexpected invocation of MockLoginSourceFileStore.SetGeneral")
  844. },
  845. },
  846. }
  847. }
  848. // surrogateMockLoginSourceFileStore is a copy of the loginSourceFileStore
  849. // interface (from the package gogs.io/gogs/internal/db). It is redefined
  850. // here as it is unexported in the source package.
  851. type surrogateMockLoginSourceFileStore interface {
  852. Save() error
  853. SetConfig(interface{}) error
  854. SetGeneral(string, string)
  855. }
  856. // NewMockLoginSourceFileStoreFrom creates a new mock of the
  857. // MockLoginSourceFileStore interface. All methods delegate to the given
  858. // implementation, unless overwritten.
  859. func NewMockLoginSourceFileStoreFrom(i surrogateMockLoginSourceFileStore) *MockLoginSourceFileStore {
  860. return &MockLoginSourceFileStore{
  861. SaveFunc: &LoginSourceFileStoreSaveFunc{
  862. defaultHook: i.Save,
  863. },
  864. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  865. defaultHook: i.SetConfig,
  866. },
  867. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  868. defaultHook: i.SetGeneral,
  869. },
  870. }
  871. }
  872. // LoginSourceFileStoreSaveFunc describes the behavior when the Save method
  873. // of the parent MockLoginSourceFileStore instance is invoked.
  874. type LoginSourceFileStoreSaveFunc struct {
  875. defaultHook func() error
  876. hooks []func() error
  877. history []LoginSourceFileStoreSaveFuncCall
  878. mutex sync.Mutex
  879. }
  880. // Save delegates to the next hook function in the queue and stores the
  881. // parameter and result values of this invocation.
  882. func (m *MockLoginSourceFileStore) Save() error {
  883. r0 := m.SaveFunc.nextHook()()
  884. m.SaveFunc.appendCall(LoginSourceFileStoreSaveFuncCall{r0})
  885. return r0
  886. }
  887. // SetDefaultHook sets function that is called when the Save method of the
  888. // parent MockLoginSourceFileStore instance is invoked and the hook queue is
  889. // empty.
  890. func (f *LoginSourceFileStoreSaveFunc) SetDefaultHook(hook func() error) {
  891. f.defaultHook = hook
  892. }
  893. // PushHook adds a function to the end of hook queue. Each invocation of the
  894. // Save method of the parent MockLoginSourceFileStore instance invokes the
  895. // hook at the front of the queue and discards it. After the queue is empty,
  896. // the default hook function is invoked for any future action.
  897. func (f *LoginSourceFileStoreSaveFunc) PushHook(hook func() error) {
  898. f.mutex.Lock()
  899. f.hooks = append(f.hooks, hook)
  900. f.mutex.Unlock()
  901. }
  902. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  903. // given values.
  904. func (f *LoginSourceFileStoreSaveFunc) SetDefaultReturn(r0 error) {
  905. f.SetDefaultHook(func() error {
  906. return r0
  907. })
  908. }
  909. // PushReturn calls PushHook with a function that returns the given values.
  910. func (f *LoginSourceFileStoreSaveFunc) PushReturn(r0 error) {
  911. f.PushHook(func() error {
  912. return r0
  913. })
  914. }
  915. func (f *LoginSourceFileStoreSaveFunc) nextHook() func() error {
  916. f.mutex.Lock()
  917. defer f.mutex.Unlock()
  918. if len(f.hooks) == 0 {
  919. return f.defaultHook
  920. }
  921. hook := f.hooks[0]
  922. f.hooks = f.hooks[1:]
  923. return hook
  924. }
  925. func (f *LoginSourceFileStoreSaveFunc) appendCall(r0 LoginSourceFileStoreSaveFuncCall) {
  926. f.mutex.Lock()
  927. f.history = append(f.history, r0)
  928. f.mutex.Unlock()
  929. }
  930. // History returns a sequence of LoginSourceFileStoreSaveFuncCall objects
  931. // describing the invocations of this function.
  932. func (f *LoginSourceFileStoreSaveFunc) History() []LoginSourceFileStoreSaveFuncCall {
  933. f.mutex.Lock()
  934. history := make([]LoginSourceFileStoreSaveFuncCall, len(f.history))
  935. copy(history, f.history)
  936. f.mutex.Unlock()
  937. return history
  938. }
  939. // LoginSourceFileStoreSaveFuncCall is an object that describes an
  940. // invocation of method Save on an instance of MockLoginSourceFileStore.
  941. type LoginSourceFileStoreSaveFuncCall struct {
  942. // Result0 is the value of the 1st result returned from this method
  943. // invocation.
  944. Result0 error
  945. }
  946. // Args returns an interface slice containing the arguments of this
  947. // invocation.
  948. func (c LoginSourceFileStoreSaveFuncCall) Args() []interface{} {
  949. return []interface{}{}
  950. }
  951. // Results returns an interface slice containing the results of this
  952. // invocation.
  953. func (c LoginSourceFileStoreSaveFuncCall) Results() []interface{} {
  954. return []interface{}{c.Result0}
  955. }
  956. // LoginSourceFileStoreSetConfigFunc describes the behavior when the
  957. // SetConfig method of the parent MockLoginSourceFileStore instance is
  958. // invoked.
  959. type LoginSourceFileStoreSetConfigFunc struct {
  960. defaultHook func(interface{}) error
  961. hooks []func(interface{}) error
  962. history []LoginSourceFileStoreSetConfigFuncCall
  963. mutex sync.Mutex
  964. }
  965. // SetConfig delegates to the next hook function in the queue and stores the
  966. // parameter and result values of this invocation.
  967. func (m *MockLoginSourceFileStore) SetConfig(v0 interface{}) error {
  968. r0 := m.SetConfigFunc.nextHook()(v0)
  969. m.SetConfigFunc.appendCall(LoginSourceFileStoreSetConfigFuncCall{v0, r0})
  970. return r0
  971. }
  972. // SetDefaultHook sets function that is called when the SetConfig method of
  973. // the parent MockLoginSourceFileStore instance is invoked and the hook
  974. // queue is empty.
  975. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultHook(hook func(interface{}) error) {
  976. f.defaultHook = hook
  977. }
  978. // PushHook adds a function to the end of hook queue. Each invocation of the
  979. // SetConfig method of the parent MockLoginSourceFileStore instance invokes
  980. // the hook at the front of the queue and discards it. After the queue is
  981. // empty, the default hook function is invoked for any future action.
  982. func (f *LoginSourceFileStoreSetConfigFunc) PushHook(hook func(interface{}) error) {
  983. f.mutex.Lock()
  984. f.hooks = append(f.hooks, hook)
  985. f.mutex.Unlock()
  986. }
  987. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  988. // given values.
  989. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultReturn(r0 error) {
  990. f.SetDefaultHook(func(interface{}) error {
  991. return r0
  992. })
  993. }
  994. // PushReturn calls PushHook with a function that returns the given values.
  995. func (f *LoginSourceFileStoreSetConfigFunc) PushReturn(r0 error) {
  996. f.PushHook(func(interface{}) error {
  997. return r0
  998. })
  999. }
  1000. func (f *LoginSourceFileStoreSetConfigFunc) nextHook() func(interface{}) error {
  1001. f.mutex.Lock()
  1002. defer f.mutex.Unlock()
  1003. if len(f.hooks) == 0 {
  1004. return f.defaultHook
  1005. }
  1006. hook := f.hooks[0]
  1007. f.hooks = f.hooks[1:]
  1008. return hook
  1009. }
  1010. func (f *LoginSourceFileStoreSetConfigFunc) appendCall(r0 LoginSourceFileStoreSetConfigFuncCall) {
  1011. f.mutex.Lock()
  1012. f.history = append(f.history, r0)
  1013. f.mutex.Unlock()
  1014. }
  1015. // History returns a sequence of LoginSourceFileStoreSetConfigFuncCall
  1016. // objects describing the invocations of this function.
  1017. func (f *LoginSourceFileStoreSetConfigFunc) History() []LoginSourceFileStoreSetConfigFuncCall {
  1018. f.mutex.Lock()
  1019. history := make([]LoginSourceFileStoreSetConfigFuncCall, len(f.history))
  1020. copy(history, f.history)
  1021. f.mutex.Unlock()
  1022. return history
  1023. }
  1024. // LoginSourceFileStoreSetConfigFuncCall is an object that describes an
  1025. // invocation of method SetConfig on an instance of
  1026. // MockLoginSourceFileStore.
  1027. type LoginSourceFileStoreSetConfigFuncCall struct {
  1028. // Arg0 is the value of the 1st argument passed to this method
  1029. // invocation.
  1030. Arg0 interface{}
  1031. // Result0 is the value of the 1st result returned from this method
  1032. // invocation.
  1033. Result0 error
  1034. }
  1035. // Args returns an interface slice containing the arguments of this
  1036. // invocation.
  1037. func (c LoginSourceFileStoreSetConfigFuncCall) Args() []interface{} {
  1038. return []interface{}{c.Arg0}
  1039. }
  1040. // Results returns an interface slice containing the results of this
  1041. // invocation.
  1042. func (c LoginSourceFileStoreSetConfigFuncCall) Results() []interface{} {
  1043. return []interface{}{c.Result0}
  1044. }
  1045. // LoginSourceFileStoreSetGeneralFunc describes the behavior when the
  1046. // SetGeneral method of the parent MockLoginSourceFileStore instance is
  1047. // invoked.
  1048. type LoginSourceFileStoreSetGeneralFunc struct {
  1049. defaultHook func(string, string)
  1050. hooks []func(string, string)
  1051. history []LoginSourceFileStoreSetGeneralFuncCall
  1052. mutex sync.Mutex
  1053. }
  1054. // SetGeneral delegates to the next hook function in the queue and stores
  1055. // the parameter and result values of this invocation.
  1056. func (m *MockLoginSourceFileStore) SetGeneral(v0 string, v1 string) {
  1057. m.SetGeneralFunc.nextHook()(v0, v1)
  1058. m.SetGeneralFunc.appendCall(LoginSourceFileStoreSetGeneralFuncCall{v0, v1})
  1059. return
  1060. }
  1061. // SetDefaultHook sets function that is called when the SetGeneral method of
  1062. // the parent MockLoginSourceFileStore instance is invoked and the hook
  1063. // queue is empty.
  1064. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultHook(hook func(string, string)) {
  1065. f.defaultHook = hook
  1066. }
  1067. // PushHook adds a function to the end of hook queue. Each invocation of the
  1068. // SetGeneral method of the parent MockLoginSourceFileStore instance invokes
  1069. // the hook at the front of the queue and discards it. After the queue is
  1070. // empty, the default hook function is invoked for any future action.
  1071. func (f *LoginSourceFileStoreSetGeneralFunc) PushHook(hook func(string, string)) {
  1072. f.mutex.Lock()
  1073. f.hooks = append(f.hooks, hook)
  1074. f.mutex.Unlock()
  1075. }
  1076. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1077. // given values.
  1078. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultReturn() {
  1079. f.SetDefaultHook(func(string, string) {
  1080. return
  1081. })
  1082. }
  1083. // PushReturn calls PushHook with a function that returns the given values.
  1084. func (f *LoginSourceFileStoreSetGeneralFunc) PushReturn() {
  1085. f.PushHook(func(string, string) {
  1086. return
  1087. })
  1088. }
  1089. func (f *LoginSourceFileStoreSetGeneralFunc) nextHook() func(string, string) {
  1090. f.mutex.Lock()
  1091. defer f.mutex.Unlock()
  1092. if len(f.hooks) == 0 {
  1093. return f.defaultHook
  1094. }
  1095. hook := f.hooks[0]
  1096. f.hooks = f.hooks[1:]
  1097. return hook
  1098. }
  1099. func (f *LoginSourceFileStoreSetGeneralFunc) appendCall(r0 LoginSourceFileStoreSetGeneralFuncCall) {
  1100. f.mutex.Lock()
  1101. f.history = append(f.history, r0)
  1102. f.mutex.Unlock()
  1103. }
  1104. // History returns a sequence of LoginSourceFileStoreSetGeneralFuncCall
  1105. // objects describing the invocations of this function.
  1106. func (f *LoginSourceFileStoreSetGeneralFunc) History() []LoginSourceFileStoreSetGeneralFuncCall {
  1107. f.mutex.Lock()
  1108. history := make([]LoginSourceFileStoreSetGeneralFuncCall, len(f.history))
  1109. copy(history, f.history)
  1110. f.mutex.Unlock()
  1111. return history
  1112. }
  1113. // LoginSourceFileStoreSetGeneralFuncCall is an object that describes an
  1114. // invocation of method SetGeneral on an instance of
  1115. // MockLoginSourceFileStore.
  1116. type LoginSourceFileStoreSetGeneralFuncCall struct {
  1117. // Arg0 is the value of the 1st argument passed to this method
  1118. // invocation.
  1119. Arg0 string
  1120. // Arg1 is the value of the 2nd argument passed to this method
  1121. // invocation.
  1122. Arg1 string
  1123. }
  1124. // Args returns an interface slice containing the arguments of this
  1125. // invocation.
  1126. func (c LoginSourceFileStoreSetGeneralFuncCall) Args() []interface{} {
  1127. return []interface{}{c.Arg0, c.Arg1}
  1128. }
  1129. // Results returns an interface slice containing the results of this
  1130. // invocation.
  1131. func (c LoginSourceFileStoreSetGeneralFuncCall) Results() []interface{} {
  1132. return []interface{}{}
  1133. }
  1134. // MockLoginSourceFilesStore is a mock implementation of the
  1135. // loginSourceFilesStore interface (from the package
  1136. // gogs.io/gogs/internal/db) used for unit testing.
  1137. type MockLoginSourceFilesStore struct {
  1138. // GetByIDFunc is an instance of a mock function object controlling the
  1139. // behavior of the method GetByID.
  1140. GetByIDFunc *LoginSourceFilesStoreGetByIDFunc
  1141. // LenFunc is an instance of a mock function object controlling the
  1142. // behavior of the method Len.
  1143. LenFunc *LoginSourceFilesStoreLenFunc
  1144. // ListFunc is an instance of a mock function object controlling the
  1145. // behavior of the method List.
  1146. ListFunc *LoginSourceFilesStoreListFunc
  1147. // UpdateFunc is an instance of a mock function object controlling the
  1148. // behavior of the method Update.
  1149. UpdateFunc *LoginSourceFilesStoreUpdateFunc
  1150. }
  1151. // NewMockLoginSourceFilesStore creates a new mock of the
  1152. // loginSourceFilesStore interface. All methods return zero values for all
  1153. // results, unless overwritten.
  1154. func NewMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  1155. return &MockLoginSourceFilesStore{
  1156. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  1157. defaultHook: func(int64) (r0 *LoginSource, r1 error) {
  1158. return
  1159. },
  1160. },
  1161. LenFunc: &LoginSourceFilesStoreLenFunc{
  1162. defaultHook: func() (r0 int) {
  1163. return
  1164. },
  1165. },
  1166. ListFunc: &LoginSourceFilesStoreListFunc{
  1167. defaultHook: func(ListLoginSourceOptions) (r0 []*LoginSource) {
  1168. return
  1169. },
  1170. },
  1171. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  1172. defaultHook: func(*LoginSource) {
  1173. return
  1174. },
  1175. },
  1176. }
  1177. }
  1178. // NewStrictMockLoginSourceFilesStore creates a new mock of the
  1179. // loginSourceFilesStore interface. All methods panic on invocation, unless
  1180. // overwritten.
  1181. func NewStrictMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  1182. return &MockLoginSourceFilesStore{
  1183. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  1184. defaultHook: func(int64) (*LoginSource, error) {
  1185. panic("unexpected invocation of MockLoginSourceFilesStore.GetByID")
  1186. },
  1187. },
  1188. LenFunc: &LoginSourceFilesStoreLenFunc{
  1189. defaultHook: func() int {
  1190. panic("unexpected invocation of MockLoginSourceFilesStore.Len")
  1191. },
  1192. },
  1193. ListFunc: &LoginSourceFilesStoreListFunc{
  1194. defaultHook: func(ListLoginSourceOptions) []*LoginSource {
  1195. panic("unexpected invocation of MockLoginSourceFilesStore.List")
  1196. },
  1197. },
  1198. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  1199. defaultHook: func(*LoginSource) {
  1200. panic("unexpected invocation of MockLoginSourceFilesStore.Update")
  1201. },
  1202. },
  1203. }
  1204. }
  1205. // surrogateMockLoginSourceFilesStore is a copy of the loginSourceFilesStore
  1206. // interface (from the package gogs.io/gogs/internal/db). It is redefined
  1207. // here as it is unexported in the source package.
  1208. type surrogateMockLoginSourceFilesStore interface {
  1209. GetByID(int64) (*LoginSource, error)
  1210. Len() int
  1211. List(ListLoginSourceOptions) []*LoginSource
  1212. Update(*LoginSource)
  1213. }
  1214. // NewMockLoginSourceFilesStoreFrom creates a new mock of the
  1215. // MockLoginSourceFilesStore interface. All methods delegate to the given
  1216. // implementation, unless overwritten.
  1217. func NewMockLoginSourceFilesStoreFrom(i surrogateMockLoginSourceFilesStore) *MockLoginSourceFilesStore {
  1218. return &MockLoginSourceFilesStore{
  1219. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  1220. defaultHook: i.GetByID,
  1221. },
  1222. LenFunc: &LoginSourceFilesStoreLenFunc{
  1223. defaultHook: i.Len,
  1224. },
  1225. ListFunc: &LoginSourceFilesStoreListFunc{
  1226. defaultHook: i.List,
  1227. },
  1228. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  1229. defaultHook: i.Update,
  1230. },
  1231. }
  1232. }
  1233. // LoginSourceFilesStoreGetByIDFunc describes the behavior when the GetByID
  1234. // method of the parent MockLoginSourceFilesStore instance is invoked.
  1235. type LoginSourceFilesStoreGetByIDFunc struct {
  1236. defaultHook func(int64) (*LoginSource, error)
  1237. hooks []func(int64) (*LoginSource, error)
  1238. history []LoginSourceFilesStoreGetByIDFuncCall
  1239. mutex sync.Mutex
  1240. }
  1241. // GetByID delegates to the next hook function in the queue and stores the
  1242. // parameter and result values of this invocation.
  1243. func (m *MockLoginSourceFilesStore) GetByID(v0 int64) (*LoginSource, error) {
  1244. r0, r1 := m.GetByIDFunc.nextHook()(v0)
  1245. m.GetByIDFunc.appendCall(LoginSourceFilesStoreGetByIDFuncCall{v0, r0, r1})
  1246. return r0, r1
  1247. }
  1248. // SetDefaultHook sets function that is called when the GetByID method of
  1249. // the parent MockLoginSourceFilesStore instance is invoked and the hook
  1250. // queue is empty.
  1251. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultHook(hook func(int64) (*LoginSource, error)) {
  1252. f.defaultHook = hook
  1253. }
  1254. // PushHook adds a function to the end of hook queue. Each invocation of the
  1255. // GetByID method of the parent MockLoginSourceFilesStore instance invokes
  1256. // the hook at the front of the queue and discards it. After the queue is
  1257. // empty, the default hook function is invoked for any future action.
  1258. func (f *LoginSourceFilesStoreGetByIDFunc) PushHook(hook func(int64) (*LoginSource, error)) {
  1259. f.mutex.Lock()
  1260. f.hooks = append(f.hooks, hook)
  1261. f.mutex.Unlock()
  1262. }
  1263. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1264. // given values.
  1265. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  1266. f.SetDefaultHook(func(int64) (*LoginSource, error) {
  1267. return r0, r1
  1268. })
  1269. }
  1270. // PushReturn calls PushHook with a function that returns the given values.
  1271. func (f *LoginSourceFilesStoreGetByIDFunc) PushReturn(r0 *LoginSource, r1 error) {
  1272. f.PushHook(func(int64) (*LoginSource, error) {
  1273. return r0, r1
  1274. })
  1275. }
  1276. func (f *LoginSourceFilesStoreGetByIDFunc) nextHook() func(int64) (*LoginSource, error) {
  1277. f.mutex.Lock()
  1278. defer f.mutex.Unlock()
  1279. if len(f.hooks) == 0 {
  1280. return f.defaultHook
  1281. }
  1282. hook := f.hooks[0]
  1283. f.hooks = f.hooks[1:]
  1284. return hook
  1285. }
  1286. func (f *LoginSourceFilesStoreGetByIDFunc) appendCall(r0 LoginSourceFilesStoreGetByIDFuncCall) {
  1287. f.mutex.Lock()
  1288. f.history = append(f.history, r0)
  1289. f.mutex.Unlock()
  1290. }
  1291. // History returns a sequence of LoginSourceFilesStoreGetByIDFuncCall
  1292. // objects describing the invocations of this function.
  1293. func (f *LoginSourceFilesStoreGetByIDFunc) History() []LoginSourceFilesStoreGetByIDFuncCall {
  1294. f.mutex.Lock()
  1295. history := make([]LoginSourceFilesStoreGetByIDFuncCall, len(f.history))
  1296. copy(history, f.history)
  1297. f.mutex.Unlock()
  1298. return history
  1299. }
  1300. // LoginSourceFilesStoreGetByIDFuncCall is an object that describes an
  1301. // invocation of method GetByID on an instance of MockLoginSourceFilesStore.
  1302. type LoginSourceFilesStoreGetByIDFuncCall struct {
  1303. // Arg0 is the value of the 1st argument passed to this method
  1304. // invocation.
  1305. Arg0 int64
  1306. // Result0 is the value of the 1st result returned from this method
  1307. // invocation.
  1308. Result0 *LoginSource
  1309. // Result1 is the value of the 2nd result returned from this method
  1310. // invocation.
  1311. Result1 error
  1312. }
  1313. // Args returns an interface slice containing the arguments of this
  1314. // invocation.
  1315. func (c LoginSourceFilesStoreGetByIDFuncCall) Args() []interface{} {
  1316. return []interface{}{c.Arg0}
  1317. }
  1318. // Results returns an interface slice containing the results of this
  1319. // invocation.
  1320. func (c LoginSourceFilesStoreGetByIDFuncCall) Results() []interface{} {
  1321. return []interface{}{c.Result0, c.Result1}
  1322. }
  1323. // LoginSourceFilesStoreLenFunc describes the behavior when the Len method
  1324. // of the parent MockLoginSourceFilesStore instance is invoked.
  1325. type LoginSourceFilesStoreLenFunc struct {
  1326. defaultHook func() int
  1327. hooks []func() int
  1328. history []LoginSourceFilesStoreLenFuncCall
  1329. mutex sync.Mutex
  1330. }
  1331. // Len delegates to the next hook function in the queue and stores the
  1332. // parameter and result values of this invocation.
  1333. func (m *MockLoginSourceFilesStore) Len() int {
  1334. r0 := m.LenFunc.nextHook()()
  1335. m.LenFunc.appendCall(LoginSourceFilesStoreLenFuncCall{r0})
  1336. return r0
  1337. }
  1338. // SetDefaultHook sets function that is called when the Len method of the
  1339. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  1340. // is empty.
  1341. func (f *LoginSourceFilesStoreLenFunc) SetDefaultHook(hook func() int) {
  1342. f.defaultHook = hook
  1343. }
  1344. // PushHook adds a function to the end of hook queue. Each invocation of the
  1345. // Len method of the parent MockLoginSourceFilesStore instance invokes the
  1346. // hook at the front of the queue and discards it. After the queue is empty,
  1347. // the default hook function is invoked for any future action.
  1348. func (f *LoginSourceFilesStoreLenFunc) PushHook(hook func() int) {
  1349. f.mutex.Lock()
  1350. f.hooks = append(f.hooks, hook)
  1351. f.mutex.Unlock()
  1352. }
  1353. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1354. // given values.
  1355. func (f *LoginSourceFilesStoreLenFunc) SetDefaultReturn(r0 int) {
  1356. f.SetDefaultHook(func() int {
  1357. return r0
  1358. })
  1359. }
  1360. // PushReturn calls PushHook with a function that returns the given values.
  1361. func (f *LoginSourceFilesStoreLenFunc) PushReturn(r0 int) {
  1362. f.PushHook(func() int {
  1363. return r0
  1364. })
  1365. }
  1366. func (f *LoginSourceFilesStoreLenFunc) nextHook() func() int {
  1367. f.mutex.Lock()
  1368. defer f.mutex.Unlock()
  1369. if len(f.hooks) == 0 {
  1370. return f.defaultHook
  1371. }
  1372. hook := f.hooks[0]
  1373. f.hooks = f.hooks[1:]
  1374. return hook
  1375. }
  1376. func (f *LoginSourceFilesStoreLenFunc) appendCall(r0 LoginSourceFilesStoreLenFuncCall) {
  1377. f.mutex.Lock()
  1378. f.history = append(f.history, r0)
  1379. f.mutex.Unlock()
  1380. }
  1381. // History returns a sequence of LoginSourceFilesStoreLenFuncCall objects
  1382. // describing the invocations of this function.
  1383. func (f *LoginSourceFilesStoreLenFunc) History() []LoginSourceFilesStoreLenFuncCall {
  1384. f.mutex.Lock()
  1385. history := make([]LoginSourceFilesStoreLenFuncCall, len(f.history))
  1386. copy(history, f.history)
  1387. f.mutex.Unlock()
  1388. return history
  1389. }
  1390. // LoginSourceFilesStoreLenFuncCall is an object that describes an
  1391. // invocation of method Len on an instance of MockLoginSourceFilesStore.
  1392. type LoginSourceFilesStoreLenFuncCall struct {
  1393. // Result0 is the value of the 1st result returned from this method
  1394. // invocation.
  1395. Result0 int
  1396. }
  1397. // Args returns an interface slice containing the arguments of this
  1398. // invocation.
  1399. func (c LoginSourceFilesStoreLenFuncCall) Args() []interface{} {
  1400. return []interface{}{}
  1401. }
  1402. // Results returns an interface slice containing the results of this
  1403. // invocation.
  1404. func (c LoginSourceFilesStoreLenFuncCall) Results() []interface{} {
  1405. return []interface{}{c.Result0}
  1406. }
  1407. // LoginSourceFilesStoreListFunc describes the behavior when the List method
  1408. // of the parent MockLoginSourceFilesStore instance is invoked.
  1409. type LoginSourceFilesStoreListFunc struct {
  1410. defaultHook func(ListLoginSourceOptions) []*LoginSource
  1411. hooks []func(ListLoginSourceOptions) []*LoginSource
  1412. history []LoginSourceFilesStoreListFuncCall
  1413. mutex sync.Mutex
  1414. }
  1415. // List delegates to the next hook function in the queue and stores the
  1416. // parameter and result values of this invocation.
  1417. func (m *MockLoginSourceFilesStore) List(v0 ListLoginSourceOptions) []*LoginSource {
  1418. r0 := m.ListFunc.nextHook()(v0)
  1419. m.ListFunc.appendCall(LoginSourceFilesStoreListFuncCall{v0, r0})
  1420. return r0
  1421. }
  1422. // SetDefaultHook sets function that is called when the List method of the
  1423. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  1424. // is empty.
  1425. func (f *LoginSourceFilesStoreListFunc) SetDefaultHook(hook func(ListLoginSourceOptions) []*LoginSource) {
  1426. f.defaultHook = hook
  1427. }
  1428. // PushHook adds a function to the end of hook queue. Each invocation of the
  1429. // List method of the parent MockLoginSourceFilesStore instance invokes the
  1430. // hook at the front of the queue and discards it. After the queue is empty,
  1431. // the default hook function is invoked for any future action.
  1432. func (f *LoginSourceFilesStoreListFunc) PushHook(hook func(ListLoginSourceOptions) []*LoginSource) {
  1433. f.mutex.Lock()
  1434. f.hooks = append(f.hooks, hook)
  1435. f.mutex.Unlock()
  1436. }
  1437. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1438. // given values.
  1439. func (f *LoginSourceFilesStoreListFunc) SetDefaultReturn(r0 []*LoginSource) {
  1440. f.SetDefaultHook(func(ListLoginSourceOptions) []*LoginSource {
  1441. return r0
  1442. })
  1443. }
  1444. // PushReturn calls PushHook with a function that returns the given values.
  1445. func (f *LoginSourceFilesStoreListFunc) PushReturn(r0 []*LoginSource) {
  1446. f.PushHook(func(ListLoginSourceOptions) []*LoginSource {
  1447. return r0
  1448. })
  1449. }
  1450. func (f *LoginSourceFilesStoreListFunc) nextHook() func(ListLoginSourceOptions) []*LoginSource {
  1451. f.mutex.Lock()
  1452. defer f.mutex.Unlock()
  1453. if len(f.hooks) == 0 {
  1454. return f.defaultHook
  1455. }
  1456. hook := f.hooks[0]
  1457. f.hooks = f.hooks[1:]
  1458. return hook
  1459. }
  1460. func (f *LoginSourceFilesStoreListFunc) appendCall(r0 LoginSourceFilesStoreListFuncCall) {
  1461. f.mutex.Lock()
  1462. f.history = append(f.history, r0)
  1463. f.mutex.Unlock()
  1464. }
  1465. // History returns a sequence of LoginSourceFilesStoreListFuncCall objects
  1466. // describing the invocations of this function.
  1467. func (f *LoginSourceFilesStoreListFunc) History() []LoginSourceFilesStoreListFuncCall {
  1468. f.mutex.Lock()
  1469. history := make([]LoginSourceFilesStoreListFuncCall, len(f.history))
  1470. copy(history, f.history)
  1471. f.mutex.Unlock()
  1472. return history
  1473. }
  1474. // LoginSourceFilesStoreListFuncCall is an object that describes an
  1475. // invocation of method List on an instance of MockLoginSourceFilesStore.
  1476. type LoginSourceFilesStoreListFuncCall struct {
  1477. // Arg0 is the value of the 1st argument passed to this method
  1478. // invocation.
  1479. Arg0 ListLoginSourceOptions
  1480. // Result0 is the value of the 1st result returned from this method
  1481. // invocation.
  1482. Result0 []*LoginSource
  1483. }
  1484. // Args returns an interface slice containing the arguments of this
  1485. // invocation.
  1486. func (c LoginSourceFilesStoreListFuncCall) Args() []interface{} {
  1487. return []interface{}{c.Arg0}
  1488. }
  1489. // Results returns an interface slice containing the results of this
  1490. // invocation.
  1491. func (c LoginSourceFilesStoreListFuncCall) Results() []interface{} {
  1492. return []interface{}{c.Result0}
  1493. }
  1494. // LoginSourceFilesStoreUpdateFunc describes the behavior when the Update
  1495. // method of the parent MockLoginSourceFilesStore instance is invoked.
  1496. type LoginSourceFilesStoreUpdateFunc struct {
  1497. defaultHook func(*LoginSource)
  1498. hooks []func(*LoginSource)
  1499. history []LoginSourceFilesStoreUpdateFuncCall
  1500. mutex sync.Mutex
  1501. }
  1502. // Update delegates to the next hook function in the queue and stores the
  1503. // parameter and result values of this invocation.
  1504. func (m *MockLoginSourceFilesStore) Update(v0 *LoginSource) {
  1505. m.UpdateFunc.nextHook()(v0)
  1506. m.UpdateFunc.appendCall(LoginSourceFilesStoreUpdateFuncCall{v0})
  1507. return
  1508. }
  1509. // SetDefaultHook sets function that is called when the Update method of the
  1510. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  1511. // is empty.
  1512. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultHook(hook func(*LoginSource)) {
  1513. f.defaultHook = hook
  1514. }
  1515. // PushHook adds a function to the end of hook queue. Each invocation of the
  1516. // Update method of the parent MockLoginSourceFilesStore instance invokes
  1517. // the hook at the front of the queue and discards it. After the queue is
  1518. // empty, the default hook function is invoked for any future action.
  1519. func (f *LoginSourceFilesStoreUpdateFunc) PushHook(hook func(*LoginSource)) {
  1520. f.mutex.Lock()
  1521. f.hooks = append(f.hooks, hook)
  1522. f.mutex.Unlock()
  1523. }
  1524. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1525. // given values.
  1526. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultReturn() {
  1527. f.SetDefaultHook(func(*LoginSource) {
  1528. return
  1529. })
  1530. }
  1531. // PushReturn calls PushHook with a function that returns the given values.
  1532. func (f *LoginSourceFilesStoreUpdateFunc) PushReturn() {
  1533. f.PushHook(func(*LoginSource) {
  1534. return
  1535. })
  1536. }
  1537. func (f *LoginSourceFilesStoreUpdateFunc) nextHook() func(*LoginSource) {
  1538. f.mutex.Lock()
  1539. defer f.mutex.Unlock()
  1540. if len(f.hooks) == 0 {
  1541. return f.defaultHook
  1542. }
  1543. hook := f.hooks[0]
  1544. f.hooks = f.hooks[1:]
  1545. return hook
  1546. }
  1547. func (f *LoginSourceFilesStoreUpdateFunc) appendCall(r0 LoginSourceFilesStoreUpdateFuncCall) {
  1548. f.mutex.Lock()
  1549. f.history = append(f.history, r0)
  1550. f.mutex.Unlock()
  1551. }
  1552. // History returns a sequence of LoginSourceFilesStoreUpdateFuncCall objects
  1553. // describing the invocations of this function.
  1554. func (f *LoginSourceFilesStoreUpdateFunc) History() []LoginSourceFilesStoreUpdateFuncCall {
  1555. f.mutex.Lock()
  1556. history := make([]LoginSourceFilesStoreUpdateFuncCall, len(f.history))
  1557. copy(history, f.history)
  1558. f.mutex.Unlock()
  1559. return history
  1560. }
  1561. // LoginSourceFilesStoreUpdateFuncCall is an object that describes an
  1562. // invocation of method Update on an instance of MockLoginSourceFilesStore.
  1563. type LoginSourceFilesStoreUpdateFuncCall struct {
  1564. // Arg0 is the value of the 1st argument passed to this method
  1565. // invocation.
  1566. Arg0 *LoginSource
  1567. }
  1568. // Args returns an interface slice containing the arguments of this
  1569. // invocation.
  1570. func (c LoginSourceFilesStoreUpdateFuncCall) Args() []interface{} {
  1571. return []interface{}{c.Arg0}
  1572. }
  1573. // Results returns an interface slice containing the results of this
  1574. // invocation.
  1575. func (c LoginSourceFilesStoreUpdateFuncCall) Results() []interface{} {
  1576. return []interface{}{}
  1577. }
  1578. // MockProvider is a mock implementation of the Provider interface (from the
  1579. // package gogs.io/gogs/internal/auth) used for unit testing.
  1580. type MockProvider struct {
  1581. // AuthenticateFunc is an instance of a mock function object controlling
  1582. // the behavior of the method Authenticate.
  1583. AuthenticateFunc *ProviderAuthenticateFunc
  1584. // ConfigFunc is an instance of a mock function object controlling the
  1585. // behavior of the method Config.
  1586. ConfigFunc *ProviderConfigFunc
  1587. // HasTLSFunc is an instance of a mock function object controlling the
  1588. // behavior of the method HasTLS.
  1589. HasTLSFunc *ProviderHasTLSFunc
  1590. // SkipTLSVerifyFunc is an instance of a mock function object
  1591. // controlling the behavior of the method SkipTLSVerify.
  1592. SkipTLSVerifyFunc *ProviderSkipTLSVerifyFunc
  1593. // UseTLSFunc is an instance of a mock function object controlling the
  1594. // behavior of the method UseTLS.
  1595. UseTLSFunc *ProviderUseTLSFunc
  1596. }
  1597. // NewMockProvider creates a new mock of the Provider interface. All methods
  1598. // return zero values for all results, unless overwritten.
  1599. func NewMockProvider() *MockProvider {
  1600. return &MockProvider{
  1601. AuthenticateFunc: &ProviderAuthenticateFunc{
  1602. defaultHook: func(string, string) (r0 *auth.ExternalAccount, r1 error) {
  1603. return
  1604. },
  1605. },
  1606. ConfigFunc: &ProviderConfigFunc{
  1607. defaultHook: func() (r0 interface{}) {
  1608. return
  1609. },
  1610. },
  1611. HasTLSFunc: &ProviderHasTLSFunc{
  1612. defaultHook: func() (r0 bool) {
  1613. return
  1614. },
  1615. },
  1616. SkipTLSVerifyFunc: &ProviderSkipTLSVerifyFunc{
  1617. defaultHook: func() (r0 bool) {
  1618. return
  1619. },
  1620. },
  1621. UseTLSFunc: &ProviderUseTLSFunc{
  1622. defaultHook: func() (r0 bool) {
  1623. return
  1624. },
  1625. },
  1626. }
  1627. }
  1628. // NewStrictMockProvider creates a new mock of the Provider interface. All
  1629. // methods panic on invocation, unless overwritten.
  1630. func NewStrictMockProvider() *MockProvider {
  1631. return &MockProvider{
  1632. AuthenticateFunc: &ProviderAuthenticateFunc{
  1633. defaultHook: func(string, string) (*auth.ExternalAccount, error) {
  1634. panic("unexpected invocation of MockProvider.Authenticate")
  1635. },
  1636. },
  1637. ConfigFunc: &ProviderConfigFunc{
  1638. defaultHook: func() interface{} {
  1639. panic("unexpected invocation of MockProvider.Config")
  1640. },
  1641. },
  1642. HasTLSFunc: &ProviderHasTLSFunc{
  1643. defaultHook: func() bool {
  1644. panic("unexpected invocation of MockProvider.HasTLS")
  1645. },
  1646. },
  1647. SkipTLSVerifyFunc: &ProviderSkipTLSVerifyFunc{
  1648. defaultHook: func() bool {
  1649. panic("unexpected invocation of MockProvider.SkipTLSVerify")
  1650. },
  1651. },
  1652. UseTLSFunc: &ProviderUseTLSFunc{
  1653. defaultHook: func() bool {
  1654. panic("unexpected invocation of MockProvider.UseTLS")
  1655. },
  1656. },
  1657. }
  1658. }
  1659. // NewMockProviderFrom creates a new mock of the MockProvider interface. All
  1660. // methods delegate to the given implementation, unless overwritten.
  1661. func NewMockProviderFrom(i auth.Provider) *MockProvider {
  1662. return &MockProvider{
  1663. AuthenticateFunc: &ProviderAuthenticateFunc{
  1664. defaultHook: i.Authenticate,
  1665. },
  1666. ConfigFunc: &ProviderConfigFunc{
  1667. defaultHook: i.Config,
  1668. },
  1669. HasTLSFunc: &ProviderHasTLSFunc{
  1670. defaultHook: i.HasTLS,
  1671. },
  1672. SkipTLSVerifyFunc: &ProviderSkipTLSVerifyFunc{
  1673. defaultHook: i.SkipTLSVerify,
  1674. },
  1675. UseTLSFunc: &ProviderUseTLSFunc{
  1676. defaultHook: i.UseTLS,
  1677. },
  1678. }
  1679. }
  1680. // ProviderAuthenticateFunc describes the behavior when the Authenticate
  1681. // method of the parent MockProvider instance is invoked.
  1682. type ProviderAuthenticateFunc struct {
  1683. defaultHook func(string, string) (*auth.ExternalAccount, error)
  1684. hooks []func(string, string) (*auth.ExternalAccount, error)
  1685. history []ProviderAuthenticateFuncCall
  1686. mutex sync.Mutex
  1687. }
  1688. // Authenticate delegates to the next hook function in the queue and stores
  1689. // the parameter and result values of this invocation.
  1690. func (m *MockProvider) Authenticate(v0 string, v1 string) (*auth.ExternalAccount, error) {
  1691. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1)
  1692. m.AuthenticateFunc.appendCall(ProviderAuthenticateFuncCall{v0, v1, r0, r1})
  1693. return r0, r1
  1694. }
  1695. // SetDefaultHook sets function that is called when the Authenticate method
  1696. // of the parent MockProvider instance is invoked and the hook queue is
  1697. // empty.
  1698. func (f *ProviderAuthenticateFunc) SetDefaultHook(hook func(string, string) (*auth.ExternalAccount, error)) {
  1699. f.defaultHook = hook
  1700. }
  1701. // PushHook adds a function to the end of hook queue. Each invocation of the
  1702. // Authenticate method of the parent MockProvider instance invokes the hook
  1703. // at the front of the queue and discards it. After the queue is empty, the
  1704. // default hook function is invoked for any future action.
  1705. func (f *ProviderAuthenticateFunc) PushHook(hook func(string, string) (*auth.ExternalAccount, error)) {
  1706. f.mutex.Lock()
  1707. f.hooks = append(f.hooks, hook)
  1708. f.mutex.Unlock()
  1709. }
  1710. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1711. // given values.
  1712. func (f *ProviderAuthenticateFunc) SetDefaultReturn(r0 *auth.ExternalAccount, r1 error) {
  1713. f.SetDefaultHook(func(string, string) (*auth.ExternalAccount, error) {
  1714. return r0, r1
  1715. })
  1716. }
  1717. // PushReturn calls PushHook with a function that returns the given values.
  1718. func (f *ProviderAuthenticateFunc) PushReturn(r0 *auth.ExternalAccount, r1 error) {
  1719. f.PushHook(func(string, string) (*auth.ExternalAccount, error) {
  1720. return r0, r1
  1721. })
  1722. }
  1723. func (f *ProviderAuthenticateFunc) nextHook() func(string, string) (*auth.ExternalAccount, error) {
  1724. f.mutex.Lock()
  1725. defer f.mutex.Unlock()
  1726. if len(f.hooks) == 0 {
  1727. return f.defaultHook
  1728. }
  1729. hook := f.hooks[0]
  1730. f.hooks = f.hooks[1:]
  1731. return hook
  1732. }
  1733. func (f *ProviderAuthenticateFunc) appendCall(r0 ProviderAuthenticateFuncCall) {
  1734. f.mutex.Lock()
  1735. f.history = append(f.history, r0)
  1736. f.mutex.Unlock()
  1737. }
  1738. // History returns a sequence of ProviderAuthenticateFuncCall objects
  1739. // describing the invocations of this function.
  1740. func (f *ProviderAuthenticateFunc) History() []ProviderAuthenticateFuncCall {
  1741. f.mutex.Lock()
  1742. history := make([]ProviderAuthenticateFuncCall, len(f.history))
  1743. copy(history, f.history)
  1744. f.mutex.Unlock()
  1745. return history
  1746. }
  1747. // ProviderAuthenticateFuncCall is an object that describes an invocation of
  1748. // method Authenticate on an instance of MockProvider.
  1749. type ProviderAuthenticateFuncCall struct {
  1750. // Arg0 is the value of the 1st argument passed to this method
  1751. // invocation.
  1752. Arg0 string
  1753. // Arg1 is the value of the 2nd argument passed to this method
  1754. // invocation.
  1755. Arg1 string
  1756. // Result0 is the value of the 1st result returned from this method
  1757. // invocation.
  1758. Result0 *auth.ExternalAccount
  1759. // Result1 is the value of the 2nd result returned from this method
  1760. // invocation.
  1761. Result1 error
  1762. }
  1763. // Args returns an interface slice containing the arguments of this
  1764. // invocation.
  1765. func (c ProviderAuthenticateFuncCall) Args() []interface{} {
  1766. return []interface{}{c.Arg0, c.Arg1}
  1767. }
  1768. // Results returns an interface slice containing the results of this
  1769. // invocation.
  1770. func (c ProviderAuthenticateFuncCall) Results() []interface{} {
  1771. return []interface{}{c.Result0, c.Result1}
  1772. }
  1773. // ProviderConfigFunc describes the behavior when the Config method of the
  1774. // parent MockProvider instance is invoked.
  1775. type ProviderConfigFunc struct {
  1776. defaultHook func() interface{}
  1777. hooks []func() interface{}
  1778. history []ProviderConfigFuncCall
  1779. mutex sync.Mutex
  1780. }
  1781. // Config delegates to the next hook function in the queue and stores the
  1782. // parameter and result values of this invocation.
  1783. func (m *MockProvider) Config() interface{} {
  1784. r0 := m.ConfigFunc.nextHook()()
  1785. m.ConfigFunc.appendCall(ProviderConfigFuncCall{r0})
  1786. return r0
  1787. }
  1788. // SetDefaultHook sets function that is called when the Config method of the
  1789. // parent MockProvider instance is invoked and the hook queue is empty.
  1790. func (f *ProviderConfigFunc) SetDefaultHook(hook func() interface{}) {
  1791. f.defaultHook = hook
  1792. }
  1793. // PushHook adds a function to the end of hook queue. Each invocation of the
  1794. // Config method of the parent MockProvider instance invokes the hook at the
  1795. // front of the queue and discards it. After the queue is empty, the default
  1796. // hook function is invoked for any future action.
  1797. func (f *ProviderConfigFunc) PushHook(hook func() interface{}) {
  1798. f.mutex.Lock()
  1799. f.hooks = append(f.hooks, hook)
  1800. f.mutex.Unlock()
  1801. }
  1802. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1803. // given values.
  1804. func (f *ProviderConfigFunc) SetDefaultReturn(r0 interface{}) {
  1805. f.SetDefaultHook(func() interface{} {
  1806. return r0
  1807. })
  1808. }
  1809. // PushReturn calls PushHook with a function that returns the given values.
  1810. func (f *ProviderConfigFunc) PushReturn(r0 interface{}) {
  1811. f.PushHook(func() interface{} {
  1812. return r0
  1813. })
  1814. }
  1815. func (f *ProviderConfigFunc) nextHook() func() interface{} {
  1816. f.mutex.Lock()
  1817. defer f.mutex.Unlock()
  1818. if len(f.hooks) == 0 {
  1819. return f.defaultHook
  1820. }
  1821. hook := f.hooks[0]
  1822. f.hooks = f.hooks[1:]
  1823. return hook
  1824. }
  1825. func (f *ProviderConfigFunc) appendCall(r0 ProviderConfigFuncCall) {
  1826. f.mutex.Lock()
  1827. f.history = append(f.history, r0)
  1828. f.mutex.Unlock()
  1829. }
  1830. // History returns a sequence of ProviderConfigFuncCall objects describing
  1831. // the invocations of this function.
  1832. func (f *ProviderConfigFunc) History() []ProviderConfigFuncCall {
  1833. f.mutex.Lock()
  1834. history := make([]ProviderConfigFuncCall, len(f.history))
  1835. copy(history, f.history)
  1836. f.mutex.Unlock()
  1837. return history
  1838. }
  1839. // ProviderConfigFuncCall is an object that describes an invocation of
  1840. // method Config on an instance of MockProvider.
  1841. type ProviderConfigFuncCall struct {
  1842. // Result0 is the value of the 1st result returned from this method
  1843. // invocation.
  1844. Result0 interface{}
  1845. }
  1846. // Args returns an interface slice containing the arguments of this
  1847. // invocation.
  1848. func (c ProviderConfigFuncCall) Args() []interface{} {
  1849. return []interface{}{}
  1850. }
  1851. // Results returns an interface slice containing the results of this
  1852. // invocation.
  1853. func (c ProviderConfigFuncCall) Results() []interface{} {
  1854. return []interface{}{c.Result0}
  1855. }
  1856. // ProviderHasTLSFunc describes the behavior when the HasTLS method of the
  1857. // parent MockProvider instance is invoked.
  1858. type ProviderHasTLSFunc struct {
  1859. defaultHook func() bool
  1860. hooks []func() bool
  1861. history []ProviderHasTLSFuncCall
  1862. mutex sync.Mutex
  1863. }
  1864. // HasTLS delegates to the next hook function in the queue and stores the
  1865. // parameter and result values of this invocation.
  1866. func (m *MockProvider) HasTLS() bool {
  1867. r0 := m.HasTLSFunc.nextHook()()
  1868. m.HasTLSFunc.appendCall(ProviderHasTLSFuncCall{r0})
  1869. return r0
  1870. }
  1871. // SetDefaultHook sets function that is called when the HasTLS method of the
  1872. // parent MockProvider instance is invoked and the hook queue is empty.
  1873. func (f *ProviderHasTLSFunc) SetDefaultHook(hook func() bool) {
  1874. f.defaultHook = hook
  1875. }
  1876. // PushHook adds a function to the end of hook queue. Each invocation of the
  1877. // HasTLS method of the parent MockProvider instance invokes the hook at the
  1878. // front of the queue and discards it. After the queue is empty, the default
  1879. // hook function is invoked for any future action.
  1880. func (f *ProviderHasTLSFunc) PushHook(hook func() bool) {
  1881. f.mutex.Lock()
  1882. f.hooks = append(f.hooks, hook)
  1883. f.mutex.Unlock()
  1884. }
  1885. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1886. // given values.
  1887. func (f *ProviderHasTLSFunc) SetDefaultReturn(r0 bool) {
  1888. f.SetDefaultHook(func() bool {
  1889. return r0
  1890. })
  1891. }
  1892. // PushReturn calls PushHook with a function that returns the given values.
  1893. func (f *ProviderHasTLSFunc) PushReturn(r0 bool) {
  1894. f.PushHook(func() bool {
  1895. return r0
  1896. })
  1897. }
  1898. func (f *ProviderHasTLSFunc) nextHook() func() bool {
  1899. f.mutex.Lock()
  1900. defer f.mutex.Unlock()
  1901. if len(f.hooks) == 0 {
  1902. return f.defaultHook
  1903. }
  1904. hook := f.hooks[0]
  1905. f.hooks = f.hooks[1:]
  1906. return hook
  1907. }
  1908. func (f *ProviderHasTLSFunc) appendCall(r0 ProviderHasTLSFuncCall) {
  1909. f.mutex.Lock()
  1910. f.history = append(f.history, r0)
  1911. f.mutex.Unlock()
  1912. }
  1913. // History returns a sequence of ProviderHasTLSFuncCall objects describing
  1914. // the invocations of this function.
  1915. func (f *ProviderHasTLSFunc) History() []ProviderHasTLSFuncCall {
  1916. f.mutex.Lock()
  1917. history := make([]ProviderHasTLSFuncCall, len(f.history))
  1918. copy(history, f.history)
  1919. f.mutex.Unlock()
  1920. return history
  1921. }
  1922. // ProviderHasTLSFuncCall is an object that describes an invocation of
  1923. // method HasTLS on an instance of MockProvider.
  1924. type ProviderHasTLSFuncCall struct {
  1925. // Result0 is the value of the 1st result returned from this method
  1926. // invocation.
  1927. Result0 bool
  1928. }
  1929. // Args returns an interface slice containing the arguments of this
  1930. // invocation.
  1931. func (c ProviderHasTLSFuncCall) Args() []interface{} {
  1932. return []interface{}{}
  1933. }
  1934. // Results returns an interface slice containing the results of this
  1935. // invocation.
  1936. func (c ProviderHasTLSFuncCall) Results() []interface{} {
  1937. return []interface{}{c.Result0}
  1938. }
  1939. // ProviderSkipTLSVerifyFunc describes the behavior when the SkipTLSVerify
  1940. // method of the parent MockProvider instance is invoked.
  1941. type ProviderSkipTLSVerifyFunc struct {
  1942. defaultHook func() bool
  1943. hooks []func() bool
  1944. history []ProviderSkipTLSVerifyFuncCall
  1945. mutex sync.Mutex
  1946. }
  1947. // SkipTLSVerify delegates to the next hook function in the queue and stores
  1948. // the parameter and result values of this invocation.
  1949. func (m *MockProvider) SkipTLSVerify() bool {
  1950. r0 := m.SkipTLSVerifyFunc.nextHook()()
  1951. m.SkipTLSVerifyFunc.appendCall(ProviderSkipTLSVerifyFuncCall{r0})
  1952. return r0
  1953. }
  1954. // SetDefaultHook sets function that is called when the SkipTLSVerify method
  1955. // of the parent MockProvider instance is invoked and the hook queue is
  1956. // empty.
  1957. func (f *ProviderSkipTLSVerifyFunc) SetDefaultHook(hook func() bool) {
  1958. f.defaultHook = hook
  1959. }
  1960. // PushHook adds a function to the end of hook queue. Each invocation of the
  1961. // SkipTLSVerify method of the parent MockProvider instance invokes the hook
  1962. // at the front of the queue and discards it. After the queue is empty, the
  1963. // default hook function is invoked for any future action.
  1964. func (f *ProviderSkipTLSVerifyFunc) PushHook(hook func() bool) {
  1965. f.mutex.Lock()
  1966. f.hooks = append(f.hooks, hook)
  1967. f.mutex.Unlock()
  1968. }
  1969. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1970. // given values.
  1971. func (f *ProviderSkipTLSVerifyFunc) SetDefaultReturn(r0 bool) {
  1972. f.SetDefaultHook(func() bool {
  1973. return r0
  1974. })
  1975. }
  1976. // PushReturn calls PushHook with a function that returns the given values.
  1977. func (f *ProviderSkipTLSVerifyFunc) PushReturn(r0 bool) {
  1978. f.PushHook(func() bool {
  1979. return r0
  1980. })
  1981. }
  1982. func (f *ProviderSkipTLSVerifyFunc) nextHook() func() bool {
  1983. f.mutex.Lock()
  1984. defer f.mutex.Unlock()
  1985. if len(f.hooks) == 0 {
  1986. return f.defaultHook
  1987. }
  1988. hook := f.hooks[0]
  1989. f.hooks = f.hooks[1:]
  1990. return hook
  1991. }
  1992. func (f *ProviderSkipTLSVerifyFunc) appendCall(r0 ProviderSkipTLSVerifyFuncCall) {
  1993. f.mutex.Lock()
  1994. f.history = append(f.history, r0)
  1995. f.mutex.Unlock()
  1996. }
  1997. // History returns a sequence of ProviderSkipTLSVerifyFuncCall objects
  1998. // describing the invocations of this function.
  1999. func (f *ProviderSkipTLSVerifyFunc) History() []ProviderSkipTLSVerifyFuncCall {
  2000. f.mutex.Lock()
  2001. history := make([]ProviderSkipTLSVerifyFuncCall, len(f.history))
  2002. copy(history, f.history)
  2003. f.mutex.Unlock()
  2004. return history
  2005. }
  2006. // ProviderSkipTLSVerifyFuncCall is an object that describes an invocation
  2007. // of method SkipTLSVerify on an instance of MockProvider.
  2008. type ProviderSkipTLSVerifyFuncCall struct {
  2009. // Result0 is the value of the 1st result returned from this method
  2010. // invocation.
  2011. Result0 bool
  2012. }
  2013. // Args returns an interface slice containing the arguments of this
  2014. // invocation.
  2015. func (c ProviderSkipTLSVerifyFuncCall) Args() []interface{} {
  2016. return []interface{}{}
  2017. }
  2018. // Results returns an interface slice containing the results of this
  2019. // invocation.
  2020. func (c ProviderSkipTLSVerifyFuncCall) Results() []interface{} {
  2021. return []interface{}{c.Result0}
  2022. }
  2023. // ProviderUseTLSFunc describes the behavior when the UseTLS method of the
  2024. // parent MockProvider instance is invoked.
  2025. type ProviderUseTLSFunc struct {
  2026. defaultHook func() bool
  2027. hooks []func() bool
  2028. history []ProviderUseTLSFuncCall
  2029. mutex sync.Mutex
  2030. }
  2031. // UseTLS delegates to the next hook function in the queue and stores the
  2032. // parameter and result values of this invocation.
  2033. func (m *MockProvider) UseTLS() bool {
  2034. r0 := m.UseTLSFunc.nextHook()()
  2035. m.UseTLSFunc.appendCall(ProviderUseTLSFuncCall{r0})
  2036. return r0
  2037. }
  2038. // SetDefaultHook sets function that is called when the UseTLS method of the
  2039. // parent MockProvider instance is invoked and the hook queue is empty.
  2040. func (f *ProviderUseTLSFunc) SetDefaultHook(hook func() bool) {
  2041. f.defaultHook = hook
  2042. }
  2043. // PushHook adds a function to the end of hook queue. Each invocation of the
  2044. // UseTLS method of the parent MockProvider instance invokes the hook at the
  2045. // front of the queue and discards it. After the queue is empty, the default
  2046. // hook function is invoked for any future action.
  2047. func (f *ProviderUseTLSFunc) PushHook(hook func() bool) {
  2048. f.mutex.Lock()
  2049. f.hooks = append(f.hooks, hook)
  2050. f.mutex.Unlock()
  2051. }
  2052. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2053. // given values.
  2054. func (f *ProviderUseTLSFunc) SetDefaultReturn(r0 bool) {
  2055. f.SetDefaultHook(func() bool {
  2056. return r0
  2057. })
  2058. }
  2059. // PushReturn calls PushHook with a function that returns the given values.
  2060. func (f *ProviderUseTLSFunc) PushReturn(r0 bool) {
  2061. f.PushHook(func() bool {
  2062. return r0
  2063. })
  2064. }
  2065. func (f *ProviderUseTLSFunc) nextHook() func() bool {
  2066. f.mutex.Lock()
  2067. defer f.mutex.Unlock()
  2068. if len(f.hooks) == 0 {
  2069. return f.defaultHook
  2070. }
  2071. hook := f.hooks[0]
  2072. f.hooks = f.hooks[1:]
  2073. return hook
  2074. }
  2075. func (f *ProviderUseTLSFunc) appendCall(r0 ProviderUseTLSFuncCall) {
  2076. f.mutex.Lock()
  2077. f.history = append(f.history, r0)
  2078. f.mutex.Unlock()
  2079. }
  2080. // History returns a sequence of ProviderUseTLSFuncCall objects describing
  2081. // the invocations of this function.
  2082. func (f *ProviderUseTLSFunc) History() []ProviderUseTLSFuncCall {
  2083. f.mutex.Lock()
  2084. history := make([]ProviderUseTLSFuncCall, len(f.history))
  2085. copy(history, f.history)
  2086. f.mutex.Unlock()
  2087. return history
  2088. }
  2089. // ProviderUseTLSFuncCall is an object that describes an invocation of
  2090. // method UseTLS on an instance of MockProvider.
  2091. type ProviderUseTLSFuncCall struct {
  2092. // Result0 is the value of the 1st result returned from this method
  2093. // invocation.
  2094. Result0 bool
  2095. }
  2096. // Args returns an interface slice containing the arguments of this
  2097. // invocation.
  2098. func (c ProviderUseTLSFuncCall) Args() []interface{} {
  2099. return []interface{}{}
  2100. }
  2101. // Results returns an interface slice containing the results of this
  2102. // invocation.
  2103. func (c ProviderUseTLSFuncCall) Results() []interface{} {
  2104. return []interface{}{c.Result0}
  2105. }