mocks.go 131 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932
  1. // Code generated by go-mockgen 1.2.0; DO NOT EDIT.
  2. package db
  3. import (
  4. "context"
  5. "sync"
  6. lfsutil "gogs.io/gogs/internal/lfsutil"
  7. )
  8. // MockAccessTokensStore is a mock implementation of the AccessTokensStore
  9. // interface (from the package gogs.io/gogs/internal/db) used for unit
  10. // testing.
  11. type MockAccessTokensStore struct {
  12. // CreateFunc is an instance of a mock function object controlling the
  13. // behavior of the method Create.
  14. CreateFunc *AccessTokensStoreCreateFunc
  15. // DeleteByIDFunc is an instance of a mock function object controlling
  16. // the behavior of the method DeleteByID.
  17. DeleteByIDFunc *AccessTokensStoreDeleteByIDFunc
  18. // GetBySHA1Func is an instance of a mock function object controlling
  19. // the behavior of the method GetBySHA1.
  20. GetBySHA1Func *AccessTokensStoreGetBySHA1Func
  21. // ListFunc is an instance of a mock function object controlling the
  22. // behavior of the method List.
  23. ListFunc *AccessTokensStoreListFunc
  24. // TouchFunc is an instance of a mock function object controlling the
  25. // behavior of the method Touch.
  26. TouchFunc *AccessTokensStoreTouchFunc
  27. }
  28. // NewMockAccessTokensStore creates a new mock of the AccessTokensStore
  29. // interface. All methods return zero values for all results, unless
  30. // overwritten.
  31. func NewMockAccessTokensStore() *MockAccessTokensStore {
  32. return &MockAccessTokensStore{
  33. CreateFunc: &AccessTokensStoreCreateFunc{
  34. defaultHook: func(context.Context, int64, string) (r0 *AccessToken, r1 error) {
  35. return
  36. },
  37. },
  38. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  39. defaultHook: func(context.Context, int64, int64) (r0 error) {
  40. return
  41. },
  42. },
  43. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  44. defaultHook: func(context.Context, string) (r0 *AccessToken, r1 error) {
  45. return
  46. },
  47. },
  48. ListFunc: &AccessTokensStoreListFunc{
  49. defaultHook: func(context.Context, int64) (r0 []*AccessToken, r1 error) {
  50. return
  51. },
  52. },
  53. TouchFunc: &AccessTokensStoreTouchFunc{
  54. defaultHook: func(context.Context, int64) (r0 error) {
  55. return
  56. },
  57. },
  58. }
  59. }
  60. // NewStrictMockAccessTokensStore creates a new mock of the
  61. // AccessTokensStore interface. All methods panic on invocation, unless
  62. // overwritten.
  63. func NewStrictMockAccessTokensStore() *MockAccessTokensStore {
  64. return &MockAccessTokensStore{
  65. CreateFunc: &AccessTokensStoreCreateFunc{
  66. defaultHook: func(context.Context, int64, string) (*AccessToken, error) {
  67. panic("unexpected invocation of MockAccessTokensStore.Create")
  68. },
  69. },
  70. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  71. defaultHook: func(context.Context, int64, int64) error {
  72. panic("unexpected invocation of MockAccessTokensStore.DeleteByID")
  73. },
  74. },
  75. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  76. defaultHook: func(context.Context, string) (*AccessToken, error) {
  77. panic("unexpected invocation of MockAccessTokensStore.GetBySHA1")
  78. },
  79. },
  80. ListFunc: &AccessTokensStoreListFunc{
  81. defaultHook: func(context.Context, int64) ([]*AccessToken, error) {
  82. panic("unexpected invocation of MockAccessTokensStore.List")
  83. },
  84. },
  85. TouchFunc: &AccessTokensStoreTouchFunc{
  86. defaultHook: func(context.Context, int64) error {
  87. panic("unexpected invocation of MockAccessTokensStore.Touch")
  88. },
  89. },
  90. }
  91. }
  92. // NewMockAccessTokensStoreFrom creates a new mock of the
  93. // MockAccessTokensStore interface. All methods delegate to the given
  94. // implementation, unless overwritten.
  95. func NewMockAccessTokensStoreFrom(i AccessTokensStore) *MockAccessTokensStore {
  96. return &MockAccessTokensStore{
  97. CreateFunc: &AccessTokensStoreCreateFunc{
  98. defaultHook: i.Create,
  99. },
  100. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  101. defaultHook: i.DeleteByID,
  102. },
  103. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  104. defaultHook: i.GetBySHA1,
  105. },
  106. ListFunc: &AccessTokensStoreListFunc{
  107. defaultHook: i.List,
  108. },
  109. TouchFunc: &AccessTokensStoreTouchFunc{
  110. defaultHook: i.Touch,
  111. },
  112. }
  113. }
  114. // AccessTokensStoreCreateFunc describes the behavior when the Create method
  115. // of the parent MockAccessTokensStore instance is invoked.
  116. type AccessTokensStoreCreateFunc struct {
  117. defaultHook func(context.Context, int64, string) (*AccessToken, error)
  118. hooks []func(context.Context, int64, string) (*AccessToken, error)
  119. history []AccessTokensStoreCreateFuncCall
  120. mutex sync.Mutex
  121. }
  122. // Create delegates to the next hook function in the queue and stores the
  123. // parameter and result values of this invocation.
  124. func (m *MockAccessTokensStore) Create(v0 context.Context, v1 int64, v2 string) (*AccessToken, error) {
  125. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  126. m.CreateFunc.appendCall(AccessTokensStoreCreateFuncCall{v0, v1, v2, r0, r1})
  127. return r0, r1
  128. }
  129. // SetDefaultHook sets function that is called when the Create method of the
  130. // parent MockAccessTokensStore instance is invoked and the hook queue is
  131. // empty.
  132. func (f *AccessTokensStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string) (*AccessToken, error)) {
  133. f.defaultHook = hook
  134. }
  135. // PushHook adds a function to the end of hook queue. Each invocation of the
  136. // Create method of the parent MockAccessTokensStore instance invokes the
  137. // hook at the front of the queue and discards it. After the queue is empty,
  138. // the default hook function is invoked for any future action.
  139. func (f *AccessTokensStoreCreateFunc) PushHook(hook func(context.Context, int64, string) (*AccessToken, error)) {
  140. f.mutex.Lock()
  141. f.hooks = append(f.hooks, hook)
  142. f.mutex.Unlock()
  143. }
  144. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  145. // given values.
  146. func (f *AccessTokensStoreCreateFunc) SetDefaultReturn(r0 *AccessToken, r1 error) {
  147. f.SetDefaultHook(func(context.Context, int64, string) (*AccessToken, error) {
  148. return r0, r1
  149. })
  150. }
  151. // PushReturn calls PushHook with a function that returns the given values.
  152. func (f *AccessTokensStoreCreateFunc) PushReturn(r0 *AccessToken, r1 error) {
  153. f.PushHook(func(context.Context, int64, string) (*AccessToken, error) {
  154. return r0, r1
  155. })
  156. }
  157. func (f *AccessTokensStoreCreateFunc) nextHook() func(context.Context, int64, string) (*AccessToken, error) {
  158. f.mutex.Lock()
  159. defer f.mutex.Unlock()
  160. if len(f.hooks) == 0 {
  161. return f.defaultHook
  162. }
  163. hook := f.hooks[0]
  164. f.hooks = f.hooks[1:]
  165. return hook
  166. }
  167. func (f *AccessTokensStoreCreateFunc) appendCall(r0 AccessTokensStoreCreateFuncCall) {
  168. f.mutex.Lock()
  169. f.history = append(f.history, r0)
  170. f.mutex.Unlock()
  171. }
  172. // History returns a sequence of AccessTokensStoreCreateFuncCall objects
  173. // describing the invocations of this function.
  174. func (f *AccessTokensStoreCreateFunc) History() []AccessTokensStoreCreateFuncCall {
  175. f.mutex.Lock()
  176. history := make([]AccessTokensStoreCreateFuncCall, len(f.history))
  177. copy(history, f.history)
  178. f.mutex.Unlock()
  179. return history
  180. }
  181. // AccessTokensStoreCreateFuncCall is an object that describes an invocation
  182. // of method Create on an instance of MockAccessTokensStore.
  183. type AccessTokensStoreCreateFuncCall struct {
  184. // Arg0 is the value of the 1st argument passed to this method
  185. // invocation.
  186. Arg0 context.Context
  187. // Arg1 is the value of the 2nd argument passed to this method
  188. // invocation.
  189. Arg1 int64
  190. // Arg2 is the value of the 3rd argument passed to this method
  191. // invocation.
  192. Arg2 string
  193. // Result0 is the value of the 1st result returned from this method
  194. // invocation.
  195. Result0 *AccessToken
  196. // Result1 is the value of the 2nd result returned from this method
  197. // invocation.
  198. Result1 error
  199. }
  200. // Args returns an interface slice containing the arguments of this
  201. // invocation.
  202. func (c AccessTokensStoreCreateFuncCall) Args() []interface{} {
  203. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  204. }
  205. // Results returns an interface slice containing the results of this
  206. // invocation.
  207. func (c AccessTokensStoreCreateFuncCall) Results() []interface{} {
  208. return []interface{}{c.Result0, c.Result1}
  209. }
  210. // AccessTokensStoreDeleteByIDFunc describes the behavior when the
  211. // DeleteByID method of the parent MockAccessTokensStore instance is
  212. // invoked.
  213. type AccessTokensStoreDeleteByIDFunc struct {
  214. defaultHook func(context.Context, int64, int64) error
  215. hooks []func(context.Context, int64, int64) error
  216. history []AccessTokensStoreDeleteByIDFuncCall
  217. mutex sync.Mutex
  218. }
  219. // DeleteByID delegates to the next hook function in the queue and stores
  220. // the parameter and result values of this invocation.
  221. func (m *MockAccessTokensStore) DeleteByID(v0 context.Context, v1 int64, v2 int64) error {
  222. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  223. m.DeleteByIDFunc.appendCall(AccessTokensStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  224. return r0
  225. }
  226. // SetDefaultHook sets function that is called when the DeleteByID method of
  227. // the parent MockAccessTokensStore instance is invoked and the hook queue
  228. // is empty.
  229. func (f *AccessTokensStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  230. f.defaultHook = hook
  231. }
  232. // PushHook adds a function to the end of hook queue. Each invocation of the
  233. // DeleteByID method of the parent MockAccessTokensStore instance invokes
  234. // the hook at the front of the queue and discards it. After the queue is
  235. // empty, the default hook function is invoked for any future action.
  236. func (f *AccessTokensStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, int64) error) {
  237. f.mutex.Lock()
  238. f.hooks = append(f.hooks, hook)
  239. f.mutex.Unlock()
  240. }
  241. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  242. // given values.
  243. func (f *AccessTokensStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  244. f.SetDefaultHook(func(context.Context, int64, int64) error {
  245. return r0
  246. })
  247. }
  248. // PushReturn calls PushHook with a function that returns the given values.
  249. func (f *AccessTokensStoreDeleteByIDFunc) PushReturn(r0 error) {
  250. f.PushHook(func(context.Context, int64, int64) error {
  251. return r0
  252. })
  253. }
  254. func (f *AccessTokensStoreDeleteByIDFunc) nextHook() func(context.Context, int64, int64) error {
  255. f.mutex.Lock()
  256. defer f.mutex.Unlock()
  257. if len(f.hooks) == 0 {
  258. return f.defaultHook
  259. }
  260. hook := f.hooks[0]
  261. f.hooks = f.hooks[1:]
  262. return hook
  263. }
  264. func (f *AccessTokensStoreDeleteByIDFunc) appendCall(r0 AccessTokensStoreDeleteByIDFuncCall) {
  265. f.mutex.Lock()
  266. f.history = append(f.history, r0)
  267. f.mutex.Unlock()
  268. }
  269. // History returns a sequence of AccessTokensStoreDeleteByIDFuncCall objects
  270. // describing the invocations of this function.
  271. func (f *AccessTokensStoreDeleteByIDFunc) History() []AccessTokensStoreDeleteByIDFuncCall {
  272. f.mutex.Lock()
  273. history := make([]AccessTokensStoreDeleteByIDFuncCall, len(f.history))
  274. copy(history, f.history)
  275. f.mutex.Unlock()
  276. return history
  277. }
  278. // AccessTokensStoreDeleteByIDFuncCall is an object that describes an
  279. // invocation of method DeleteByID on an instance of MockAccessTokensStore.
  280. type AccessTokensStoreDeleteByIDFuncCall struct {
  281. // Arg0 is the value of the 1st argument passed to this method
  282. // invocation.
  283. Arg0 context.Context
  284. // Arg1 is the value of the 2nd argument passed to this method
  285. // invocation.
  286. Arg1 int64
  287. // Arg2 is the value of the 3rd argument passed to this method
  288. // invocation.
  289. Arg2 int64
  290. // Result0 is the value of the 1st result returned from this method
  291. // invocation.
  292. Result0 error
  293. }
  294. // Args returns an interface slice containing the arguments of this
  295. // invocation.
  296. func (c AccessTokensStoreDeleteByIDFuncCall) Args() []interface{} {
  297. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  298. }
  299. // Results returns an interface slice containing the results of this
  300. // invocation.
  301. func (c AccessTokensStoreDeleteByIDFuncCall) Results() []interface{} {
  302. return []interface{}{c.Result0}
  303. }
  304. // AccessTokensStoreGetBySHA1Func describes the behavior when the GetBySHA1
  305. // method of the parent MockAccessTokensStore instance is invoked.
  306. type AccessTokensStoreGetBySHA1Func struct {
  307. defaultHook func(context.Context, string) (*AccessToken, error)
  308. hooks []func(context.Context, string) (*AccessToken, error)
  309. history []AccessTokensStoreGetBySHA1FuncCall
  310. mutex sync.Mutex
  311. }
  312. // GetBySHA1 delegates to the next hook function in the queue and stores the
  313. // parameter and result values of this invocation.
  314. func (m *MockAccessTokensStore) GetBySHA1(v0 context.Context, v1 string) (*AccessToken, error) {
  315. r0, r1 := m.GetBySHA1Func.nextHook()(v0, v1)
  316. m.GetBySHA1Func.appendCall(AccessTokensStoreGetBySHA1FuncCall{v0, v1, r0, r1})
  317. return r0, r1
  318. }
  319. // SetDefaultHook sets function that is called when the GetBySHA1 method of
  320. // the parent MockAccessTokensStore instance is invoked and the hook queue
  321. // is empty.
  322. func (f *AccessTokensStoreGetBySHA1Func) SetDefaultHook(hook func(context.Context, string) (*AccessToken, error)) {
  323. f.defaultHook = hook
  324. }
  325. // PushHook adds a function to the end of hook queue. Each invocation of the
  326. // GetBySHA1 method of the parent MockAccessTokensStore instance invokes the
  327. // hook at the front of the queue and discards it. After the queue is empty,
  328. // the default hook function is invoked for any future action.
  329. func (f *AccessTokensStoreGetBySHA1Func) PushHook(hook func(context.Context, string) (*AccessToken, error)) {
  330. f.mutex.Lock()
  331. f.hooks = append(f.hooks, hook)
  332. f.mutex.Unlock()
  333. }
  334. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  335. // given values.
  336. func (f *AccessTokensStoreGetBySHA1Func) SetDefaultReturn(r0 *AccessToken, r1 error) {
  337. f.SetDefaultHook(func(context.Context, string) (*AccessToken, error) {
  338. return r0, r1
  339. })
  340. }
  341. // PushReturn calls PushHook with a function that returns the given values.
  342. func (f *AccessTokensStoreGetBySHA1Func) PushReturn(r0 *AccessToken, r1 error) {
  343. f.PushHook(func(context.Context, string) (*AccessToken, error) {
  344. return r0, r1
  345. })
  346. }
  347. func (f *AccessTokensStoreGetBySHA1Func) nextHook() func(context.Context, string) (*AccessToken, error) {
  348. f.mutex.Lock()
  349. defer f.mutex.Unlock()
  350. if len(f.hooks) == 0 {
  351. return f.defaultHook
  352. }
  353. hook := f.hooks[0]
  354. f.hooks = f.hooks[1:]
  355. return hook
  356. }
  357. func (f *AccessTokensStoreGetBySHA1Func) appendCall(r0 AccessTokensStoreGetBySHA1FuncCall) {
  358. f.mutex.Lock()
  359. f.history = append(f.history, r0)
  360. f.mutex.Unlock()
  361. }
  362. // History returns a sequence of AccessTokensStoreGetBySHA1FuncCall objects
  363. // describing the invocations of this function.
  364. func (f *AccessTokensStoreGetBySHA1Func) History() []AccessTokensStoreGetBySHA1FuncCall {
  365. f.mutex.Lock()
  366. history := make([]AccessTokensStoreGetBySHA1FuncCall, len(f.history))
  367. copy(history, f.history)
  368. f.mutex.Unlock()
  369. return history
  370. }
  371. // AccessTokensStoreGetBySHA1FuncCall is an object that describes an
  372. // invocation of method GetBySHA1 on an instance of MockAccessTokensStore.
  373. type AccessTokensStoreGetBySHA1FuncCall struct {
  374. // Arg0 is the value of the 1st argument passed to this method
  375. // invocation.
  376. Arg0 context.Context
  377. // Arg1 is the value of the 2nd argument passed to this method
  378. // invocation.
  379. Arg1 string
  380. // Result0 is the value of the 1st result returned from this method
  381. // invocation.
  382. Result0 *AccessToken
  383. // Result1 is the value of the 2nd result returned from this method
  384. // invocation.
  385. Result1 error
  386. }
  387. // Args returns an interface slice containing the arguments of this
  388. // invocation.
  389. func (c AccessTokensStoreGetBySHA1FuncCall) Args() []interface{} {
  390. return []interface{}{c.Arg0, c.Arg1}
  391. }
  392. // Results returns an interface slice containing the results of this
  393. // invocation.
  394. func (c AccessTokensStoreGetBySHA1FuncCall) Results() []interface{} {
  395. return []interface{}{c.Result0, c.Result1}
  396. }
  397. // AccessTokensStoreListFunc describes the behavior when the List method of
  398. // the parent MockAccessTokensStore instance is invoked.
  399. type AccessTokensStoreListFunc struct {
  400. defaultHook func(context.Context, int64) ([]*AccessToken, error)
  401. hooks []func(context.Context, int64) ([]*AccessToken, error)
  402. history []AccessTokensStoreListFuncCall
  403. mutex sync.Mutex
  404. }
  405. // List delegates to the next hook function in the queue and stores the
  406. // parameter and result values of this invocation.
  407. func (m *MockAccessTokensStore) List(v0 context.Context, v1 int64) ([]*AccessToken, error) {
  408. r0, r1 := m.ListFunc.nextHook()(v0, v1)
  409. m.ListFunc.appendCall(AccessTokensStoreListFuncCall{v0, v1, r0, r1})
  410. return r0, r1
  411. }
  412. // SetDefaultHook sets function that is called when the List method of the
  413. // parent MockAccessTokensStore instance is invoked and the hook queue is
  414. // empty.
  415. func (f *AccessTokensStoreListFunc) SetDefaultHook(hook func(context.Context, int64) ([]*AccessToken, error)) {
  416. f.defaultHook = hook
  417. }
  418. // PushHook adds a function to the end of hook queue. Each invocation of the
  419. // List method of the parent MockAccessTokensStore instance invokes the hook
  420. // at the front of the queue and discards it. After the queue is empty, the
  421. // default hook function is invoked for any future action.
  422. func (f *AccessTokensStoreListFunc) PushHook(hook func(context.Context, int64) ([]*AccessToken, error)) {
  423. f.mutex.Lock()
  424. f.hooks = append(f.hooks, hook)
  425. f.mutex.Unlock()
  426. }
  427. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  428. // given values.
  429. func (f *AccessTokensStoreListFunc) SetDefaultReturn(r0 []*AccessToken, r1 error) {
  430. f.SetDefaultHook(func(context.Context, int64) ([]*AccessToken, error) {
  431. return r0, r1
  432. })
  433. }
  434. // PushReturn calls PushHook with a function that returns the given values.
  435. func (f *AccessTokensStoreListFunc) PushReturn(r0 []*AccessToken, r1 error) {
  436. f.PushHook(func(context.Context, int64) ([]*AccessToken, error) {
  437. return r0, r1
  438. })
  439. }
  440. func (f *AccessTokensStoreListFunc) nextHook() func(context.Context, int64) ([]*AccessToken, error) {
  441. f.mutex.Lock()
  442. defer f.mutex.Unlock()
  443. if len(f.hooks) == 0 {
  444. return f.defaultHook
  445. }
  446. hook := f.hooks[0]
  447. f.hooks = f.hooks[1:]
  448. return hook
  449. }
  450. func (f *AccessTokensStoreListFunc) appendCall(r0 AccessTokensStoreListFuncCall) {
  451. f.mutex.Lock()
  452. f.history = append(f.history, r0)
  453. f.mutex.Unlock()
  454. }
  455. // History returns a sequence of AccessTokensStoreListFuncCall objects
  456. // describing the invocations of this function.
  457. func (f *AccessTokensStoreListFunc) History() []AccessTokensStoreListFuncCall {
  458. f.mutex.Lock()
  459. history := make([]AccessTokensStoreListFuncCall, len(f.history))
  460. copy(history, f.history)
  461. f.mutex.Unlock()
  462. return history
  463. }
  464. // AccessTokensStoreListFuncCall is an object that describes an invocation
  465. // of method List on an instance of MockAccessTokensStore.
  466. type AccessTokensStoreListFuncCall struct {
  467. // Arg0 is the value of the 1st argument passed to this method
  468. // invocation.
  469. Arg0 context.Context
  470. // Arg1 is the value of the 2nd argument passed to this method
  471. // invocation.
  472. Arg1 int64
  473. // Result0 is the value of the 1st result returned from this method
  474. // invocation.
  475. Result0 []*AccessToken
  476. // Result1 is the value of the 2nd result returned from this method
  477. // invocation.
  478. Result1 error
  479. }
  480. // Args returns an interface slice containing the arguments of this
  481. // invocation.
  482. func (c AccessTokensStoreListFuncCall) Args() []interface{} {
  483. return []interface{}{c.Arg0, c.Arg1}
  484. }
  485. // Results returns an interface slice containing the results of this
  486. // invocation.
  487. func (c AccessTokensStoreListFuncCall) Results() []interface{} {
  488. return []interface{}{c.Result0, c.Result1}
  489. }
  490. // AccessTokensStoreTouchFunc describes the behavior when the Touch method
  491. // of the parent MockAccessTokensStore instance is invoked.
  492. type AccessTokensStoreTouchFunc struct {
  493. defaultHook func(context.Context, int64) error
  494. hooks []func(context.Context, int64) error
  495. history []AccessTokensStoreTouchFuncCall
  496. mutex sync.Mutex
  497. }
  498. // Touch delegates to the next hook function in the queue and stores the
  499. // parameter and result values of this invocation.
  500. func (m *MockAccessTokensStore) Touch(v0 context.Context, v1 int64) error {
  501. r0 := m.TouchFunc.nextHook()(v0, v1)
  502. m.TouchFunc.appendCall(AccessTokensStoreTouchFuncCall{v0, v1, r0})
  503. return r0
  504. }
  505. // SetDefaultHook sets function that is called when the Touch method of the
  506. // parent MockAccessTokensStore instance is invoked and the hook queue is
  507. // empty.
  508. func (f *AccessTokensStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  509. f.defaultHook = hook
  510. }
  511. // PushHook adds a function to the end of hook queue. Each invocation of the
  512. // Touch method of the parent MockAccessTokensStore instance invokes the
  513. // hook at the front of the queue and discards it. After the queue is empty,
  514. // the default hook function is invoked for any future action.
  515. func (f *AccessTokensStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  516. f.mutex.Lock()
  517. f.hooks = append(f.hooks, hook)
  518. f.mutex.Unlock()
  519. }
  520. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  521. // given values.
  522. func (f *AccessTokensStoreTouchFunc) SetDefaultReturn(r0 error) {
  523. f.SetDefaultHook(func(context.Context, int64) error {
  524. return r0
  525. })
  526. }
  527. // PushReturn calls PushHook with a function that returns the given values.
  528. func (f *AccessTokensStoreTouchFunc) PushReturn(r0 error) {
  529. f.PushHook(func(context.Context, int64) error {
  530. return r0
  531. })
  532. }
  533. func (f *AccessTokensStoreTouchFunc) nextHook() func(context.Context, int64) error {
  534. f.mutex.Lock()
  535. defer f.mutex.Unlock()
  536. if len(f.hooks) == 0 {
  537. return f.defaultHook
  538. }
  539. hook := f.hooks[0]
  540. f.hooks = f.hooks[1:]
  541. return hook
  542. }
  543. func (f *AccessTokensStoreTouchFunc) appendCall(r0 AccessTokensStoreTouchFuncCall) {
  544. f.mutex.Lock()
  545. f.history = append(f.history, r0)
  546. f.mutex.Unlock()
  547. }
  548. // History returns a sequence of AccessTokensStoreTouchFuncCall objects
  549. // describing the invocations of this function.
  550. func (f *AccessTokensStoreTouchFunc) History() []AccessTokensStoreTouchFuncCall {
  551. f.mutex.Lock()
  552. history := make([]AccessTokensStoreTouchFuncCall, len(f.history))
  553. copy(history, f.history)
  554. f.mutex.Unlock()
  555. return history
  556. }
  557. // AccessTokensStoreTouchFuncCall is an object that describes an invocation
  558. // of method Touch on an instance of MockAccessTokensStore.
  559. type AccessTokensStoreTouchFuncCall struct {
  560. // Arg0 is the value of the 1st argument passed to this method
  561. // invocation.
  562. Arg0 context.Context
  563. // Arg1 is the value of the 2nd argument passed to this method
  564. // invocation.
  565. Arg1 int64
  566. // Result0 is the value of the 1st result returned from this method
  567. // invocation.
  568. Result0 error
  569. }
  570. // Args returns an interface slice containing the arguments of this
  571. // invocation.
  572. func (c AccessTokensStoreTouchFuncCall) Args() []interface{} {
  573. return []interface{}{c.Arg0, c.Arg1}
  574. }
  575. // Results returns an interface slice containing the results of this
  576. // invocation.
  577. func (c AccessTokensStoreTouchFuncCall) Results() []interface{} {
  578. return []interface{}{c.Result0}
  579. }
  580. // MockLFSStore is a mock implementation of the LFSStore interface (from the
  581. // package gogs.io/gogs/internal/db) used for unit testing.
  582. type MockLFSStore struct {
  583. // CreateObjectFunc is an instance of a mock function object controlling
  584. // the behavior of the method CreateObject.
  585. CreateObjectFunc *LFSStoreCreateObjectFunc
  586. // GetObjectByOIDFunc is an instance of a mock function object
  587. // controlling the behavior of the method GetObjectByOID.
  588. GetObjectByOIDFunc *LFSStoreGetObjectByOIDFunc
  589. // GetObjectsByOIDsFunc is an instance of a mock function object
  590. // controlling the behavior of the method GetObjectsByOIDs.
  591. GetObjectsByOIDsFunc *LFSStoreGetObjectsByOIDsFunc
  592. }
  593. // NewMockLFSStore creates a new mock of the LFSStore interface. All methods
  594. // return zero values for all results, unless overwritten.
  595. func NewMockLFSStore() *MockLFSStore {
  596. return &MockLFSStore{
  597. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  598. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) (r0 error) {
  599. return
  600. },
  601. },
  602. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  603. defaultHook: func(context.Context, int64, lfsutil.OID) (r0 *LFSObject, r1 error) {
  604. return
  605. },
  606. },
  607. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  608. defaultHook: func(context.Context, int64, ...lfsutil.OID) (r0 []*LFSObject, r1 error) {
  609. return
  610. },
  611. },
  612. }
  613. }
  614. // NewStrictMockLFSStore creates a new mock of the LFSStore interface. All
  615. // methods panic on invocation, unless overwritten.
  616. func NewStrictMockLFSStore() *MockLFSStore {
  617. return &MockLFSStore{
  618. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  619. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  620. panic("unexpected invocation of MockLFSStore.CreateObject")
  621. },
  622. },
  623. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  624. defaultHook: func(context.Context, int64, lfsutil.OID) (*LFSObject, error) {
  625. panic("unexpected invocation of MockLFSStore.GetObjectByOID")
  626. },
  627. },
  628. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  629. defaultHook: func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error) {
  630. panic("unexpected invocation of MockLFSStore.GetObjectsByOIDs")
  631. },
  632. },
  633. }
  634. }
  635. // NewMockLFSStoreFrom creates a new mock of the MockLFSStore interface. All
  636. // methods delegate to the given implementation, unless overwritten.
  637. func NewMockLFSStoreFrom(i LFSStore) *MockLFSStore {
  638. return &MockLFSStore{
  639. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  640. defaultHook: i.CreateObject,
  641. },
  642. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  643. defaultHook: i.GetObjectByOID,
  644. },
  645. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  646. defaultHook: i.GetObjectsByOIDs,
  647. },
  648. }
  649. }
  650. // LFSStoreCreateObjectFunc describes the behavior when the CreateObject
  651. // method of the parent MockLFSStore instance is invoked.
  652. type LFSStoreCreateObjectFunc struct {
  653. defaultHook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  654. hooks []func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  655. history []LFSStoreCreateObjectFuncCall
  656. mutex sync.Mutex
  657. }
  658. // CreateObject delegates to the next hook function in the queue and stores
  659. // the parameter and result values of this invocation.
  660. func (m *MockLFSStore) CreateObject(v0 context.Context, v1 int64, v2 lfsutil.OID, v3 int64, v4 lfsutil.Storage) error {
  661. r0 := m.CreateObjectFunc.nextHook()(v0, v1, v2, v3, v4)
  662. m.CreateObjectFunc.appendCall(LFSStoreCreateObjectFuncCall{v0, v1, v2, v3, v4, r0})
  663. return r0
  664. }
  665. // SetDefaultHook sets function that is called when the CreateObject method
  666. // of the parent MockLFSStore instance is invoked and the hook queue is
  667. // empty.
  668. func (f *LFSStoreCreateObjectFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  669. f.defaultHook = hook
  670. }
  671. // PushHook adds a function to the end of hook queue. Each invocation of the
  672. // CreateObject method of the parent MockLFSStore instance invokes the hook
  673. // at the front of the queue and discards it. After the queue is empty, the
  674. // default hook function is invoked for any future action.
  675. func (f *LFSStoreCreateObjectFunc) PushHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  676. f.mutex.Lock()
  677. f.hooks = append(f.hooks, hook)
  678. f.mutex.Unlock()
  679. }
  680. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  681. // given values.
  682. func (f *LFSStoreCreateObjectFunc) SetDefaultReturn(r0 error) {
  683. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  684. return r0
  685. })
  686. }
  687. // PushReturn calls PushHook with a function that returns the given values.
  688. func (f *LFSStoreCreateObjectFunc) PushReturn(r0 error) {
  689. f.PushHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  690. return r0
  691. })
  692. }
  693. func (f *LFSStoreCreateObjectFunc) nextHook() func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  694. f.mutex.Lock()
  695. defer f.mutex.Unlock()
  696. if len(f.hooks) == 0 {
  697. return f.defaultHook
  698. }
  699. hook := f.hooks[0]
  700. f.hooks = f.hooks[1:]
  701. return hook
  702. }
  703. func (f *LFSStoreCreateObjectFunc) appendCall(r0 LFSStoreCreateObjectFuncCall) {
  704. f.mutex.Lock()
  705. f.history = append(f.history, r0)
  706. f.mutex.Unlock()
  707. }
  708. // History returns a sequence of LFSStoreCreateObjectFuncCall objects
  709. // describing the invocations of this function.
  710. func (f *LFSStoreCreateObjectFunc) History() []LFSStoreCreateObjectFuncCall {
  711. f.mutex.Lock()
  712. history := make([]LFSStoreCreateObjectFuncCall, len(f.history))
  713. copy(history, f.history)
  714. f.mutex.Unlock()
  715. return history
  716. }
  717. // LFSStoreCreateObjectFuncCall is an object that describes an invocation of
  718. // method CreateObject on an instance of MockLFSStore.
  719. type LFSStoreCreateObjectFuncCall struct {
  720. // Arg0 is the value of the 1st argument passed to this method
  721. // invocation.
  722. Arg0 context.Context
  723. // Arg1 is the value of the 2nd argument passed to this method
  724. // invocation.
  725. Arg1 int64
  726. // Arg2 is the value of the 3rd argument passed to this method
  727. // invocation.
  728. Arg2 lfsutil.OID
  729. // Arg3 is the value of the 4th argument passed to this method
  730. // invocation.
  731. Arg3 int64
  732. // Arg4 is the value of the 5th argument passed to this method
  733. // invocation.
  734. Arg4 lfsutil.Storage
  735. // Result0 is the value of the 1st result returned from this method
  736. // invocation.
  737. Result0 error
  738. }
  739. // Args returns an interface slice containing the arguments of this
  740. // invocation.
  741. func (c LFSStoreCreateObjectFuncCall) Args() []interface{} {
  742. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  743. }
  744. // Results returns an interface slice containing the results of this
  745. // invocation.
  746. func (c LFSStoreCreateObjectFuncCall) Results() []interface{} {
  747. return []interface{}{c.Result0}
  748. }
  749. // LFSStoreGetObjectByOIDFunc describes the behavior when the GetObjectByOID
  750. // method of the parent MockLFSStore instance is invoked.
  751. type LFSStoreGetObjectByOIDFunc struct {
  752. defaultHook func(context.Context, int64, lfsutil.OID) (*LFSObject, error)
  753. hooks []func(context.Context, int64, lfsutil.OID) (*LFSObject, error)
  754. history []LFSStoreGetObjectByOIDFuncCall
  755. mutex sync.Mutex
  756. }
  757. // GetObjectByOID delegates to the next hook function in the queue and
  758. // stores the parameter and result values of this invocation.
  759. func (m *MockLFSStore) GetObjectByOID(v0 context.Context, v1 int64, v2 lfsutil.OID) (*LFSObject, error) {
  760. r0, r1 := m.GetObjectByOIDFunc.nextHook()(v0, v1, v2)
  761. m.GetObjectByOIDFunc.appendCall(LFSStoreGetObjectByOIDFuncCall{v0, v1, v2, r0, r1})
  762. return r0, r1
  763. }
  764. // SetDefaultHook sets function that is called when the GetObjectByOID
  765. // method of the parent MockLFSStore instance is invoked and the hook queue
  766. // is empty.
  767. func (f *LFSStoreGetObjectByOIDFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID) (*LFSObject, error)) {
  768. f.defaultHook = hook
  769. }
  770. // PushHook adds a function to the end of hook queue. Each invocation of the
  771. // GetObjectByOID method of the parent MockLFSStore instance invokes the
  772. // hook at the front of the queue and discards it. After the queue is empty,
  773. // the default hook function is invoked for any future action.
  774. func (f *LFSStoreGetObjectByOIDFunc) PushHook(hook func(context.Context, int64, lfsutil.OID) (*LFSObject, error)) {
  775. f.mutex.Lock()
  776. f.hooks = append(f.hooks, hook)
  777. f.mutex.Unlock()
  778. }
  779. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  780. // given values.
  781. func (f *LFSStoreGetObjectByOIDFunc) SetDefaultReturn(r0 *LFSObject, r1 error) {
  782. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID) (*LFSObject, error) {
  783. return r0, r1
  784. })
  785. }
  786. // PushReturn calls PushHook with a function that returns the given values.
  787. func (f *LFSStoreGetObjectByOIDFunc) PushReturn(r0 *LFSObject, r1 error) {
  788. f.PushHook(func(context.Context, int64, lfsutil.OID) (*LFSObject, error) {
  789. return r0, r1
  790. })
  791. }
  792. func (f *LFSStoreGetObjectByOIDFunc) nextHook() func(context.Context, int64, lfsutil.OID) (*LFSObject, error) {
  793. f.mutex.Lock()
  794. defer f.mutex.Unlock()
  795. if len(f.hooks) == 0 {
  796. return f.defaultHook
  797. }
  798. hook := f.hooks[0]
  799. f.hooks = f.hooks[1:]
  800. return hook
  801. }
  802. func (f *LFSStoreGetObjectByOIDFunc) appendCall(r0 LFSStoreGetObjectByOIDFuncCall) {
  803. f.mutex.Lock()
  804. f.history = append(f.history, r0)
  805. f.mutex.Unlock()
  806. }
  807. // History returns a sequence of LFSStoreGetObjectByOIDFuncCall objects
  808. // describing the invocations of this function.
  809. func (f *LFSStoreGetObjectByOIDFunc) History() []LFSStoreGetObjectByOIDFuncCall {
  810. f.mutex.Lock()
  811. history := make([]LFSStoreGetObjectByOIDFuncCall, len(f.history))
  812. copy(history, f.history)
  813. f.mutex.Unlock()
  814. return history
  815. }
  816. // LFSStoreGetObjectByOIDFuncCall is an object that describes an invocation
  817. // of method GetObjectByOID on an instance of MockLFSStore.
  818. type LFSStoreGetObjectByOIDFuncCall struct {
  819. // Arg0 is the value of the 1st argument passed to this method
  820. // invocation.
  821. Arg0 context.Context
  822. // Arg1 is the value of the 2nd argument passed to this method
  823. // invocation.
  824. Arg1 int64
  825. // Arg2 is the value of the 3rd argument passed to this method
  826. // invocation.
  827. Arg2 lfsutil.OID
  828. // Result0 is the value of the 1st result returned from this method
  829. // invocation.
  830. Result0 *LFSObject
  831. // Result1 is the value of the 2nd result returned from this method
  832. // invocation.
  833. Result1 error
  834. }
  835. // Args returns an interface slice containing the arguments of this
  836. // invocation.
  837. func (c LFSStoreGetObjectByOIDFuncCall) Args() []interface{} {
  838. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  839. }
  840. // Results returns an interface slice containing the results of this
  841. // invocation.
  842. func (c LFSStoreGetObjectByOIDFuncCall) Results() []interface{} {
  843. return []interface{}{c.Result0, c.Result1}
  844. }
  845. // LFSStoreGetObjectsByOIDsFunc describes the behavior when the
  846. // GetObjectsByOIDs method of the parent MockLFSStore instance is invoked.
  847. type LFSStoreGetObjectsByOIDsFunc struct {
  848. defaultHook func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error)
  849. hooks []func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error)
  850. history []LFSStoreGetObjectsByOIDsFuncCall
  851. mutex sync.Mutex
  852. }
  853. // GetObjectsByOIDs delegates to the next hook function in the queue and
  854. // stores the parameter and result values of this invocation.
  855. func (m *MockLFSStore) GetObjectsByOIDs(v0 context.Context, v1 int64, v2 ...lfsutil.OID) ([]*LFSObject, error) {
  856. r0, r1 := m.GetObjectsByOIDsFunc.nextHook()(v0, v1, v2...)
  857. m.GetObjectsByOIDsFunc.appendCall(LFSStoreGetObjectsByOIDsFuncCall{v0, v1, v2, r0, r1})
  858. return r0, r1
  859. }
  860. // SetDefaultHook sets function that is called when the GetObjectsByOIDs
  861. // method of the parent MockLFSStore instance is invoked and the hook queue
  862. // is empty.
  863. func (f *LFSStoreGetObjectsByOIDsFunc) SetDefaultHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error)) {
  864. f.defaultHook = hook
  865. }
  866. // PushHook adds a function to the end of hook queue. Each invocation of the
  867. // GetObjectsByOIDs method of the parent MockLFSStore instance invokes the
  868. // hook at the front of the queue and discards it. After the queue is empty,
  869. // the default hook function is invoked for any future action.
  870. func (f *LFSStoreGetObjectsByOIDsFunc) PushHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error)) {
  871. f.mutex.Lock()
  872. f.hooks = append(f.hooks, hook)
  873. f.mutex.Unlock()
  874. }
  875. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  876. // given values.
  877. func (f *LFSStoreGetObjectsByOIDsFunc) SetDefaultReturn(r0 []*LFSObject, r1 error) {
  878. f.SetDefaultHook(func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error) {
  879. return r0, r1
  880. })
  881. }
  882. // PushReturn calls PushHook with a function that returns the given values.
  883. func (f *LFSStoreGetObjectsByOIDsFunc) PushReturn(r0 []*LFSObject, r1 error) {
  884. f.PushHook(func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error) {
  885. return r0, r1
  886. })
  887. }
  888. func (f *LFSStoreGetObjectsByOIDsFunc) nextHook() func(context.Context, int64, ...lfsutil.OID) ([]*LFSObject, error) {
  889. f.mutex.Lock()
  890. defer f.mutex.Unlock()
  891. if len(f.hooks) == 0 {
  892. return f.defaultHook
  893. }
  894. hook := f.hooks[0]
  895. f.hooks = f.hooks[1:]
  896. return hook
  897. }
  898. func (f *LFSStoreGetObjectsByOIDsFunc) appendCall(r0 LFSStoreGetObjectsByOIDsFuncCall) {
  899. f.mutex.Lock()
  900. f.history = append(f.history, r0)
  901. f.mutex.Unlock()
  902. }
  903. // History returns a sequence of LFSStoreGetObjectsByOIDsFuncCall objects
  904. // describing the invocations of this function.
  905. func (f *LFSStoreGetObjectsByOIDsFunc) History() []LFSStoreGetObjectsByOIDsFuncCall {
  906. f.mutex.Lock()
  907. history := make([]LFSStoreGetObjectsByOIDsFuncCall, len(f.history))
  908. copy(history, f.history)
  909. f.mutex.Unlock()
  910. return history
  911. }
  912. // LFSStoreGetObjectsByOIDsFuncCall is an object that describes an
  913. // invocation of method GetObjectsByOIDs on an instance of MockLFSStore.
  914. type LFSStoreGetObjectsByOIDsFuncCall struct {
  915. // Arg0 is the value of the 1st argument passed to this method
  916. // invocation.
  917. Arg0 context.Context
  918. // Arg1 is the value of the 2nd argument passed to this method
  919. // invocation.
  920. Arg1 int64
  921. // Arg2 is a slice containing the values of the variadic arguments
  922. // passed to this method invocation.
  923. Arg2 []lfsutil.OID
  924. // Result0 is the value of the 1st result returned from this method
  925. // invocation.
  926. Result0 []*LFSObject
  927. // Result1 is the value of the 2nd result returned from this method
  928. // invocation.
  929. Result1 error
  930. }
  931. // Args returns an interface slice containing the arguments of this
  932. // invocation. The variadic slice argument is flattened in this array such
  933. // that one positional argument and three variadic arguments would result in
  934. // a slice of four, not two.
  935. func (c LFSStoreGetObjectsByOIDsFuncCall) Args() []interface{} {
  936. trailing := []interface{}{}
  937. for _, val := range c.Arg2 {
  938. trailing = append(trailing, val)
  939. }
  940. return append([]interface{}{c.Arg0, c.Arg1}, trailing...)
  941. }
  942. // Results returns an interface slice containing the results of this
  943. // invocation.
  944. func (c LFSStoreGetObjectsByOIDsFuncCall) Results() []interface{} {
  945. return []interface{}{c.Result0, c.Result1}
  946. }
  947. // MockLoginSourcesStore is a mock implementation of the LoginSourcesStore
  948. // interface (from the package gogs.io/gogs/internal/db) used for unit
  949. // testing.
  950. type MockLoginSourcesStore struct {
  951. // CountFunc is an instance of a mock function object controlling the
  952. // behavior of the method Count.
  953. CountFunc *LoginSourcesStoreCountFunc
  954. // CreateFunc is an instance of a mock function object controlling the
  955. // behavior of the method Create.
  956. CreateFunc *LoginSourcesStoreCreateFunc
  957. // DeleteByIDFunc is an instance of a mock function object controlling
  958. // the behavior of the method DeleteByID.
  959. DeleteByIDFunc *LoginSourcesStoreDeleteByIDFunc
  960. // GetByIDFunc is an instance of a mock function object controlling the
  961. // behavior of the method GetByID.
  962. GetByIDFunc *LoginSourcesStoreGetByIDFunc
  963. // ListFunc is an instance of a mock function object controlling the
  964. // behavior of the method List.
  965. ListFunc *LoginSourcesStoreListFunc
  966. // ResetNonDefaultFunc is an instance of a mock function object
  967. // controlling the behavior of the method ResetNonDefault.
  968. ResetNonDefaultFunc *LoginSourcesStoreResetNonDefaultFunc
  969. // SaveFunc is an instance of a mock function object controlling the
  970. // behavior of the method Save.
  971. SaveFunc *LoginSourcesStoreSaveFunc
  972. }
  973. // NewMockLoginSourcesStore creates a new mock of the LoginSourcesStore
  974. // interface. All methods return zero values for all results, unless
  975. // overwritten.
  976. func NewMockLoginSourcesStore() *MockLoginSourcesStore {
  977. return &MockLoginSourcesStore{
  978. CountFunc: &LoginSourcesStoreCountFunc{
  979. defaultHook: func(context.Context) (r0 int64) {
  980. return
  981. },
  982. },
  983. CreateFunc: &LoginSourcesStoreCreateFunc{
  984. defaultHook: func(context.Context, CreateLoginSourceOpts) (r0 *LoginSource, r1 error) {
  985. return
  986. },
  987. },
  988. DeleteByIDFunc: &LoginSourcesStoreDeleteByIDFunc{
  989. defaultHook: func(context.Context, int64) (r0 error) {
  990. return
  991. },
  992. },
  993. GetByIDFunc: &LoginSourcesStoreGetByIDFunc{
  994. defaultHook: func(context.Context, int64) (r0 *LoginSource, r1 error) {
  995. return
  996. },
  997. },
  998. ListFunc: &LoginSourcesStoreListFunc{
  999. defaultHook: func(context.Context, ListLoginSourceOpts) (r0 []*LoginSource, r1 error) {
  1000. return
  1001. },
  1002. },
  1003. ResetNonDefaultFunc: &LoginSourcesStoreResetNonDefaultFunc{
  1004. defaultHook: func(context.Context, *LoginSource) (r0 error) {
  1005. return
  1006. },
  1007. },
  1008. SaveFunc: &LoginSourcesStoreSaveFunc{
  1009. defaultHook: func(context.Context, *LoginSource) (r0 error) {
  1010. return
  1011. },
  1012. },
  1013. }
  1014. }
  1015. // NewStrictMockLoginSourcesStore creates a new mock of the
  1016. // LoginSourcesStore interface. All methods panic on invocation, unless
  1017. // overwritten.
  1018. func NewStrictMockLoginSourcesStore() *MockLoginSourcesStore {
  1019. return &MockLoginSourcesStore{
  1020. CountFunc: &LoginSourcesStoreCountFunc{
  1021. defaultHook: func(context.Context) int64 {
  1022. panic("unexpected invocation of MockLoginSourcesStore.Count")
  1023. },
  1024. },
  1025. CreateFunc: &LoginSourcesStoreCreateFunc{
  1026. defaultHook: func(context.Context, CreateLoginSourceOpts) (*LoginSource, error) {
  1027. panic("unexpected invocation of MockLoginSourcesStore.Create")
  1028. },
  1029. },
  1030. DeleteByIDFunc: &LoginSourcesStoreDeleteByIDFunc{
  1031. defaultHook: func(context.Context, int64) error {
  1032. panic("unexpected invocation of MockLoginSourcesStore.DeleteByID")
  1033. },
  1034. },
  1035. GetByIDFunc: &LoginSourcesStoreGetByIDFunc{
  1036. defaultHook: func(context.Context, int64) (*LoginSource, error) {
  1037. panic("unexpected invocation of MockLoginSourcesStore.GetByID")
  1038. },
  1039. },
  1040. ListFunc: &LoginSourcesStoreListFunc{
  1041. defaultHook: func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error) {
  1042. panic("unexpected invocation of MockLoginSourcesStore.List")
  1043. },
  1044. },
  1045. ResetNonDefaultFunc: &LoginSourcesStoreResetNonDefaultFunc{
  1046. defaultHook: func(context.Context, *LoginSource) error {
  1047. panic("unexpected invocation of MockLoginSourcesStore.ResetNonDefault")
  1048. },
  1049. },
  1050. SaveFunc: &LoginSourcesStoreSaveFunc{
  1051. defaultHook: func(context.Context, *LoginSource) error {
  1052. panic("unexpected invocation of MockLoginSourcesStore.Save")
  1053. },
  1054. },
  1055. }
  1056. }
  1057. // NewMockLoginSourcesStoreFrom creates a new mock of the
  1058. // MockLoginSourcesStore interface. All methods delegate to the given
  1059. // implementation, unless overwritten.
  1060. func NewMockLoginSourcesStoreFrom(i LoginSourcesStore) *MockLoginSourcesStore {
  1061. return &MockLoginSourcesStore{
  1062. CountFunc: &LoginSourcesStoreCountFunc{
  1063. defaultHook: i.Count,
  1064. },
  1065. CreateFunc: &LoginSourcesStoreCreateFunc{
  1066. defaultHook: i.Create,
  1067. },
  1068. DeleteByIDFunc: &LoginSourcesStoreDeleteByIDFunc{
  1069. defaultHook: i.DeleteByID,
  1070. },
  1071. GetByIDFunc: &LoginSourcesStoreGetByIDFunc{
  1072. defaultHook: i.GetByID,
  1073. },
  1074. ListFunc: &LoginSourcesStoreListFunc{
  1075. defaultHook: i.List,
  1076. },
  1077. ResetNonDefaultFunc: &LoginSourcesStoreResetNonDefaultFunc{
  1078. defaultHook: i.ResetNonDefault,
  1079. },
  1080. SaveFunc: &LoginSourcesStoreSaveFunc{
  1081. defaultHook: i.Save,
  1082. },
  1083. }
  1084. }
  1085. // LoginSourcesStoreCountFunc describes the behavior when the Count method
  1086. // of the parent MockLoginSourcesStore instance is invoked.
  1087. type LoginSourcesStoreCountFunc struct {
  1088. defaultHook func(context.Context) int64
  1089. hooks []func(context.Context) int64
  1090. history []LoginSourcesStoreCountFuncCall
  1091. mutex sync.Mutex
  1092. }
  1093. // Count delegates to the next hook function in the queue and stores the
  1094. // parameter and result values of this invocation.
  1095. func (m *MockLoginSourcesStore) Count(v0 context.Context) int64 {
  1096. r0 := m.CountFunc.nextHook()(v0)
  1097. m.CountFunc.appendCall(LoginSourcesStoreCountFuncCall{v0, r0})
  1098. return r0
  1099. }
  1100. // SetDefaultHook sets function that is called when the Count method of the
  1101. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  1102. // empty.
  1103. func (f *LoginSourcesStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  1104. f.defaultHook = hook
  1105. }
  1106. // PushHook adds a function to the end of hook queue. Each invocation of the
  1107. // Count method of the parent MockLoginSourcesStore instance invokes the
  1108. // hook at the front of the queue and discards it. After the queue is empty,
  1109. // the default hook function is invoked for any future action.
  1110. func (f *LoginSourcesStoreCountFunc) PushHook(hook func(context.Context) int64) {
  1111. f.mutex.Lock()
  1112. f.hooks = append(f.hooks, hook)
  1113. f.mutex.Unlock()
  1114. }
  1115. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1116. // given values.
  1117. func (f *LoginSourcesStoreCountFunc) SetDefaultReturn(r0 int64) {
  1118. f.SetDefaultHook(func(context.Context) int64 {
  1119. return r0
  1120. })
  1121. }
  1122. // PushReturn calls PushHook with a function that returns the given values.
  1123. func (f *LoginSourcesStoreCountFunc) PushReturn(r0 int64) {
  1124. f.PushHook(func(context.Context) int64 {
  1125. return r0
  1126. })
  1127. }
  1128. func (f *LoginSourcesStoreCountFunc) nextHook() func(context.Context) int64 {
  1129. f.mutex.Lock()
  1130. defer f.mutex.Unlock()
  1131. if len(f.hooks) == 0 {
  1132. return f.defaultHook
  1133. }
  1134. hook := f.hooks[0]
  1135. f.hooks = f.hooks[1:]
  1136. return hook
  1137. }
  1138. func (f *LoginSourcesStoreCountFunc) appendCall(r0 LoginSourcesStoreCountFuncCall) {
  1139. f.mutex.Lock()
  1140. f.history = append(f.history, r0)
  1141. f.mutex.Unlock()
  1142. }
  1143. // History returns a sequence of LoginSourcesStoreCountFuncCall objects
  1144. // describing the invocations of this function.
  1145. func (f *LoginSourcesStoreCountFunc) History() []LoginSourcesStoreCountFuncCall {
  1146. f.mutex.Lock()
  1147. history := make([]LoginSourcesStoreCountFuncCall, len(f.history))
  1148. copy(history, f.history)
  1149. f.mutex.Unlock()
  1150. return history
  1151. }
  1152. // LoginSourcesStoreCountFuncCall is an object that describes an invocation
  1153. // of method Count on an instance of MockLoginSourcesStore.
  1154. type LoginSourcesStoreCountFuncCall struct {
  1155. // Arg0 is the value of the 1st argument passed to this method
  1156. // invocation.
  1157. Arg0 context.Context
  1158. // Result0 is the value of the 1st result returned from this method
  1159. // invocation.
  1160. Result0 int64
  1161. }
  1162. // Args returns an interface slice containing the arguments of this
  1163. // invocation.
  1164. func (c LoginSourcesStoreCountFuncCall) Args() []interface{} {
  1165. return []interface{}{c.Arg0}
  1166. }
  1167. // Results returns an interface slice containing the results of this
  1168. // invocation.
  1169. func (c LoginSourcesStoreCountFuncCall) Results() []interface{} {
  1170. return []interface{}{c.Result0}
  1171. }
  1172. // LoginSourcesStoreCreateFunc describes the behavior when the Create method
  1173. // of the parent MockLoginSourcesStore instance is invoked.
  1174. type LoginSourcesStoreCreateFunc struct {
  1175. defaultHook func(context.Context, CreateLoginSourceOpts) (*LoginSource, error)
  1176. hooks []func(context.Context, CreateLoginSourceOpts) (*LoginSource, error)
  1177. history []LoginSourcesStoreCreateFuncCall
  1178. mutex sync.Mutex
  1179. }
  1180. // Create delegates to the next hook function in the queue and stores the
  1181. // parameter and result values of this invocation.
  1182. func (m *MockLoginSourcesStore) Create(v0 context.Context, v1 CreateLoginSourceOpts) (*LoginSource, error) {
  1183. r0, r1 := m.CreateFunc.nextHook()(v0, v1)
  1184. m.CreateFunc.appendCall(LoginSourcesStoreCreateFuncCall{v0, v1, r0, r1})
  1185. return r0, r1
  1186. }
  1187. // SetDefaultHook sets function that is called when the Create method of the
  1188. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  1189. // empty.
  1190. func (f *LoginSourcesStoreCreateFunc) SetDefaultHook(hook func(context.Context, CreateLoginSourceOpts) (*LoginSource, error)) {
  1191. f.defaultHook = hook
  1192. }
  1193. // PushHook adds a function to the end of hook queue. Each invocation of the
  1194. // Create method of the parent MockLoginSourcesStore instance invokes the
  1195. // hook at the front of the queue and discards it. After the queue is empty,
  1196. // the default hook function is invoked for any future action.
  1197. func (f *LoginSourcesStoreCreateFunc) PushHook(hook func(context.Context, CreateLoginSourceOpts) (*LoginSource, error)) {
  1198. f.mutex.Lock()
  1199. f.hooks = append(f.hooks, hook)
  1200. f.mutex.Unlock()
  1201. }
  1202. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1203. // given values.
  1204. func (f *LoginSourcesStoreCreateFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  1205. f.SetDefaultHook(func(context.Context, CreateLoginSourceOpts) (*LoginSource, error) {
  1206. return r0, r1
  1207. })
  1208. }
  1209. // PushReturn calls PushHook with a function that returns the given values.
  1210. func (f *LoginSourcesStoreCreateFunc) PushReturn(r0 *LoginSource, r1 error) {
  1211. f.PushHook(func(context.Context, CreateLoginSourceOpts) (*LoginSource, error) {
  1212. return r0, r1
  1213. })
  1214. }
  1215. func (f *LoginSourcesStoreCreateFunc) nextHook() func(context.Context, CreateLoginSourceOpts) (*LoginSource, error) {
  1216. f.mutex.Lock()
  1217. defer f.mutex.Unlock()
  1218. if len(f.hooks) == 0 {
  1219. return f.defaultHook
  1220. }
  1221. hook := f.hooks[0]
  1222. f.hooks = f.hooks[1:]
  1223. return hook
  1224. }
  1225. func (f *LoginSourcesStoreCreateFunc) appendCall(r0 LoginSourcesStoreCreateFuncCall) {
  1226. f.mutex.Lock()
  1227. f.history = append(f.history, r0)
  1228. f.mutex.Unlock()
  1229. }
  1230. // History returns a sequence of LoginSourcesStoreCreateFuncCall objects
  1231. // describing the invocations of this function.
  1232. func (f *LoginSourcesStoreCreateFunc) History() []LoginSourcesStoreCreateFuncCall {
  1233. f.mutex.Lock()
  1234. history := make([]LoginSourcesStoreCreateFuncCall, len(f.history))
  1235. copy(history, f.history)
  1236. f.mutex.Unlock()
  1237. return history
  1238. }
  1239. // LoginSourcesStoreCreateFuncCall is an object that describes an invocation
  1240. // of method Create on an instance of MockLoginSourcesStore.
  1241. type LoginSourcesStoreCreateFuncCall struct {
  1242. // Arg0 is the value of the 1st argument passed to this method
  1243. // invocation.
  1244. Arg0 context.Context
  1245. // Arg1 is the value of the 2nd argument passed to this method
  1246. // invocation.
  1247. Arg1 CreateLoginSourceOpts
  1248. // Result0 is the value of the 1st result returned from this method
  1249. // invocation.
  1250. Result0 *LoginSource
  1251. // Result1 is the value of the 2nd result returned from this method
  1252. // invocation.
  1253. Result1 error
  1254. }
  1255. // Args returns an interface slice containing the arguments of this
  1256. // invocation.
  1257. func (c LoginSourcesStoreCreateFuncCall) Args() []interface{} {
  1258. return []interface{}{c.Arg0, c.Arg1}
  1259. }
  1260. // Results returns an interface slice containing the results of this
  1261. // invocation.
  1262. func (c LoginSourcesStoreCreateFuncCall) Results() []interface{} {
  1263. return []interface{}{c.Result0, c.Result1}
  1264. }
  1265. // LoginSourcesStoreDeleteByIDFunc describes the behavior when the
  1266. // DeleteByID method of the parent MockLoginSourcesStore instance is
  1267. // invoked.
  1268. type LoginSourcesStoreDeleteByIDFunc struct {
  1269. defaultHook func(context.Context, int64) error
  1270. hooks []func(context.Context, int64) error
  1271. history []LoginSourcesStoreDeleteByIDFuncCall
  1272. mutex sync.Mutex
  1273. }
  1274. // DeleteByID delegates to the next hook function in the queue and stores
  1275. // the parameter and result values of this invocation.
  1276. func (m *MockLoginSourcesStore) DeleteByID(v0 context.Context, v1 int64) error {
  1277. r0 := m.DeleteByIDFunc.nextHook()(v0, v1)
  1278. m.DeleteByIDFunc.appendCall(LoginSourcesStoreDeleteByIDFuncCall{v0, v1, r0})
  1279. return r0
  1280. }
  1281. // SetDefaultHook sets function that is called when the DeleteByID method of
  1282. // the parent MockLoginSourcesStore instance is invoked and the hook queue
  1283. // is empty.
  1284. func (f *LoginSourcesStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  1285. f.defaultHook = hook
  1286. }
  1287. // PushHook adds a function to the end of hook queue. Each invocation of the
  1288. // DeleteByID method of the parent MockLoginSourcesStore instance invokes
  1289. // the hook at the front of the queue and discards it. After the queue is
  1290. // empty, the default hook function is invoked for any future action.
  1291. func (f *LoginSourcesStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64) error) {
  1292. f.mutex.Lock()
  1293. f.hooks = append(f.hooks, hook)
  1294. f.mutex.Unlock()
  1295. }
  1296. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1297. // given values.
  1298. func (f *LoginSourcesStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  1299. f.SetDefaultHook(func(context.Context, int64) error {
  1300. return r0
  1301. })
  1302. }
  1303. // PushReturn calls PushHook with a function that returns the given values.
  1304. func (f *LoginSourcesStoreDeleteByIDFunc) PushReturn(r0 error) {
  1305. f.PushHook(func(context.Context, int64) error {
  1306. return r0
  1307. })
  1308. }
  1309. func (f *LoginSourcesStoreDeleteByIDFunc) nextHook() func(context.Context, int64) error {
  1310. f.mutex.Lock()
  1311. defer f.mutex.Unlock()
  1312. if len(f.hooks) == 0 {
  1313. return f.defaultHook
  1314. }
  1315. hook := f.hooks[0]
  1316. f.hooks = f.hooks[1:]
  1317. return hook
  1318. }
  1319. func (f *LoginSourcesStoreDeleteByIDFunc) appendCall(r0 LoginSourcesStoreDeleteByIDFuncCall) {
  1320. f.mutex.Lock()
  1321. f.history = append(f.history, r0)
  1322. f.mutex.Unlock()
  1323. }
  1324. // History returns a sequence of LoginSourcesStoreDeleteByIDFuncCall objects
  1325. // describing the invocations of this function.
  1326. func (f *LoginSourcesStoreDeleteByIDFunc) History() []LoginSourcesStoreDeleteByIDFuncCall {
  1327. f.mutex.Lock()
  1328. history := make([]LoginSourcesStoreDeleteByIDFuncCall, len(f.history))
  1329. copy(history, f.history)
  1330. f.mutex.Unlock()
  1331. return history
  1332. }
  1333. // LoginSourcesStoreDeleteByIDFuncCall is an object that describes an
  1334. // invocation of method DeleteByID on an instance of MockLoginSourcesStore.
  1335. type LoginSourcesStoreDeleteByIDFuncCall struct {
  1336. // Arg0 is the value of the 1st argument passed to this method
  1337. // invocation.
  1338. Arg0 context.Context
  1339. // Arg1 is the value of the 2nd argument passed to this method
  1340. // invocation.
  1341. Arg1 int64
  1342. // Result0 is the value of the 1st result returned from this method
  1343. // invocation.
  1344. Result0 error
  1345. }
  1346. // Args returns an interface slice containing the arguments of this
  1347. // invocation.
  1348. func (c LoginSourcesStoreDeleteByIDFuncCall) Args() []interface{} {
  1349. return []interface{}{c.Arg0, c.Arg1}
  1350. }
  1351. // Results returns an interface slice containing the results of this
  1352. // invocation.
  1353. func (c LoginSourcesStoreDeleteByIDFuncCall) Results() []interface{} {
  1354. return []interface{}{c.Result0}
  1355. }
  1356. // LoginSourcesStoreGetByIDFunc describes the behavior when the GetByID
  1357. // method of the parent MockLoginSourcesStore instance is invoked.
  1358. type LoginSourcesStoreGetByIDFunc struct {
  1359. defaultHook func(context.Context, int64) (*LoginSource, error)
  1360. hooks []func(context.Context, int64) (*LoginSource, error)
  1361. history []LoginSourcesStoreGetByIDFuncCall
  1362. mutex sync.Mutex
  1363. }
  1364. // GetByID delegates to the next hook function in the queue and stores the
  1365. // parameter and result values of this invocation.
  1366. func (m *MockLoginSourcesStore) GetByID(v0 context.Context, v1 int64) (*LoginSource, error) {
  1367. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  1368. m.GetByIDFunc.appendCall(LoginSourcesStoreGetByIDFuncCall{v0, v1, r0, r1})
  1369. return r0, r1
  1370. }
  1371. // SetDefaultHook sets function that is called when the GetByID method of
  1372. // the parent MockLoginSourcesStore instance is invoked and the hook queue
  1373. // is empty.
  1374. func (f *LoginSourcesStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*LoginSource, error)) {
  1375. f.defaultHook = hook
  1376. }
  1377. // PushHook adds a function to the end of hook queue. Each invocation of the
  1378. // GetByID method of the parent MockLoginSourcesStore instance invokes the
  1379. // hook at the front of the queue and discards it. After the queue is empty,
  1380. // the default hook function is invoked for any future action.
  1381. func (f *LoginSourcesStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*LoginSource, error)) {
  1382. f.mutex.Lock()
  1383. f.hooks = append(f.hooks, hook)
  1384. f.mutex.Unlock()
  1385. }
  1386. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1387. // given values.
  1388. func (f *LoginSourcesStoreGetByIDFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  1389. f.SetDefaultHook(func(context.Context, int64) (*LoginSource, error) {
  1390. return r0, r1
  1391. })
  1392. }
  1393. // PushReturn calls PushHook with a function that returns the given values.
  1394. func (f *LoginSourcesStoreGetByIDFunc) PushReturn(r0 *LoginSource, r1 error) {
  1395. f.PushHook(func(context.Context, int64) (*LoginSource, error) {
  1396. return r0, r1
  1397. })
  1398. }
  1399. func (f *LoginSourcesStoreGetByIDFunc) nextHook() func(context.Context, int64) (*LoginSource, error) {
  1400. f.mutex.Lock()
  1401. defer f.mutex.Unlock()
  1402. if len(f.hooks) == 0 {
  1403. return f.defaultHook
  1404. }
  1405. hook := f.hooks[0]
  1406. f.hooks = f.hooks[1:]
  1407. return hook
  1408. }
  1409. func (f *LoginSourcesStoreGetByIDFunc) appendCall(r0 LoginSourcesStoreGetByIDFuncCall) {
  1410. f.mutex.Lock()
  1411. f.history = append(f.history, r0)
  1412. f.mutex.Unlock()
  1413. }
  1414. // History returns a sequence of LoginSourcesStoreGetByIDFuncCall objects
  1415. // describing the invocations of this function.
  1416. func (f *LoginSourcesStoreGetByIDFunc) History() []LoginSourcesStoreGetByIDFuncCall {
  1417. f.mutex.Lock()
  1418. history := make([]LoginSourcesStoreGetByIDFuncCall, len(f.history))
  1419. copy(history, f.history)
  1420. f.mutex.Unlock()
  1421. return history
  1422. }
  1423. // LoginSourcesStoreGetByIDFuncCall is an object that describes an
  1424. // invocation of method GetByID on an instance of MockLoginSourcesStore.
  1425. type LoginSourcesStoreGetByIDFuncCall struct {
  1426. // Arg0 is the value of the 1st argument passed to this method
  1427. // invocation.
  1428. Arg0 context.Context
  1429. // Arg1 is the value of the 2nd argument passed to this method
  1430. // invocation.
  1431. Arg1 int64
  1432. // Result0 is the value of the 1st result returned from this method
  1433. // invocation.
  1434. Result0 *LoginSource
  1435. // Result1 is the value of the 2nd result returned from this method
  1436. // invocation.
  1437. Result1 error
  1438. }
  1439. // Args returns an interface slice containing the arguments of this
  1440. // invocation.
  1441. func (c LoginSourcesStoreGetByIDFuncCall) Args() []interface{} {
  1442. return []interface{}{c.Arg0, c.Arg1}
  1443. }
  1444. // Results returns an interface slice containing the results of this
  1445. // invocation.
  1446. func (c LoginSourcesStoreGetByIDFuncCall) Results() []interface{} {
  1447. return []interface{}{c.Result0, c.Result1}
  1448. }
  1449. // LoginSourcesStoreListFunc describes the behavior when the List method of
  1450. // the parent MockLoginSourcesStore instance is invoked.
  1451. type LoginSourcesStoreListFunc struct {
  1452. defaultHook func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error)
  1453. hooks []func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error)
  1454. history []LoginSourcesStoreListFuncCall
  1455. mutex sync.Mutex
  1456. }
  1457. // List delegates to the next hook function in the queue and stores the
  1458. // parameter and result values of this invocation.
  1459. func (m *MockLoginSourcesStore) List(v0 context.Context, v1 ListLoginSourceOpts) ([]*LoginSource, error) {
  1460. r0, r1 := m.ListFunc.nextHook()(v0, v1)
  1461. m.ListFunc.appendCall(LoginSourcesStoreListFuncCall{v0, v1, r0, r1})
  1462. return r0, r1
  1463. }
  1464. // SetDefaultHook sets function that is called when the List method of the
  1465. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  1466. // empty.
  1467. func (f *LoginSourcesStoreListFunc) SetDefaultHook(hook func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error)) {
  1468. f.defaultHook = hook
  1469. }
  1470. // PushHook adds a function to the end of hook queue. Each invocation of the
  1471. // List method of the parent MockLoginSourcesStore instance invokes the hook
  1472. // at the front of the queue and discards it. After the queue is empty, the
  1473. // default hook function is invoked for any future action.
  1474. func (f *LoginSourcesStoreListFunc) PushHook(hook func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error)) {
  1475. f.mutex.Lock()
  1476. f.hooks = append(f.hooks, hook)
  1477. f.mutex.Unlock()
  1478. }
  1479. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1480. // given values.
  1481. func (f *LoginSourcesStoreListFunc) SetDefaultReturn(r0 []*LoginSource, r1 error) {
  1482. f.SetDefaultHook(func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error) {
  1483. return r0, r1
  1484. })
  1485. }
  1486. // PushReturn calls PushHook with a function that returns the given values.
  1487. func (f *LoginSourcesStoreListFunc) PushReturn(r0 []*LoginSource, r1 error) {
  1488. f.PushHook(func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error) {
  1489. return r0, r1
  1490. })
  1491. }
  1492. func (f *LoginSourcesStoreListFunc) nextHook() func(context.Context, ListLoginSourceOpts) ([]*LoginSource, error) {
  1493. f.mutex.Lock()
  1494. defer f.mutex.Unlock()
  1495. if len(f.hooks) == 0 {
  1496. return f.defaultHook
  1497. }
  1498. hook := f.hooks[0]
  1499. f.hooks = f.hooks[1:]
  1500. return hook
  1501. }
  1502. func (f *LoginSourcesStoreListFunc) appendCall(r0 LoginSourcesStoreListFuncCall) {
  1503. f.mutex.Lock()
  1504. f.history = append(f.history, r0)
  1505. f.mutex.Unlock()
  1506. }
  1507. // History returns a sequence of LoginSourcesStoreListFuncCall objects
  1508. // describing the invocations of this function.
  1509. func (f *LoginSourcesStoreListFunc) History() []LoginSourcesStoreListFuncCall {
  1510. f.mutex.Lock()
  1511. history := make([]LoginSourcesStoreListFuncCall, len(f.history))
  1512. copy(history, f.history)
  1513. f.mutex.Unlock()
  1514. return history
  1515. }
  1516. // LoginSourcesStoreListFuncCall is an object that describes an invocation
  1517. // of method List on an instance of MockLoginSourcesStore.
  1518. type LoginSourcesStoreListFuncCall struct {
  1519. // Arg0 is the value of the 1st argument passed to this method
  1520. // invocation.
  1521. Arg0 context.Context
  1522. // Arg1 is the value of the 2nd argument passed to this method
  1523. // invocation.
  1524. Arg1 ListLoginSourceOpts
  1525. // Result0 is the value of the 1st result returned from this method
  1526. // invocation.
  1527. Result0 []*LoginSource
  1528. // Result1 is the value of the 2nd result returned from this method
  1529. // invocation.
  1530. Result1 error
  1531. }
  1532. // Args returns an interface slice containing the arguments of this
  1533. // invocation.
  1534. func (c LoginSourcesStoreListFuncCall) Args() []interface{} {
  1535. return []interface{}{c.Arg0, c.Arg1}
  1536. }
  1537. // Results returns an interface slice containing the results of this
  1538. // invocation.
  1539. func (c LoginSourcesStoreListFuncCall) Results() []interface{} {
  1540. return []interface{}{c.Result0, c.Result1}
  1541. }
  1542. // LoginSourcesStoreResetNonDefaultFunc describes the behavior when the
  1543. // ResetNonDefault method of the parent MockLoginSourcesStore instance is
  1544. // invoked.
  1545. type LoginSourcesStoreResetNonDefaultFunc struct {
  1546. defaultHook func(context.Context, *LoginSource) error
  1547. hooks []func(context.Context, *LoginSource) error
  1548. history []LoginSourcesStoreResetNonDefaultFuncCall
  1549. mutex sync.Mutex
  1550. }
  1551. // ResetNonDefault delegates to the next hook function in the queue and
  1552. // stores the parameter and result values of this invocation.
  1553. func (m *MockLoginSourcesStore) ResetNonDefault(v0 context.Context, v1 *LoginSource) error {
  1554. r0 := m.ResetNonDefaultFunc.nextHook()(v0, v1)
  1555. m.ResetNonDefaultFunc.appendCall(LoginSourcesStoreResetNonDefaultFuncCall{v0, v1, r0})
  1556. return r0
  1557. }
  1558. // SetDefaultHook sets function that is called when the ResetNonDefault
  1559. // method of the parent MockLoginSourcesStore instance is invoked and the
  1560. // hook queue is empty.
  1561. func (f *LoginSourcesStoreResetNonDefaultFunc) SetDefaultHook(hook func(context.Context, *LoginSource) error) {
  1562. f.defaultHook = hook
  1563. }
  1564. // PushHook adds a function to the end of hook queue. Each invocation of the
  1565. // ResetNonDefault method of the parent MockLoginSourcesStore instance
  1566. // invokes the hook at the front of the queue and discards it. After the
  1567. // queue is empty, the default hook function is invoked for any future
  1568. // action.
  1569. func (f *LoginSourcesStoreResetNonDefaultFunc) PushHook(hook func(context.Context, *LoginSource) error) {
  1570. f.mutex.Lock()
  1571. f.hooks = append(f.hooks, hook)
  1572. f.mutex.Unlock()
  1573. }
  1574. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1575. // given values.
  1576. func (f *LoginSourcesStoreResetNonDefaultFunc) SetDefaultReturn(r0 error) {
  1577. f.SetDefaultHook(func(context.Context, *LoginSource) error {
  1578. return r0
  1579. })
  1580. }
  1581. // PushReturn calls PushHook with a function that returns the given values.
  1582. func (f *LoginSourcesStoreResetNonDefaultFunc) PushReturn(r0 error) {
  1583. f.PushHook(func(context.Context, *LoginSource) error {
  1584. return r0
  1585. })
  1586. }
  1587. func (f *LoginSourcesStoreResetNonDefaultFunc) nextHook() func(context.Context, *LoginSource) error {
  1588. f.mutex.Lock()
  1589. defer f.mutex.Unlock()
  1590. if len(f.hooks) == 0 {
  1591. return f.defaultHook
  1592. }
  1593. hook := f.hooks[0]
  1594. f.hooks = f.hooks[1:]
  1595. return hook
  1596. }
  1597. func (f *LoginSourcesStoreResetNonDefaultFunc) appendCall(r0 LoginSourcesStoreResetNonDefaultFuncCall) {
  1598. f.mutex.Lock()
  1599. f.history = append(f.history, r0)
  1600. f.mutex.Unlock()
  1601. }
  1602. // History returns a sequence of LoginSourcesStoreResetNonDefaultFuncCall
  1603. // objects describing the invocations of this function.
  1604. func (f *LoginSourcesStoreResetNonDefaultFunc) History() []LoginSourcesStoreResetNonDefaultFuncCall {
  1605. f.mutex.Lock()
  1606. history := make([]LoginSourcesStoreResetNonDefaultFuncCall, len(f.history))
  1607. copy(history, f.history)
  1608. f.mutex.Unlock()
  1609. return history
  1610. }
  1611. // LoginSourcesStoreResetNonDefaultFuncCall is an object that describes an
  1612. // invocation of method ResetNonDefault on an instance of
  1613. // MockLoginSourcesStore.
  1614. type LoginSourcesStoreResetNonDefaultFuncCall struct {
  1615. // Arg0 is the value of the 1st argument passed to this method
  1616. // invocation.
  1617. Arg0 context.Context
  1618. // Arg1 is the value of the 2nd argument passed to this method
  1619. // invocation.
  1620. Arg1 *LoginSource
  1621. // Result0 is the value of the 1st result returned from this method
  1622. // invocation.
  1623. Result0 error
  1624. }
  1625. // Args returns an interface slice containing the arguments of this
  1626. // invocation.
  1627. func (c LoginSourcesStoreResetNonDefaultFuncCall) Args() []interface{} {
  1628. return []interface{}{c.Arg0, c.Arg1}
  1629. }
  1630. // Results returns an interface slice containing the results of this
  1631. // invocation.
  1632. func (c LoginSourcesStoreResetNonDefaultFuncCall) Results() []interface{} {
  1633. return []interface{}{c.Result0}
  1634. }
  1635. // LoginSourcesStoreSaveFunc describes the behavior when the Save method of
  1636. // the parent MockLoginSourcesStore instance is invoked.
  1637. type LoginSourcesStoreSaveFunc struct {
  1638. defaultHook func(context.Context, *LoginSource) error
  1639. hooks []func(context.Context, *LoginSource) error
  1640. history []LoginSourcesStoreSaveFuncCall
  1641. mutex sync.Mutex
  1642. }
  1643. // Save delegates to the next hook function in the queue and stores the
  1644. // parameter and result values of this invocation.
  1645. func (m *MockLoginSourcesStore) Save(v0 context.Context, v1 *LoginSource) error {
  1646. r0 := m.SaveFunc.nextHook()(v0, v1)
  1647. m.SaveFunc.appendCall(LoginSourcesStoreSaveFuncCall{v0, v1, r0})
  1648. return r0
  1649. }
  1650. // SetDefaultHook sets function that is called when the Save method of the
  1651. // parent MockLoginSourcesStore instance is invoked and the hook queue is
  1652. // empty.
  1653. func (f *LoginSourcesStoreSaveFunc) SetDefaultHook(hook func(context.Context, *LoginSource) error) {
  1654. f.defaultHook = hook
  1655. }
  1656. // PushHook adds a function to the end of hook queue. Each invocation of the
  1657. // Save method of the parent MockLoginSourcesStore instance invokes the hook
  1658. // at the front of the queue and discards it. After the queue is empty, the
  1659. // default hook function is invoked for any future action.
  1660. func (f *LoginSourcesStoreSaveFunc) PushHook(hook func(context.Context, *LoginSource) error) {
  1661. f.mutex.Lock()
  1662. f.hooks = append(f.hooks, hook)
  1663. f.mutex.Unlock()
  1664. }
  1665. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1666. // given values.
  1667. func (f *LoginSourcesStoreSaveFunc) SetDefaultReturn(r0 error) {
  1668. f.SetDefaultHook(func(context.Context, *LoginSource) error {
  1669. return r0
  1670. })
  1671. }
  1672. // PushReturn calls PushHook with a function that returns the given values.
  1673. func (f *LoginSourcesStoreSaveFunc) PushReturn(r0 error) {
  1674. f.PushHook(func(context.Context, *LoginSource) error {
  1675. return r0
  1676. })
  1677. }
  1678. func (f *LoginSourcesStoreSaveFunc) nextHook() func(context.Context, *LoginSource) error {
  1679. f.mutex.Lock()
  1680. defer f.mutex.Unlock()
  1681. if len(f.hooks) == 0 {
  1682. return f.defaultHook
  1683. }
  1684. hook := f.hooks[0]
  1685. f.hooks = f.hooks[1:]
  1686. return hook
  1687. }
  1688. func (f *LoginSourcesStoreSaveFunc) appendCall(r0 LoginSourcesStoreSaveFuncCall) {
  1689. f.mutex.Lock()
  1690. f.history = append(f.history, r0)
  1691. f.mutex.Unlock()
  1692. }
  1693. // History returns a sequence of LoginSourcesStoreSaveFuncCall objects
  1694. // describing the invocations of this function.
  1695. func (f *LoginSourcesStoreSaveFunc) History() []LoginSourcesStoreSaveFuncCall {
  1696. f.mutex.Lock()
  1697. history := make([]LoginSourcesStoreSaveFuncCall, len(f.history))
  1698. copy(history, f.history)
  1699. f.mutex.Unlock()
  1700. return history
  1701. }
  1702. // LoginSourcesStoreSaveFuncCall is an object that describes an invocation
  1703. // of method Save on an instance of MockLoginSourcesStore.
  1704. type LoginSourcesStoreSaveFuncCall struct {
  1705. // Arg0 is the value of the 1st argument passed to this method
  1706. // invocation.
  1707. Arg0 context.Context
  1708. // Arg1 is the value of the 2nd argument passed to this method
  1709. // invocation.
  1710. Arg1 *LoginSource
  1711. // Result0 is the value of the 1st result returned from this method
  1712. // invocation.
  1713. Result0 error
  1714. }
  1715. // Args returns an interface slice containing the arguments of this
  1716. // invocation.
  1717. func (c LoginSourcesStoreSaveFuncCall) Args() []interface{} {
  1718. return []interface{}{c.Arg0, c.Arg1}
  1719. }
  1720. // Results returns an interface slice containing the results of this
  1721. // invocation.
  1722. func (c LoginSourcesStoreSaveFuncCall) Results() []interface{} {
  1723. return []interface{}{c.Result0}
  1724. }
  1725. // MockPermsStore is a mock implementation of the PermsStore interface (from
  1726. // the package gogs.io/gogs/internal/db) used for unit testing.
  1727. type MockPermsStore struct {
  1728. // AccessModeFunc is an instance of a mock function object controlling
  1729. // the behavior of the method AccessMode.
  1730. AccessModeFunc *PermsStoreAccessModeFunc
  1731. // AuthorizeFunc is an instance of a mock function object controlling
  1732. // the behavior of the method Authorize.
  1733. AuthorizeFunc *PermsStoreAuthorizeFunc
  1734. // SetRepoPermsFunc is an instance of a mock function object controlling
  1735. // the behavior of the method SetRepoPerms.
  1736. SetRepoPermsFunc *PermsStoreSetRepoPermsFunc
  1737. }
  1738. // NewMockPermsStore creates a new mock of the PermsStore interface. All
  1739. // methods return zero values for all results, unless overwritten.
  1740. func NewMockPermsStore() *MockPermsStore {
  1741. return &MockPermsStore{
  1742. AccessModeFunc: &PermsStoreAccessModeFunc{
  1743. defaultHook: func(context.Context, int64, int64, AccessModeOptions) (r0 AccessMode) {
  1744. return
  1745. },
  1746. },
  1747. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  1748. defaultHook: func(context.Context, int64, int64, AccessMode, AccessModeOptions) (r0 bool) {
  1749. return
  1750. },
  1751. },
  1752. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1753. defaultHook: func(context.Context, int64, map[int64]AccessMode) (r0 error) {
  1754. return
  1755. },
  1756. },
  1757. }
  1758. }
  1759. // NewStrictMockPermsStore creates a new mock of the PermsStore interface.
  1760. // All methods panic on invocation, unless overwritten.
  1761. func NewStrictMockPermsStore() *MockPermsStore {
  1762. return &MockPermsStore{
  1763. AccessModeFunc: &PermsStoreAccessModeFunc{
  1764. defaultHook: func(context.Context, int64, int64, AccessModeOptions) AccessMode {
  1765. panic("unexpected invocation of MockPermsStore.AccessMode")
  1766. },
  1767. },
  1768. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  1769. defaultHook: func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool {
  1770. panic("unexpected invocation of MockPermsStore.Authorize")
  1771. },
  1772. },
  1773. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1774. defaultHook: func(context.Context, int64, map[int64]AccessMode) error {
  1775. panic("unexpected invocation of MockPermsStore.SetRepoPerms")
  1776. },
  1777. },
  1778. }
  1779. }
  1780. // NewMockPermsStoreFrom creates a new mock of the MockPermsStore interface.
  1781. // All methods delegate to the given implementation, unless overwritten.
  1782. func NewMockPermsStoreFrom(i PermsStore) *MockPermsStore {
  1783. return &MockPermsStore{
  1784. AccessModeFunc: &PermsStoreAccessModeFunc{
  1785. defaultHook: i.AccessMode,
  1786. },
  1787. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  1788. defaultHook: i.Authorize,
  1789. },
  1790. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1791. defaultHook: i.SetRepoPerms,
  1792. },
  1793. }
  1794. }
  1795. // PermsStoreAccessModeFunc describes the behavior when the AccessMode
  1796. // method of the parent MockPermsStore instance is invoked.
  1797. type PermsStoreAccessModeFunc struct {
  1798. defaultHook func(context.Context, int64, int64, AccessModeOptions) AccessMode
  1799. hooks []func(context.Context, int64, int64, AccessModeOptions) AccessMode
  1800. history []PermsStoreAccessModeFuncCall
  1801. mutex sync.Mutex
  1802. }
  1803. // AccessMode delegates to the next hook function in the queue and stores
  1804. // the parameter and result values of this invocation.
  1805. func (m *MockPermsStore) AccessMode(v0 context.Context, v1 int64, v2 int64, v3 AccessModeOptions) AccessMode {
  1806. r0 := m.AccessModeFunc.nextHook()(v0, v1, v2, v3)
  1807. m.AccessModeFunc.appendCall(PermsStoreAccessModeFuncCall{v0, v1, v2, v3, r0})
  1808. return r0
  1809. }
  1810. // SetDefaultHook sets function that is called when the AccessMode method of
  1811. // the parent MockPermsStore instance is invoked and the hook queue is
  1812. // empty.
  1813. func (f *PermsStoreAccessModeFunc) SetDefaultHook(hook func(context.Context, int64, int64, AccessModeOptions) AccessMode) {
  1814. f.defaultHook = hook
  1815. }
  1816. // PushHook adds a function to the end of hook queue. Each invocation of the
  1817. // AccessMode method of the parent MockPermsStore instance invokes the hook
  1818. // at the front of the queue and discards it. After the queue is empty, the
  1819. // default hook function is invoked for any future action.
  1820. func (f *PermsStoreAccessModeFunc) PushHook(hook func(context.Context, int64, int64, AccessModeOptions) AccessMode) {
  1821. f.mutex.Lock()
  1822. f.hooks = append(f.hooks, hook)
  1823. f.mutex.Unlock()
  1824. }
  1825. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1826. // given values.
  1827. func (f *PermsStoreAccessModeFunc) SetDefaultReturn(r0 AccessMode) {
  1828. f.SetDefaultHook(func(context.Context, int64, int64, AccessModeOptions) AccessMode {
  1829. return r0
  1830. })
  1831. }
  1832. // PushReturn calls PushHook with a function that returns the given values.
  1833. func (f *PermsStoreAccessModeFunc) PushReturn(r0 AccessMode) {
  1834. f.PushHook(func(context.Context, int64, int64, AccessModeOptions) AccessMode {
  1835. return r0
  1836. })
  1837. }
  1838. func (f *PermsStoreAccessModeFunc) nextHook() func(context.Context, int64, int64, AccessModeOptions) AccessMode {
  1839. f.mutex.Lock()
  1840. defer f.mutex.Unlock()
  1841. if len(f.hooks) == 0 {
  1842. return f.defaultHook
  1843. }
  1844. hook := f.hooks[0]
  1845. f.hooks = f.hooks[1:]
  1846. return hook
  1847. }
  1848. func (f *PermsStoreAccessModeFunc) appendCall(r0 PermsStoreAccessModeFuncCall) {
  1849. f.mutex.Lock()
  1850. f.history = append(f.history, r0)
  1851. f.mutex.Unlock()
  1852. }
  1853. // History returns a sequence of PermsStoreAccessModeFuncCall objects
  1854. // describing the invocations of this function.
  1855. func (f *PermsStoreAccessModeFunc) History() []PermsStoreAccessModeFuncCall {
  1856. f.mutex.Lock()
  1857. history := make([]PermsStoreAccessModeFuncCall, len(f.history))
  1858. copy(history, f.history)
  1859. f.mutex.Unlock()
  1860. return history
  1861. }
  1862. // PermsStoreAccessModeFuncCall is an object that describes an invocation of
  1863. // method AccessMode on an instance of MockPermsStore.
  1864. type PermsStoreAccessModeFuncCall struct {
  1865. // Arg0 is the value of the 1st argument passed to this method
  1866. // invocation.
  1867. Arg0 context.Context
  1868. // Arg1 is the value of the 2nd argument passed to this method
  1869. // invocation.
  1870. Arg1 int64
  1871. // Arg2 is the value of the 3rd argument passed to this method
  1872. // invocation.
  1873. Arg2 int64
  1874. // Arg3 is the value of the 4th argument passed to this method
  1875. // invocation.
  1876. Arg3 AccessModeOptions
  1877. // Result0 is the value of the 1st result returned from this method
  1878. // invocation.
  1879. Result0 AccessMode
  1880. }
  1881. // Args returns an interface slice containing the arguments of this
  1882. // invocation.
  1883. func (c PermsStoreAccessModeFuncCall) Args() []interface{} {
  1884. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1885. }
  1886. // Results returns an interface slice containing the results of this
  1887. // invocation.
  1888. func (c PermsStoreAccessModeFuncCall) Results() []interface{} {
  1889. return []interface{}{c.Result0}
  1890. }
  1891. // PermsStoreAuthorizeFunc describes the behavior when the Authorize method
  1892. // of the parent MockPermsStore instance is invoked.
  1893. type PermsStoreAuthorizeFunc struct {
  1894. defaultHook func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool
  1895. hooks []func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool
  1896. history []PermsStoreAuthorizeFuncCall
  1897. mutex sync.Mutex
  1898. }
  1899. // Authorize delegates to the next hook function in the queue and stores the
  1900. // parameter and result values of this invocation.
  1901. func (m *MockPermsStore) Authorize(v0 context.Context, v1 int64, v2 int64, v3 AccessMode, v4 AccessModeOptions) bool {
  1902. r0 := m.AuthorizeFunc.nextHook()(v0, v1, v2, v3, v4)
  1903. m.AuthorizeFunc.appendCall(PermsStoreAuthorizeFuncCall{v0, v1, v2, v3, v4, r0})
  1904. return r0
  1905. }
  1906. // SetDefaultHook sets function that is called when the Authorize method of
  1907. // the parent MockPermsStore instance is invoked and the hook queue is
  1908. // empty.
  1909. func (f *PermsStoreAuthorizeFunc) SetDefaultHook(hook func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool) {
  1910. f.defaultHook = hook
  1911. }
  1912. // PushHook adds a function to the end of hook queue. Each invocation of the
  1913. // Authorize method of the parent MockPermsStore instance invokes the hook
  1914. // at the front of the queue and discards it. After the queue is empty, the
  1915. // default hook function is invoked for any future action.
  1916. func (f *PermsStoreAuthorizeFunc) PushHook(hook func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool) {
  1917. f.mutex.Lock()
  1918. f.hooks = append(f.hooks, hook)
  1919. f.mutex.Unlock()
  1920. }
  1921. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1922. // given values.
  1923. func (f *PermsStoreAuthorizeFunc) SetDefaultReturn(r0 bool) {
  1924. f.SetDefaultHook(func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool {
  1925. return r0
  1926. })
  1927. }
  1928. // PushReturn calls PushHook with a function that returns the given values.
  1929. func (f *PermsStoreAuthorizeFunc) PushReturn(r0 bool) {
  1930. f.PushHook(func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool {
  1931. return r0
  1932. })
  1933. }
  1934. func (f *PermsStoreAuthorizeFunc) nextHook() func(context.Context, int64, int64, AccessMode, AccessModeOptions) bool {
  1935. f.mutex.Lock()
  1936. defer f.mutex.Unlock()
  1937. if len(f.hooks) == 0 {
  1938. return f.defaultHook
  1939. }
  1940. hook := f.hooks[0]
  1941. f.hooks = f.hooks[1:]
  1942. return hook
  1943. }
  1944. func (f *PermsStoreAuthorizeFunc) appendCall(r0 PermsStoreAuthorizeFuncCall) {
  1945. f.mutex.Lock()
  1946. f.history = append(f.history, r0)
  1947. f.mutex.Unlock()
  1948. }
  1949. // History returns a sequence of PermsStoreAuthorizeFuncCall objects
  1950. // describing the invocations of this function.
  1951. func (f *PermsStoreAuthorizeFunc) History() []PermsStoreAuthorizeFuncCall {
  1952. f.mutex.Lock()
  1953. history := make([]PermsStoreAuthorizeFuncCall, len(f.history))
  1954. copy(history, f.history)
  1955. f.mutex.Unlock()
  1956. return history
  1957. }
  1958. // PermsStoreAuthorizeFuncCall is an object that describes an invocation of
  1959. // method Authorize on an instance of MockPermsStore.
  1960. type PermsStoreAuthorizeFuncCall struct {
  1961. // Arg0 is the value of the 1st argument passed to this method
  1962. // invocation.
  1963. Arg0 context.Context
  1964. // Arg1 is the value of the 2nd argument passed to this method
  1965. // invocation.
  1966. Arg1 int64
  1967. // Arg2 is the value of the 3rd argument passed to this method
  1968. // invocation.
  1969. Arg2 int64
  1970. // Arg3 is the value of the 4th argument passed to this method
  1971. // invocation.
  1972. Arg3 AccessMode
  1973. // Arg4 is the value of the 5th argument passed to this method
  1974. // invocation.
  1975. Arg4 AccessModeOptions
  1976. // Result0 is the value of the 1st result returned from this method
  1977. // invocation.
  1978. Result0 bool
  1979. }
  1980. // Args returns an interface slice containing the arguments of this
  1981. // invocation.
  1982. func (c PermsStoreAuthorizeFuncCall) Args() []interface{} {
  1983. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  1984. }
  1985. // Results returns an interface slice containing the results of this
  1986. // invocation.
  1987. func (c PermsStoreAuthorizeFuncCall) Results() []interface{} {
  1988. return []interface{}{c.Result0}
  1989. }
  1990. // PermsStoreSetRepoPermsFunc describes the behavior when the SetRepoPerms
  1991. // method of the parent MockPermsStore instance is invoked.
  1992. type PermsStoreSetRepoPermsFunc struct {
  1993. defaultHook func(context.Context, int64, map[int64]AccessMode) error
  1994. hooks []func(context.Context, int64, map[int64]AccessMode) error
  1995. history []PermsStoreSetRepoPermsFuncCall
  1996. mutex sync.Mutex
  1997. }
  1998. // SetRepoPerms delegates to the next hook function in the queue and stores
  1999. // the parameter and result values of this invocation.
  2000. func (m *MockPermsStore) SetRepoPerms(v0 context.Context, v1 int64, v2 map[int64]AccessMode) error {
  2001. r0 := m.SetRepoPermsFunc.nextHook()(v0, v1, v2)
  2002. m.SetRepoPermsFunc.appendCall(PermsStoreSetRepoPermsFuncCall{v0, v1, v2, r0})
  2003. return r0
  2004. }
  2005. // SetDefaultHook sets function that is called when the SetRepoPerms method
  2006. // of the parent MockPermsStore instance is invoked and the hook queue is
  2007. // empty.
  2008. func (f *PermsStoreSetRepoPermsFunc) SetDefaultHook(hook func(context.Context, int64, map[int64]AccessMode) error) {
  2009. f.defaultHook = hook
  2010. }
  2011. // PushHook adds a function to the end of hook queue. Each invocation of the
  2012. // SetRepoPerms method of the parent MockPermsStore instance invokes the
  2013. // hook at the front of the queue and discards it. After the queue is empty,
  2014. // the default hook function is invoked for any future action.
  2015. func (f *PermsStoreSetRepoPermsFunc) PushHook(hook func(context.Context, int64, map[int64]AccessMode) error) {
  2016. f.mutex.Lock()
  2017. f.hooks = append(f.hooks, hook)
  2018. f.mutex.Unlock()
  2019. }
  2020. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2021. // given values.
  2022. func (f *PermsStoreSetRepoPermsFunc) SetDefaultReturn(r0 error) {
  2023. f.SetDefaultHook(func(context.Context, int64, map[int64]AccessMode) error {
  2024. return r0
  2025. })
  2026. }
  2027. // PushReturn calls PushHook with a function that returns the given values.
  2028. func (f *PermsStoreSetRepoPermsFunc) PushReturn(r0 error) {
  2029. f.PushHook(func(context.Context, int64, map[int64]AccessMode) error {
  2030. return r0
  2031. })
  2032. }
  2033. func (f *PermsStoreSetRepoPermsFunc) nextHook() func(context.Context, int64, map[int64]AccessMode) error {
  2034. f.mutex.Lock()
  2035. defer f.mutex.Unlock()
  2036. if len(f.hooks) == 0 {
  2037. return f.defaultHook
  2038. }
  2039. hook := f.hooks[0]
  2040. f.hooks = f.hooks[1:]
  2041. return hook
  2042. }
  2043. func (f *PermsStoreSetRepoPermsFunc) appendCall(r0 PermsStoreSetRepoPermsFuncCall) {
  2044. f.mutex.Lock()
  2045. f.history = append(f.history, r0)
  2046. f.mutex.Unlock()
  2047. }
  2048. // History returns a sequence of PermsStoreSetRepoPermsFuncCall objects
  2049. // describing the invocations of this function.
  2050. func (f *PermsStoreSetRepoPermsFunc) History() []PermsStoreSetRepoPermsFuncCall {
  2051. f.mutex.Lock()
  2052. history := make([]PermsStoreSetRepoPermsFuncCall, len(f.history))
  2053. copy(history, f.history)
  2054. f.mutex.Unlock()
  2055. return history
  2056. }
  2057. // PermsStoreSetRepoPermsFuncCall is an object that describes an invocation
  2058. // of method SetRepoPerms on an instance of MockPermsStore.
  2059. type PermsStoreSetRepoPermsFuncCall struct {
  2060. // Arg0 is the value of the 1st argument passed to this method
  2061. // invocation.
  2062. Arg0 context.Context
  2063. // Arg1 is the value of the 2nd argument passed to this method
  2064. // invocation.
  2065. Arg1 int64
  2066. // Arg2 is the value of the 3rd argument passed to this method
  2067. // invocation.
  2068. Arg2 map[int64]AccessMode
  2069. // Result0 is the value of the 1st result returned from this method
  2070. // invocation.
  2071. Result0 error
  2072. }
  2073. // Args returns an interface slice containing the arguments of this
  2074. // invocation.
  2075. func (c PermsStoreSetRepoPermsFuncCall) Args() []interface{} {
  2076. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2077. }
  2078. // Results returns an interface slice containing the results of this
  2079. // invocation.
  2080. func (c PermsStoreSetRepoPermsFuncCall) Results() []interface{} {
  2081. return []interface{}{c.Result0}
  2082. }
  2083. // MockUsersStore is a mock implementation of the UsersStore interface (from
  2084. // the package gogs.io/gogs/internal/db) used for unit testing.
  2085. type MockUsersStore struct {
  2086. // AuthenticateFunc is an instance of a mock function object controlling
  2087. // the behavior of the method Authenticate.
  2088. AuthenticateFunc *UsersStoreAuthenticateFunc
  2089. // CreateFunc is an instance of a mock function object controlling the
  2090. // behavior of the method Create.
  2091. CreateFunc *UsersStoreCreateFunc
  2092. // GetByEmailFunc is an instance of a mock function object controlling
  2093. // the behavior of the method GetByEmail.
  2094. GetByEmailFunc *UsersStoreGetByEmailFunc
  2095. // GetByIDFunc is an instance of a mock function object controlling the
  2096. // behavior of the method GetByID.
  2097. GetByIDFunc *UsersStoreGetByIDFunc
  2098. // GetByUsernameFunc is an instance of a mock function object
  2099. // controlling the behavior of the method GetByUsername.
  2100. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  2101. }
  2102. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  2103. // methods return zero values for all results, unless overwritten.
  2104. func NewMockUsersStore() *MockUsersStore {
  2105. return &MockUsersStore{
  2106. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2107. defaultHook: func(context.Context, string, string, int64) (r0 *User, r1 error) {
  2108. return
  2109. },
  2110. },
  2111. CreateFunc: &UsersStoreCreateFunc{
  2112. defaultHook: func(context.Context, string, string, CreateUserOpts) (r0 *User, r1 error) {
  2113. return
  2114. },
  2115. },
  2116. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2117. defaultHook: func(context.Context, string) (r0 *User, r1 error) {
  2118. return
  2119. },
  2120. },
  2121. GetByIDFunc: &UsersStoreGetByIDFunc{
  2122. defaultHook: func(context.Context, int64) (r0 *User, r1 error) {
  2123. return
  2124. },
  2125. },
  2126. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2127. defaultHook: func(context.Context, string) (r0 *User, r1 error) {
  2128. return
  2129. },
  2130. },
  2131. }
  2132. }
  2133. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  2134. // All methods panic on invocation, unless overwritten.
  2135. func NewStrictMockUsersStore() *MockUsersStore {
  2136. return &MockUsersStore{
  2137. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2138. defaultHook: func(context.Context, string, string, int64) (*User, error) {
  2139. panic("unexpected invocation of MockUsersStore.Authenticate")
  2140. },
  2141. },
  2142. CreateFunc: &UsersStoreCreateFunc{
  2143. defaultHook: func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2144. panic("unexpected invocation of MockUsersStore.Create")
  2145. },
  2146. },
  2147. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2148. defaultHook: func(context.Context, string) (*User, error) {
  2149. panic("unexpected invocation of MockUsersStore.GetByEmail")
  2150. },
  2151. },
  2152. GetByIDFunc: &UsersStoreGetByIDFunc{
  2153. defaultHook: func(context.Context, int64) (*User, error) {
  2154. panic("unexpected invocation of MockUsersStore.GetByID")
  2155. },
  2156. },
  2157. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2158. defaultHook: func(context.Context, string) (*User, error) {
  2159. panic("unexpected invocation of MockUsersStore.GetByUsername")
  2160. },
  2161. },
  2162. }
  2163. }
  2164. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  2165. // All methods delegate to the given implementation, unless overwritten.
  2166. func NewMockUsersStoreFrom(i UsersStore) *MockUsersStore {
  2167. return &MockUsersStore{
  2168. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2169. defaultHook: i.Authenticate,
  2170. },
  2171. CreateFunc: &UsersStoreCreateFunc{
  2172. defaultHook: i.Create,
  2173. },
  2174. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2175. defaultHook: i.GetByEmail,
  2176. },
  2177. GetByIDFunc: &UsersStoreGetByIDFunc{
  2178. defaultHook: i.GetByID,
  2179. },
  2180. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2181. defaultHook: i.GetByUsername,
  2182. },
  2183. }
  2184. }
  2185. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  2186. // method of the parent MockUsersStore instance is invoked.
  2187. type UsersStoreAuthenticateFunc struct {
  2188. defaultHook func(context.Context, string, string, int64) (*User, error)
  2189. hooks []func(context.Context, string, string, int64) (*User, error)
  2190. history []UsersStoreAuthenticateFuncCall
  2191. mutex sync.Mutex
  2192. }
  2193. // Authenticate delegates to the next hook function in the queue and stores
  2194. // the parameter and result values of this invocation.
  2195. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*User, error) {
  2196. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  2197. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  2198. return r0, r1
  2199. }
  2200. // SetDefaultHook sets function that is called when the Authenticate method
  2201. // of the parent MockUsersStore instance is invoked and the hook queue is
  2202. // empty.
  2203. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*User, error)) {
  2204. f.defaultHook = hook
  2205. }
  2206. // PushHook adds a function to the end of hook queue. Each invocation of the
  2207. // Authenticate method of the parent MockUsersStore instance invokes the
  2208. // hook at the front of the queue and discards it. After the queue is empty,
  2209. // the default hook function is invoked for any future action.
  2210. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*User, error)) {
  2211. f.mutex.Lock()
  2212. f.hooks = append(f.hooks, hook)
  2213. f.mutex.Unlock()
  2214. }
  2215. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2216. // given values.
  2217. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *User, r1 error) {
  2218. f.SetDefaultHook(func(context.Context, string, string, int64) (*User, error) {
  2219. return r0, r1
  2220. })
  2221. }
  2222. // PushReturn calls PushHook with a function that returns the given values.
  2223. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *User, r1 error) {
  2224. f.PushHook(func(context.Context, string, string, int64) (*User, error) {
  2225. return r0, r1
  2226. })
  2227. }
  2228. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*User, error) {
  2229. f.mutex.Lock()
  2230. defer f.mutex.Unlock()
  2231. if len(f.hooks) == 0 {
  2232. return f.defaultHook
  2233. }
  2234. hook := f.hooks[0]
  2235. f.hooks = f.hooks[1:]
  2236. return hook
  2237. }
  2238. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  2239. f.mutex.Lock()
  2240. f.history = append(f.history, r0)
  2241. f.mutex.Unlock()
  2242. }
  2243. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  2244. // describing the invocations of this function.
  2245. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  2246. f.mutex.Lock()
  2247. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  2248. copy(history, f.history)
  2249. f.mutex.Unlock()
  2250. return history
  2251. }
  2252. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  2253. // of method Authenticate on an instance of MockUsersStore.
  2254. type UsersStoreAuthenticateFuncCall struct {
  2255. // Arg0 is the value of the 1st argument passed to this method
  2256. // invocation.
  2257. Arg0 context.Context
  2258. // Arg1 is the value of the 2nd argument passed to this method
  2259. // invocation.
  2260. Arg1 string
  2261. // Arg2 is the value of the 3rd argument passed to this method
  2262. // invocation.
  2263. Arg2 string
  2264. // Arg3 is the value of the 4th argument passed to this method
  2265. // invocation.
  2266. Arg3 int64
  2267. // Result0 is the value of the 1st result returned from this method
  2268. // invocation.
  2269. Result0 *User
  2270. // Result1 is the value of the 2nd result returned from this method
  2271. // invocation.
  2272. Result1 error
  2273. }
  2274. // Args returns an interface slice containing the arguments of this
  2275. // invocation.
  2276. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  2277. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2278. }
  2279. // Results returns an interface slice containing the results of this
  2280. // invocation.
  2281. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  2282. return []interface{}{c.Result0, c.Result1}
  2283. }
  2284. // UsersStoreCreateFunc describes the behavior when the Create method of the
  2285. // parent MockUsersStore instance is invoked.
  2286. type UsersStoreCreateFunc struct {
  2287. defaultHook func(context.Context, string, string, CreateUserOpts) (*User, error)
  2288. hooks []func(context.Context, string, string, CreateUserOpts) (*User, error)
  2289. history []UsersStoreCreateFuncCall
  2290. mutex sync.Mutex
  2291. }
  2292. // Create delegates to the next hook function in the queue and stores the
  2293. // parameter and result values of this invocation.
  2294. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 CreateUserOpts) (*User, error) {
  2295. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2296. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  2297. return r0, r1
  2298. }
  2299. // SetDefaultHook sets function that is called when the Create method of the
  2300. // parent MockUsersStore instance is invoked and the hook queue is empty.
  2301. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, CreateUserOpts) (*User, error)) {
  2302. f.defaultHook = hook
  2303. }
  2304. // PushHook adds a function to the end of hook queue. Each invocation of the
  2305. // Create method of the parent MockUsersStore instance invokes the hook at
  2306. // the front of the queue and discards it. After the queue is empty, the
  2307. // default hook function is invoked for any future action.
  2308. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, CreateUserOpts) (*User, error)) {
  2309. f.mutex.Lock()
  2310. f.hooks = append(f.hooks, hook)
  2311. f.mutex.Unlock()
  2312. }
  2313. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2314. // given values.
  2315. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *User, r1 error) {
  2316. f.SetDefaultHook(func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2317. return r0, r1
  2318. })
  2319. }
  2320. // PushReturn calls PushHook with a function that returns the given values.
  2321. func (f *UsersStoreCreateFunc) PushReturn(r0 *User, r1 error) {
  2322. f.PushHook(func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2323. return r0, r1
  2324. })
  2325. }
  2326. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2327. f.mutex.Lock()
  2328. defer f.mutex.Unlock()
  2329. if len(f.hooks) == 0 {
  2330. return f.defaultHook
  2331. }
  2332. hook := f.hooks[0]
  2333. f.hooks = f.hooks[1:]
  2334. return hook
  2335. }
  2336. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  2337. f.mutex.Lock()
  2338. f.history = append(f.history, r0)
  2339. f.mutex.Unlock()
  2340. }
  2341. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  2342. // the invocations of this function.
  2343. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  2344. f.mutex.Lock()
  2345. history := make([]UsersStoreCreateFuncCall, len(f.history))
  2346. copy(history, f.history)
  2347. f.mutex.Unlock()
  2348. return history
  2349. }
  2350. // UsersStoreCreateFuncCall is an object that describes an invocation of
  2351. // method Create on an instance of MockUsersStore.
  2352. type UsersStoreCreateFuncCall struct {
  2353. // Arg0 is the value of the 1st argument passed to this method
  2354. // invocation.
  2355. Arg0 context.Context
  2356. // Arg1 is the value of the 2nd argument passed to this method
  2357. // invocation.
  2358. Arg1 string
  2359. // Arg2 is the value of the 3rd argument passed to this method
  2360. // invocation.
  2361. Arg2 string
  2362. // Arg3 is the value of the 4th argument passed to this method
  2363. // invocation.
  2364. Arg3 CreateUserOpts
  2365. // Result0 is the value of the 1st result returned from this method
  2366. // invocation.
  2367. Result0 *User
  2368. // Result1 is the value of the 2nd result returned from this method
  2369. // invocation.
  2370. Result1 error
  2371. }
  2372. // Args returns an interface slice containing the arguments of this
  2373. // invocation.
  2374. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  2375. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2376. }
  2377. // Results returns an interface slice containing the results of this
  2378. // invocation.
  2379. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  2380. return []interface{}{c.Result0, c.Result1}
  2381. }
  2382. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  2383. // method of the parent MockUsersStore instance is invoked.
  2384. type UsersStoreGetByEmailFunc struct {
  2385. defaultHook func(context.Context, string) (*User, error)
  2386. hooks []func(context.Context, string) (*User, error)
  2387. history []UsersStoreGetByEmailFuncCall
  2388. mutex sync.Mutex
  2389. }
  2390. // GetByEmail delegates to the next hook function in the queue and stores
  2391. // the parameter and result values of this invocation.
  2392. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*User, error) {
  2393. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  2394. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  2395. return r0, r1
  2396. }
  2397. // SetDefaultHook sets function that is called when the GetByEmail method of
  2398. // the parent MockUsersStore instance is invoked and the hook queue is
  2399. // empty.
  2400. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*User, error)) {
  2401. f.defaultHook = hook
  2402. }
  2403. // PushHook adds a function to the end of hook queue. Each invocation of the
  2404. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  2405. // at the front of the queue and discards it. After the queue is empty, the
  2406. // default hook function is invoked for any future action.
  2407. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*User, error)) {
  2408. f.mutex.Lock()
  2409. f.hooks = append(f.hooks, hook)
  2410. f.mutex.Unlock()
  2411. }
  2412. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2413. // given values.
  2414. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *User, r1 error) {
  2415. f.SetDefaultHook(func(context.Context, string) (*User, error) {
  2416. return r0, r1
  2417. })
  2418. }
  2419. // PushReturn calls PushHook with a function that returns the given values.
  2420. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *User, r1 error) {
  2421. f.PushHook(func(context.Context, string) (*User, error) {
  2422. return r0, r1
  2423. })
  2424. }
  2425. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*User, error) {
  2426. f.mutex.Lock()
  2427. defer f.mutex.Unlock()
  2428. if len(f.hooks) == 0 {
  2429. return f.defaultHook
  2430. }
  2431. hook := f.hooks[0]
  2432. f.hooks = f.hooks[1:]
  2433. return hook
  2434. }
  2435. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  2436. f.mutex.Lock()
  2437. f.history = append(f.history, r0)
  2438. f.mutex.Unlock()
  2439. }
  2440. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  2441. // describing the invocations of this function.
  2442. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  2443. f.mutex.Lock()
  2444. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  2445. copy(history, f.history)
  2446. f.mutex.Unlock()
  2447. return history
  2448. }
  2449. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  2450. // method GetByEmail on an instance of MockUsersStore.
  2451. type UsersStoreGetByEmailFuncCall struct {
  2452. // Arg0 is the value of the 1st argument passed to this method
  2453. // invocation.
  2454. Arg0 context.Context
  2455. // Arg1 is the value of the 2nd argument passed to this method
  2456. // invocation.
  2457. Arg1 string
  2458. // Result0 is the value of the 1st result returned from this method
  2459. // invocation.
  2460. Result0 *User
  2461. // Result1 is the value of the 2nd result returned from this method
  2462. // invocation.
  2463. Result1 error
  2464. }
  2465. // Args returns an interface slice containing the arguments of this
  2466. // invocation.
  2467. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  2468. return []interface{}{c.Arg0, c.Arg1}
  2469. }
  2470. // Results returns an interface slice containing the results of this
  2471. // invocation.
  2472. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  2473. return []interface{}{c.Result0, c.Result1}
  2474. }
  2475. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  2476. // the parent MockUsersStore instance is invoked.
  2477. type UsersStoreGetByIDFunc struct {
  2478. defaultHook func(context.Context, int64) (*User, error)
  2479. hooks []func(context.Context, int64) (*User, error)
  2480. history []UsersStoreGetByIDFuncCall
  2481. mutex sync.Mutex
  2482. }
  2483. // GetByID delegates to the next hook function in the queue and stores the
  2484. // parameter and result values of this invocation.
  2485. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*User, error) {
  2486. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  2487. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  2488. return r0, r1
  2489. }
  2490. // SetDefaultHook sets function that is called when the GetByID method of
  2491. // the parent MockUsersStore instance is invoked and the hook queue is
  2492. // empty.
  2493. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*User, error)) {
  2494. f.defaultHook = hook
  2495. }
  2496. // PushHook adds a function to the end of hook queue. Each invocation of the
  2497. // GetByID method of the parent MockUsersStore instance invokes the hook at
  2498. // the front of the queue and discards it. After the queue is empty, the
  2499. // default hook function is invoked for any future action.
  2500. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*User, error)) {
  2501. f.mutex.Lock()
  2502. f.hooks = append(f.hooks, hook)
  2503. f.mutex.Unlock()
  2504. }
  2505. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2506. // given values.
  2507. func (f *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *User, r1 error) {
  2508. f.SetDefaultHook(func(context.Context, int64) (*User, error) {
  2509. return r0, r1
  2510. })
  2511. }
  2512. // PushReturn calls PushHook with a function that returns the given values.
  2513. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *User, r1 error) {
  2514. f.PushHook(func(context.Context, int64) (*User, error) {
  2515. return r0, r1
  2516. })
  2517. }
  2518. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*User, error) {
  2519. f.mutex.Lock()
  2520. defer f.mutex.Unlock()
  2521. if len(f.hooks) == 0 {
  2522. return f.defaultHook
  2523. }
  2524. hook := f.hooks[0]
  2525. f.hooks = f.hooks[1:]
  2526. return hook
  2527. }
  2528. func (f *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  2529. f.mutex.Lock()
  2530. f.history = append(f.history, r0)
  2531. f.mutex.Unlock()
  2532. }
  2533. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  2534. // describing the invocations of this function.
  2535. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  2536. f.mutex.Lock()
  2537. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  2538. copy(history, f.history)
  2539. f.mutex.Unlock()
  2540. return history
  2541. }
  2542. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  2543. // method GetByID on an instance of MockUsersStore.
  2544. type UsersStoreGetByIDFuncCall struct {
  2545. // Arg0 is the value of the 1st argument passed to this method
  2546. // invocation.
  2547. Arg0 context.Context
  2548. // Arg1 is the value of the 2nd argument passed to this method
  2549. // invocation.
  2550. Arg1 int64
  2551. // Result0 is the value of the 1st result returned from this method
  2552. // invocation.
  2553. Result0 *User
  2554. // Result1 is the value of the 2nd result returned from this method
  2555. // invocation.
  2556. Result1 error
  2557. }
  2558. // Args returns an interface slice containing the arguments of this
  2559. // invocation.
  2560. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  2561. return []interface{}{c.Arg0, c.Arg1}
  2562. }
  2563. // Results returns an interface slice containing the results of this
  2564. // invocation.
  2565. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  2566. return []interface{}{c.Result0, c.Result1}
  2567. }
  2568. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  2569. // method of the parent MockUsersStore instance is invoked.
  2570. type UsersStoreGetByUsernameFunc struct {
  2571. defaultHook func(context.Context, string) (*User, error)
  2572. hooks []func(context.Context, string) (*User, error)
  2573. history []UsersStoreGetByUsernameFuncCall
  2574. mutex sync.Mutex
  2575. }
  2576. // GetByUsername delegates to the next hook function in the queue and stores
  2577. // the parameter and result values of this invocation.
  2578. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*User, error) {
  2579. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  2580. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  2581. return r0, r1
  2582. }
  2583. // SetDefaultHook sets function that is called when the GetByUsername method
  2584. // of the parent MockUsersStore instance is invoked and the hook queue is
  2585. // empty.
  2586. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*User, error)) {
  2587. f.defaultHook = hook
  2588. }
  2589. // PushHook adds a function to the end of hook queue. Each invocation of the
  2590. // GetByUsername method of the parent MockUsersStore instance invokes the
  2591. // hook at the front of the queue and discards it. After the queue is empty,
  2592. // the default hook function is invoked for any future action.
  2593. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*User, error)) {
  2594. f.mutex.Lock()
  2595. f.hooks = append(f.hooks, hook)
  2596. f.mutex.Unlock()
  2597. }
  2598. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2599. // given values.
  2600. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *User, r1 error) {
  2601. f.SetDefaultHook(func(context.Context, string) (*User, error) {
  2602. return r0, r1
  2603. })
  2604. }
  2605. // PushReturn calls PushHook with a function that returns the given values.
  2606. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *User, r1 error) {
  2607. f.PushHook(func(context.Context, string) (*User, error) {
  2608. return r0, r1
  2609. })
  2610. }
  2611. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*User, error) {
  2612. f.mutex.Lock()
  2613. defer f.mutex.Unlock()
  2614. if len(f.hooks) == 0 {
  2615. return f.defaultHook
  2616. }
  2617. hook := f.hooks[0]
  2618. f.hooks = f.hooks[1:]
  2619. return hook
  2620. }
  2621. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  2622. f.mutex.Lock()
  2623. f.history = append(f.history, r0)
  2624. f.mutex.Unlock()
  2625. }
  2626. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  2627. // describing the invocations of this function.
  2628. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  2629. f.mutex.Lock()
  2630. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  2631. copy(history, f.history)
  2632. f.mutex.Unlock()
  2633. return history
  2634. }
  2635. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  2636. // of method GetByUsername on an instance of MockUsersStore.
  2637. type UsersStoreGetByUsernameFuncCall struct {
  2638. // Arg0 is the value of the 1st argument passed to this method
  2639. // invocation.
  2640. Arg0 context.Context
  2641. // Arg1 is the value of the 2nd argument passed to this method
  2642. // invocation.
  2643. Arg1 string
  2644. // Result0 is the value of the 1st result returned from this method
  2645. // invocation.
  2646. Result0 *User
  2647. // Result1 is the value of the 2nd result returned from this method
  2648. // invocation.
  2649. Result1 error
  2650. }
  2651. // Args returns an interface slice containing the arguments of this
  2652. // invocation.
  2653. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  2654. return []interface{}{c.Arg0, c.Arg1}
  2655. }
  2656. // Results returns an interface slice containing the results of this
  2657. // invocation.
  2658. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  2659. return []interface{}{c.Result0, c.Result1}
  2660. }
  2661. // MockLoginSourceFileStore is a mock implementation of the
  2662. // loginSourceFileStore interface (from the package
  2663. // gogs.io/gogs/internal/db) used for unit testing.
  2664. type MockLoginSourceFileStore struct {
  2665. // SaveFunc is an instance of a mock function object controlling the
  2666. // behavior of the method Save.
  2667. SaveFunc *LoginSourceFileStoreSaveFunc
  2668. // SetConfigFunc is an instance of a mock function object controlling
  2669. // the behavior of the method SetConfig.
  2670. SetConfigFunc *LoginSourceFileStoreSetConfigFunc
  2671. // SetGeneralFunc is an instance of a mock function object controlling
  2672. // the behavior of the method SetGeneral.
  2673. SetGeneralFunc *LoginSourceFileStoreSetGeneralFunc
  2674. }
  2675. // NewMockLoginSourceFileStore creates a new mock of the
  2676. // loginSourceFileStore interface. All methods return zero values for all
  2677. // results, unless overwritten.
  2678. func NewMockLoginSourceFileStore() *MockLoginSourceFileStore {
  2679. return &MockLoginSourceFileStore{
  2680. SaveFunc: &LoginSourceFileStoreSaveFunc{
  2681. defaultHook: func() (r0 error) {
  2682. return
  2683. },
  2684. },
  2685. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  2686. defaultHook: func(interface{}) (r0 error) {
  2687. return
  2688. },
  2689. },
  2690. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  2691. defaultHook: func(string, string) {
  2692. return
  2693. },
  2694. },
  2695. }
  2696. }
  2697. // NewStrictMockLoginSourceFileStore creates a new mock of the
  2698. // loginSourceFileStore interface. All methods panic on invocation, unless
  2699. // overwritten.
  2700. func NewStrictMockLoginSourceFileStore() *MockLoginSourceFileStore {
  2701. return &MockLoginSourceFileStore{
  2702. SaveFunc: &LoginSourceFileStoreSaveFunc{
  2703. defaultHook: func() error {
  2704. panic("unexpected invocation of MockLoginSourceFileStore.Save")
  2705. },
  2706. },
  2707. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  2708. defaultHook: func(interface{}) error {
  2709. panic("unexpected invocation of MockLoginSourceFileStore.SetConfig")
  2710. },
  2711. },
  2712. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  2713. defaultHook: func(string, string) {
  2714. panic("unexpected invocation of MockLoginSourceFileStore.SetGeneral")
  2715. },
  2716. },
  2717. }
  2718. }
  2719. // surrogateMockLoginSourceFileStore is a copy of the loginSourceFileStore
  2720. // interface (from the package gogs.io/gogs/internal/db). It is redefined
  2721. // here as it is unexported in the source package.
  2722. type surrogateMockLoginSourceFileStore interface {
  2723. Save() error
  2724. SetConfig(interface{}) error
  2725. SetGeneral(string, string)
  2726. }
  2727. // NewMockLoginSourceFileStoreFrom creates a new mock of the
  2728. // MockLoginSourceFileStore interface. All methods delegate to the given
  2729. // implementation, unless overwritten.
  2730. func NewMockLoginSourceFileStoreFrom(i surrogateMockLoginSourceFileStore) *MockLoginSourceFileStore {
  2731. return &MockLoginSourceFileStore{
  2732. SaveFunc: &LoginSourceFileStoreSaveFunc{
  2733. defaultHook: i.Save,
  2734. },
  2735. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  2736. defaultHook: i.SetConfig,
  2737. },
  2738. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  2739. defaultHook: i.SetGeneral,
  2740. },
  2741. }
  2742. }
  2743. // LoginSourceFileStoreSaveFunc describes the behavior when the Save method
  2744. // of the parent MockLoginSourceFileStore instance is invoked.
  2745. type LoginSourceFileStoreSaveFunc struct {
  2746. defaultHook func() error
  2747. hooks []func() error
  2748. history []LoginSourceFileStoreSaveFuncCall
  2749. mutex sync.Mutex
  2750. }
  2751. // Save delegates to the next hook function in the queue and stores the
  2752. // parameter and result values of this invocation.
  2753. func (m *MockLoginSourceFileStore) Save() error {
  2754. r0 := m.SaveFunc.nextHook()()
  2755. m.SaveFunc.appendCall(LoginSourceFileStoreSaveFuncCall{r0})
  2756. return r0
  2757. }
  2758. // SetDefaultHook sets function that is called when the Save method of the
  2759. // parent MockLoginSourceFileStore instance is invoked and the hook queue is
  2760. // empty.
  2761. func (f *LoginSourceFileStoreSaveFunc) SetDefaultHook(hook func() error) {
  2762. f.defaultHook = hook
  2763. }
  2764. // PushHook adds a function to the end of hook queue. Each invocation of the
  2765. // Save method of the parent MockLoginSourceFileStore instance invokes the
  2766. // hook at the front of the queue and discards it. After the queue is empty,
  2767. // the default hook function is invoked for any future action.
  2768. func (f *LoginSourceFileStoreSaveFunc) PushHook(hook func() error) {
  2769. f.mutex.Lock()
  2770. f.hooks = append(f.hooks, hook)
  2771. f.mutex.Unlock()
  2772. }
  2773. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2774. // given values.
  2775. func (f *LoginSourceFileStoreSaveFunc) SetDefaultReturn(r0 error) {
  2776. f.SetDefaultHook(func() error {
  2777. return r0
  2778. })
  2779. }
  2780. // PushReturn calls PushHook with a function that returns the given values.
  2781. func (f *LoginSourceFileStoreSaveFunc) PushReturn(r0 error) {
  2782. f.PushHook(func() error {
  2783. return r0
  2784. })
  2785. }
  2786. func (f *LoginSourceFileStoreSaveFunc) nextHook() func() error {
  2787. f.mutex.Lock()
  2788. defer f.mutex.Unlock()
  2789. if len(f.hooks) == 0 {
  2790. return f.defaultHook
  2791. }
  2792. hook := f.hooks[0]
  2793. f.hooks = f.hooks[1:]
  2794. return hook
  2795. }
  2796. func (f *LoginSourceFileStoreSaveFunc) appendCall(r0 LoginSourceFileStoreSaveFuncCall) {
  2797. f.mutex.Lock()
  2798. f.history = append(f.history, r0)
  2799. f.mutex.Unlock()
  2800. }
  2801. // History returns a sequence of LoginSourceFileStoreSaveFuncCall objects
  2802. // describing the invocations of this function.
  2803. func (f *LoginSourceFileStoreSaveFunc) History() []LoginSourceFileStoreSaveFuncCall {
  2804. f.mutex.Lock()
  2805. history := make([]LoginSourceFileStoreSaveFuncCall, len(f.history))
  2806. copy(history, f.history)
  2807. f.mutex.Unlock()
  2808. return history
  2809. }
  2810. // LoginSourceFileStoreSaveFuncCall is an object that describes an
  2811. // invocation of method Save on an instance of MockLoginSourceFileStore.
  2812. type LoginSourceFileStoreSaveFuncCall struct {
  2813. // Result0 is the value of the 1st result returned from this method
  2814. // invocation.
  2815. Result0 error
  2816. }
  2817. // Args returns an interface slice containing the arguments of this
  2818. // invocation.
  2819. func (c LoginSourceFileStoreSaveFuncCall) Args() []interface{} {
  2820. return []interface{}{}
  2821. }
  2822. // Results returns an interface slice containing the results of this
  2823. // invocation.
  2824. func (c LoginSourceFileStoreSaveFuncCall) Results() []interface{} {
  2825. return []interface{}{c.Result0}
  2826. }
  2827. // LoginSourceFileStoreSetConfigFunc describes the behavior when the
  2828. // SetConfig method of the parent MockLoginSourceFileStore instance is
  2829. // invoked.
  2830. type LoginSourceFileStoreSetConfigFunc struct {
  2831. defaultHook func(interface{}) error
  2832. hooks []func(interface{}) error
  2833. history []LoginSourceFileStoreSetConfigFuncCall
  2834. mutex sync.Mutex
  2835. }
  2836. // SetConfig delegates to the next hook function in the queue and stores the
  2837. // parameter and result values of this invocation.
  2838. func (m *MockLoginSourceFileStore) SetConfig(v0 interface{}) error {
  2839. r0 := m.SetConfigFunc.nextHook()(v0)
  2840. m.SetConfigFunc.appendCall(LoginSourceFileStoreSetConfigFuncCall{v0, r0})
  2841. return r0
  2842. }
  2843. // SetDefaultHook sets function that is called when the SetConfig method of
  2844. // the parent MockLoginSourceFileStore instance is invoked and the hook
  2845. // queue is empty.
  2846. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultHook(hook func(interface{}) error) {
  2847. f.defaultHook = hook
  2848. }
  2849. // PushHook adds a function to the end of hook queue. Each invocation of the
  2850. // SetConfig method of the parent MockLoginSourceFileStore instance invokes
  2851. // the hook at the front of the queue and discards it. After the queue is
  2852. // empty, the default hook function is invoked for any future action.
  2853. func (f *LoginSourceFileStoreSetConfigFunc) PushHook(hook func(interface{}) error) {
  2854. f.mutex.Lock()
  2855. f.hooks = append(f.hooks, hook)
  2856. f.mutex.Unlock()
  2857. }
  2858. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2859. // given values.
  2860. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultReturn(r0 error) {
  2861. f.SetDefaultHook(func(interface{}) error {
  2862. return r0
  2863. })
  2864. }
  2865. // PushReturn calls PushHook with a function that returns the given values.
  2866. func (f *LoginSourceFileStoreSetConfigFunc) PushReturn(r0 error) {
  2867. f.PushHook(func(interface{}) error {
  2868. return r0
  2869. })
  2870. }
  2871. func (f *LoginSourceFileStoreSetConfigFunc) nextHook() func(interface{}) error {
  2872. f.mutex.Lock()
  2873. defer f.mutex.Unlock()
  2874. if len(f.hooks) == 0 {
  2875. return f.defaultHook
  2876. }
  2877. hook := f.hooks[0]
  2878. f.hooks = f.hooks[1:]
  2879. return hook
  2880. }
  2881. func (f *LoginSourceFileStoreSetConfigFunc) appendCall(r0 LoginSourceFileStoreSetConfigFuncCall) {
  2882. f.mutex.Lock()
  2883. f.history = append(f.history, r0)
  2884. f.mutex.Unlock()
  2885. }
  2886. // History returns a sequence of LoginSourceFileStoreSetConfigFuncCall
  2887. // objects describing the invocations of this function.
  2888. func (f *LoginSourceFileStoreSetConfigFunc) History() []LoginSourceFileStoreSetConfigFuncCall {
  2889. f.mutex.Lock()
  2890. history := make([]LoginSourceFileStoreSetConfigFuncCall, len(f.history))
  2891. copy(history, f.history)
  2892. f.mutex.Unlock()
  2893. return history
  2894. }
  2895. // LoginSourceFileStoreSetConfigFuncCall is an object that describes an
  2896. // invocation of method SetConfig on an instance of
  2897. // MockLoginSourceFileStore.
  2898. type LoginSourceFileStoreSetConfigFuncCall struct {
  2899. // Arg0 is the value of the 1st argument passed to this method
  2900. // invocation.
  2901. Arg0 interface{}
  2902. // Result0 is the value of the 1st result returned from this method
  2903. // invocation.
  2904. Result0 error
  2905. }
  2906. // Args returns an interface slice containing the arguments of this
  2907. // invocation.
  2908. func (c LoginSourceFileStoreSetConfigFuncCall) Args() []interface{} {
  2909. return []interface{}{c.Arg0}
  2910. }
  2911. // Results returns an interface slice containing the results of this
  2912. // invocation.
  2913. func (c LoginSourceFileStoreSetConfigFuncCall) Results() []interface{} {
  2914. return []interface{}{c.Result0}
  2915. }
  2916. // LoginSourceFileStoreSetGeneralFunc describes the behavior when the
  2917. // SetGeneral method of the parent MockLoginSourceFileStore instance is
  2918. // invoked.
  2919. type LoginSourceFileStoreSetGeneralFunc struct {
  2920. defaultHook func(string, string)
  2921. hooks []func(string, string)
  2922. history []LoginSourceFileStoreSetGeneralFuncCall
  2923. mutex sync.Mutex
  2924. }
  2925. // SetGeneral delegates to the next hook function in the queue and stores
  2926. // the parameter and result values of this invocation.
  2927. func (m *MockLoginSourceFileStore) SetGeneral(v0 string, v1 string) {
  2928. m.SetGeneralFunc.nextHook()(v0, v1)
  2929. m.SetGeneralFunc.appendCall(LoginSourceFileStoreSetGeneralFuncCall{v0, v1})
  2930. return
  2931. }
  2932. // SetDefaultHook sets function that is called when the SetGeneral method of
  2933. // the parent MockLoginSourceFileStore instance is invoked and the hook
  2934. // queue is empty.
  2935. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultHook(hook func(string, string)) {
  2936. f.defaultHook = hook
  2937. }
  2938. // PushHook adds a function to the end of hook queue. Each invocation of the
  2939. // SetGeneral method of the parent MockLoginSourceFileStore instance invokes
  2940. // the hook at the front of the queue and discards it. After the queue is
  2941. // empty, the default hook function is invoked for any future action.
  2942. func (f *LoginSourceFileStoreSetGeneralFunc) PushHook(hook func(string, string)) {
  2943. f.mutex.Lock()
  2944. f.hooks = append(f.hooks, hook)
  2945. f.mutex.Unlock()
  2946. }
  2947. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2948. // given values.
  2949. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultReturn() {
  2950. f.SetDefaultHook(func(string, string) {
  2951. return
  2952. })
  2953. }
  2954. // PushReturn calls PushHook with a function that returns the given values.
  2955. func (f *LoginSourceFileStoreSetGeneralFunc) PushReturn() {
  2956. f.PushHook(func(string, string) {
  2957. return
  2958. })
  2959. }
  2960. func (f *LoginSourceFileStoreSetGeneralFunc) nextHook() func(string, string) {
  2961. f.mutex.Lock()
  2962. defer f.mutex.Unlock()
  2963. if len(f.hooks) == 0 {
  2964. return f.defaultHook
  2965. }
  2966. hook := f.hooks[0]
  2967. f.hooks = f.hooks[1:]
  2968. return hook
  2969. }
  2970. func (f *LoginSourceFileStoreSetGeneralFunc) appendCall(r0 LoginSourceFileStoreSetGeneralFuncCall) {
  2971. f.mutex.Lock()
  2972. f.history = append(f.history, r0)
  2973. f.mutex.Unlock()
  2974. }
  2975. // History returns a sequence of LoginSourceFileStoreSetGeneralFuncCall
  2976. // objects describing the invocations of this function.
  2977. func (f *LoginSourceFileStoreSetGeneralFunc) History() []LoginSourceFileStoreSetGeneralFuncCall {
  2978. f.mutex.Lock()
  2979. history := make([]LoginSourceFileStoreSetGeneralFuncCall, len(f.history))
  2980. copy(history, f.history)
  2981. f.mutex.Unlock()
  2982. return history
  2983. }
  2984. // LoginSourceFileStoreSetGeneralFuncCall is an object that describes an
  2985. // invocation of method SetGeneral on an instance of
  2986. // MockLoginSourceFileStore.
  2987. type LoginSourceFileStoreSetGeneralFuncCall struct {
  2988. // Arg0 is the value of the 1st argument passed to this method
  2989. // invocation.
  2990. Arg0 string
  2991. // Arg1 is the value of the 2nd argument passed to this method
  2992. // invocation.
  2993. Arg1 string
  2994. }
  2995. // Args returns an interface slice containing the arguments of this
  2996. // invocation.
  2997. func (c LoginSourceFileStoreSetGeneralFuncCall) Args() []interface{} {
  2998. return []interface{}{c.Arg0, c.Arg1}
  2999. }
  3000. // Results returns an interface slice containing the results of this
  3001. // invocation.
  3002. func (c LoginSourceFileStoreSetGeneralFuncCall) Results() []interface{} {
  3003. return []interface{}{}
  3004. }
  3005. // MockLoginSourceFilesStore is a mock implementation of the
  3006. // loginSourceFilesStore interface (from the package
  3007. // gogs.io/gogs/internal/db) used for unit testing.
  3008. type MockLoginSourceFilesStore struct {
  3009. // GetByIDFunc is an instance of a mock function object controlling the
  3010. // behavior of the method GetByID.
  3011. GetByIDFunc *LoginSourceFilesStoreGetByIDFunc
  3012. // LenFunc is an instance of a mock function object controlling the
  3013. // behavior of the method Len.
  3014. LenFunc *LoginSourceFilesStoreLenFunc
  3015. // ListFunc is an instance of a mock function object controlling the
  3016. // behavior of the method List.
  3017. ListFunc *LoginSourceFilesStoreListFunc
  3018. // UpdateFunc is an instance of a mock function object controlling the
  3019. // behavior of the method Update.
  3020. UpdateFunc *LoginSourceFilesStoreUpdateFunc
  3021. }
  3022. // NewMockLoginSourceFilesStore creates a new mock of the
  3023. // loginSourceFilesStore interface. All methods return zero values for all
  3024. // results, unless overwritten.
  3025. func NewMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  3026. return &MockLoginSourceFilesStore{
  3027. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  3028. defaultHook: func(int64) (r0 *LoginSource, r1 error) {
  3029. return
  3030. },
  3031. },
  3032. LenFunc: &LoginSourceFilesStoreLenFunc{
  3033. defaultHook: func() (r0 int) {
  3034. return
  3035. },
  3036. },
  3037. ListFunc: &LoginSourceFilesStoreListFunc{
  3038. defaultHook: func(ListLoginSourceOpts) (r0 []*LoginSource) {
  3039. return
  3040. },
  3041. },
  3042. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  3043. defaultHook: func(*LoginSource) {
  3044. return
  3045. },
  3046. },
  3047. }
  3048. }
  3049. // NewStrictMockLoginSourceFilesStore creates a new mock of the
  3050. // loginSourceFilesStore interface. All methods panic on invocation, unless
  3051. // overwritten.
  3052. func NewStrictMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  3053. return &MockLoginSourceFilesStore{
  3054. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  3055. defaultHook: func(int64) (*LoginSource, error) {
  3056. panic("unexpected invocation of MockLoginSourceFilesStore.GetByID")
  3057. },
  3058. },
  3059. LenFunc: &LoginSourceFilesStoreLenFunc{
  3060. defaultHook: func() int {
  3061. panic("unexpected invocation of MockLoginSourceFilesStore.Len")
  3062. },
  3063. },
  3064. ListFunc: &LoginSourceFilesStoreListFunc{
  3065. defaultHook: func(ListLoginSourceOpts) []*LoginSource {
  3066. panic("unexpected invocation of MockLoginSourceFilesStore.List")
  3067. },
  3068. },
  3069. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  3070. defaultHook: func(*LoginSource) {
  3071. panic("unexpected invocation of MockLoginSourceFilesStore.Update")
  3072. },
  3073. },
  3074. }
  3075. }
  3076. // surrogateMockLoginSourceFilesStore is a copy of the loginSourceFilesStore
  3077. // interface (from the package gogs.io/gogs/internal/db). It is redefined
  3078. // here as it is unexported in the source package.
  3079. type surrogateMockLoginSourceFilesStore interface {
  3080. GetByID(int64) (*LoginSource, error)
  3081. Len() int
  3082. List(ListLoginSourceOpts) []*LoginSource
  3083. Update(*LoginSource)
  3084. }
  3085. // NewMockLoginSourceFilesStoreFrom creates a new mock of the
  3086. // MockLoginSourceFilesStore interface. All methods delegate to the given
  3087. // implementation, unless overwritten.
  3088. func NewMockLoginSourceFilesStoreFrom(i surrogateMockLoginSourceFilesStore) *MockLoginSourceFilesStore {
  3089. return &MockLoginSourceFilesStore{
  3090. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  3091. defaultHook: i.GetByID,
  3092. },
  3093. LenFunc: &LoginSourceFilesStoreLenFunc{
  3094. defaultHook: i.Len,
  3095. },
  3096. ListFunc: &LoginSourceFilesStoreListFunc{
  3097. defaultHook: i.List,
  3098. },
  3099. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  3100. defaultHook: i.Update,
  3101. },
  3102. }
  3103. }
  3104. // LoginSourceFilesStoreGetByIDFunc describes the behavior when the GetByID
  3105. // method of the parent MockLoginSourceFilesStore instance is invoked.
  3106. type LoginSourceFilesStoreGetByIDFunc struct {
  3107. defaultHook func(int64) (*LoginSource, error)
  3108. hooks []func(int64) (*LoginSource, error)
  3109. history []LoginSourceFilesStoreGetByIDFuncCall
  3110. mutex sync.Mutex
  3111. }
  3112. // GetByID delegates to the next hook function in the queue and stores the
  3113. // parameter and result values of this invocation.
  3114. func (m *MockLoginSourceFilesStore) GetByID(v0 int64) (*LoginSource, error) {
  3115. r0, r1 := m.GetByIDFunc.nextHook()(v0)
  3116. m.GetByIDFunc.appendCall(LoginSourceFilesStoreGetByIDFuncCall{v0, r0, r1})
  3117. return r0, r1
  3118. }
  3119. // SetDefaultHook sets function that is called when the GetByID method of
  3120. // the parent MockLoginSourceFilesStore instance is invoked and the hook
  3121. // queue is empty.
  3122. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultHook(hook func(int64) (*LoginSource, error)) {
  3123. f.defaultHook = hook
  3124. }
  3125. // PushHook adds a function to the end of hook queue. Each invocation of the
  3126. // GetByID method of the parent MockLoginSourceFilesStore instance invokes
  3127. // the hook at the front of the queue and discards it. After the queue is
  3128. // empty, the default hook function is invoked for any future action.
  3129. func (f *LoginSourceFilesStoreGetByIDFunc) PushHook(hook func(int64) (*LoginSource, error)) {
  3130. f.mutex.Lock()
  3131. f.hooks = append(f.hooks, hook)
  3132. f.mutex.Unlock()
  3133. }
  3134. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3135. // given values.
  3136. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  3137. f.SetDefaultHook(func(int64) (*LoginSource, error) {
  3138. return r0, r1
  3139. })
  3140. }
  3141. // PushReturn calls PushHook with a function that returns the given values.
  3142. func (f *LoginSourceFilesStoreGetByIDFunc) PushReturn(r0 *LoginSource, r1 error) {
  3143. f.PushHook(func(int64) (*LoginSource, error) {
  3144. return r0, r1
  3145. })
  3146. }
  3147. func (f *LoginSourceFilesStoreGetByIDFunc) nextHook() func(int64) (*LoginSource, error) {
  3148. f.mutex.Lock()
  3149. defer f.mutex.Unlock()
  3150. if len(f.hooks) == 0 {
  3151. return f.defaultHook
  3152. }
  3153. hook := f.hooks[0]
  3154. f.hooks = f.hooks[1:]
  3155. return hook
  3156. }
  3157. func (f *LoginSourceFilesStoreGetByIDFunc) appendCall(r0 LoginSourceFilesStoreGetByIDFuncCall) {
  3158. f.mutex.Lock()
  3159. f.history = append(f.history, r0)
  3160. f.mutex.Unlock()
  3161. }
  3162. // History returns a sequence of LoginSourceFilesStoreGetByIDFuncCall
  3163. // objects describing the invocations of this function.
  3164. func (f *LoginSourceFilesStoreGetByIDFunc) History() []LoginSourceFilesStoreGetByIDFuncCall {
  3165. f.mutex.Lock()
  3166. history := make([]LoginSourceFilesStoreGetByIDFuncCall, len(f.history))
  3167. copy(history, f.history)
  3168. f.mutex.Unlock()
  3169. return history
  3170. }
  3171. // LoginSourceFilesStoreGetByIDFuncCall is an object that describes an
  3172. // invocation of method GetByID on an instance of MockLoginSourceFilesStore.
  3173. type LoginSourceFilesStoreGetByIDFuncCall struct {
  3174. // Arg0 is the value of the 1st argument passed to this method
  3175. // invocation.
  3176. Arg0 int64
  3177. // Result0 is the value of the 1st result returned from this method
  3178. // invocation.
  3179. Result0 *LoginSource
  3180. // Result1 is the value of the 2nd result returned from this method
  3181. // invocation.
  3182. Result1 error
  3183. }
  3184. // Args returns an interface slice containing the arguments of this
  3185. // invocation.
  3186. func (c LoginSourceFilesStoreGetByIDFuncCall) Args() []interface{} {
  3187. return []interface{}{c.Arg0}
  3188. }
  3189. // Results returns an interface slice containing the results of this
  3190. // invocation.
  3191. func (c LoginSourceFilesStoreGetByIDFuncCall) Results() []interface{} {
  3192. return []interface{}{c.Result0, c.Result1}
  3193. }
  3194. // LoginSourceFilesStoreLenFunc describes the behavior when the Len method
  3195. // of the parent MockLoginSourceFilesStore instance is invoked.
  3196. type LoginSourceFilesStoreLenFunc struct {
  3197. defaultHook func() int
  3198. hooks []func() int
  3199. history []LoginSourceFilesStoreLenFuncCall
  3200. mutex sync.Mutex
  3201. }
  3202. // Len delegates to the next hook function in the queue and stores the
  3203. // parameter and result values of this invocation.
  3204. func (m *MockLoginSourceFilesStore) Len() int {
  3205. r0 := m.LenFunc.nextHook()()
  3206. m.LenFunc.appendCall(LoginSourceFilesStoreLenFuncCall{r0})
  3207. return r0
  3208. }
  3209. // SetDefaultHook sets function that is called when the Len method of the
  3210. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  3211. // is empty.
  3212. func (f *LoginSourceFilesStoreLenFunc) SetDefaultHook(hook func() int) {
  3213. f.defaultHook = hook
  3214. }
  3215. // PushHook adds a function to the end of hook queue. Each invocation of the
  3216. // Len method of the parent MockLoginSourceFilesStore instance invokes the
  3217. // hook at the front of the queue and discards it. After the queue is empty,
  3218. // the default hook function is invoked for any future action.
  3219. func (f *LoginSourceFilesStoreLenFunc) PushHook(hook func() int) {
  3220. f.mutex.Lock()
  3221. f.hooks = append(f.hooks, hook)
  3222. f.mutex.Unlock()
  3223. }
  3224. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3225. // given values.
  3226. func (f *LoginSourceFilesStoreLenFunc) SetDefaultReturn(r0 int) {
  3227. f.SetDefaultHook(func() int {
  3228. return r0
  3229. })
  3230. }
  3231. // PushReturn calls PushHook with a function that returns the given values.
  3232. func (f *LoginSourceFilesStoreLenFunc) PushReturn(r0 int) {
  3233. f.PushHook(func() int {
  3234. return r0
  3235. })
  3236. }
  3237. func (f *LoginSourceFilesStoreLenFunc) nextHook() func() int {
  3238. f.mutex.Lock()
  3239. defer f.mutex.Unlock()
  3240. if len(f.hooks) == 0 {
  3241. return f.defaultHook
  3242. }
  3243. hook := f.hooks[0]
  3244. f.hooks = f.hooks[1:]
  3245. return hook
  3246. }
  3247. func (f *LoginSourceFilesStoreLenFunc) appendCall(r0 LoginSourceFilesStoreLenFuncCall) {
  3248. f.mutex.Lock()
  3249. f.history = append(f.history, r0)
  3250. f.mutex.Unlock()
  3251. }
  3252. // History returns a sequence of LoginSourceFilesStoreLenFuncCall objects
  3253. // describing the invocations of this function.
  3254. func (f *LoginSourceFilesStoreLenFunc) History() []LoginSourceFilesStoreLenFuncCall {
  3255. f.mutex.Lock()
  3256. history := make([]LoginSourceFilesStoreLenFuncCall, len(f.history))
  3257. copy(history, f.history)
  3258. f.mutex.Unlock()
  3259. return history
  3260. }
  3261. // LoginSourceFilesStoreLenFuncCall is an object that describes an
  3262. // invocation of method Len on an instance of MockLoginSourceFilesStore.
  3263. type LoginSourceFilesStoreLenFuncCall struct {
  3264. // Result0 is the value of the 1st result returned from this method
  3265. // invocation.
  3266. Result0 int
  3267. }
  3268. // Args returns an interface slice containing the arguments of this
  3269. // invocation.
  3270. func (c LoginSourceFilesStoreLenFuncCall) Args() []interface{} {
  3271. return []interface{}{}
  3272. }
  3273. // Results returns an interface slice containing the results of this
  3274. // invocation.
  3275. func (c LoginSourceFilesStoreLenFuncCall) Results() []interface{} {
  3276. return []interface{}{c.Result0}
  3277. }
  3278. // LoginSourceFilesStoreListFunc describes the behavior when the List method
  3279. // of the parent MockLoginSourceFilesStore instance is invoked.
  3280. type LoginSourceFilesStoreListFunc struct {
  3281. defaultHook func(ListLoginSourceOpts) []*LoginSource
  3282. hooks []func(ListLoginSourceOpts) []*LoginSource
  3283. history []LoginSourceFilesStoreListFuncCall
  3284. mutex sync.Mutex
  3285. }
  3286. // List delegates to the next hook function in the queue and stores the
  3287. // parameter and result values of this invocation.
  3288. func (m *MockLoginSourceFilesStore) List(v0 ListLoginSourceOpts) []*LoginSource {
  3289. r0 := m.ListFunc.nextHook()(v0)
  3290. m.ListFunc.appendCall(LoginSourceFilesStoreListFuncCall{v0, r0})
  3291. return r0
  3292. }
  3293. // SetDefaultHook sets function that is called when the List method of the
  3294. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  3295. // is empty.
  3296. func (f *LoginSourceFilesStoreListFunc) SetDefaultHook(hook func(ListLoginSourceOpts) []*LoginSource) {
  3297. f.defaultHook = hook
  3298. }
  3299. // PushHook adds a function to the end of hook queue. Each invocation of the
  3300. // List method of the parent MockLoginSourceFilesStore instance invokes the
  3301. // hook at the front of the queue and discards it. After the queue is empty,
  3302. // the default hook function is invoked for any future action.
  3303. func (f *LoginSourceFilesStoreListFunc) PushHook(hook func(ListLoginSourceOpts) []*LoginSource) {
  3304. f.mutex.Lock()
  3305. f.hooks = append(f.hooks, hook)
  3306. f.mutex.Unlock()
  3307. }
  3308. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3309. // given values.
  3310. func (f *LoginSourceFilesStoreListFunc) SetDefaultReturn(r0 []*LoginSource) {
  3311. f.SetDefaultHook(func(ListLoginSourceOpts) []*LoginSource {
  3312. return r0
  3313. })
  3314. }
  3315. // PushReturn calls PushHook with a function that returns the given values.
  3316. func (f *LoginSourceFilesStoreListFunc) PushReturn(r0 []*LoginSource) {
  3317. f.PushHook(func(ListLoginSourceOpts) []*LoginSource {
  3318. return r0
  3319. })
  3320. }
  3321. func (f *LoginSourceFilesStoreListFunc) nextHook() func(ListLoginSourceOpts) []*LoginSource {
  3322. f.mutex.Lock()
  3323. defer f.mutex.Unlock()
  3324. if len(f.hooks) == 0 {
  3325. return f.defaultHook
  3326. }
  3327. hook := f.hooks[0]
  3328. f.hooks = f.hooks[1:]
  3329. return hook
  3330. }
  3331. func (f *LoginSourceFilesStoreListFunc) appendCall(r0 LoginSourceFilesStoreListFuncCall) {
  3332. f.mutex.Lock()
  3333. f.history = append(f.history, r0)
  3334. f.mutex.Unlock()
  3335. }
  3336. // History returns a sequence of LoginSourceFilesStoreListFuncCall objects
  3337. // describing the invocations of this function.
  3338. func (f *LoginSourceFilesStoreListFunc) History() []LoginSourceFilesStoreListFuncCall {
  3339. f.mutex.Lock()
  3340. history := make([]LoginSourceFilesStoreListFuncCall, len(f.history))
  3341. copy(history, f.history)
  3342. f.mutex.Unlock()
  3343. return history
  3344. }
  3345. // LoginSourceFilesStoreListFuncCall is an object that describes an
  3346. // invocation of method List on an instance of MockLoginSourceFilesStore.
  3347. type LoginSourceFilesStoreListFuncCall struct {
  3348. // Arg0 is the value of the 1st argument passed to this method
  3349. // invocation.
  3350. Arg0 ListLoginSourceOpts
  3351. // Result0 is the value of the 1st result returned from this method
  3352. // invocation.
  3353. Result0 []*LoginSource
  3354. }
  3355. // Args returns an interface slice containing the arguments of this
  3356. // invocation.
  3357. func (c LoginSourceFilesStoreListFuncCall) Args() []interface{} {
  3358. return []interface{}{c.Arg0}
  3359. }
  3360. // Results returns an interface slice containing the results of this
  3361. // invocation.
  3362. func (c LoginSourceFilesStoreListFuncCall) Results() []interface{} {
  3363. return []interface{}{c.Result0}
  3364. }
  3365. // LoginSourceFilesStoreUpdateFunc describes the behavior when the Update
  3366. // method of the parent MockLoginSourceFilesStore instance is invoked.
  3367. type LoginSourceFilesStoreUpdateFunc struct {
  3368. defaultHook func(*LoginSource)
  3369. hooks []func(*LoginSource)
  3370. history []LoginSourceFilesStoreUpdateFuncCall
  3371. mutex sync.Mutex
  3372. }
  3373. // Update delegates to the next hook function in the queue and stores the
  3374. // parameter and result values of this invocation.
  3375. func (m *MockLoginSourceFilesStore) Update(v0 *LoginSource) {
  3376. m.UpdateFunc.nextHook()(v0)
  3377. m.UpdateFunc.appendCall(LoginSourceFilesStoreUpdateFuncCall{v0})
  3378. return
  3379. }
  3380. // SetDefaultHook sets function that is called when the Update method of the
  3381. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  3382. // is empty.
  3383. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultHook(hook func(*LoginSource)) {
  3384. f.defaultHook = hook
  3385. }
  3386. // PushHook adds a function to the end of hook queue. Each invocation of the
  3387. // Update method of the parent MockLoginSourceFilesStore instance invokes
  3388. // the hook at the front of the queue and discards it. After the queue is
  3389. // empty, the default hook function is invoked for any future action.
  3390. func (f *LoginSourceFilesStoreUpdateFunc) PushHook(hook func(*LoginSource)) {
  3391. f.mutex.Lock()
  3392. f.hooks = append(f.hooks, hook)
  3393. f.mutex.Unlock()
  3394. }
  3395. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3396. // given values.
  3397. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultReturn() {
  3398. f.SetDefaultHook(func(*LoginSource) {
  3399. return
  3400. })
  3401. }
  3402. // PushReturn calls PushHook with a function that returns the given values.
  3403. func (f *LoginSourceFilesStoreUpdateFunc) PushReturn() {
  3404. f.PushHook(func(*LoginSource) {
  3405. return
  3406. })
  3407. }
  3408. func (f *LoginSourceFilesStoreUpdateFunc) nextHook() func(*LoginSource) {
  3409. f.mutex.Lock()
  3410. defer f.mutex.Unlock()
  3411. if len(f.hooks) == 0 {
  3412. return f.defaultHook
  3413. }
  3414. hook := f.hooks[0]
  3415. f.hooks = f.hooks[1:]
  3416. return hook
  3417. }
  3418. func (f *LoginSourceFilesStoreUpdateFunc) appendCall(r0 LoginSourceFilesStoreUpdateFuncCall) {
  3419. f.mutex.Lock()
  3420. f.history = append(f.history, r0)
  3421. f.mutex.Unlock()
  3422. }
  3423. // History returns a sequence of LoginSourceFilesStoreUpdateFuncCall objects
  3424. // describing the invocations of this function.
  3425. func (f *LoginSourceFilesStoreUpdateFunc) History() []LoginSourceFilesStoreUpdateFuncCall {
  3426. f.mutex.Lock()
  3427. history := make([]LoginSourceFilesStoreUpdateFuncCall, len(f.history))
  3428. copy(history, f.history)
  3429. f.mutex.Unlock()
  3430. return history
  3431. }
  3432. // LoginSourceFilesStoreUpdateFuncCall is an object that describes an
  3433. // invocation of method Update on an instance of MockLoginSourceFilesStore.
  3434. type LoginSourceFilesStoreUpdateFuncCall struct {
  3435. // Arg0 is the value of the 1st argument passed to this method
  3436. // invocation.
  3437. Arg0 *LoginSource
  3438. }
  3439. // Args returns an interface slice containing the arguments of this
  3440. // invocation.
  3441. func (c LoginSourceFilesStoreUpdateFuncCall) Args() []interface{} {
  3442. return []interface{}{c.Arg0}
  3443. }
  3444. // Results returns an interface slice containing the results of this
  3445. // invocation.
  3446. func (c LoginSourceFilesStoreUpdateFuncCall) Results() []interface{} {
  3447. return []interface{}{}
  3448. }