mocks.go 145 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334
  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. // MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
  2084. // interface (from the package gogs.io/gogs/internal/db) used for unit
  2085. // testing.
  2086. type MockTwoFactorsStore struct {
  2087. // CreateFunc is an instance of a mock function object controlling the
  2088. // behavior of the method Create.
  2089. CreateFunc *TwoFactorsStoreCreateFunc
  2090. // GetByUserIDFunc is an instance of a mock function object controlling
  2091. // the behavior of the method GetByUserID.
  2092. GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
  2093. // IsUserEnabledFunc is an instance of a mock function object
  2094. // controlling the behavior of the method IsUserEnabled.
  2095. IsUserEnabledFunc *TwoFactorsStoreIsUserEnabledFunc
  2096. }
  2097. // NewMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2098. // interface. All methods return zero values for all results, unless
  2099. // overwritten.
  2100. func NewMockTwoFactorsStore() *MockTwoFactorsStore {
  2101. return &MockTwoFactorsStore{
  2102. CreateFunc: &TwoFactorsStoreCreateFunc{
  2103. defaultHook: func(context.Context, int64, string, string) (r0 error) {
  2104. return
  2105. },
  2106. },
  2107. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2108. defaultHook: func(context.Context, int64) (r0 *TwoFactor, r1 error) {
  2109. return
  2110. },
  2111. },
  2112. IsUserEnabledFunc: &TwoFactorsStoreIsUserEnabledFunc{
  2113. defaultHook: func(context.Context, int64) (r0 bool) {
  2114. return
  2115. },
  2116. },
  2117. }
  2118. }
  2119. // NewStrictMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2120. // interface. All methods panic on invocation, unless overwritten.
  2121. func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
  2122. return &MockTwoFactorsStore{
  2123. CreateFunc: &TwoFactorsStoreCreateFunc{
  2124. defaultHook: func(context.Context, int64, string, string) error {
  2125. panic("unexpected invocation of MockTwoFactorsStore.Create")
  2126. },
  2127. },
  2128. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2129. defaultHook: func(context.Context, int64) (*TwoFactor, error) {
  2130. panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
  2131. },
  2132. },
  2133. IsUserEnabledFunc: &TwoFactorsStoreIsUserEnabledFunc{
  2134. defaultHook: func(context.Context, int64) bool {
  2135. panic("unexpected invocation of MockTwoFactorsStore.IsUserEnabled")
  2136. },
  2137. },
  2138. }
  2139. }
  2140. // NewMockTwoFactorsStoreFrom creates a new mock of the MockTwoFactorsStore
  2141. // interface. All methods delegate to the given implementation, unless
  2142. // overwritten.
  2143. func NewMockTwoFactorsStoreFrom(i TwoFactorsStore) *MockTwoFactorsStore {
  2144. return &MockTwoFactorsStore{
  2145. CreateFunc: &TwoFactorsStoreCreateFunc{
  2146. defaultHook: i.Create,
  2147. },
  2148. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2149. defaultHook: i.GetByUserID,
  2150. },
  2151. IsUserEnabledFunc: &TwoFactorsStoreIsUserEnabledFunc{
  2152. defaultHook: i.IsUserEnabled,
  2153. },
  2154. }
  2155. }
  2156. // TwoFactorsStoreCreateFunc describes the behavior when the Create method
  2157. // of the parent MockTwoFactorsStore instance is invoked.
  2158. type TwoFactorsStoreCreateFunc struct {
  2159. defaultHook func(context.Context, int64, string, string) error
  2160. hooks []func(context.Context, int64, string, string) error
  2161. history []TwoFactorsStoreCreateFuncCall
  2162. mutex sync.Mutex
  2163. }
  2164. // Create delegates to the next hook function in the queue and stores the
  2165. // parameter and result values of this invocation.
  2166. func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
  2167. r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2168. m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
  2169. return r0
  2170. }
  2171. // SetDefaultHook sets function that is called when the Create method of the
  2172. // parent MockTwoFactorsStore instance is invoked and the hook queue is
  2173. // empty.
  2174. func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
  2175. f.defaultHook = hook
  2176. }
  2177. // PushHook adds a function to the end of hook queue. Each invocation of the
  2178. // Create method of the parent MockTwoFactorsStore instance invokes the hook
  2179. // at the front of the queue and discards it. After the queue is empty, the
  2180. // default hook function is invoked for any future action.
  2181. func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
  2182. f.mutex.Lock()
  2183. f.hooks = append(f.hooks, hook)
  2184. f.mutex.Unlock()
  2185. }
  2186. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2187. // given values.
  2188. func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
  2189. f.SetDefaultHook(func(context.Context, int64, string, string) error {
  2190. return r0
  2191. })
  2192. }
  2193. // PushReturn calls PushHook with a function that returns the given values.
  2194. func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
  2195. f.PushHook(func(context.Context, int64, string, string) error {
  2196. return r0
  2197. })
  2198. }
  2199. func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
  2200. f.mutex.Lock()
  2201. defer f.mutex.Unlock()
  2202. if len(f.hooks) == 0 {
  2203. return f.defaultHook
  2204. }
  2205. hook := f.hooks[0]
  2206. f.hooks = f.hooks[1:]
  2207. return hook
  2208. }
  2209. func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
  2210. f.mutex.Lock()
  2211. f.history = append(f.history, r0)
  2212. f.mutex.Unlock()
  2213. }
  2214. // History returns a sequence of TwoFactorsStoreCreateFuncCall objects
  2215. // describing the invocations of this function.
  2216. func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
  2217. f.mutex.Lock()
  2218. history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
  2219. copy(history, f.history)
  2220. f.mutex.Unlock()
  2221. return history
  2222. }
  2223. // TwoFactorsStoreCreateFuncCall is an object that describes an invocation
  2224. // of method Create on an instance of MockTwoFactorsStore.
  2225. type TwoFactorsStoreCreateFuncCall struct {
  2226. // Arg0 is the value of the 1st argument passed to this method
  2227. // invocation.
  2228. Arg0 context.Context
  2229. // Arg1 is the value of the 2nd argument passed to this method
  2230. // invocation.
  2231. Arg1 int64
  2232. // Arg2 is the value of the 3rd argument passed to this method
  2233. // invocation.
  2234. Arg2 string
  2235. // Arg3 is the value of the 4th argument passed to this method
  2236. // invocation.
  2237. Arg3 string
  2238. // Result0 is the value of the 1st result returned from this method
  2239. // invocation.
  2240. Result0 error
  2241. }
  2242. // Args returns an interface slice containing the arguments of this
  2243. // invocation.
  2244. func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
  2245. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2246. }
  2247. // Results returns an interface slice containing the results of this
  2248. // invocation.
  2249. func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
  2250. return []interface{}{c.Result0}
  2251. }
  2252. // TwoFactorsStoreGetByUserIDFunc describes the behavior when the
  2253. // GetByUserID method of the parent MockTwoFactorsStore instance is invoked.
  2254. type TwoFactorsStoreGetByUserIDFunc struct {
  2255. defaultHook func(context.Context, int64) (*TwoFactor, error)
  2256. hooks []func(context.Context, int64) (*TwoFactor, error)
  2257. history []TwoFactorsStoreGetByUserIDFuncCall
  2258. mutex sync.Mutex
  2259. }
  2260. // GetByUserID delegates to the next hook function in the queue and stores
  2261. // the parameter and result values of this invocation.
  2262. func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*TwoFactor, error) {
  2263. r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
  2264. m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
  2265. return r0, r1
  2266. }
  2267. // SetDefaultHook sets function that is called when the GetByUserID method
  2268. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  2269. // is empty.
  2270. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*TwoFactor, error)) {
  2271. f.defaultHook = hook
  2272. }
  2273. // PushHook adds a function to the end of hook queue. Each invocation of the
  2274. // GetByUserID method of the parent MockTwoFactorsStore instance invokes the
  2275. // hook at the front of the queue and discards it. After the queue is empty,
  2276. // the default hook function is invoked for any future action.
  2277. func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*TwoFactor, error)) {
  2278. f.mutex.Lock()
  2279. f.hooks = append(f.hooks, hook)
  2280. f.mutex.Unlock()
  2281. }
  2282. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2283. // given values.
  2284. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *TwoFactor, r1 error) {
  2285. f.SetDefaultHook(func(context.Context, int64) (*TwoFactor, error) {
  2286. return r0, r1
  2287. })
  2288. }
  2289. // PushReturn calls PushHook with a function that returns the given values.
  2290. func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *TwoFactor, r1 error) {
  2291. f.PushHook(func(context.Context, int64) (*TwoFactor, error) {
  2292. return r0, r1
  2293. })
  2294. }
  2295. func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*TwoFactor, error) {
  2296. f.mutex.Lock()
  2297. defer f.mutex.Unlock()
  2298. if len(f.hooks) == 0 {
  2299. return f.defaultHook
  2300. }
  2301. hook := f.hooks[0]
  2302. f.hooks = f.hooks[1:]
  2303. return hook
  2304. }
  2305. func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
  2306. f.mutex.Lock()
  2307. f.history = append(f.history, r0)
  2308. f.mutex.Unlock()
  2309. }
  2310. // History returns a sequence of TwoFactorsStoreGetByUserIDFuncCall objects
  2311. // describing the invocations of this function.
  2312. func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
  2313. f.mutex.Lock()
  2314. history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
  2315. copy(history, f.history)
  2316. f.mutex.Unlock()
  2317. return history
  2318. }
  2319. // TwoFactorsStoreGetByUserIDFuncCall is an object that describes an
  2320. // invocation of method GetByUserID on an instance of MockTwoFactorsStore.
  2321. type TwoFactorsStoreGetByUserIDFuncCall struct {
  2322. // Arg0 is the value of the 1st argument passed to this method
  2323. // invocation.
  2324. Arg0 context.Context
  2325. // Arg1 is the value of the 2nd argument passed to this method
  2326. // invocation.
  2327. Arg1 int64
  2328. // Result0 is the value of the 1st result returned from this method
  2329. // invocation.
  2330. Result0 *TwoFactor
  2331. // Result1 is the value of the 2nd result returned from this method
  2332. // invocation.
  2333. Result1 error
  2334. }
  2335. // Args returns an interface slice containing the arguments of this
  2336. // invocation.
  2337. func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
  2338. return []interface{}{c.Arg0, c.Arg1}
  2339. }
  2340. // Results returns an interface slice containing the results of this
  2341. // invocation.
  2342. func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
  2343. return []interface{}{c.Result0, c.Result1}
  2344. }
  2345. // TwoFactorsStoreIsUserEnabledFunc describes the behavior when the
  2346. // IsUserEnabled method of the parent MockTwoFactorsStore instance is
  2347. // invoked.
  2348. type TwoFactorsStoreIsUserEnabledFunc struct {
  2349. defaultHook func(context.Context, int64) bool
  2350. hooks []func(context.Context, int64) bool
  2351. history []TwoFactorsStoreIsUserEnabledFuncCall
  2352. mutex sync.Mutex
  2353. }
  2354. // IsUserEnabled delegates to the next hook function in the queue and stores
  2355. // the parameter and result values of this invocation.
  2356. func (m *MockTwoFactorsStore) IsUserEnabled(v0 context.Context, v1 int64) bool {
  2357. r0 := m.IsUserEnabledFunc.nextHook()(v0, v1)
  2358. m.IsUserEnabledFunc.appendCall(TwoFactorsStoreIsUserEnabledFuncCall{v0, v1, r0})
  2359. return r0
  2360. }
  2361. // SetDefaultHook sets function that is called when the IsUserEnabled method
  2362. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  2363. // is empty.
  2364. func (f *TwoFactorsStoreIsUserEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
  2365. f.defaultHook = hook
  2366. }
  2367. // PushHook adds a function to the end of hook queue. Each invocation of the
  2368. // IsUserEnabled method of the parent MockTwoFactorsStore instance invokes
  2369. // the hook at the front of the queue and discards it. After the queue is
  2370. // empty, the default hook function is invoked for any future action.
  2371. func (f *TwoFactorsStoreIsUserEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
  2372. f.mutex.Lock()
  2373. f.hooks = append(f.hooks, hook)
  2374. f.mutex.Unlock()
  2375. }
  2376. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2377. // given values.
  2378. func (f *TwoFactorsStoreIsUserEnabledFunc) SetDefaultReturn(r0 bool) {
  2379. f.SetDefaultHook(func(context.Context, int64) bool {
  2380. return r0
  2381. })
  2382. }
  2383. // PushReturn calls PushHook with a function that returns the given values.
  2384. func (f *TwoFactorsStoreIsUserEnabledFunc) PushReturn(r0 bool) {
  2385. f.PushHook(func(context.Context, int64) bool {
  2386. return r0
  2387. })
  2388. }
  2389. func (f *TwoFactorsStoreIsUserEnabledFunc) nextHook() func(context.Context, int64) bool {
  2390. f.mutex.Lock()
  2391. defer f.mutex.Unlock()
  2392. if len(f.hooks) == 0 {
  2393. return f.defaultHook
  2394. }
  2395. hook := f.hooks[0]
  2396. f.hooks = f.hooks[1:]
  2397. return hook
  2398. }
  2399. func (f *TwoFactorsStoreIsUserEnabledFunc) appendCall(r0 TwoFactorsStoreIsUserEnabledFuncCall) {
  2400. f.mutex.Lock()
  2401. f.history = append(f.history, r0)
  2402. f.mutex.Unlock()
  2403. }
  2404. // History returns a sequence of TwoFactorsStoreIsUserEnabledFuncCall
  2405. // objects describing the invocations of this function.
  2406. func (f *TwoFactorsStoreIsUserEnabledFunc) History() []TwoFactorsStoreIsUserEnabledFuncCall {
  2407. f.mutex.Lock()
  2408. history := make([]TwoFactorsStoreIsUserEnabledFuncCall, len(f.history))
  2409. copy(history, f.history)
  2410. f.mutex.Unlock()
  2411. return history
  2412. }
  2413. // TwoFactorsStoreIsUserEnabledFuncCall is an object that describes an
  2414. // invocation of method IsUserEnabled on an instance of MockTwoFactorsStore.
  2415. type TwoFactorsStoreIsUserEnabledFuncCall struct {
  2416. // Arg0 is the value of the 1st argument passed to this method
  2417. // invocation.
  2418. Arg0 context.Context
  2419. // Arg1 is the value of the 2nd argument passed to this method
  2420. // invocation.
  2421. Arg1 int64
  2422. // Result0 is the value of the 1st result returned from this method
  2423. // invocation.
  2424. Result0 bool
  2425. }
  2426. // Args returns an interface slice containing the arguments of this
  2427. // invocation.
  2428. func (c TwoFactorsStoreIsUserEnabledFuncCall) Args() []interface{} {
  2429. return []interface{}{c.Arg0, c.Arg1}
  2430. }
  2431. // Results returns an interface slice containing the results of this
  2432. // invocation.
  2433. func (c TwoFactorsStoreIsUserEnabledFuncCall) Results() []interface{} {
  2434. return []interface{}{c.Result0}
  2435. }
  2436. // MockUsersStore is a mock implementation of the UsersStore interface (from
  2437. // the package gogs.io/gogs/internal/db) used for unit testing.
  2438. type MockUsersStore struct {
  2439. // AuthenticateFunc is an instance of a mock function object controlling
  2440. // the behavior of the method Authenticate.
  2441. AuthenticateFunc *UsersStoreAuthenticateFunc
  2442. // CreateFunc is an instance of a mock function object controlling the
  2443. // behavior of the method Create.
  2444. CreateFunc *UsersStoreCreateFunc
  2445. // GetByEmailFunc is an instance of a mock function object controlling
  2446. // the behavior of the method GetByEmail.
  2447. GetByEmailFunc *UsersStoreGetByEmailFunc
  2448. // GetByIDFunc is an instance of a mock function object controlling the
  2449. // behavior of the method GetByID.
  2450. GetByIDFunc *UsersStoreGetByIDFunc
  2451. // GetByUsernameFunc is an instance of a mock function object
  2452. // controlling the behavior of the method GetByUsername.
  2453. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  2454. }
  2455. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  2456. // methods return zero values for all results, unless overwritten.
  2457. func NewMockUsersStore() *MockUsersStore {
  2458. return &MockUsersStore{
  2459. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2460. defaultHook: func(context.Context, string, string, int64) (r0 *User, r1 error) {
  2461. return
  2462. },
  2463. },
  2464. CreateFunc: &UsersStoreCreateFunc{
  2465. defaultHook: func(context.Context, string, string, CreateUserOpts) (r0 *User, r1 error) {
  2466. return
  2467. },
  2468. },
  2469. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2470. defaultHook: func(context.Context, string) (r0 *User, r1 error) {
  2471. return
  2472. },
  2473. },
  2474. GetByIDFunc: &UsersStoreGetByIDFunc{
  2475. defaultHook: func(context.Context, int64) (r0 *User, r1 error) {
  2476. return
  2477. },
  2478. },
  2479. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2480. defaultHook: func(context.Context, string) (r0 *User, r1 error) {
  2481. return
  2482. },
  2483. },
  2484. }
  2485. }
  2486. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  2487. // All methods panic on invocation, unless overwritten.
  2488. func NewStrictMockUsersStore() *MockUsersStore {
  2489. return &MockUsersStore{
  2490. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2491. defaultHook: func(context.Context, string, string, int64) (*User, error) {
  2492. panic("unexpected invocation of MockUsersStore.Authenticate")
  2493. },
  2494. },
  2495. CreateFunc: &UsersStoreCreateFunc{
  2496. defaultHook: func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2497. panic("unexpected invocation of MockUsersStore.Create")
  2498. },
  2499. },
  2500. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2501. defaultHook: func(context.Context, string) (*User, error) {
  2502. panic("unexpected invocation of MockUsersStore.GetByEmail")
  2503. },
  2504. },
  2505. GetByIDFunc: &UsersStoreGetByIDFunc{
  2506. defaultHook: func(context.Context, int64) (*User, error) {
  2507. panic("unexpected invocation of MockUsersStore.GetByID")
  2508. },
  2509. },
  2510. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2511. defaultHook: func(context.Context, string) (*User, error) {
  2512. panic("unexpected invocation of MockUsersStore.GetByUsername")
  2513. },
  2514. },
  2515. }
  2516. }
  2517. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  2518. // All methods delegate to the given implementation, unless overwritten.
  2519. func NewMockUsersStoreFrom(i UsersStore) *MockUsersStore {
  2520. return &MockUsersStore{
  2521. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2522. defaultHook: i.Authenticate,
  2523. },
  2524. CreateFunc: &UsersStoreCreateFunc{
  2525. defaultHook: i.Create,
  2526. },
  2527. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2528. defaultHook: i.GetByEmail,
  2529. },
  2530. GetByIDFunc: &UsersStoreGetByIDFunc{
  2531. defaultHook: i.GetByID,
  2532. },
  2533. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2534. defaultHook: i.GetByUsername,
  2535. },
  2536. }
  2537. }
  2538. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  2539. // method of the parent MockUsersStore instance is invoked.
  2540. type UsersStoreAuthenticateFunc struct {
  2541. defaultHook func(context.Context, string, string, int64) (*User, error)
  2542. hooks []func(context.Context, string, string, int64) (*User, error)
  2543. history []UsersStoreAuthenticateFuncCall
  2544. mutex sync.Mutex
  2545. }
  2546. // Authenticate delegates to the next hook function in the queue and stores
  2547. // the parameter and result values of this invocation.
  2548. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*User, error) {
  2549. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  2550. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  2551. return r0, r1
  2552. }
  2553. // SetDefaultHook sets function that is called when the Authenticate method
  2554. // of the parent MockUsersStore instance is invoked and the hook queue is
  2555. // empty.
  2556. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*User, error)) {
  2557. f.defaultHook = hook
  2558. }
  2559. // PushHook adds a function to the end of hook queue. Each invocation of the
  2560. // Authenticate method of the parent MockUsersStore instance invokes the
  2561. // hook at the front of the queue and discards it. After the queue is empty,
  2562. // the default hook function is invoked for any future action.
  2563. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*User, error)) {
  2564. f.mutex.Lock()
  2565. f.hooks = append(f.hooks, hook)
  2566. f.mutex.Unlock()
  2567. }
  2568. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2569. // given values.
  2570. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *User, r1 error) {
  2571. f.SetDefaultHook(func(context.Context, string, string, int64) (*User, error) {
  2572. return r0, r1
  2573. })
  2574. }
  2575. // PushReturn calls PushHook with a function that returns the given values.
  2576. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *User, r1 error) {
  2577. f.PushHook(func(context.Context, string, string, int64) (*User, error) {
  2578. return r0, r1
  2579. })
  2580. }
  2581. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*User, error) {
  2582. f.mutex.Lock()
  2583. defer f.mutex.Unlock()
  2584. if len(f.hooks) == 0 {
  2585. return f.defaultHook
  2586. }
  2587. hook := f.hooks[0]
  2588. f.hooks = f.hooks[1:]
  2589. return hook
  2590. }
  2591. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  2592. f.mutex.Lock()
  2593. f.history = append(f.history, r0)
  2594. f.mutex.Unlock()
  2595. }
  2596. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  2597. // describing the invocations of this function.
  2598. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  2599. f.mutex.Lock()
  2600. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  2601. copy(history, f.history)
  2602. f.mutex.Unlock()
  2603. return history
  2604. }
  2605. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  2606. // of method Authenticate on an instance of MockUsersStore.
  2607. type UsersStoreAuthenticateFuncCall struct {
  2608. // Arg0 is the value of the 1st argument passed to this method
  2609. // invocation.
  2610. Arg0 context.Context
  2611. // Arg1 is the value of the 2nd argument passed to this method
  2612. // invocation.
  2613. Arg1 string
  2614. // Arg2 is the value of the 3rd argument passed to this method
  2615. // invocation.
  2616. Arg2 string
  2617. // Arg3 is the value of the 4th argument passed to this method
  2618. // invocation.
  2619. Arg3 int64
  2620. // Result0 is the value of the 1st result returned from this method
  2621. // invocation.
  2622. Result0 *User
  2623. // Result1 is the value of the 2nd result returned from this method
  2624. // invocation.
  2625. Result1 error
  2626. }
  2627. // Args returns an interface slice containing the arguments of this
  2628. // invocation.
  2629. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  2630. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2631. }
  2632. // Results returns an interface slice containing the results of this
  2633. // invocation.
  2634. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  2635. return []interface{}{c.Result0, c.Result1}
  2636. }
  2637. // UsersStoreCreateFunc describes the behavior when the Create method of the
  2638. // parent MockUsersStore instance is invoked.
  2639. type UsersStoreCreateFunc struct {
  2640. defaultHook func(context.Context, string, string, CreateUserOpts) (*User, error)
  2641. hooks []func(context.Context, string, string, CreateUserOpts) (*User, error)
  2642. history []UsersStoreCreateFuncCall
  2643. mutex sync.Mutex
  2644. }
  2645. // Create delegates to the next hook function in the queue and stores the
  2646. // parameter and result values of this invocation.
  2647. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 CreateUserOpts) (*User, error) {
  2648. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2649. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  2650. return r0, r1
  2651. }
  2652. // SetDefaultHook sets function that is called when the Create method of the
  2653. // parent MockUsersStore instance is invoked and the hook queue is empty.
  2654. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, CreateUserOpts) (*User, error)) {
  2655. f.defaultHook = hook
  2656. }
  2657. // PushHook adds a function to the end of hook queue. Each invocation of the
  2658. // Create method of the parent MockUsersStore instance invokes the hook at
  2659. // the front of the queue and discards it. After the queue is empty, the
  2660. // default hook function is invoked for any future action.
  2661. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, CreateUserOpts) (*User, error)) {
  2662. f.mutex.Lock()
  2663. f.hooks = append(f.hooks, hook)
  2664. f.mutex.Unlock()
  2665. }
  2666. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2667. // given values.
  2668. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *User, r1 error) {
  2669. f.SetDefaultHook(func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2670. return r0, r1
  2671. })
  2672. }
  2673. // PushReturn calls PushHook with a function that returns the given values.
  2674. func (f *UsersStoreCreateFunc) PushReturn(r0 *User, r1 error) {
  2675. f.PushHook(func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2676. return r0, r1
  2677. })
  2678. }
  2679. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, CreateUserOpts) (*User, error) {
  2680. f.mutex.Lock()
  2681. defer f.mutex.Unlock()
  2682. if len(f.hooks) == 0 {
  2683. return f.defaultHook
  2684. }
  2685. hook := f.hooks[0]
  2686. f.hooks = f.hooks[1:]
  2687. return hook
  2688. }
  2689. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  2690. f.mutex.Lock()
  2691. f.history = append(f.history, r0)
  2692. f.mutex.Unlock()
  2693. }
  2694. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  2695. // the invocations of this function.
  2696. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  2697. f.mutex.Lock()
  2698. history := make([]UsersStoreCreateFuncCall, len(f.history))
  2699. copy(history, f.history)
  2700. f.mutex.Unlock()
  2701. return history
  2702. }
  2703. // UsersStoreCreateFuncCall is an object that describes an invocation of
  2704. // method Create on an instance of MockUsersStore.
  2705. type UsersStoreCreateFuncCall struct {
  2706. // Arg0 is the value of the 1st argument passed to this method
  2707. // invocation.
  2708. Arg0 context.Context
  2709. // Arg1 is the value of the 2nd argument passed to this method
  2710. // invocation.
  2711. Arg1 string
  2712. // Arg2 is the value of the 3rd argument passed to this method
  2713. // invocation.
  2714. Arg2 string
  2715. // Arg3 is the value of the 4th argument passed to this method
  2716. // invocation.
  2717. Arg3 CreateUserOpts
  2718. // Result0 is the value of the 1st result returned from this method
  2719. // invocation.
  2720. Result0 *User
  2721. // Result1 is the value of the 2nd result returned from this method
  2722. // invocation.
  2723. Result1 error
  2724. }
  2725. // Args returns an interface slice containing the arguments of this
  2726. // invocation.
  2727. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  2728. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2729. }
  2730. // Results returns an interface slice containing the results of this
  2731. // invocation.
  2732. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  2733. return []interface{}{c.Result0, c.Result1}
  2734. }
  2735. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  2736. // method of the parent MockUsersStore instance is invoked.
  2737. type UsersStoreGetByEmailFunc struct {
  2738. defaultHook func(context.Context, string) (*User, error)
  2739. hooks []func(context.Context, string) (*User, error)
  2740. history []UsersStoreGetByEmailFuncCall
  2741. mutex sync.Mutex
  2742. }
  2743. // GetByEmail delegates to the next hook function in the queue and stores
  2744. // the parameter and result values of this invocation.
  2745. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*User, error) {
  2746. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  2747. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  2748. return r0, r1
  2749. }
  2750. // SetDefaultHook sets function that is called when the GetByEmail method of
  2751. // the parent MockUsersStore instance is invoked and the hook queue is
  2752. // empty.
  2753. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*User, error)) {
  2754. f.defaultHook = hook
  2755. }
  2756. // PushHook adds a function to the end of hook queue. Each invocation of the
  2757. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  2758. // at the front of the queue and discards it. After the queue is empty, the
  2759. // default hook function is invoked for any future action.
  2760. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*User, error)) {
  2761. f.mutex.Lock()
  2762. f.hooks = append(f.hooks, hook)
  2763. f.mutex.Unlock()
  2764. }
  2765. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2766. // given values.
  2767. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *User, r1 error) {
  2768. f.SetDefaultHook(func(context.Context, string) (*User, error) {
  2769. return r0, r1
  2770. })
  2771. }
  2772. // PushReturn calls PushHook with a function that returns the given values.
  2773. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *User, r1 error) {
  2774. f.PushHook(func(context.Context, string) (*User, error) {
  2775. return r0, r1
  2776. })
  2777. }
  2778. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*User, error) {
  2779. f.mutex.Lock()
  2780. defer f.mutex.Unlock()
  2781. if len(f.hooks) == 0 {
  2782. return f.defaultHook
  2783. }
  2784. hook := f.hooks[0]
  2785. f.hooks = f.hooks[1:]
  2786. return hook
  2787. }
  2788. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  2789. f.mutex.Lock()
  2790. f.history = append(f.history, r0)
  2791. f.mutex.Unlock()
  2792. }
  2793. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  2794. // describing the invocations of this function.
  2795. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  2796. f.mutex.Lock()
  2797. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  2798. copy(history, f.history)
  2799. f.mutex.Unlock()
  2800. return history
  2801. }
  2802. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  2803. // method GetByEmail on an instance of MockUsersStore.
  2804. type UsersStoreGetByEmailFuncCall struct {
  2805. // Arg0 is the value of the 1st argument passed to this method
  2806. // invocation.
  2807. Arg0 context.Context
  2808. // Arg1 is the value of the 2nd argument passed to this method
  2809. // invocation.
  2810. Arg1 string
  2811. // Result0 is the value of the 1st result returned from this method
  2812. // invocation.
  2813. Result0 *User
  2814. // Result1 is the value of the 2nd result returned from this method
  2815. // invocation.
  2816. Result1 error
  2817. }
  2818. // Args returns an interface slice containing the arguments of this
  2819. // invocation.
  2820. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  2821. return []interface{}{c.Arg0, c.Arg1}
  2822. }
  2823. // Results returns an interface slice containing the results of this
  2824. // invocation.
  2825. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  2826. return []interface{}{c.Result0, c.Result1}
  2827. }
  2828. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  2829. // the parent MockUsersStore instance is invoked.
  2830. type UsersStoreGetByIDFunc struct {
  2831. defaultHook func(context.Context, int64) (*User, error)
  2832. hooks []func(context.Context, int64) (*User, error)
  2833. history []UsersStoreGetByIDFuncCall
  2834. mutex sync.Mutex
  2835. }
  2836. // GetByID delegates to the next hook function in the queue and stores the
  2837. // parameter and result values of this invocation.
  2838. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*User, error) {
  2839. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  2840. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  2841. return r0, r1
  2842. }
  2843. // SetDefaultHook sets function that is called when the GetByID method of
  2844. // the parent MockUsersStore instance is invoked and the hook queue is
  2845. // empty.
  2846. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*User, error)) {
  2847. f.defaultHook = hook
  2848. }
  2849. // PushHook adds a function to the end of hook queue. Each invocation of the
  2850. // GetByID method of the parent MockUsersStore instance invokes the hook at
  2851. // the front of the queue and discards it. After the queue is empty, the
  2852. // default hook function is invoked for any future action.
  2853. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*User, 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 *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *User, r1 error) {
  2861. f.SetDefaultHook(func(context.Context, int64) (*User, error) {
  2862. return r0, r1
  2863. })
  2864. }
  2865. // PushReturn calls PushHook with a function that returns the given values.
  2866. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *User, r1 error) {
  2867. f.PushHook(func(context.Context, int64) (*User, error) {
  2868. return r0, r1
  2869. })
  2870. }
  2871. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*User, 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 *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  2882. f.mutex.Lock()
  2883. f.history = append(f.history, r0)
  2884. f.mutex.Unlock()
  2885. }
  2886. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  2887. // describing the invocations of this function.
  2888. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  2889. f.mutex.Lock()
  2890. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  2891. copy(history, f.history)
  2892. f.mutex.Unlock()
  2893. return history
  2894. }
  2895. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  2896. // method GetByID on an instance of MockUsersStore.
  2897. type UsersStoreGetByIDFuncCall struct {
  2898. // Arg0 is the value of the 1st argument passed to this method
  2899. // invocation.
  2900. Arg0 context.Context
  2901. // Arg1 is the value of the 2nd argument passed to this method
  2902. // invocation.
  2903. Arg1 int64
  2904. // Result0 is the value of the 1st result returned from this method
  2905. // invocation.
  2906. Result0 *User
  2907. // Result1 is the value of the 2nd result returned from this method
  2908. // invocation.
  2909. Result1 error
  2910. }
  2911. // Args returns an interface slice containing the arguments of this
  2912. // invocation.
  2913. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  2914. return []interface{}{c.Arg0, c.Arg1}
  2915. }
  2916. // Results returns an interface slice containing the results of this
  2917. // invocation.
  2918. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  2919. return []interface{}{c.Result0, c.Result1}
  2920. }
  2921. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  2922. // method of the parent MockUsersStore instance is invoked.
  2923. type UsersStoreGetByUsernameFunc struct {
  2924. defaultHook func(context.Context, string) (*User, error)
  2925. hooks []func(context.Context, string) (*User, error)
  2926. history []UsersStoreGetByUsernameFuncCall
  2927. mutex sync.Mutex
  2928. }
  2929. // GetByUsername delegates to the next hook function in the queue and stores
  2930. // the parameter and result values of this invocation.
  2931. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*User, error) {
  2932. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  2933. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  2934. return r0, r1
  2935. }
  2936. // SetDefaultHook sets function that is called when the GetByUsername method
  2937. // of the parent MockUsersStore instance is invoked and the hook queue is
  2938. // empty.
  2939. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*User, error)) {
  2940. f.defaultHook = hook
  2941. }
  2942. // PushHook adds a function to the end of hook queue. Each invocation of the
  2943. // GetByUsername method of the parent MockUsersStore instance invokes the
  2944. // hook at the front of the queue and discards it. After the queue is empty,
  2945. // the default hook function is invoked for any future action.
  2946. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*User, error)) {
  2947. f.mutex.Lock()
  2948. f.hooks = append(f.hooks, hook)
  2949. f.mutex.Unlock()
  2950. }
  2951. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2952. // given values.
  2953. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *User, r1 error) {
  2954. f.SetDefaultHook(func(context.Context, string) (*User, error) {
  2955. return r0, r1
  2956. })
  2957. }
  2958. // PushReturn calls PushHook with a function that returns the given values.
  2959. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *User, r1 error) {
  2960. f.PushHook(func(context.Context, string) (*User, error) {
  2961. return r0, r1
  2962. })
  2963. }
  2964. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*User, error) {
  2965. f.mutex.Lock()
  2966. defer f.mutex.Unlock()
  2967. if len(f.hooks) == 0 {
  2968. return f.defaultHook
  2969. }
  2970. hook := f.hooks[0]
  2971. f.hooks = f.hooks[1:]
  2972. return hook
  2973. }
  2974. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  2975. f.mutex.Lock()
  2976. f.history = append(f.history, r0)
  2977. f.mutex.Unlock()
  2978. }
  2979. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  2980. // describing the invocations of this function.
  2981. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  2982. f.mutex.Lock()
  2983. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  2984. copy(history, f.history)
  2985. f.mutex.Unlock()
  2986. return history
  2987. }
  2988. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  2989. // of method GetByUsername on an instance of MockUsersStore.
  2990. type UsersStoreGetByUsernameFuncCall struct {
  2991. // Arg0 is the value of the 1st argument passed to this method
  2992. // invocation.
  2993. Arg0 context.Context
  2994. // Arg1 is the value of the 2nd argument passed to this method
  2995. // invocation.
  2996. Arg1 string
  2997. // Result0 is the value of the 1st result returned from this method
  2998. // invocation.
  2999. Result0 *User
  3000. // Result1 is the value of the 2nd result returned from this method
  3001. // invocation.
  3002. Result1 error
  3003. }
  3004. // Args returns an interface slice containing the arguments of this
  3005. // invocation.
  3006. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  3007. return []interface{}{c.Arg0, c.Arg1}
  3008. }
  3009. // Results returns an interface slice containing the results of this
  3010. // invocation.
  3011. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  3012. return []interface{}{c.Result0, c.Result1}
  3013. }
  3014. // MockLoginSourceFileStore is a mock implementation of the
  3015. // loginSourceFileStore interface (from the package
  3016. // gogs.io/gogs/internal/db) used for unit testing.
  3017. type MockLoginSourceFileStore struct {
  3018. // SaveFunc is an instance of a mock function object controlling the
  3019. // behavior of the method Save.
  3020. SaveFunc *LoginSourceFileStoreSaveFunc
  3021. // SetConfigFunc is an instance of a mock function object controlling
  3022. // the behavior of the method SetConfig.
  3023. SetConfigFunc *LoginSourceFileStoreSetConfigFunc
  3024. // SetGeneralFunc is an instance of a mock function object controlling
  3025. // the behavior of the method SetGeneral.
  3026. SetGeneralFunc *LoginSourceFileStoreSetGeneralFunc
  3027. }
  3028. // NewMockLoginSourceFileStore creates a new mock of the
  3029. // loginSourceFileStore interface. All methods return zero values for all
  3030. // results, unless overwritten.
  3031. func NewMockLoginSourceFileStore() *MockLoginSourceFileStore {
  3032. return &MockLoginSourceFileStore{
  3033. SaveFunc: &LoginSourceFileStoreSaveFunc{
  3034. defaultHook: func() (r0 error) {
  3035. return
  3036. },
  3037. },
  3038. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  3039. defaultHook: func(interface{}) (r0 error) {
  3040. return
  3041. },
  3042. },
  3043. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  3044. defaultHook: func(string, string) {
  3045. return
  3046. },
  3047. },
  3048. }
  3049. }
  3050. // NewStrictMockLoginSourceFileStore creates a new mock of the
  3051. // loginSourceFileStore interface. All methods panic on invocation, unless
  3052. // overwritten.
  3053. func NewStrictMockLoginSourceFileStore() *MockLoginSourceFileStore {
  3054. return &MockLoginSourceFileStore{
  3055. SaveFunc: &LoginSourceFileStoreSaveFunc{
  3056. defaultHook: func() error {
  3057. panic("unexpected invocation of MockLoginSourceFileStore.Save")
  3058. },
  3059. },
  3060. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  3061. defaultHook: func(interface{}) error {
  3062. panic("unexpected invocation of MockLoginSourceFileStore.SetConfig")
  3063. },
  3064. },
  3065. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  3066. defaultHook: func(string, string) {
  3067. panic("unexpected invocation of MockLoginSourceFileStore.SetGeneral")
  3068. },
  3069. },
  3070. }
  3071. }
  3072. // surrogateMockLoginSourceFileStore is a copy of the loginSourceFileStore
  3073. // interface (from the package gogs.io/gogs/internal/db). It is redefined
  3074. // here as it is unexported in the source package.
  3075. type surrogateMockLoginSourceFileStore interface {
  3076. Save() error
  3077. SetConfig(interface{}) error
  3078. SetGeneral(string, string)
  3079. }
  3080. // NewMockLoginSourceFileStoreFrom creates a new mock of the
  3081. // MockLoginSourceFileStore interface. All methods delegate to the given
  3082. // implementation, unless overwritten.
  3083. func NewMockLoginSourceFileStoreFrom(i surrogateMockLoginSourceFileStore) *MockLoginSourceFileStore {
  3084. return &MockLoginSourceFileStore{
  3085. SaveFunc: &LoginSourceFileStoreSaveFunc{
  3086. defaultHook: i.Save,
  3087. },
  3088. SetConfigFunc: &LoginSourceFileStoreSetConfigFunc{
  3089. defaultHook: i.SetConfig,
  3090. },
  3091. SetGeneralFunc: &LoginSourceFileStoreSetGeneralFunc{
  3092. defaultHook: i.SetGeneral,
  3093. },
  3094. }
  3095. }
  3096. // LoginSourceFileStoreSaveFunc describes the behavior when the Save method
  3097. // of the parent MockLoginSourceFileStore instance is invoked.
  3098. type LoginSourceFileStoreSaveFunc struct {
  3099. defaultHook func() error
  3100. hooks []func() error
  3101. history []LoginSourceFileStoreSaveFuncCall
  3102. mutex sync.Mutex
  3103. }
  3104. // Save delegates to the next hook function in the queue and stores the
  3105. // parameter and result values of this invocation.
  3106. func (m *MockLoginSourceFileStore) Save() error {
  3107. r0 := m.SaveFunc.nextHook()()
  3108. m.SaveFunc.appendCall(LoginSourceFileStoreSaveFuncCall{r0})
  3109. return r0
  3110. }
  3111. // SetDefaultHook sets function that is called when the Save method of the
  3112. // parent MockLoginSourceFileStore instance is invoked and the hook queue is
  3113. // empty.
  3114. func (f *LoginSourceFileStoreSaveFunc) SetDefaultHook(hook func() error) {
  3115. f.defaultHook = hook
  3116. }
  3117. // PushHook adds a function to the end of hook queue. Each invocation of the
  3118. // Save method of the parent MockLoginSourceFileStore instance invokes the
  3119. // hook at the front of the queue and discards it. After the queue is empty,
  3120. // the default hook function is invoked for any future action.
  3121. func (f *LoginSourceFileStoreSaveFunc) PushHook(hook func() error) {
  3122. f.mutex.Lock()
  3123. f.hooks = append(f.hooks, hook)
  3124. f.mutex.Unlock()
  3125. }
  3126. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3127. // given values.
  3128. func (f *LoginSourceFileStoreSaveFunc) SetDefaultReturn(r0 error) {
  3129. f.SetDefaultHook(func() error {
  3130. return r0
  3131. })
  3132. }
  3133. // PushReturn calls PushHook with a function that returns the given values.
  3134. func (f *LoginSourceFileStoreSaveFunc) PushReturn(r0 error) {
  3135. f.PushHook(func() error {
  3136. return r0
  3137. })
  3138. }
  3139. func (f *LoginSourceFileStoreSaveFunc) nextHook() func() error {
  3140. f.mutex.Lock()
  3141. defer f.mutex.Unlock()
  3142. if len(f.hooks) == 0 {
  3143. return f.defaultHook
  3144. }
  3145. hook := f.hooks[0]
  3146. f.hooks = f.hooks[1:]
  3147. return hook
  3148. }
  3149. func (f *LoginSourceFileStoreSaveFunc) appendCall(r0 LoginSourceFileStoreSaveFuncCall) {
  3150. f.mutex.Lock()
  3151. f.history = append(f.history, r0)
  3152. f.mutex.Unlock()
  3153. }
  3154. // History returns a sequence of LoginSourceFileStoreSaveFuncCall objects
  3155. // describing the invocations of this function.
  3156. func (f *LoginSourceFileStoreSaveFunc) History() []LoginSourceFileStoreSaveFuncCall {
  3157. f.mutex.Lock()
  3158. history := make([]LoginSourceFileStoreSaveFuncCall, len(f.history))
  3159. copy(history, f.history)
  3160. f.mutex.Unlock()
  3161. return history
  3162. }
  3163. // LoginSourceFileStoreSaveFuncCall is an object that describes an
  3164. // invocation of method Save on an instance of MockLoginSourceFileStore.
  3165. type LoginSourceFileStoreSaveFuncCall struct {
  3166. // Result0 is the value of the 1st result returned from this method
  3167. // invocation.
  3168. Result0 error
  3169. }
  3170. // Args returns an interface slice containing the arguments of this
  3171. // invocation.
  3172. func (c LoginSourceFileStoreSaveFuncCall) Args() []interface{} {
  3173. return []interface{}{}
  3174. }
  3175. // Results returns an interface slice containing the results of this
  3176. // invocation.
  3177. func (c LoginSourceFileStoreSaveFuncCall) Results() []interface{} {
  3178. return []interface{}{c.Result0}
  3179. }
  3180. // LoginSourceFileStoreSetConfigFunc describes the behavior when the
  3181. // SetConfig method of the parent MockLoginSourceFileStore instance is
  3182. // invoked.
  3183. type LoginSourceFileStoreSetConfigFunc struct {
  3184. defaultHook func(interface{}) error
  3185. hooks []func(interface{}) error
  3186. history []LoginSourceFileStoreSetConfigFuncCall
  3187. mutex sync.Mutex
  3188. }
  3189. // SetConfig delegates to the next hook function in the queue and stores the
  3190. // parameter and result values of this invocation.
  3191. func (m *MockLoginSourceFileStore) SetConfig(v0 interface{}) error {
  3192. r0 := m.SetConfigFunc.nextHook()(v0)
  3193. m.SetConfigFunc.appendCall(LoginSourceFileStoreSetConfigFuncCall{v0, r0})
  3194. return r0
  3195. }
  3196. // SetDefaultHook sets function that is called when the SetConfig method of
  3197. // the parent MockLoginSourceFileStore instance is invoked and the hook
  3198. // queue is empty.
  3199. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultHook(hook func(interface{}) error) {
  3200. f.defaultHook = hook
  3201. }
  3202. // PushHook adds a function to the end of hook queue. Each invocation of the
  3203. // SetConfig method of the parent MockLoginSourceFileStore instance invokes
  3204. // the hook at the front of the queue and discards it. After the queue is
  3205. // empty, the default hook function is invoked for any future action.
  3206. func (f *LoginSourceFileStoreSetConfigFunc) PushHook(hook func(interface{}) error) {
  3207. f.mutex.Lock()
  3208. f.hooks = append(f.hooks, hook)
  3209. f.mutex.Unlock()
  3210. }
  3211. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3212. // given values.
  3213. func (f *LoginSourceFileStoreSetConfigFunc) SetDefaultReturn(r0 error) {
  3214. f.SetDefaultHook(func(interface{}) error {
  3215. return r0
  3216. })
  3217. }
  3218. // PushReturn calls PushHook with a function that returns the given values.
  3219. func (f *LoginSourceFileStoreSetConfigFunc) PushReturn(r0 error) {
  3220. f.PushHook(func(interface{}) error {
  3221. return r0
  3222. })
  3223. }
  3224. func (f *LoginSourceFileStoreSetConfigFunc) nextHook() func(interface{}) error {
  3225. f.mutex.Lock()
  3226. defer f.mutex.Unlock()
  3227. if len(f.hooks) == 0 {
  3228. return f.defaultHook
  3229. }
  3230. hook := f.hooks[0]
  3231. f.hooks = f.hooks[1:]
  3232. return hook
  3233. }
  3234. func (f *LoginSourceFileStoreSetConfigFunc) appendCall(r0 LoginSourceFileStoreSetConfigFuncCall) {
  3235. f.mutex.Lock()
  3236. f.history = append(f.history, r0)
  3237. f.mutex.Unlock()
  3238. }
  3239. // History returns a sequence of LoginSourceFileStoreSetConfigFuncCall
  3240. // objects describing the invocations of this function.
  3241. func (f *LoginSourceFileStoreSetConfigFunc) History() []LoginSourceFileStoreSetConfigFuncCall {
  3242. f.mutex.Lock()
  3243. history := make([]LoginSourceFileStoreSetConfigFuncCall, len(f.history))
  3244. copy(history, f.history)
  3245. f.mutex.Unlock()
  3246. return history
  3247. }
  3248. // LoginSourceFileStoreSetConfigFuncCall is an object that describes an
  3249. // invocation of method SetConfig on an instance of
  3250. // MockLoginSourceFileStore.
  3251. type LoginSourceFileStoreSetConfigFuncCall struct {
  3252. // Arg0 is the value of the 1st argument passed to this method
  3253. // invocation.
  3254. Arg0 interface{}
  3255. // Result0 is the value of the 1st result returned from this method
  3256. // invocation.
  3257. Result0 error
  3258. }
  3259. // Args returns an interface slice containing the arguments of this
  3260. // invocation.
  3261. func (c LoginSourceFileStoreSetConfigFuncCall) Args() []interface{} {
  3262. return []interface{}{c.Arg0}
  3263. }
  3264. // Results returns an interface slice containing the results of this
  3265. // invocation.
  3266. func (c LoginSourceFileStoreSetConfigFuncCall) Results() []interface{} {
  3267. return []interface{}{c.Result0}
  3268. }
  3269. // LoginSourceFileStoreSetGeneralFunc describes the behavior when the
  3270. // SetGeneral method of the parent MockLoginSourceFileStore instance is
  3271. // invoked.
  3272. type LoginSourceFileStoreSetGeneralFunc struct {
  3273. defaultHook func(string, string)
  3274. hooks []func(string, string)
  3275. history []LoginSourceFileStoreSetGeneralFuncCall
  3276. mutex sync.Mutex
  3277. }
  3278. // SetGeneral delegates to the next hook function in the queue and stores
  3279. // the parameter and result values of this invocation.
  3280. func (m *MockLoginSourceFileStore) SetGeneral(v0 string, v1 string) {
  3281. m.SetGeneralFunc.nextHook()(v0, v1)
  3282. m.SetGeneralFunc.appendCall(LoginSourceFileStoreSetGeneralFuncCall{v0, v1})
  3283. return
  3284. }
  3285. // SetDefaultHook sets function that is called when the SetGeneral method of
  3286. // the parent MockLoginSourceFileStore instance is invoked and the hook
  3287. // queue is empty.
  3288. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultHook(hook func(string, string)) {
  3289. f.defaultHook = hook
  3290. }
  3291. // PushHook adds a function to the end of hook queue. Each invocation of the
  3292. // SetGeneral method of the parent MockLoginSourceFileStore instance invokes
  3293. // the hook at the front of the queue and discards it. After the queue is
  3294. // empty, the default hook function is invoked for any future action.
  3295. func (f *LoginSourceFileStoreSetGeneralFunc) PushHook(hook func(string, string)) {
  3296. f.mutex.Lock()
  3297. f.hooks = append(f.hooks, hook)
  3298. f.mutex.Unlock()
  3299. }
  3300. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3301. // given values.
  3302. func (f *LoginSourceFileStoreSetGeneralFunc) SetDefaultReturn() {
  3303. f.SetDefaultHook(func(string, string) {
  3304. return
  3305. })
  3306. }
  3307. // PushReturn calls PushHook with a function that returns the given values.
  3308. func (f *LoginSourceFileStoreSetGeneralFunc) PushReturn() {
  3309. f.PushHook(func(string, string) {
  3310. return
  3311. })
  3312. }
  3313. func (f *LoginSourceFileStoreSetGeneralFunc) nextHook() func(string, string) {
  3314. f.mutex.Lock()
  3315. defer f.mutex.Unlock()
  3316. if len(f.hooks) == 0 {
  3317. return f.defaultHook
  3318. }
  3319. hook := f.hooks[0]
  3320. f.hooks = f.hooks[1:]
  3321. return hook
  3322. }
  3323. func (f *LoginSourceFileStoreSetGeneralFunc) appendCall(r0 LoginSourceFileStoreSetGeneralFuncCall) {
  3324. f.mutex.Lock()
  3325. f.history = append(f.history, r0)
  3326. f.mutex.Unlock()
  3327. }
  3328. // History returns a sequence of LoginSourceFileStoreSetGeneralFuncCall
  3329. // objects describing the invocations of this function.
  3330. func (f *LoginSourceFileStoreSetGeneralFunc) History() []LoginSourceFileStoreSetGeneralFuncCall {
  3331. f.mutex.Lock()
  3332. history := make([]LoginSourceFileStoreSetGeneralFuncCall, len(f.history))
  3333. copy(history, f.history)
  3334. f.mutex.Unlock()
  3335. return history
  3336. }
  3337. // LoginSourceFileStoreSetGeneralFuncCall is an object that describes an
  3338. // invocation of method SetGeneral on an instance of
  3339. // MockLoginSourceFileStore.
  3340. type LoginSourceFileStoreSetGeneralFuncCall struct {
  3341. // Arg0 is the value of the 1st argument passed to this method
  3342. // invocation.
  3343. Arg0 string
  3344. // Arg1 is the value of the 2nd argument passed to this method
  3345. // invocation.
  3346. Arg1 string
  3347. }
  3348. // Args returns an interface slice containing the arguments of this
  3349. // invocation.
  3350. func (c LoginSourceFileStoreSetGeneralFuncCall) Args() []interface{} {
  3351. return []interface{}{c.Arg0, c.Arg1}
  3352. }
  3353. // Results returns an interface slice containing the results of this
  3354. // invocation.
  3355. func (c LoginSourceFileStoreSetGeneralFuncCall) Results() []interface{} {
  3356. return []interface{}{}
  3357. }
  3358. // MockLoginSourceFilesStore is a mock implementation of the
  3359. // loginSourceFilesStore interface (from the package
  3360. // gogs.io/gogs/internal/db) used for unit testing.
  3361. type MockLoginSourceFilesStore struct {
  3362. // GetByIDFunc is an instance of a mock function object controlling the
  3363. // behavior of the method GetByID.
  3364. GetByIDFunc *LoginSourceFilesStoreGetByIDFunc
  3365. // LenFunc is an instance of a mock function object controlling the
  3366. // behavior of the method Len.
  3367. LenFunc *LoginSourceFilesStoreLenFunc
  3368. // ListFunc is an instance of a mock function object controlling the
  3369. // behavior of the method List.
  3370. ListFunc *LoginSourceFilesStoreListFunc
  3371. // UpdateFunc is an instance of a mock function object controlling the
  3372. // behavior of the method Update.
  3373. UpdateFunc *LoginSourceFilesStoreUpdateFunc
  3374. }
  3375. // NewMockLoginSourceFilesStore creates a new mock of the
  3376. // loginSourceFilesStore interface. All methods return zero values for all
  3377. // results, unless overwritten.
  3378. func NewMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  3379. return &MockLoginSourceFilesStore{
  3380. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  3381. defaultHook: func(int64) (r0 *LoginSource, r1 error) {
  3382. return
  3383. },
  3384. },
  3385. LenFunc: &LoginSourceFilesStoreLenFunc{
  3386. defaultHook: func() (r0 int) {
  3387. return
  3388. },
  3389. },
  3390. ListFunc: &LoginSourceFilesStoreListFunc{
  3391. defaultHook: func(ListLoginSourceOpts) (r0 []*LoginSource) {
  3392. return
  3393. },
  3394. },
  3395. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  3396. defaultHook: func(*LoginSource) {
  3397. return
  3398. },
  3399. },
  3400. }
  3401. }
  3402. // NewStrictMockLoginSourceFilesStore creates a new mock of the
  3403. // loginSourceFilesStore interface. All methods panic on invocation, unless
  3404. // overwritten.
  3405. func NewStrictMockLoginSourceFilesStore() *MockLoginSourceFilesStore {
  3406. return &MockLoginSourceFilesStore{
  3407. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  3408. defaultHook: func(int64) (*LoginSource, error) {
  3409. panic("unexpected invocation of MockLoginSourceFilesStore.GetByID")
  3410. },
  3411. },
  3412. LenFunc: &LoginSourceFilesStoreLenFunc{
  3413. defaultHook: func() int {
  3414. panic("unexpected invocation of MockLoginSourceFilesStore.Len")
  3415. },
  3416. },
  3417. ListFunc: &LoginSourceFilesStoreListFunc{
  3418. defaultHook: func(ListLoginSourceOpts) []*LoginSource {
  3419. panic("unexpected invocation of MockLoginSourceFilesStore.List")
  3420. },
  3421. },
  3422. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  3423. defaultHook: func(*LoginSource) {
  3424. panic("unexpected invocation of MockLoginSourceFilesStore.Update")
  3425. },
  3426. },
  3427. }
  3428. }
  3429. // surrogateMockLoginSourceFilesStore is a copy of the loginSourceFilesStore
  3430. // interface (from the package gogs.io/gogs/internal/db). It is redefined
  3431. // here as it is unexported in the source package.
  3432. type surrogateMockLoginSourceFilesStore interface {
  3433. GetByID(int64) (*LoginSource, error)
  3434. Len() int
  3435. List(ListLoginSourceOpts) []*LoginSource
  3436. Update(*LoginSource)
  3437. }
  3438. // NewMockLoginSourceFilesStoreFrom creates a new mock of the
  3439. // MockLoginSourceFilesStore interface. All methods delegate to the given
  3440. // implementation, unless overwritten.
  3441. func NewMockLoginSourceFilesStoreFrom(i surrogateMockLoginSourceFilesStore) *MockLoginSourceFilesStore {
  3442. return &MockLoginSourceFilesStore{
  3443. GetByIDFunc: &LoginSourceFilesStoreGetByIDFunc{
  3444. defaultHook: i.GetByID,
  3445. },
  3446. LenFunc: &LoginSourceFilesStoreLenFunc{
  3447. defaultHook: i.Len,
  3448. },
  3449. ListFunc: &LoginSourceFilesStoreListFunc{
  3450. defaultHook: i.List,
  3451. },
  3452. UpdateFunc: &LoginSourceFilesStoreUpdateFunc{
  3453. defaultHook: i.Update,
  3454. },
  3455. }
  3456. }
  3457. // LoginSourceFilesStoreGetByIDFunc describes the behavior when the GetByID
  3458. // method of the parent MockLoginSourceFilesStore instance is invoked.
  3459. type LoginSourceFilesStoreGetByIDFunc struct {
  3460. defaultHook func(int64) (*LoginSource, error)
  3461. hooks []func(int64) (*LoginSource, error)
  3462. history []LoginSourceFilesStoreGetByIDFuncCall
  3463. mutex sync.Mutex
  3464. }
  3465. // GetByID delegates to the next hook function in the queue and stores the
  3466. // parameter and result values of this invocation.
  3467. func (m *MockLoginSourceFilesStore) GetByID(v0 int64) (*LoginSource, error) {
  3468. r0, r1 := m.GetByIDFunc.nextHook()(v0)
  3469. m.GetByIDFunc.appendCall(LoginSourceFilesStoreGetByIDFuncCall{v0, r0, r1})
  3470. return r0, r1
  3471. }
  3472. // SetDefaultHook sets function that is called when the GetByID method of
  3473. // the parent MockLoginSourceFilesStore instance is invoked and the hook
  3474. // queue is empty.
  3475. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultHook(hook func(int64) (*LoginSource, error)) {
  3476. f.defaultHook = hook
  3477. }
  3478. // PushHook adds a function to the end of hook queue. Each invocation of the
  3479. // GetByID method of the parent MockLoginSourceFilesStore instance invokes
  3480. // the hook at the front of the queue and discards it. After the queue is
  3481. // empty, the default hook function is invoked for any future action.
  3482. func (f *LoginSourceFilesStoreGetByIDFunc) PushHook(hook func(int64) (*LoginSource, error)) {
  3483. f.mutex.Lock()
  3484. f.hooks = append(f.hooks, hook)
  3485. f.mutex.Unlock()
  3486. }
  3487. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3488. // given values.
  3489. func (f *LoginSourceFilesStoreGetByIDFunc) SetDefaultReturn(r0 *LoginSource, r1 error) {
  3490. f.SetDefaultHook(func(int64) (*LoginSource, error) {
  3491. return r0, r1
  3492. })
  3493. }
  3494. // PushReturn calls PushHook with a function that returns the given values.
  3495. func (f *LoginSourceFilesStoreGetByIDFunc) PushReturn(r0 *LoginSource, r1 error) {
  3496. f.PushHook(func(int64) (*LoginSource, error) {
  3497. return r0, r1
  3498. })
  3499. }
  3500. func (f *LoginSourceFilesStoreGetByIDFunc) nextHook() func(int64) (*LoginSource, error) {
  3501. f.mutex.Lock()
  3502. defer f.mutex.Unlock()
  3503. if len(f.hooks) == 0 {
  3504. return f.defaultHook
  3505. }
  3506. hook := f.hooks[0]
  3507. f.hooks = f.hooks[1:]
  3508. return hook
  3509. }
  3510. func (f *LoginSourceFilesStoreGetByIDFunc) appendCall(r0 LoginSourceFilesStoreGetByIDFuncCall) {
  3511. f.mutex.Lock()
  3512. f.history = append(f.history, r0)
  3513. f.mutex.Unlock()
  3514. }
  3515. // History returns a sequence of LoginSourceFilesStoreGetByIDFuncCall
  3516. // objects describing the invocations of this function.
  3517. func (f *LoginSourceFilesStoreGetByIDFunc) History() []LoginSourceFilesStoreGetByIDFuncCall {
  3518. f.mutex.Lock()
  3519. history := make([]LoginSourceFilesStoreGetByIDFuncCall, len(f.history))
  3520. copy(history, f.history)
  3521. f.mutex.Unlock()
  3522. return history
  3523. }
  3524. // LoginSourceFilesStoreGetByIDFuncCall is an object that describes an
  3525. // invocation of method GetByID on an instance of MockLoginSourceFilesStore.
  3526. type LoginSourceFilesStoreGetByIDFuncCall struct {
  3527. // Arg0 is the value of the 1st argument passed to this method
  3528. // invocation.
  3529. Arg0 int64
  3530. // Result0 is the value of the 1st result returned from this method
  3531. // invocation.
  3532. Result0 *LoginSource
  3533. // Result1 is the value of the 2nd result returned from this method
  3534. // invocation.
  3535. Result1 error
  3536. }
  3537. // Args returns an interface slice containing the arguments of this
  3538. // invocation.
  3539. func (c LoginSourceFilesStoreGetByIDFuncCall) Args() []interface{} {
  3540. return []interface{}{c.Arg0}
  3541. }
  3542. // Results returns an interface slice containing the results of this
  3543. // invocation.
  3544. func (c LoginSourceFilesStoreGetByIDFuncCall) Results() []interface{} {
  3545. return []interface{}{c.Result0, c.Result1}
  3546. }
  3547. // LoginSourceFilesStoreLenFunc describes the behavior when the Len method
  3548. // of the parent MockLoginSourceFilesStore instance is invoked.
  3549. type LoginSourceFilesStoreLenFunc struct {
  3550. defaultHook func() int
  3551. hooks []func() int
  3552. history []LoginSourceFilesStoreLenFuncCall
  3553. mutex sync.Mutex
  3554. }
  3555. // Len delegates to the next hook function in the queue and stores the
  3556. // parameter and result values of this invocation.
  3557. func (m *MockLoginSourceFilesStore) Len() int {
  3558. r0 := m.LenFunc.nextHook()()
  3559. m.LenFunc.appendCall(LoginSourceFilesStoreLenFuncCall{r0})
  3560. return r0
  3561. }
  3562. // SetDefaultHook sets function that is called when the Len method of the
  3563. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  3564. // is empty.
  3565. func (f *LoginSourceFilesStoreLenFunc) SetDefaultHook(hook func() int) {
  3566. f.defaultHook = hook
  3567. }
  3568. // PushHook adds a function to the end of hook queue. Each invocation of the
  3569. // Len method of the parent MockLoginSourceFilesStore instance invokes the
  3570. // hook at the front of the queue and discards it. After the queue is empty,
  3571. // the default hook function is invoked for any future action.
  3572. func (f *LoginSourceFilesStoreLenFunc) PushHook(hook func() int) {
  3573. f.mutex.Lock()
  3574. f.hooks = append(f.hooks, hook)
  3575. f.mutex.Unlock()
  3576. }
  3577. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3578. // given values.
  3579. func (f *LoginSourceFilesStoreLenFunc) SetDefaultReturn(r0 int) {
  3580. f.SetDefaultHook(func() int {
  3581. return r0
  3582. })
  3583. }
  3584. // PushReturn calls PushHook with a function that returns the given values.
  3585. func (f *LoginSourceFilesStoreLenFunc) PushReturn(r0 int) {
  3586. f.PushHook(func() int {
  3587. return r0
  3588. })
  3589. }
  3590. func (f *LoginSourceFilesStoreLenFunc) nextHook() func() int {
  3591. f.mutex.Lock()
  3592. defer f.mutex.Unlock()
  3593. if len(f.hooks) == 0 {
  3594. return f.defaultHook
  3595. }
  3596. hook := f.hooks[0]
  3597. f.hooks = f.hooks[1:]
  3598. return hook
  3599. }
  3600. func (f *LoginSourceFilesStoreLenFunc) appendCall(r0 LoginSourceFilesStoreLenFuncCall) {
  3601. f.mutex.Lock()
  3602. f.history = append(f.history, r0)
  3603. f.mutex.Unlock()
  3604. }
  3605. // History returns a sequence of LoginSourceFilesStoreLenFuncCall objects
  3606. // describing the invocations of this function.
  3607. func (f *LoginSourceFilesStoreLenFunc) History() []LoginSourceFilesStoreLenFuncCall {
  3608. f.mutex.Lock()
  3609. history := make([]LoginSourceFilesStoreLenFuncCall, len(f.history))
  3610. copy(history, f.history)
  3611. f.mutex.Unlock()
  3612. return history
  3613. }
  3614. // LoginSourceFilesStoreLenFuncCall is an object that describes an
  3615. // invocation of method Len on an instance of MockLoginSourceFilesStore.
  3616. type LoginSourceFilesStoreLenFuncCall struct {
  3617. // Result0 is the value of the 1st result returned from this method
  3618. // invocation.
  3619. Result0 int
  3620. }
  3621. // Args returns an interface slice containing the arguments of this
  3622. // invocation.
  3623. func (c LoginSourceFilesStoreLenFuncCall) Args() []interface{} {
  3624. return []interface{}{}
  3625. }
  3626. // Results returns an interface slice containing the results of this
  3627. // invocation.
  3628. func (c LoginSourceFilesStoreLenFuncCall) Results() []interface{} {
  3629. return []interface{}{c.Result0}
  3630. }
  3631. // LoginSourceFilesStoreListFunc describes the behavior when the List method
  3632. // of the parent MockLoginSourceFilesStore instance is invoked.
  3633. type LoginSourceFilesStoreListFunc struct {
  3634. defaultHook func(ListLoginSourceOpts) []*LoginSource
  3635. hooks []func(ListLoginSourceOpts) []*LoginSource
  3636. history []LoginSourceFilesStoreListFuncCall
  3637. mutex sync.Mutex
  3638. }
  3639. // List delegates to the next hook function in the queue and stores the
  3640. // parameter and result values of this invocation.
  3641. func (m *MockLoginSourceFilesStore) List(v0 ListLoginSourceOpts) []*LoginSource {
  3642. r0 := m.ListFunc.nextHook()(v0)
  3643. m.ListFunc.appendCall(LoginSourceFilesStoreListFuncCall{v0, r0})
  3644. return r0
  3645. }
  3646. // SetDefaultHook sets function that is called when the List method of the
  3647. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  3648. // is empty.
  3649. func (f *LoginSourceFilesStoreListFunc) SetDefaultHook(hook func(ListLoginSourceOpts) []*LoginSource) {
  3650. f.defaultHook = hook
  3651. }
  3652. // PushHook adds a function to the end of hook queue. Each invocation of the
  3653. // List method of the parent MockLoginSourceFilesStore instance invokes the
  3654. // hook at the front of the queue and discards it. After the queue is empty,
  3655. // the default hook function is invoked for any future action.
  3656. func (f *LoginSourceFilesStoreListFunc) PushHook(hook func(ListLoginSourceOpts) []*LoginSource) {
  3657. f.mutex.Lock()
  3658. f.hooks = append(f.hooks, hook)
  3659. f.mutex.Unlock()
  3660. }
  3661. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3662. // given values.
  3663. func (f *LoginSourceFilesStoreListFunc) SetDefaultReturn(r0 []*LoginSource) {
  3664. f.SetDefaultHook(func(ListLoginSourceOpts) []*LoginSource {
  3665. return r0
  3666. })
  3667. }
  3668. // PushReturn calls PushHook with a function that returns the given values.
  3669. func (f *LoginSourceFilesStoreListFunc) PushReturn(r0 []*LoginSource) {
  3670. f.PushHook(func(ListLoginSourceOpts) []*LoginSource {
  3671. return r0
  3672. })
  3673. }
  3674. func (f *LoginSourceFilesStoreListFunc) nextHook() func(ListLoginSourceOpts) []*LoginSource {
  3675. f.mutex.Lock()
  3676. defer f.mutex.Unlock()
  3677. if len(f.hooks) == 0 {
  3678. return f.defaultHook
  3679. }
  3680. hook := f.hooks[0]
  3681. f.hooks = f.hooks[1:]
  3682. return hook
  3683. }
  3684. func (f *LoginSourceFilesStoreListFunc) appendCall(r0 LoginSourceFilesStoreListFuncCall) {
  3685. f.mutex.Lock()
  3686. f.history = append(f.history, r0)
  3687. f.mutex.Unlock()
  3688. }
  3689. // History returns a sequence of LoginSourceFilesStoreListFuncCall objects
  3690. // describing the invocations of this function.
  3691. func (f *LoginSourceFilesStoreListFunc) History() []LoginSourceFilesStoreListFuncCall {
  3692. f.mutex.Lock()
  3693. history := make([]LoginSourceFilesStoreListFuncCall, len(f.history))
  3694. copy(history, f.history)
  3695. f.mutex.Unlock()
  3696. return history
  3697. }
  3698. // LoginSourceFilesStoreListFuncCall is an object that describes an
  3699. // invocation of method List on an instance of MockLoginSourceFilesStore.
  3700. type LoginSourceFilesStoreListFuncCall struct {
  3701. // Arg0 is the value of the 1st argument passed to this method
  3702. // invocation.
  3703. Arg0 ListLoginSourceOpts
  3704. // Result0 is the value of the 1st result returned from this method
  3705. // invocation.
  3706. Result0 []*LoginSource
  3707. }
  3708. // Args returns an interface slice containing the arguments of this
  3709. // invocation.
  3710. func (c LoginSourceFilesStoreListFuncCall) Args() []interface{} {
  3711. return []interface{}{c.Arg0}
  3712. }
  3713. // Results returns an interface slice containing the results of this
  3714. // invocation.
  3715. func (c LoginSourceFilesStoreListFuncCall) Results() []interface{} {
  3716. return []interface{}{c.Result0}
  3717. }
  3718. // LoginSourceFilesStoreUpdateFunc describes the behavior when the Update
  3719. // method of the parent MockLoginSourceFilesStore instance is invoked.
  3720. type LoginSourceFilesStoreUpdateFunc struct {
  3721. defaultHook func(*LoginSource)
  3722. hooks []func(*LoginSource)
  3723. history []LoginSourceFilesStoreUpdateFuncCall
  3724. mutex sync.Mutex
  3725. }
  3726. // Update delegates to the next hook function in the queue and stores the
  3727. // parameter and result values of this invocation.
  3728. func (m *MockLoginSourceFilesStore) Update(v0 *LoginSource) {
  3729. m.UpdateFunc.nextHook()(v0)
  3730. m.UpdateFunc.appendCall(LoginSourceFilesStoreUpdateFuncCall{v0})
  3731. return
  3732. }
  3733. // SetDefaultHook sets function that is called when the Update method of the
  3734. // parent MockLoginSourceFilesStore instance is invoked and the hook queue
  3735. // is empty.
  3736. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultHook(hook func(*LoginSource)) {
  3737. f.defaultHook = hook
  3738. }
  3739. // PushHook adds a function to the end of hook queue. Each invocation of the
  3740. // Update method of the parent MockLoginSourceFilesStore instance invokes
  3741. // the hook at the front of the queue and discards it. After the queue is
  3742. // empty, the default hook function is invoked for any future action.
  3743. func (f *LoginSourceFilesStoreUpdateFunc) PushHook(hook func(*LoginSource)) {
  3744. f.mutex.Lock()
  3745. f.hooks = append(f.hooks, hook)
  3746. f.mutex.Unlock()
  3747. }
  3748. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3749. // given values.
  3750. func (f *LoginSourceFilesStoreUpdateFunc) SetDefaultReturn() {
  3751. f.SetDefaultHook(func(*LoginSource) {
  3752. return
  3753. })
  3754. }
  3755. // PushReturn calls PushHook with a function that returns the given values.
  3756. func (f *LoginSourceFilesStoreUpdateFunc) PushReturn() {
  3757. f.PushHook(func(*LoginSource) {
  3758. return
  3759. })
  3760. }
  3761. func (f *LoginSourceFilesStoreUpdateFunc) nextHook() func(*LoginSource) {
  3762. f.mutex.Lock()
  3763. defer f.mutex.Unlock()
  3764. if len(f.hooks) == 0 {
  3765. return f.defaultHook
  3766. }
  3767. hook := f.hooks[0]
  3768. f.hooks = f.hooks[1:]
  3769. return hook
  3770. }
  3771. func (f *LoginSourceFilesStoreUpdateFunc) appendCall(r0 LoginSourceFilesStoreUpdateFuncCall) {
  3772. f.mutex.Lock()
  3773. f.history = append(f.history, r0)
  3774. f.mutex.Unlock()
  3775. }
  3776. // History returns a sequence of LoginSourceFilesStoreUpdateFuncCall objects
  3777. // describing the invocations of this function.
  3778. func (f *LoginSourceFilesStoreUpdateFunc) History() []LoginSourceFilesStoreUpdateFuncCall {
  3779. f.mutex.Lock()
  3780. history := make([]LoginSourceFilesStoreUpdateFuncCall, len(f.history))
  3781. copy(history, f.history)
  3782. f.mutex.Unlock()
  3783. return history
  3784. }
  3785. // LoginSourceFilesStoreUpdateFuncCall is an object that describes an
  3786. // invocation of method Update on an instance of MockLoginSourceFilesStore.
  3787. type LoginSourceFilesStoreUpdateFuncCall struct {
  3788. // Arg0 is the value of the 1st argument passed to this method
  3789. // invocation.
  3790. Arg0 *LoginSource
  3791. }
  3792. // Args returns an interface slice containing the arguments of this
  3793. // invocation.
  3794. func (c LoginSourceFilesStoreUpdateFuncCall) Args() []interface{} {
  3795. return []interface{}{c.Arg0}
  3796. }
  3797. // Results returns an interface slice containing the results of this
  3798. // invocation.
  3799. func (c LoginSourceFilesStoreUpdateFuncCall) Results() []interface{} {
  3800. return []interface{}{}
  3801. }