mocks_test.go 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411
  1. // Code generated by go-mockgen 1.3.3; 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. }