mocks.go 150 KB

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