mocks_test.go 167 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869
  1. // Code generated by go-mockgen 1.3.7; DO NOT EDIT.
  2. //
  3. // This file was generated by running `go-mockgen` at the root of this repository.
  4. // To add additional mocks to this or another package, add a new entry to the
  5. // mockgen.yaml file in the root of this repository.
  6. package lfs
  7. import (
  8. "context"
  9. "sync"
  10. database "gogs.io/gogs/internal/database"
  11. lfsutil "gogs.io/gogs/internal/lfsutil"
  12. )
  13. // MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
  14. // interface (from the package gogs.io/gogs/internal/database) used for unit
  15. // testing.
  16. type MockTwoFactorsStore struct {
  17. // CreateFunc is an instance of a mock function object controlling the
  18. // behavior of the method Create.
  19. CreateFunc *TwoFactorsStoreCreateFunc
  20. // GetByUserIDFunc is an instance of a mock function object controlling
  21. // the behavior of the method GetByUserID.
  22. GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
  23. // IsEnabledFunc is an instance of a mock function object controlling
  24. // the behavior of the method IsEnabled.
  25. IsEnabledFunc *TwoFactorsStoreIsEnabledFunc
  26. }
  27. // NewMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  28. // interface. All methods return zero values for all results, unless
  29. // overwritten.
  30. func NewMockTwoFactorsStore() *MockTwoFactorsStore {
  31. return &MockTwoFactorsStore{
  32. CreateFunc: &TwoFactorsStoreCreateFunc{
  33. defaultHook: func(context.Context, int64, string, string) (r0 error) {
  34. return
  35. },
  36. },
  37. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  38. defaultHook: func(context.Context, int64) (r0 *database.TwoFactor, r1 error) {
  39. return
  40. },
  41. },
  42. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  43. defaultHook: func(context.Context, int64) (r0 bool) {
  44. return
  45. },
  46. },
  47. }
  48. }
  49. // NewStrictMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  50. // interface. All methods panic on invocation, unless overwritten.
  51. func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
  52. return &MockTwoFactorsStore{
  53. CreateFunc: &TwoFactorsStoreCreateFunc{
  54. defaultHook: func(context.Context, int64, string, string) error {
  55. panic("unexpected invocation of MockTwoFactorsStore.Create")
  56. },
  57. },
  58. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  59. defaultHook: func(context.Context, int64) (*database.TwoFactor, error) {
  60. panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
  61. },
  62. },
  63. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  64. defaultHook: func(context.Context, int64) bool {
  65. panic("unexpected invocation of MockTwoFactorsStore.IsEnabled")
  66. },
  67. },
  68. }
  69. }
  70. // NewMockTwoFactorsStoreFrom creates a new mock of the MockTwoFactorsStore
  71. // interface. All methods delegate to the given implementation, unless
  72. // overwritten.
  73. func NewMockTwoFactorsStoreFrom(i database.TwoFactorsStore) *MockTwoFactorsStore {
  74. return &MockTwoFactorsStore{
  75. CreateFunc: &TwoFactorsStoreCreateFunc{
  76. defaultHook: i.Create,
  77. },
  78. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  79. defaultHook: i.GetByUserID,
  80. },
  81. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  82. defaultHook: i.IsEnabled,
  83. },
  84. }
  85. }
  86. // TwoFactorsStoreCreateFunc describes the behavior when the Create method
  87. // of the parent MockTwoFactorsStore instance is invoked.
  88. type TwoFactorsStoreCreateFunc struct {
  89. defaultHook func(context.Context, int64, string, string) error
  90. hooks []func(context.Context, int64, string, string) error
  91. history []TwoFactorsStoreCreateFuncCall
  92. mutex sync.Mutex
  93. }
  94. // Create delegates to the next hook function in the queue and stores the
  95. // parameter and result values of this invocation.
  96. func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
  97. r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  98. m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
  99. return r0
  100. }
  101. // SetDefaultHook sets function that is called when the Create method of the
  102. // parent MockTwoFactorsStore instance is invoked and the hook queue is
  103. // empty.
  104. func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
  105. f.defaultHook = hook
  106. }
  107. // PushHook adds a function to the end of hook queue. Each invocation of the
  108. // Create method of the parent MockTwoFactorsStore instance invokes the hook
  109. // at the front of the queue and discards it. After the queue is empty, the
  110. // default hook function is invoked for any future action.
  111. func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
  112. f.mutex.Lock()
  113. f.hooks = append(f.hooks, hook)
  114. f.mutex.Unlock()
  115. }
  116. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  117. // given values.
  118. func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
  119. f.SetDefaultHook(func(context.Context, int64, string, string) error {
  120. return r0
  121. })
  122. }
  123. // PushReturn calls PushHook with a function that returns the given values.
  124. func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
  125. f.PushHook(func(context.Context, int64, string, string) error {
  126. return r0
  127. })
  128. }
  129. func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
  130. f.mutex.Lock()
  131. defer f.mutex.Unlock()
  132. if len(f.hooks) == 0 {
  133. return f.defaultHook
  134. }
  135. hook := f.hooks[0]
  136. f.hooks = f.hooks[1:]
  137. return hook
  138. }
  139. func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
  140. f.mutex.Lock()
  141. f.history = append(f.history, r0)
  142. f.mutex.Unlock()
  143. }
  144. // History returns a sequence of TwoFactorsStoreCreateFuncCall objects
  145. // describing the invocations of this function.
  146. func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
  147. f.mutex.Lock()
  148. history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
  149. copy(history, f.history)
  150. f.mutex.Unlock()
  151. return history
  152. }
  153. // TwoFactorsStoreCreateFuncCall is an object that describes an invocation
  154. // of method Create on an instance of MockTwoFactorsStore.
  155. type TwoFactorsStoreCreateFuncCall struct {
  156. // Arg0 is the value of the 1st argument passed to this method
  157. // invocation.
  158. Arg0 context.Context
  159. // Arg1 is the value of the 2nd argument passed to this method
  160. // invocation.
  161. Arg1 int64
  162. // Arg2 is the value of the 3rd argument passed to this method
  163. // invocation.
  164. Arg2 string
  165. // Arg3 is the value of the 4th argument passed to this method
  166. // invocation.
  167. Arg3 string
  168. // Result0 is the value of the 1st result returned from this method
  169. // invocation.
  170. Result0 error
  171. }
  172. // Args returns an interface slice containing the arguments of this
  173. // invocation.
  174. func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
  175. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  176. }
  177. // Results returns an interface slice containing the results of this
  178. // invocation.
  179. func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
  180. return []interface{}{c.Result0}
  181. }
  182. // TwoFactorsStoreGetByUserIDFunc describes the behavior when the
  183. // GetByUserID method of the parent MockTwoFactorsStore instance is invoked.
  184. type TwoFactorsStoreGetByUserIDFunc struct {
  185. defaultHook func(context.Context, int64) (*database.TwoFactor, error)
  186. hooks []func(context.Context, int64) (*database.TwoFactor, error)
  187. history []TwoFactorsStoreGetByUserIDFuncCall
  188. mutex sync.Mutex
  189. }
  190. // GetByUserID delegates to the next hook function in the queue and stores
  191. // the parameter and result values of this invocation.
  192. func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*database.TwoFactor, error) {
  193. r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
  194. m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
  195. return r0, r1
  196. }
  197. // SetDefaultHook sets function that is called when the GetByUserID method
  198. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  199. // is empty.
  200. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*database.TwoFactor, error)) {
  201. f.defaultHook = hook
  202. }
  203. // PushHook adds a function to the end of hook queue. Each invocation of the
  204. // GetByUserID method of the parent MockTwoFactorsStore instance invokes the
  205. // hook at the front of the queue and discards it. After the queue is empty,
  206. // the default hook function is invoked for any future action.
  207. func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*database.TwoFactor, error)) {
  208. f.mutex.Lock()
  209. f.hooks = append(f.hooks, hook)
  210. f.mutex.Unlock()
  211. }
  212. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  213. // given values.
  214. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *database.TwoFactor, r1 error) {
  215. f.SetDefaultHook(func(context.Context, int64) (*database.TwoFactor, error) {
  216. return r0, r1
  217. })
  218. }
  219. // PushReturn calls PushHook with a function that returns the given values.
  220. func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *database.TwoFactor, r1 error) {
  221. f.PushHook(func(context.Context, int64) (*database.TwoFactor, error) {
  222. return r0, r1
  223. })
  224. }
  225. func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*database.TwoFactor, error) {
  226. f.mutex.Lock()
  227. defer f.mutex.Unlock()
  228. if len(f.hooks) == 0 {
  229. return f.defaultHook
  230. }
  231. hook := f.hooks[0]
  232. f.hooks = f.hooks[1:]
  233. return hook
  234. }
  235. func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
  236. f.mutex.Lock()
  237. f.history = append(f.history, r0)
  238. f.mutex.Unlock()
  239. }
  240. // History returns a sequence of TwoFactorsStoreGetByUserIDFuncCall objects
  241. // describing the invocations of this function.
  242. func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
  243. f.mutex.Lock()
  244. history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
  245. copy(history, f.history)
  246. f.mutex.Unlock()
  247. return history
  248. }
  249. // TwoFactorsStoreGetByUserIDFuncCall is an object that describes an
  250. // invocation of method GetByUserID on an instance of MockTwoFactorsStore.
  251. type TwoFactorsStoreGetByUserIDFuncCall struct {
  252. // Arg0 is the value of the 1st argument passed to this method
  253. // invocation.
  254. Arg0 context.Context
  255. // Arg1 is the value of the 2nd argument passed to this method
  256. // invocation.
  257. Arg1 int64
  258. // Result0 is the value of the 1st result returned from this method
  259. // invocation.
  260. Result0 *database.TwoFactor
  261. // Result1 is the value of the 2nd result returned from this method
  262. // invocation.
  263. Result1 error
  264. }
  265. // Args returns an interface slice containing the arguments of this
  266. // invocation.
  267. func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
  268. return []interface{}{c.Arg0, c.Arg1}
  269. }
  270. // Results returns an interface slice containing the results of this
  271. // invocation.
  272. func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
  273. return []interface{}{c.Result0, c.Result1}
  274. }
  275. // TwoFactorsStoreIsEnabledFunc describes the behavior when the IsEnabled
  276. // method of the parent MockTwoFactorsStore instance is invoked.
  277. type TwoFactorsStoreIsEnabledFunc struct {
  278. defaultHook func(context.Context, int64) bool
  279. hooks []func(context.Context, int64) bool
  280. history []TwoFactorsStoreIsEnabledFuncCall
  281. mutex sync.Mutex
  282. }
  283. // IsEnabled delegates to the next hook function in the queue and stores the
  284. // parameter and result values of this invocation.
  285. func (m *MockTwoFactorsStore) IsEnabled(v0 context.Context, v1 int64) bool {
  286. r0 := m.IsEnabledFunc.nextHook()(v0, v1)
  287. m.IsEnabledFunc.appendCall(TwoFactorsStoreIsEnabledFuncCall{v0, v1, r0})
  288. return r0
  289. }
  290. // SetDefaultHook sets function that is called when the IsEnabled method of
  291. // the parent MockTwoFactorsStore instance is invoked and the hook queue is
  292. // empty.
  293. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
  294. f.defaultHook = hook
  295. }
  296. // PushHook adds a function to the end of hook queue. Each invocation of the
  297. // IsEnabled method of the parent MockTwoFactorsStore instance invokes the
  298. // hook at the front of the queue and discards it. After the queue is empty,
  299. // the default hook function is invoked for any future action.
  300. func (f *TwoFactorsStoreIsEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
  301. f.mutex.Lock()
  302. f.hooks = append(f.hooks, hook)
  303. f.mutex.Unlock()
  304. }
  305. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  306. // given values.
  307. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultReturn(r0 bool) {
  308. f.SetDefaultHook(func(context.Context, int64) bool {
  309. return r0
  310. })
  311. }
  312. // PushReturn calls PushHook with a function that returns the given values.
  313. func (f *TwoFactorsStoreIsEnabledFunc) PushReturn(r0 bool) {
  314. f.PushHook(func(context.Context, int64) bool {
  315. return r0
  316. })
  317. }
  318. func (f *TwoFactorsStoreIsEnabledFunc) nextHook() func(context.Context, int64) bool {
  319. f.mutex.Lock()
  320. defer f.mutex.Unlock()
  321. if len(f.hooks) == 0 {
  322. return f.defaultHook
  323. }
  324. hook := f.hooks[0]
  325. f.hooks = f.hooks[1:]
  326. return hook
  327. }
  328. func (f *TwoFactorsStoreIsEnabledFunc) appendCall(r0 TwoFactorsStoreIsEnabledFuncCall) {
  329. f.mutex.Lock()
  330. f.history = append(f.history, r0)
  331. f.mutex.Unlock()
  332. }
  333. // History returns a sequence of TwoFactorsStoreIsEnabledFuncCall objects
  334. // describing the invocations of this function.
  335. func (f *TwoFactorsStoreIsEnabledFunc) History() []TwoFactorsStoreIsEnabledFuncCall {
  336. f.mutex.Lock()
  337. history := make([]TwoFactorsStoreIsEnabledFuncCall, len(f.history))
  338. copy(history, f.history)
  339. f.mutex.Unlock()
  340. return history
  341. }
  342. // TwoFactorsStoreIsEnabledFuncCall is an object that describes an
  343. // invocation of method IsEnabled on an instance of MockTwoFactorsStore.
  344. type TwoFactorsStoreIsEnabledFuncCall struct {
  345. // Arg0 is the value of the 1st argument passed to this method
  346. // invocation.
  347. Arg0 context.Context
  348. // Arg1 is the value of the 2nd argument passed to this method
  349. // invocation.
  350. Arg1 int64
  351. // Result0 is the value of the 1st result returned from this method
  352. // invocation.
  353. Result0 bool
  354. }
  355. // Args returns an interface slice containing the arguments of this
  356. // invocation.
  357. func (c TwoFactorsStoreIsEnabledFuncCall) Args() []interface{} {
  358. return []interface{}{c.Arg0, c.Arg1}
  359. }
  360. // Results returns an interface slice containing the results of this
  361. // invocation.
  362. func (c TwoFactorsStoreIsEnabledFuncCall) Results() []interface{} {
  363. return []interface{}{c.Result0}
  364. }
  365. // MockUsersStore is a mock implementation of the UsersStore interface (from
  366. // the package gogs.io/gogs/internal/database) used for unit testing.
  367. type MockUsersStore struct {
  368. // AddEmailFunc is an instance of a mock function object controlling the
  369. // behavior of the method AddEmail.
  370. AddEmailFunc *UsersStoreAddEmailFunc
  371. // AuthenticateFunc is an instance of a mock function object controlling
  372. // the behavior of the method Authenticate.
  373. AuthenticateFunc *UsersStoreAuthenticateFunc
  374. // ChangeUsernameFunc is an instance of a mock function object
  375. // controlling the behavior of the method ChangeUsername.
  376. ChangeUsernameFunc *UsersStoreChangeUsernameFunc
  377. // CountFunc is an instance of a mock function object controlling the
  378. // behavior of the method Count.
  379. CountFunc *UsersStoreCountFunc
  380. // CreateFunc is an instance of a mock function object controlling the
  381. // behavior of the method Create.
  382. CreateFunc *UsersStoreCreateFunc
  383. // DeleteByIDFunc is an instance of a mock function object controlling
  384. // the behavior of the method DeleteByID.
  385. DeleteByIDFunc *UsersStoreDeleteByIDFunc
  386. // DeleteCustomAvatarFunc is an instance of a mock function object
  387. // controlling the behavior of the method DeleteCustomAvatar.
  388. DeleteCustomAvatarFunc *UsersStoreDeleteCustomAvatarFunc
  389. // DeleteEmailFunc is an instance of a mock function object controlling
  390. // the behavior of the method DeleteEmail.
  391. DeleteEmailFunc *UsersStoreDeleteEmailFunc
  392. // DeleteInactivatedFunc is an instance of a mock function object
  393. // controlling the behavior of the method DeleteInactivated.
  394. DeleteInactivatedFunc *UsersStoreDeleteInactivatedFunc
  395. // FollowFunc is an instance of a mock function object controlling the
  396. // behavior of the method Follow.
  397. FollowFunc *UsersStoreFollowFunc
  398. // GetByEmailFunc is an instance of a mock function object controlling
  399. // the behavior of the method GetByEmail.
  400. GetByEmailFunc *UsersStoreGetByEmailFunc
  401. // GetByIDFunc is an instance of a mock function object controlling the
  402. // behavior of the method GetByID.
  403. GetByIDFunc *UsersStoreGetByIDFunc
  404. // GetByKeyIDFunc is an instance of a mock function object controlling
  405. // the behavior of the method GetByKeyID.
  406. GetByKeyIDFunc *UsersStoreGetByKeyIDFunc
  407. // GetByUsernameFunc is an instance of a mock function object
  408. // controlling the behavior of the method GetByUsername.
  409. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  410. // GetEmailFunc is an instance of a mock function object controlling the
  411. // behavior of the method GetEmail.
  412. GetEmailFunc *UsersStoreGetEmailFunc
  413. // GetMailableEmailsByUsernamesFunc is an instance of a mock function
  414. // object controlling the behavior of the method
  415. // GetMailableEmailsByUsernames.
  416. GetMailableEmailsByUsernamesFunc *UsersStoreGetMailableEmailsByUsernamesFunc
  417. // IsFollowingFunc is an instance of a mock function object controlling
  418. // the behavior of the method IsFollowing.
  419. IsFollowingFunc *UsersStoreIsFollowingFunc
  420. // IsUsernameUsedFunc is an instance of a mock function object
  421. // controlling the behavior of the method IsUsernameUsed.
  422. IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
  423. // ListFunc is an instance of a mock function object controlling the
  424. // behavior of the method List.
  425. ListFunc *UsersStoreListFunc
  426. // ListEmailsFunc is an instance of a mock function object controlling
  427. // the behavior of the method ListEmails.
  428. ListEmailsFunc *UsersStoreListEmailsFunc
  429. // ListFollowersFunc is an instance of a mock function object
  430. // controlling the behavior of the method ListFollowers.
  431. ListFollowersFunc *UsersStoreListFollowersFunc
  432. // ListFollowingsFunc is an instance of a mock function object
  433. // controlling the behavior of the method ListFollowings.
  434. ListFollowingsFunc *UsersStoreListFollowingsFunc
  435. // MarkEmailActivatedFunc is an instance of a mock function object
  436. // controlling the behavior of the method MarkEmailActivated.
  437. MarkEmailActivatedFunc *UsersStoreMarkEmailActivatedFunc
  438. // MarkEmailPrimaryFunc is an instance of a mock function object
  439. // controlling the behavior of the method MarkEmailPrimary.
  440. MarkEmailPrimaryFunc *UsersStoreMarkEmailPrimaryFunc
  441. // SearchByNameFunc is an instance of a mock function object controlling
  442. // the behavior of the method SearchByName.
  443. SearchByNameFunc *UsersStoreSearchByNameFunc
  444. // UnfollowFunc is an instance of a mock function object controlling the
  445. // behavior of the method Unfollow.
  446. UnfollowFunc *UsersStoreUnfollowFunc
  447. // UpdateFunc is an instance of a mock function object controlling the
  448. // behavior of the method Update.
  449. UpdateFunc *UsersStoreUpdateFunc
  450. // UseCustomAvatarFunc is an instance of a mock function object
  451. // controlling the behavior of the method UseCustomAvatar.
  452. UseCustomAvatarFunc *UsersStoreUseCustomAvatarFunc
  453. }
  454. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  455. // methods return zero values for all results, unless overwritten.
  456. func NewMockUsersStore() *MockUsersStore {
  457. return &MockUsersStore{
  458. AddEmailFunc: &UsersStoreAddEmailFunc{
  459. defaultHook: func(context.Context, int64, string, bool) (r0 error) {
  460. return
  461. },
  462. },
  463. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  464. defaultHook: func(context.Context, string, string, int64) (r0 *database.User, r1 error) {
  465. return
  466. },
  467. },
  468. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  469. defaultHook: func(context.Context, int64, string) (r0 error) {
  470. return
  471. },
  472. },
  473. CountFunc: &UsersStoreCountFunc{
  474. defaultHook: func(context.Context) (r0 int64) {
  475. return
  476. },
  477. },
  478. CreateFunc: &UsersStoreCreateFunc{
  479. defaultHook: func(context.Context, string, string, database.CreateUserOptions) (r0 *database.User, r1 error) {
  480. return
  481. },
  482. },
  483. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  484. defaultHook: func(context.Context, int64, bool) (r0 error) {
  485. return
  486. },
  487. },
  488. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  489. defaultHook: func(context.Context, int64) (r0 error) {
  490. return
  491. },
  492. },
  493. DeleteEmailFunc: &UsersStoreDeleteEmailFunc{
  494. defaultHook: func(context.Context, int64, string) (r0 error) {
  495. return
  496. },
  497. },
  498. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  499. defaultHook: func() (r0 error) {
  500. return
  501. },
  502. },
  503. FollowFunc: &UsersStoreFollowFunc{
  504. defaultHook: func(context.Context, int64, int64) (r0 error) {
  505. return
  506. },
  507. },
  508. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  509. defaultHook: func(context.Context, string) (r0 *database.User, r1 error) {
  510. return
  511. },
  512. },
  513. GetByIDFunc: &UsersStoreGetByIDFunc{
  514. defaultHook: func(context.Context, int64) (r0 *database.User, r1 error) {
  515. return
  516. },
  517. },
  518. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  519. defaultHook: func(context.Context, int64) (r0 *database.User, r1 error) {
  520. return
  521. },
  522. },
  523. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  524. defaultHook: func(context.Context, string) (r0 *database.User, r1 error) {
  525. return
  526. },
  527. },
  528. GetEmailFunc: &UsersStoreGetEmailFunc{
  529. defaultHook: func(context.Context, int64, string, bool) (r0 *database.EmailAddress, r1 error) {
  530. return
  531. },
  532. },
  533. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  534. defaultHook: func(context.Context, []string) (r0 []string, r1 error) {
  535. return
  536. },
  537. },
  538. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  539. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  540. return
  541. },
  542. },
  543. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  544. defaultHook: func(context.Context, string, int64) (r0 bool) {
  545. return
  546. },
  547. },
  548. ListFunc: &UsersStoreListFunc{
  549. defaultHook: func(context.Context, int, int) (r0 []*database.User, r1 error) {
  550. return
  551. },
  552. },
  553. ListEmailsFunc: &UsersStoreListEmailsFunc{
  554. defaultHook: func(context.Context, int64) (r0 []*database.EmailAddress, r1 error) {
  555. return
  556. },
  557. },
  558. ListFollowersFunc: &UsersStoreListFollowersFunc{
  559. defaultHook: func(context.Context, int64, int, int) (r0 []*database.User, r1 error) {
  560. return
  561. },
  562. },
  563. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  564. defaultHook: func(context.Context, int64, int, int) (r0 []*database.User, r1 error) {
  565. return
  566. },
  567. },
  568. MarkEmailActivatedFunc: &UsersStoreMarkEmailActivatedFunc{
  569. defaultHook: func(context.Context, int64, string) (r0 error) {
  570. return
  571. },
  572. },
  573. MarkEmailPrimaryFunc: &UsersStoreMarkEmailPrimaryFunc{
  574. defaultHook: func(context.Context, int64, string) (r0 error) {
  575. return
  576. },
  577. },
  578. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  579. defaultHook: func(context.Context, string, int, int, string) (r0 []*database.User, r1 int64, r2 error) {
  580. return
  581. },
  582. },
  583. UnfollowFunc: &UsersStoreUnfollowFunc{
  584. defaultHook: func(context.Context, int64, int64) (r0 error) {
  585. return
  586. },
  587. },
  588. UpdateFunc: &UsersStoreUpdateFunc{
  589. defaultHook: func(context.Context, int64, database.UpdateUserOptions) (r0 error) {
  590. return
  591. },
  592. },
  593. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  594. defaultHook: func(context.Context, int64, []byte) (r0 error) {
  595. return
  596. },
  597. },
  598. }
  599. }
  600. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  601. // All methods panic on invocation, unless overwritten.
  602. func NewStrictMockUsersStore() *MockUsersStore {
  603. return &MockUsersStore{
  604. AddEmailFunc: &UsersStoreAddEmailFunc{
  605. defaultHook: func(context.Context, int64, string, bool) error {
  606. panic("unexpected invocation of MockUsersStore.AddEmail")
  607. },
  608. },
  609. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  610. defaultHook: func(context.Context, string, string, int64) (*database.User, error) {
  611. panic("unexpected invocation of MockUsersStore.Authenticate")
  612. },
  613. },
  614. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  615. defaultHook: func(context.Context, int64, string) error {
  616. panic("unexpected invocation of MockUsersStore.ChangeUsername")
  617. },
  618. },
  619. CountFunc: &UsersStoreCountFunc{
  620. defaultHook: func(context.Context) int64 {
  621. panic("unexpected invocation of MockUsersStore.Count")
  622. },
  623. },
  624. CreateFunc: &UsersStoreCreateFunc{
  625. defaultHook: func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
  626. panic("unexpected invocation of MockUsersStore.Create")
  627. },
  628. },
  629. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  630. defaultHook: func(context.Context, int64, bool) error {
  631. panic("unexpected invocation of MockUsersStore.DeleteByID")
  632. },
  633. },
  634. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  635. defaultHook: func(context.Context, int64) error {
  636. panic("unexpected invocation of MockUsersStore.DeleteCustomAvatar")
  637. },
  638. },
  639. DeleteEmailFunc: &UsersStoreDeleteEmailFunc{
  640. defaultHook: func(context.Context, int64, string) error {
  641. panic("unexpected invocation of MockUsersStore.DeleteEmail")
  642. },
  643. },
  644. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  645. defaultHook: func() error {
  646. panic("unexpected invocation of MockUsersStore.DeleteInactivated")
  647. },
  648. },
  649. FollowFunc: &UsersStoreFollowFunc{
  650. defaultHook: func(context.Context, int64, int64) error {
  651. panic("unexpected invocation of MockUsersStore.Follow")
  652. },
  653. },
  654. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  655. defaultHook: func(context.Context, string) (*database.User, error) {
  656. panic("unexpected invocation of MockUsersStore.GetByEmail")
  657. },
  658. },
  659. GetByIDFunc: &UsersStoreGetByIDFunc{
  660. defaultHook: func(context.Context, int64) (*database.User, error) {
  661. panic("unexpected invocation of MockUsersStore.GetByID")
  662. },
  663. },
  664. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  665. defaultHook: func(context.Context, int64) (*database.User, error) {
  666. panic("unexpected invocation of MockUsersStore.GetByKeyID")
  667. },
  668. },
  669. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  670. defaultHook: func(context.Context, string) (*database.User, error) {
  671. panic("unexpected invocation of MockUsersStore.GetByUsername")
  672. },
  673. },
  674. GetEmailFunc: &UsersStoreGetEmailFunc{
  675. defaultHook: func(context.Context, int64, string, bool) (*database.EmailAddress, error) {
  676. panic("unexpected invocation of MockUsersStore.GetEmail")
  677. },
  678. },
  679. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  680. defaultHook: func(context.Context, []string) ([]string, error) {
  681. panic("unexpected invocation of MockUsersStore.GetMailableEmailsByUsernames")
  682. },
  683. },
  684. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  685. defaultHook: func(context.Context, int64, int64) bool {
  686. panic("unexpected invocation of MockUsersStore.IsFollowing")
  687. },
  688. },
  689. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  690. defaultHook: func(context.Context, string, int64) bool {
  691. panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
  692. },
  693. },
  694. ListFunc: &UsersStoreListFunc{
  695. defaultHook: func(context.Context, int, int) ([]*database.User, error) {
  696. panic("unexpected invocation of MockUsersStore.List")
  697. },
  698. },
  699. ListEmailsFunc: &UsersStoreListEmailsFunc{
  700. defaultHook: func(context.Context, int64) ([]*database.EmailAddress, error) {
  701. panic("unexpected invocation of MockUsersStore.ListEmails")
  702. },
  703. },
  704. ListFollowersFunc: &UsersStoreListFollowersFunc{
  705. defaultHook: func(context.Context, int64, int, int) ([]*database.User, error) {
  706. panic("unexpected invocation of MockUsersStore.ListFollowers")
  707. },
  708. },
  709. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  710. defaultHook: func(context.Context, int64, int, int) ([]*database.User, error) {
  711. panic("unexpected invocation of MockUsersStore.ListFollowings")
  712. },
  713. },
  714. MarkEmailActivatedFunc: &UsersStoreMarkEmailActivatedFunc{
  715. defaultHook: func(context.Context, int64, string) error {
  716. panic("unexpected invocation of MockUsersStore.MarkEmailActivated")
  717. },
  718. },
  719. MarkEmailPrimaryFunc: &UsersStoreMarkEmailPrimaryFunc{
  720. defaultHook: func(context.Context, int64, string) error {
  721. panic("unexpected invocation of MockUsersStore.MarkEmailPrimary")
  722. },
  723. },
  724. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  725. defaultHook: func(context.Context, string, int, int, string) ([]*database.User, int64, error) {
  726. panic("unexpected invocation of MockUsersStore.SearchByName")
  727. },
  728. },
  729. UnfollowFunc: &UsersStoreUnfollowFunc{
  730. defaultHook: func(context.Context, int64, int64) error {
  731. panic("unexpected invocation of MockUsersStore.Unfollow")
  732. },
  733. },
  734. UpdateFunc: &UsersStoreUpdateFunc{
  735. defaultHook: func(context.Context, int64, database.UpdateUserOptions) error {
  736. panic("unexpected invocation of MockUsersStore.Update")
  737. },
  738. },
  739. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  740. defaultHook: func(context.Context, int64, []byte) error {
  741. panic("unexpected invocation of MockUsersStore.UseCustomAvatar")
  742. },
  743. },
  744. }
  745. }
  746. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  747. // All methods delegate to the given implementation, unless overwritten.
  748. func NewMockUsersStoreFrom(i database.UsersStore) *MockUsersStore {
  749. return &MockUsersStore{
  750. AddEmailFunc: &UsersStoreAddEmailFunc{
  751. defaultHook: i.AddEmail,
  752. },
  753. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  754. defaultHook: i.Authenticate,
  755. },
  756. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  757. defaultHook: i.ChangeUsername,
  758. },
  759. CountFunc: &UsersStoreCountFunc{
  760. defaultHook: i.Count,
  761. },
  762. CreateFunc: &UsersStoreCreateFunc{
  763. defaultHook: i.Create,
  764. },
  765. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  766. defaultHook: i.DeleteByID,
  767. },
  768. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  769. defaultHook: i.DeleteCustomAvatar,
  770. },
  771. DeleteEmailFunc: &UsersStoreDeleteEmailFunc{
  772. defaultHook: i.DeleteEmail,
  773. },
  774. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  775. defaultHook: i.DeleteInactivated,
  776. },
  777. FollowFunc: &UsersStoreFollowFunc{
  778. defaultHook: i.Follow,
  779. },
  780. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  781. defaultHook: i.GetByEmail,
  782. },
  783. GetByIDFunc: &UsersStoreGetByIDFunc{
  784. defaultHook: i.GetByID,
  785. },
  786. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  787. defaultHook: i.GetByKeyID,
  788. },
  789. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  790. defaultHook: i.GetByUsername,
  791. },
  792. GetEmailFunc: &UsersStoreGetEmailFunc{
  793. defaultHook: i.GetEmail,
  794. },
  795. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  796. defaultHook: i.GetMailableEmailsByUsernames,
  797. },
  798. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  799. defaultHook: i.IsFollowing,
  800. },
  801. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  802. defaultHook: i.IsUsernameUsed,
  803. },
  804. ListFunc: &UsersStoreListFunc{
  805. defaultHook: i.List,
  806. },
  807. ListEmailsFunc: &UsersStoreListEmailsFunc{
  808. defaultHook: i.ListEmails,
  809. },
  810. ListFollowersFunc: &UsersStoreListFollowersFunc{
  811. defaultHook: i.ListFollowers,
  812. },
  813. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  814. defaultHook: i.ListFollowings,
  815. },
  816. MarkEmailActivatedFunc: &UsersStoreMarkEmailActivatedFunc{
  817. defaultHook: i.MarkEmailActivated,
  818. },
  819. MarkEmailPrimaryFunc: &UsersStoreMarkEmailPrimaryFunc{
  820. defaultHook: i.MarkEmailPrimary,
  821. },
  822. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  823. defaultHook: i.SearchByName,
  824. },
  825. UnfollowFunc: &UsersStoreUnfollowFunc{
  826. defaultHook: i.Unfollow,
  827. },
  828. UpdateFunc: &UsersStoreUpdateFunc{
  829. defaultHook: i.Update,
  830. },
  831. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  832. defaultHook: i.UseCustomAvatar,
  833. },
  834. }
  835. }
  836. // UsersStoreAddEmailFunc describes the behavior when the AddEmail method of
  837. // the parent MockUsersStore instance is invoked.
  838. type UsersStoreAddEmailFunc struct {
  839. defaultHook func(context.Context, int64, string, bool) error
  840. hooks []func(context.Context, int64, string, bool) error
  841. history []UsersStoreAddEmailFuncCall
  842. mutex sync.Mutex
  843. }
  844. // AddEmail delegates to the next hook function in the queue and stores the
  845. // parameter and result values of this invocation.
  846. func (m *MockUsersStore) AddEmail(v0 context.Context, v1 int64, v2 string, v3 bool) error {
  847. r0 := m.AddEmailFunc.nextHook()(v0, v1, v2, v3)
  848. m.AddEmailFunc.appendCall(UsersStoreAddEmailFuncCall{v0, v1, v2, v3, r0})
  849. return r0
  850. }
  851. // SetDefaultHook sets function that is called when the AddEmail method of
  852. // the parent MockUsersStore instance is invoked and the hook queue is
  853. // empty.
  854. func (f *UsersStoreAddEmailFunc) SetDefaultHook(hook func(context.Context, int64, string, bool) error) {
  855. f.defaultHook = hook
  856. }
  857. // PushHook adds a function to the end of hook queue. Each invocation of the
  858. // AddEmail method of the parent MockUsersStore instance invokes the hook at
  859. // the front of the queue and discards it. After the queue is empty, the
  860. // default hook function is invoked for any future action.
  861. func (f *UsersStoreAddEmailFunc) PushHook(hook func(context.Context, int64, string, bool) error) {
  862. f.mutex.Lock()
  863. f.hooks = append(f.hooks, hook)
  864. f.mutex.Unlock()
  865. }
  866. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  867. // given values.
  868. func (f *UsersStoreAddEmailFunc) SetDefaultReturn(r0 error) {
  869. f.SetDefaultHook(func(context.Context, int64, string, bool) error {
  870. return r0
  871. })
  872. }
  873. // PushReturn calls PushHook with a function that returns the given values.
  874. func (f *UsersStoreAddEmailFunc) PushReturn(r0 error) {
  875. f.PushHook(func(context.Context, int64, string, bool) error {
  876. return r0
  877. })
  878. }
  879. func (f *UsersStoreAddEmailFunc) nextHook() func(context.Context, int64, string, bool) error {
  880. f.mutex.Lock()
  881. defer f.mutex.Unlock()
  882. if len(f.hooks) == 0 {
  883. return f.defaultHook
  884. }
  885. hook := f.hooks[0]
  886. f.hooks = f.hooks[1:]
  887. return hook
  888. }
  889. func (f *UsersStoreAddEmailFunc) appendCall(r0 UsersStoreAddEmailFuncCall) {
  890. f.mutex.Lock()
  891. f.history = append(f.history, r0)
  892. f.mutex.Unlock()
  893. }
  894. // History returns a sequence of UsersStoreAddEmailFuncCall objects
  895. // describing the invocations of this function.
  896. func (f *UsersStoreAddEmailFunc) History() []UsersStoreAddEmailFuncCall {
  897. f.mutex.Lock()
  898. history := make([]UsersStoreAddEmailFuncCall, len(f.history))
  899. copy(history, f.history)
  900. f.mutex.Unlock()
  901. return history
  902. }
  903. // UsersStoreAddEmailFuncCall is an object that describes an invocation of
  904. // method AddEmail on an instance of MockUsersStore.
  905. type UsersStoreAddEmailFuncCall struct {
  906. // Arg0 is the value of the 1st argument passed to this method
  907. // invocation.
  908. Arg0 context.Context
  909. // Arg1 is the value of the 2nd argument passed to this method
  910. // invocation.
  911. Arg1 int64
  912. // Arg2 is the value of the 3rd argument passed to this method
  913. // invocation.
  914. Arg2 string
  915. // Arg3 is the value of the 4th argument passed to this method
  916. // invocation.
  917. Arg3 bool
  918. // Result0 is the value of the 1st result returned from this method
  919. // invocation.
  920. Result0 error
  921. }
  922. // Args returns an interface slice containing the arguments of this
  923. // invocation.
  924. func (c UsersStoreAddEmailFuncCall) Args() []interface{} {
  925. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  926. }
  927. // Results returns an interface slice containing the results of this
  928. // invocation.
  929. func (c UsersStoreAddEmailFuncCall) Results() []interface{} {
  930. return []interface{}{c.Result0}
  931. }
  932. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  933. // method of the parent MockUsersStore instance is invoked.
  934. type UsersStoreAuthenticateFunc struct {
  935. defaultHook func(context.Context, string, string, int64) (*database.User, error)
  936. hooks []func(context.Context, string, string, int64) (*database.User, error)
  937. history []UsersStoreAuthenticateFuncCall
  938. mutex sync.Mutex
  939. }
  940. // Authenticate delegates to the next hook function in the queue and stores
  941. // the parameter and result values of this invocation.
  942. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*database.User, error) {
  943. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  944. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  945. return r0, r1
  946. }
  947. // SetDefaultHook sets function that is called when the Authenticate method
  948. // of the parent MockUsersStore instance is invoked and the hook queue is
  949. // empty.
  950. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*database.User, error)) {
  951. f.defaultHook = hook
  952. }
  953. // PushHook adds a function to the end of hook queue. Each invocation of the
  954. // Authenticate method of the parent MockUsersStore instance invokes the
  955. // hook at the front of the queue and discards it. After the queue is empty,
  956. // the default hook function is invoked for any future action.
  957. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*database.User, error)) {
  958. f.mutex.Lock()
  959. f.hooks = append(f.hooks, hook)
  960. f.mutex.Unlock()
  961. }
  962. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  963. // given values.
  964. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *database.User, r1 error) {
  965. f.SetDefaultHook(func(context.Context, string, string, int64) (*database.User, error) {
  966. return r0, r1
  967. })
  968. }
  969. // PushReturn calls PushHook with a function that returns the given values.
  970. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *database.User, r1 error) {
  971. f.PushHook(func(context.Context, string, string, int64) (*database.User, error) {
  972. return r0, r1
  973. })
  974. }
  975. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*database.User, error) {
  976. f.mutex.Lock()
  977. defer f.mutex.Unlock()
  978. if len(f.hooks) == 0 {
  979. return f.defaultHook
  980. }
  981. hook := f.hooks[0]
  982. f.hooks = f.hooks[1:]
  983. return hook
  984. }
  985. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  986. f.mutex.Lock()
  987. f.history = append(f.history, r0)
  988. f.mutex.Unlock()
  989. }
  990. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  991. // describing the invocations of this function.
  992. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  993. f.mutex.Lock()
  994. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  995. copy(history, f.history)
  996. f.mutex.Unlock()
  997. return history
  998. }
  999. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  1000. // of method Authenticate on an instance of MockUsersStore.
  1001. type UsersStoreAuthenticateFuncCall struct {
  1002. // Arg0 is the value of the 1st argument passed to this method
  1003. // invocation.
  1004. Arg0 context.Context
  1005. // Arg1 is the value of the 2nd argument passed to this method
  1006. // invocation.
  1007. Arg1 string
  1008. // Arg2 is the value of the 3rd argument passed to this method
  1009. // invocation.
  1010. Arg2 string
  1011. // Arg3 is the value of the 4th argument passed to this method
  1012. // invocation.
  1013. Arg3 int64
  1014. // Result0 is the value of the 1st result returned from this method
  1015. // invocation.
  1016. Result0 *database.User
  1017. // Result1 is the value of the 2nd result returned from this method
  1018. // invocation.
  1019. Result1 error
  1020. }
  1021. // Args returns an interface slice containing the arguments of this
  1022. // invocation.
  1023. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  1024. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1025. }
  1026. // Results returns an interface slice containing the results of this
  1027. // invocation.
  1028. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  1029. return []interface{}{c.Result0, c.Result1}
  1030. }
  1031. // UsersStoreChangeUsernameFunc describes the behavior when the
  1032. // ChangeUsername method of the parent MockUsersStore instance is invoked.
  1033. type UsersStoreChangeUsernameFunc struct {
  1034. defaultHook func(context.Context, int64, string) error
  1035. hooks []func(context.Context, int64, string) error
  1036. history []UsersStoreChangeUsernameFuncCall
  1037. mutex sync.Mutex
  1038. }
  1039. // ChangeUsername delegates to the next hook function in the queue and
  1040. // stores the parameter and result values of this invocation.
  1041. func (m *MockUsersStore) ChangeUsername(v0 context.Context, v1 int64, v2 string) error {
  1042. r0 := m.ChangeUsernameFunc.nextHook()(v0, v1, v2)
  1043. m.ChangeUsernameFunc.appendCall(UsersStoreChangeUsernameFuncCall{v0, v1, v2, r0})
  1044. return r0
  1045. }
  1046. // SetDefaultHook sets function that is called when the ChangeUsername
  1047. // method of the parent MockUsersStore instance is invoked and the hook
  1048. // queue is empty.
  1049. func (f *UsersStoreChangeUsernameFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  1050. f.defaultHook = hook
  1051. }
  1052. // PushHook adds a function to the end of hook queue. Each invocation of the
  1053. // ChangeUsername method of the parent MockUsersStore instance invokes the
  1054. // hook at the front of the queue and discards it. After the queue is empty,
  1055. // the default hook function is invoked for any future action.
  1056. func (f *UsersStoreChangeUsernameFunc) PushHook(hook func(context.Context, int64, string) error) {
  1057. f.mutex.Lock()
  1058. f.hooks = append(f.hooks, hook)
  1059. f.mutex.Unlock()
  1060. }
  1061. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1062. // given values.
  1063. func (f *UsersStoreChangeUsernameFunc) SetDefaultReturn(r0 error) {
  1064. f.SetDefaultHook(func(context.Context, int64, string) error {
  1065. return r0
  1066. })
  1067. }
  1068. // PushReturn calls PushHook with a function that returns the given values.
  1069. func (f *UsersStoreChangeUsernameFunc) PushReturn(r0 error) {
  1070. f.PushHook(func(context.Context, int64, string) error {
  1071. return r0
  1072. })
  1073. }
  1074. func (f *UsersStoreChangeUsernameFunc) nextHook() func(context.Context, int64, string) error {
  1075. f.mutex.Lock()
  1076. defer f.mutex.Unlock()
  1077. if len(f.hooks) == 0 {
  1078. return f.defaultHook
  1079. }
  1080. hook := f.hooks[0]
  1081. f.hooks = f.hooks[1:]
  1082. return hook
  1083. }
  1084. func (f *UsersStoreChangeUsernameFunc) appendCall(r0 UsersStoreChangeUsernameFuncCall) {
  1085. f.mutex.Lock()
  1086. f.history = append(f.history, r0)
  1087. f.mutex.Unlock()
  1088. }
  1089. // History returns a sequence of UsersStoreChangeUsernameFuncCall objects
  1090. // describing the invocations of this function.
  1091. func (f *UsersStoreChangeUsernameFunc) History() []UsersStoreChangeUsernameFuncCall {
  1092. f.mutex.Lock()
  1093. history := make([]UsersStoreChangeUsernameFuncCall, len(f.history))
  1094. copy(history, f.history)
  1095. f.mutex.Unlock()
  1096. return history
  1097. }
  1098. // UsersStoreChangeUsernameFuncCall is an object that describes an
  1099. // invocation of method ChangeUsername on an instance of MockUsersStore.
  1100. type UsersStoreChangeUsernameFuncCall struct {
  1101. // Arg0 is the value of the 1st argument passed to this method
  1102. // invocation.
  1103. Arg0 context.Context
  1104. // Arg1 is the value of the 2nd argument passed to this method
  1105. // invocation.
  1106. Arg1 int64
  1107. // Arg2 is the value of the 3rd argument passed to this method
  1108. // invocation.
  1109. Arg2 string
  1110. // Result0 is the value of the 1st result returned from this method
  1111. // invocation.
  1112. Result0 error
  1113. }
  1114. // Args returns an interface slice containing the arguments of this
  1115. // invocation.
  1116. func (c UsersStoreChangeUsernameFuncCall) Args() []interface{} {
  1117. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1118. }
  1119. // Results returns an interface slice containing the results of this
  1120. // invocation.
  1121. func (c UsersStoreChangeUsernameFuncCall) Results() []interface{} {
  1122. return []interface{}{c.Result0}
  1123. }
  1124. // UsersStoreCountFunc describes the behavior when the Count method of the
  1125. // parent MockUsersStore instance is invoked.
  1126. type UsersStoreCountFunc struct {
  1127. defaultHook func(context.Context) int64
  1128. hooks []func(context.Context) int64
  1129. history []UsersStoreCountFuncCall
  1130. mutex sync.Mutex
  1131. }
  1132. // Count delegates to the next hook function in the queue and stores the
  1133. // parameter and result values of this invocation.
  1134. func (m *MockUsersStore) Count(v0 context.Context) int64 {
  1135. r0 := m.CountFunc.nextHook()(v0)
  1136. m.CountFunc.appendCall(UsersStoreCountFuncCall{v0, r0})
  1137. return r0
  1138. }
  1139. // SetDefaultHook sets function that is called when the Count method of the
  1140. // parent MockUsersStore instance is invoked and the hook queue is empty.
  1141. func (f *UsersStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  1142. f.defaultHook = hook
  1143. }
  1144. // PushHook adds a function to the end of hook queue. Each invocation of the
  1145. // Count method of the parent MockUsersStore instance invokes the hook at
  1146. // the front of the queue and discards it. After the queue is empty, the
  1147. // default hook function is invoked for any future action.
  1148. func (f *UsersStoreCountFunc) PushHook(hook func(context.Context) int64) {
  1149. f.mutex.Lock()
  1150. f.hooks = append(f.hooks, hook)
  1151. f.mutex.Unlock()
  1152. }
  1153. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1154. // given values.
  1155. func (f *UsersStoreCountFunc) SetDefaultReturn(r0 int64) {
  1156. f.SetDefaultHook(func(context.Context) int64 {
  1157. return r0
  1158. })
  1159. }
  1160. // PushReturn calls PushHook with a function that returns the given values.
  1161. func (f *UsersStoreCountFunc) PushReturn(r0 int64) {
  1162. f.PushHook(func(context.Context) int64 {
  1163. return r0
  1164. })
  1165. }
  1166. func (f *UsersStoreCountFunc) nextHook() func(context.Context) int64 {
  1167. f.mutex.Lock()
  1168. defer f.mutex.Unlock()
  1169. if len(f.hooks) == 0 {
  1170. return f.defaultHook
  1171. }
  1172. hook := f.hooks[0]
  1173. f.hooks = f.hooks[1:]
  1174. return hook
  1175. }
  1176. func (f *UsersStoreCountFunc) appendCall(r0 UsersStoreCountFuncCall) {
  1177. f.mutex.Lock()
  1178. f.history = append(f.history, r0)
  1179. f.mutex.Unlock()
  1180. }
  1181. // History returns a sequence of UsersStoreCountFuncCall objects describing
  1182. // the invocations of this function.
  1183. func (f *UsersStoreCountFunc) History() []UsersStoreCountFuncCall {
  1184. f.mutex.Lock()
  1185. history := make([]UsersStoreCountFuncCall, len(f.history))
  1186. copy(history, f.history)
  1187. f.mutex.Unlock()
  1188. return history
  1189. }
  1190. // UsersStoreCountFuncCall is an object that describes an invocation of
  1191. // method Count on an instance of MockUsersStore.
  1192. type UsersStoreCountFuncCall struct {
  1193. // Arg0 is the value of the 1st argument passed to this method
  1194. // invocation.
  1195. Arg0 context.Context
  1196. // Result0 is the value of the 1st result returned from this method
  1197. // invocation.
  1198. Result0 int64
  1199. }
  1200. // Args returns an interface slice containing the arguments of this
  1201. // invocation.
  1202. func (c UsersStoreCountFuncCall) Args() []interface{} {
  1203. return []interface{}{c.Arg0}
  1204. }
  1205. // Results returns an interface slice containing the results of this
  1206. // invocation.
  1207. func (c UsersStoreCountFuncCall) Results() []interface{} {
  1208. return []interface{}{c.Result0}
  1209. }
  1210. // UsersStoreCreateFunc describes the behavior when the Create method of the
  1211. // parent MockUsersStore instance is invoked.
  1212. type UsersStoreCreateFunc struct {
  1213. defaultHook func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)
  1214. hooks []func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)
  1215. history []UsersStoreCreateFuncCall
  1216. mutex sync.Mutex
  1217. }
  1218. // Create delegates to the next hook function in the queue and stores the
  1219. // parameter and result values of this invocation.
  1220. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 database.CreateUserOptions) (*database.User, error) {
  1221. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  1222. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  1223. return r0, r1
  1224. }
  1225. // SetDefaultHook sets function that is called when the Create method of the
  1226. // parent MockUsersStore instance is invoked and the hook queue is empty.
  1227. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)) {
  1228. f.defaultHook = hook
  1229. }
  1230. // PushHook adds a function to the end of hook queue. Each invocation of the
  1231. // Create method of the parent MockUsersStore instance invokes the hook at
  1232. // the front of the queue and discards it. After the queue is empty, the
  1233. // default hook function is invoked for any future action.
  1234. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)) {
  1235. f.mutex.Lock()
  1236. f.hooks = append(f.hooks, hook)
  1237. f.mutex.Unlock()
  1238. }
  1239. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1240. // given values.
  1241. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *database.User, r1 error) {
  1242. f.SetDefaultHook(func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
  1243. return r0, r1
  1244. })
  1245. }
  1246. // PushReturn calls PushHook with a function that returns the given values.
  1247. func (f *UsersStoreCreateFunc) PushReturn(r0 *database.User, r1 error) {
  1248. f.PushHook(func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
  1249. return r0, r1
  1250. })
  1251. }
  1252. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
  1253. f.mutex.Lock()
  1254. defer f.mutex.Unlock()
  1255. if len(f.hooks) == 0 {
  1256. return f.defaultHook
  1257. }
  1258. hook := f.hooks[0]
  1259. f.hooks = f.hooks[1:]
  1260. return hook
  1261. }
  1262. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  1263. f.mutex.Lock()
  1264. f.history = append(f.history, r0)
  1265. f.mutex.Unlock()
  1266. }
  1267. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  1268. // the invocations of this function.
  1269. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  1270. f.mutex.Lock()
  1271. history := make([]UsersStoreCreateFuncCall, len(f.history))
  1272. copy(history, f.history)
  1273. f.mutex.Unlock()
  1274. return history
  1275. }
  1276. // UsersStoreCreateFuncCall is an object that describes an invocation of
  1277. // method Create on an instance of MockUsersStore.
  1278. type UsersStoreCreateFuncCall struct {
  1279. // Arg0 is the value of the 1st argument passed to this method
  1280. // invocation.
  1281. Arg0 context.Context
  1282. // Arg1 is the value of the 2nd argument passed to this method
  1283. // invocation.
  1284. Arg1 string
  1285. // Arg2 is the value of the 3rd argument passed to this method
  1286. // invocation.
  1287. Arg2 string
  1288. // Arg3 is the value of the 4th argument passed to this method
  1289. // invocation.
  1290. Arg3 database.CreateUserOptions
  1291. // Result0 is the value of the 1st result returned from this method
  1292. // invocation.
  1293. Result0 *database.User
  1294. // Result1 is the value of the 2nd result returned from this method
  1295. // invocation.
  1296. Result1 error
  1297. }
  1298. // Args returns an interface slice containing the arguments of this
  1299. // invocation.
  1300. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  1301. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1302. }
  1303. // Results returns an interface slice containing the results of this
  1304. // invocation.
  1305. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  1306. return []interface{}{c.Result0, c.Result1}
  1307. }
  1308. // UsersStoreDeleteByIDFunc describes the behavior when the DeleteByID
  1309. // method of the parent MockUsersStore instance is invoked.
  1310. type UsersStoreDeleteByIDFunc struct {
  1311. defaultHook func(context.Context, int64, bool) error
  1312. hooks []func(context.Context, int64, bool) error
  1313. history []UsersStoreDeleteByIDFuncCall
  1314. mutex sync.Mutex
  1315. }
  1316. // DeleteByID delegates to the next hook function in the queue and stores
  1317. // the parameter and result values of this invocation.
  1318. func (m *MockUsersStore) DeleteByID(v0 context.Context, v1 int64, v2 bool) error {
  1319. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  1320. m.DeleteByIDFunc.appendCall(UsersStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  1321. return r0
  1322. }
  1323. // SetDefaultHook sets function that is called when the DeleteByID method of
  1324. // the parent MockUsersStore instance is invoked and the hook queue is
  1325. // empty.
  1326. func (f *UsersStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, bool) error) {
  1327. f.defaultHook = hook
  1328. }
  1329. // PushHook adds a function to the end of hook queue. Each invocation of the
  1330. // DeleteByID method of the parent MockUsersStore instance invokes the hook
  1331. // at the front of the queue and discards it. After the queue is empty, the
  1332. // default hook function is invoked for any future action.
  1333. func (f *UsersStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, bool) error) {
  1334. f.mutex.Lock()
  1335. f.hooks = append(f.hooks, hook)
  1336. f.mutex.Unlock()
  1337. }
  1338. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1339. // given values.
  1340. func (f *UsersStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  1341. f.SetDefaultHook(func(context.Context, int64, bool) error {
  1342. return r0
  1343. })
  1344. }
  1345. // PushReturn calls PushHook with a function that returns the given values.
  1346. func (f *UsersStoreDeleteByIDFunc) PushReturn(r0 error) {
  1347. f.PushHook(func(context.Context, int64, bool) error {
  1348. return r0
  1349. })
  1350. }
  1351. func (f *UsersStoreDeleteByIDFunc) nextHook() func(context.Context, int64, bool) error {
  1352. f.mutex.Lock()
  1353. defer f.mutex.Unlock()
  1354. if len(f.hooks) == 0 {
  1355. return f.defaultHook
  1356. }
  1357. hook := f.hooks[0]
  1358. f.hooks = f.hooks[1:]
  1359. return hook
  1360. }
  1361. func (f *UsersStoreDeleteByIDFunc) appendCall(r0 UsersStoreDeleteByIDFuncCall) {
  1362. f.mutex.Lock()
  1363. f.history = append(f.history, r0)
  1364. f.mutex.Unlock()
  1365. }
  1366. // History returns a sequence of UsersStoreDeleteByIDFuncCall objects
  1367. // describing the invocations of this function.
  1368. func (f *UsersStoreDeleteByIDFunc) History() []UsersStoreDeleteByIDFuncCall {
  1369. f.mutex.Lock()
  1370. history := make([]UsersStoreDeleteByIDFuncCall, len(f.history))
  1371. copy(history, f.history)
  1372. f.mutex.Unlock()
  1373. return history
  1374. }
  1375. // UsersStoreDeleteByIDFuncCall is an object that describes an invocation of
  1376. // method DeleteByID on an instance of MockUsersStore.
  1377. type UsersStoreDeleteByIDFuncCall struct {
  1378. // Arg0 is the value of the 1st argument passed to this method
  1379. // invocation.
  1380. Arg0 context.Context
  1381. // Arg1 is the value of the 2nd argument passed to this method
  1382. // invocation.
  1383. Arg1 int64
  1384. // Arg2 is the value of the 3rd argument passed to this method
  1385. // invocation.
  1386. Arg2 bool
  1387. // Result0 is the value of the 1st result returned from this method
  1388. // invocation.
  1389. Result0 error
  1390. }
  1391. // Args returns an interface slice containing the arguments of this
  1392. // invocation.
  1393. func (c UsersStoreDeleteByIDFuncCall) Args() []interface{} {
  1394. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1395. }
  1396. // Results returns an interface slice containing the results of this
  1397. // invocation.
  1398. func (c UsersStoreDeleteByIDFuncCall) Results() []interface{} {
  1399. return []interface{}{c.Result0}
  1400. }
  1401. // UsersStoreDeleteCustomAvatarFunc describes the behavior when the
  1402. // DeleteCustomAvatar method of the parent MockUsersStore instance is
  1403. // invoked.
  1404. type UsersStoreDeleteCustomAvatarFunc struct {
  1405. defaultHook func(context.Context, int64) error
  1406. hooks []func(context.Context, int64) error
  1407. history []UsersStoreDeleteCustomAvatarFuncCall
  1408. mutex sync.Mutex
  1409. }
  1410. // DeleteCustomAvatar delegates to the next hook function in the queue and
  1411. // stores the parameter and result values of this invocation.
  1412. func (m *MockUsersStore) DeleteCustomAvatar(v0 context.Context, v1 int64) error {
  1413. r0 := m.DeleteCustomAvatarFunc.nextHook()(v0, v1)
  1414. m.DeleteCustomAvatarFunc.appendCall(UsersStoreDeleteCustomAvatarFuncCall{v0, v1, r0})
  1415. return r0
  1416. }
  1417. // SetDefaultHook sets function that is called when the DeleteCustomAvatar
  1418. // method of the parent MockUsersStore instance is invoked and the hook
  1419. // queue is empty.
  1420. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  1421. f.defaultHook = hook
  1422. }
  1423. // PushHook adds a function to the end of hook queue. Each invocation of the
  1424. // DeleteCustomAvatar method of the parent MockUsersStore instance invokes
  1425. // the hook at the front of the queue and discards it. After the queue is
  1426. // empty, the default hook function is invoked for any future action.
  1427. func (f *UsersStoreDeleteCustomAvatarFunc) PushHook(hook func(context.Context, int64) error) {
  1428. f.mutex.Lock()
  1429. f.hooks = append(f.hooks, hook)
  1430. f.mutex.Unlock()
  1431. }
  1432. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1433. // given values.
  1434. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultReturn(r0 error) {
  1435. f.SetDefaultHook(func(context.Context, int64) error {
  1436. return r0
  1437. })
  1438. }
  1439. // PushReturn calls PushHook with a function that returns the given values.
  1440. func (f *UsersStoreDeleteCustomAvatarFunc) PushReturn(r0 error) {
  1441. f.PushHook(func(context.Context, int64) error {
  1442. return r0
  1443. })
  1444. }
  1445. func (f *UsersStoreDeleteCustomAvatarFunc) nextHook() func(context.Context, int64) error {
  1446. f.mutex.Lock()
  1447. defer f.mutex.Unlock()
  1448. if len(f.hooks) == 0 {
  1449. return f.defaultHook
  1450. }
  1451. hook := f.hooks[0]
  1452. f.hooks = f.hooks[1:]
  1453. return hook
  1454. }
  1455. func (f *UsersStoreDeleteCustomAvatarFunc) appendCall(r0 UsersStoreDeleteCustomAvatarFuncCall) {
  1456. f.mutex.Lock()
  1457. f.history = append(f.history, r0)
  1458. f.mutex.Unlock()
  1459. }
  1460. // History returns a sequence of UsersStoreDeleteCustomAvatarFuncCall
  1461. // objects describing the invocations of this function.
  1462. func (f *UsersStoreDeleteCustomAvatarFunc) History() []UsersStoreDeleteCustomAvatarFuncCall {
  1463. f.mutex.Lock()
  1464. history := make([]UsersStoreDeleteCustomAvatarFuncCall, len(f.history))
  1465. copy(history, f.history)
  1466. f.mutex.Unlock()
  1467. return history
  1468. }
  1469. // UsersStoreDeleteCustomAvatarFuncCall is an object that describes an
  1470. // invocation of method DeleteCustomAvatar on an instance of MockUsersStore.
  1471. type UsersStoreDeleteCustomAvatarFuncCall struct {
  1472. // Arg0 is the value of the 1st argument passed to this method
  1473. // invocation.
  1474. Arg0 context.Context
  1475. // Arg1 is the value of the 2nd argument passed to this method
  1476. // invocation.
  1477. Arg1 int64
  1478. // Result0 is the value of the 1st result returned from this method
  1479. // invocation.
  1480. Result0 error
  1481. }
  1482. // Args returns an interface slice containing the arguments of this
  1483. // invocation.
  1484. func (c UsersStoreDeleteCustomAvatarFuncCall) Args() []interface{} {
  1485. return []interface{}{c.Arg0, c.Arg1}
  1486. }
  1487. // Results returns an interface slice containing the results of this
  1488. // invocation.
  1489. func (c UsersStoreDeleteCustomAvatarFuncCall) Results() []interface{} {
  1490. return []interface{}{c.Result0}
  1491. }
  1492. // UsersStoreDeleteEmailFunc describes the behavior when the DeleteEmail
  1493. // method of the parent MockUsersStore instance is invoked.
  1494. type UsersStoreDeleteEmailFunc struct {
  1495. defaultHook func(context.Context, int64, string) error
  1496. hooks []func(context.Context, int64, string) error
  1497. history []UsersStoreDeleteEmailFuncCall
  1498. mutex sync.Mutex
  1499. }
  1500. // DeleteEmail delegates to the next hook function in the queue and stores
  1501. // the parameter and result values of this invocation.
  1502. func (m *MockUsersStore) DeleteEmail(v0 context.Context, v1 int64, v2 string) error {
  1503. r0 := m.DeleteEmailFunc.nextHook()(v0, v1, v2)
  1504. m.DeleteEmailFunc.appendCall(UsersStoreDeleteEmailFuncCall{v0, v1, v2, r0})
  1505. return r0
  1506. }
  1507. // SetDefaultHook sets function that is called when the DeleteEmail method
  1508. // of the parent MockUsersStore instance is invoked and the hook queue is
  1509. // empty.
  1510. func (f *UsersStoreDeleteEmailFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  1511. f.defaultHook = hook
  1512. }
  1513. // PushHook adds a function to the end of hook queue. Each invocation of the
  1514. // DeleteEmail method of the parent MockUsersStore instance invokes the hook
  1515. // at the front of the queue and discards it. After the queue is empty, the
  1516. // default hook function is invoked for any future action.
  1517. func (f *UsersStoreDeleteEmailFunc) PushHook(hook func(context.Context, int64, string) error) {
  1518. f.mutex.Lock()
  1519. f.hooks = append(f.hooks, hook)
  1520. f.mutex.Unlock()
  1521. }
  1522. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1523. // given values.
  1524. func (f *UsersStoreDeleteEmailFunc) SetDefaultReturn(r0 error) {
  1525. f.SetDefaultHook(func(context.Context, int64, string) error {
  1526. return r0
  1527. })
  1528. }
  1529. // PushReturn calls PushHook with a function that returns the given values.
  1530. func (f *UsersStoreDeleteEmailFunc) PushReturn(r0 error) {
  1531. f.PushHook(func(context.Context, int64, string) error {
  1532. return r0
  1533. })
  1534. }
  1535. func (f *UsersStoreDeleteEmailFunc) nextHook() func(context.Context, int64, string) error {
  1536. f.mutex.Lock()
  1537. defer f.mutex.Unlock()
  1538. if len(f.hooks) == 0 {
  1539. return f.defaultHook
  1540. }
  1541. hook := f.hooks[0]
  1542. f.hooks = f.hooks[1:]
  1543. return hook
  1544. }
  1545. func (f *UsersStoreDeleteEmailFunc) appendCall(r0 UsersStoreDeleteEmailFuncCall) {
  1546. f.mutex.Lock()
  1547. f.history = append(f.history, r0)
  1548. f.mutex.Unlock()
  1549. }
  1550. // History returns a sequence of UsersStoreDeleteEmailFuncCall objects
  1551. // describing the invocations of this function.
  1552. func (f *UsersStoreDeleteEmailFunc) History() []UsersStoreDeleteEmailFuncCall {
  1553. f.mutex.Lock()
  1554. history := make([]UsersStoreDeleteEmailFuncCall, len(f.history))
  1555. copy(history, f.history)
  1556. f.mutex.Unlock()
  1557. return history
  1558. }
  1559. // UsersStoreDeleteEmailFuncCall is an object that describes an invocation
  1560. // of method DeleteEmail on an instance of MockUsersStore.
  1561. type UsersStoreDeleteEmailFuncCall struct {
  1562. // Arg0 is the value of the 1st argument passed to this method
  1563. // invocation.
  1564. Arg0 context.Context
  1565. // Arg1 is the value of the 2nd argument passed to this method
  1566. // invocation.
  1567. Arg1 int64
  1568. // Arg2 is the value of the 3rd argument passed to this method
  1569. // invocation.
  1570. Arg2 string
  1571. // Result0 is the value of the 1st result returned from this method
  1572. // invocation.
  1573. Result0 error
  1574. }
  1575. // Args returns an interface slice containing the arguments of this
  1576. // invocation.
  1577. func (c UsersStoreDeleteEmailFuncCall) Args() []interface{} {
  1578. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1579. }
  1580. // Results returns an interface slice containing the results of this
  1581. // invocation.
  1582. func (c UsersStoreDeleteEmailFuncCall) Results() []interface{} {
  1583. return []interface{}{c.Result0}
  1584. }
  1585. // UsersStoreDeleteInactivatedFunc describes the behavior when the
  1586. // DeleteInactivated method of the parent MockUsersStore instance is
  1587. // invoked.
  1588. type UsersStoreDeleteInactivatedFunc struct {
  1589. defaultHook func() error
  1590. hooks []func() error
  1591. history []UsersStoreDeleteInactivatedFuncCall
  1592. mutex sync.Mutex
  1593. }
  1594. // DeleteInactivated delegates to the next hook function in the queue and
  1595. // stores the parameter and result values of this invocation.
  1596. func (m *MockUsersStore) DeleteInactivated() error {
  1597. r0 := m.DeleteInactivatedFunc.nextHook()()
  1598. m.DeleteInactivatedFunc.appendCall(UsersStoreDeleteInactivatedFuncCall{r0})
  1599. return r0
  1600. }
  1601. // SetDefaultHook sets function that is called when the DeleteInactivated
  1602. // method of the parent MockUsersStore instance is invoked and the hook
  1603. // queue is empty.
  1604. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultHook(hook func() error) {
  1605. f.defaultHook = hook
  1606. }
  1607. // PushHook adds a function to the end of hook queue. Each invocation of the
  1608. // DeleteInactivated method of the parent MockUsersStore instance invokes
  1609. // the hook at the front of the queue and discards it. After the queue is
  1610. // empty, the default hook function is invoked for any future action.
  1611. func (f *UsersStoreDeleteInactivatedFunc) PushHook(hook func() error) {
  1612. f.mutex.Lock()
  1613. f.hooks = append(f.hooks, hook)
  1614. f.mutex.Unlock()
  1615. }
  1616. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1617. // given values.
  1618. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultReturn(r0 error) {
  1619. f.SetDefaultHook(func() error {
  1620. return r0
  1621. })
  1622. }
  1623. // PushReturn calls PushHook with a function that returns the given values.
  1624. func (f *UsersStoreDeleteInactivatedFunc) PushReturn(r0 error) {
  1625. f.PushHook(func() error {
  1626. return r0
  1627. })
  1628. }
  1629. func (f *UsersStoreDeleteInactivatedFunc) nextHook() func() error {
  1630. f.mutex.Lock()
  1631. defer f.mutex.Unlock()
  1632. if len(f.hooks) == 0 {
  1633. return f.defaultHook
  1634. }
  1635. hook := f.hooks[0]
  1636. f.hooks = f.hooks[1:]
  1637. return hook
  1638. }
  1639. func (f *UsersStoreDeleteInactivatedFunc) appendCall(r0 UsersStoreDeleteInactivatedFuncCall) {
  1640. f.mutex.Lock()
  1641. f.history = append(f.history, r0)
  1642. f.mutex.Unlock()
  1643. }
  1644. // History returns a sequence of UsersStoreDeleteInactivatedFuncCall objects
  1645. // describing the invocations of this function.
  1646. func (f *UsersStoreDeleteInactivatedFunc) History() []UsersStoreDeleteInactivatedFuncCall {
  1647. f.mutex.Lock()
  1648. history := make([]UsersStoreDeleteInactivatedFuncCall, len(f.history))
  1649. copy(history, f.history)
  1650. f.mutex.Unlock()
  1651. return history
  1652. }
  1653. // UsersStoreDeleteInactivatedFuncCall is an object that describes an
  1654. // invocation of method DeleteInactivated on an instance of MockUsersStore.
  1655. type UsersStoreDeleteInactivatedFuncCall struct {
  1656. // Result0 is the value of the 1st result returned from this method
  1657. // invocation.
  1658. Result0 error
  1659. }
  1660. // Args returns an interface slice containing the arguments of this
  1661. // invocation.
  1662. func (c UsersStoreDeleteInactivatedFuncCall) Args() []interface{} {
  1663. return []interface{}{}
  1664. }
  1665. // Results returns an interface slice containing the results of this
  1666. // invocation.
  1667. func (c UsersStoreDeleteInactivatedFuncCall) Results() []interface{} {
  1668. return []interface{}{c.Result0}
  1669. }
  1670. // UsersStoreFollowFunc describes the behavior when the Follow method of the
  1671. // parent MockUsersStore instance is invoked.
  1672. type UsersStoreFollowFunc struct {
  1673. defaultHook func(context.Context, int64, int64) error
  1674. hooks []func(context.Context, int64, int64) error
  1675. history []UsersStoreFollowFuncCall
  1676. mutex sync.Mutex
  1677. }
  1678. // Follow delegates to the next hook function in the queue and stores the
  1679. // parameter and result values of this invocation.
  1680. func (m *MockUsersStore) Follow(v0 context.Context, v1 int64, v2 int64) error {
  1681. r0 := m.FollowFunc.nextHook()(v0, v1, v2)
  1682. m.FollowFunc.appendCall(UsersStoreFollowFuncCall{v0, v1, v2, r0})
  1683. return r0
  1684. }
  1685. // SetDefaultHook sets function that is called when the Follow method of the
  1686. // parent MockUsersStore instance is invoked and the hook queue is empty.
  1687. func (f *UsersStoreFollowFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  1688. f.defaultHook = hook
  1689. }
  1690. // PushHook adds a function to the end of hook queue. Each invocation of the
  1691. // Follow method of the parent MockUsersStore instance invokes the hook at
  1692. // the front of the queue and discards it. After the queue is empty, the
  1693. // default hook function is invoked for any future action.
  1694. func (f *UsersStoreFollowFunc) PushHook(hook func(context.Context, int64, int64) error) {
  1695. f.mutex.Lock()
  1696. f.hooks = append(f.hooks, hook)
  1697. f.mutex.Unlock()
  1698. }
  1699. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1700. // given values.
  1701. func (f *UsersStoreFollowFunc) SetDefaultReturn(r0 error) {
  1702. f.SetDefaultHook(func(context.Context, int64, int64) error {
  1703. return r0
  1704. })
  1705. }
  1706. // PushReturn calls PushHook with a function that returns the given values.
  1707. func (f *UsersStoreFollowFunc) PushReturn(r0 error) {
  1708. f.PushHook(func(context.Context, int64, int64) error {
  1709. return r0
  1710. })
  1711. }
  1712. func (f *UsersStoreFollowFunc) nextHook() func(context.Context, int64, int64) error {
  1713. f.mutex.Lock()
  1714. defer f.mutex.Unlock()
  1715. if len(f.hooks) == 0 {
  1716. return f.defaultHook
  1717. }
  1718. hook := f.hooks[0]
  1719. f.hooks = f.hooks[1:]
  1720. return hook
  1721. }
  1722. func (f *UsersStoreFollowFunc) appendCall(r0 UsersStoreFollowFuncCall) {
  1723. f.mutex.Lock()
  1724. f.history = append(f.history, r0)
  1725. f.mutex.Unlock()
  1726. }
  1727. // History returns a sequence of UsersStoreFollowFuncCall objects describing
  1728. // the invocations of this function.
  1729. func (f *UsersStoreFollowFunc) History() []UsersStoreFollowFuncCall {
  1730. f.mutex.Lock()
  1731. history := make([]UsersStoreFollowFuncCall, len(f.history))
  1732. copy(history, f.history)
  1733. f.mutex.Unlock()
  1734. return history
  1735. }
  1736. // UsersStoreFollowFuncCall is an object that describes an invocation of
  1737. // method Follow on an instance of MockUsersStore.
  1738. type UsersStoreFollowFuncCall struct {
  1739. // Arg0 is the value of the 1st argument passed to this method
  1740. // invocation.
  1741. Arg0 context.Context
  1742. // Arg1 is the value of the 2nd argument passed to this method
  1743. // invocation.
  1744. Arg1 int64
  1745. // Arg2 is the value of the 3rd argument passed to this method
  1746. // invocation.
  1747. Arg2 int64
  1748. // Result0 is the value of the 1st result returned from this method
  1749. // invocation.
  1750. Result0 error
  1751. }
  1752. // Args returns an interface slice containing the arguments of this
  1753. // invocation.
  1754. func (c UsersStoreFollowFuncCall) Args() []interface{} {
  1755. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1756. }
  1757. // Results returns an interface slice containing the results of this
  1758. // invocation.
  1759. func (c UsersStoreFollowFuncCall) Results() []interface{} {
  1760. return []interface{}{c.Result0}
  1761. }
  1762. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  1763. // method of the parent MockUsersStore instance is invoked.
  1764. type UsersStoreGetByEmailFunc struct {
  1765. defaultHook func(context.Context, string) (*database.User, error)
  1766. hooks []func(context.Context, string) (*database.User, error)
  1767. history []UsersStoreGetByEmailFuncCall
  1768. mutex sync.Mutex
  1769. }
  1770. // GetByEmail delegates to the next hook function in the queue and stores
  1771. // the parameter and result values of this invocation.
  1772. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*database.User, error) {
  1773. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  1774. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  1775. return r0, r1
  1776. }
  1777. // SetDefaultHook sets function that is called when the GetByEmail method of
  1778. // the parent MockUsersStore instance is invoked and the hook queue is
  1779. // empty.
  1780. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*database.User, error)) {
  1781. f.defaultHook = hook
  1782. }
  1783. // PushHook adds a function to the end of hook queue. Each invocation of the
  1784. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  1785. // at the front of the queue and discards it. After the queue is empty, the
  1786. // default hook function is invoked for any future action.
  1787. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*database.User, error)) {
  1788. f.mutex.Lock()
  1789. f.hooks = append(f.hooks, hook)
  1790. f.mutex.Unlock()
  1791. }
  1792. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1793. // given values.
  1794. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *database.User, r1 error) {
  1795. f.SetDefaultHook(func(context.Context, string) (*database.User, error) {
  1796. return r0, r1
  1797. })
  1798. }
  1799. // PushReturn calls PushHook with a function that returns the given values.
  1800. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *database.User, r1 error) {
  1801. f.PushHook(func(context.Context, string) (*database.User, error) {
  1802. return r0, r1
  1803. })
  1804. }
  1805. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*database.User, error) {
  1806. f.mutex.Lock()
  1807. defer f.mutex.Unlock()
  1808. if len(f.hooks) == 0 {
  1809. return f.defaultHook
  1810. }
  1811. hook := f.hooks[0]
  1812. f.hooks = f.hooks[1:]
  1813. return hook
  1814. }
  1815. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  1816. f.mutex.Lock()
  1817. f.history = append(f.history, r0)
  1818. f.mutex.Unlock()
  1819. }
  1820. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  1821. // describing the invocations of this function.
  1822. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  1823. f.mutex.Lock()
  1824. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  1825. copy(history, f.history)
  1826. f.mutex.Unlock()
  1827. return history
  1828. }
  1829. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  1830. // method GetByEmail on an instance of MockUsersStore.
  1831. type UsersStoreGetByEmailFuncCall struct {
  1832. // Arg0 is the value of the 1st argument passed to this method
  1833. // invocation.
  1834. Arg0 context.Context
  1835. // Arg1 is the value of the 2nd argument passed to this method
  1836. // invocation.
  1837. Arg1 string
  1838. // Result0 is the value of the 1st result returned from this method
  1839. // invocation.
  1840. Result0 *database.User
  1841. // Result1 is the value of the 2nd result returned from this method
  1842. // invocation.
  1843. Result1 error
  1844. }
  1845. // Args returns an interface slice containing the arguments of this
  1846. // invocation.
  1847. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  1848. return []interface{}{c.Arg0, c.Arg1}
  1849. }
  1850. // Results returns an interface slice containing the results of this
  1851. // invocation.
  1852. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  1853. return []interface{}{c.Result0, c.Result1}
  1854. }
  1855. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  1856. // the parent MockUsersStore instance is invoked.
  1857. type UsersStoreGetByIDFunc struct {
  1858. defaultHook func(context.Context, int64) (*database.User, error)
  1859. hooks []func(context.Context, int64) (*database.User, error)
  1860. history []UsersStoreGetByIDFuncCall
  1861. mutex sync.Mutex
  1862. }
  1863. // GetByID delegates to the next hook function in the queue and stores the
  1864. // parameter and result values of this invocation.
  1865. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*database.User, error) {
  1866. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  1867. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  1868. return r0, r1
  1869. }
  1870. // SetDefaultHook sets function that is called when the GetByID method of
  1871. // the parent MockUsersStore instance is invoked and the hook queue is
  1872. // empty.
  1873. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*database.User, error)) {
  1874. f.defaultHook = hook
  1875. }
  1876. // PushHook adds a function to the end of hook queue. Each invocation of the
  1877. // GetByID method of the parent MockUsersStore instance invokes the hook at
  1878. // the front of the queue and discards it. After the queue is empty, the
  1879. // default hook function is invoked for any future action.
  1880. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*database.User, error)) {
  1881. f.mutex.Lock()
  1882. f.hooks = append(f.hooks, hook)
  1883. f.mutex.Unlock()
  1884. }
  1885. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1886. // given values.
  1887. func (f *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *database.User, r1 error) {
  1888. f.SetDefaultHook(func(context.Context, int64) (*database.User, error) {
  1889. return r0, r1
  1890. })
  1891. }
  1892. // PushReturn calls PushHook with a function that returns the given values.
  1893. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *database.User, r1 error) {
  1894. f.PushHook(func(context.Context, int64) (*database.User, error) {
  1895. return r0, r1
  1896. })
  1897. }
  1898. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*database.User, error) {
  1899. f.mutex.Lock()
  1900. defer f.mutex.Unlock()
  1901. if len(f.hooks) == 0 {
  1902. return f.defaultHook
  1903. }
  1904. hook := f.hooks[0]
  1905. f.hooks = f.hooks[1:]
  1906. return hook
  1907. }
  1908. func (f *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  1909. f.mutex.Lock()
  1910. f.history = append(f.history, r0)
  1911. f.mutex.Unlock()
  1912. }
  1913. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  1914. // describing the invocations of this function.
  1915. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  1916. f.mutex.Lock()
  1917. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  1918. copy(history, f.history)
  1919. f.mutex.Unlock()
  1920. return history
  1921. }
  1922. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  1923. // method GetByID on an instance of MockUsersStore.
  1924. type UsersStoreGetByIDFuncCall struct {
  1925. // Arg0 is the value of the 1st argument passed to this method
  1926. // invocation.
  1927. Arg0 context.Context
  1928. // Arg1 is the value of the 2nd argument passed to this method
  1929. // invocation.
  1930. Arg1 int64
  1931. // Result0 is the value of the 1st result returned from this method
  1932. // invocation.
  1933. Result0 *database.User
  1934. // Result1 is the value of the 2nd result returned from this method
  1935. // invocation.
  1936. Result1 error
  1937. }
  1938. // Args returns an interface slice containing the arguments of this
  1939. // invocation.
  1940. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  1941. return []interface{}{c.Arg0, c.Arg1}
  1942. }
  1943. // Results returns an interface slice containing the results of this
  1944. // invocation.
  1945. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  1946. return []interface{}{c.Result0, c.Result1}
  1947. }
  1948. // UsersStoreGetByKeyIDFunc describes the behavior when the GetByKeyID
  1949. // method of the parent MockUsersStore instance is invoked.
  1950. type UsersStoreGetByKeyIDFunc struct {
  1951. defaultHook func(context.Context, int64) (*database.User, error)
  1952. hooks []func(context.Context, int64) (*database.User, error)
  1953. history []UsersStoreGetByKeyIDFuncCall
  1954. mutex sync.Mutex
  1955. }
  1956. // GetByKeyID delegates to the next hook function in the queue and stores
  1957. // the parameter and result values of this invocation.
  1958. func (m *MockUsersStore) GetByKeyID(v0 context.Context, v1 int64) (*database.User, error) {
  1959. r0, r1 := m.GetByKeyIDFunc.nextHook()(v0, v1)
  1960. m.GetByKeyIDFunc.appendCall(UsersStoreGetByKeyIDFuncCall{v0, v1, r0, r1})
  1961. return r0, r1
  1962. }
  1963. // SetDefaultHook sets function that is called when the GetByKeyID method of
  1964. // the parent MockUsersStore instance is invoked and the hook queue is
  1965. // empty.
  1966. func (f *UsersStoreGetByKeyIDFunc) SetDefaultHook(hook func(context.Context, int64) (*database.User, error)) {
  1967. f.defaultHook = hook
  1968. }
  1969. // PushHook adds a function to the end of hook queue. Each invocation of the
  1970. // GetByKeyID method of the parent MockUsersStore instance invokes the hook
  1971. // at the front of the queue and discards it. After the queue is empty, the
  1972. // default hook function is invoked for any future action.
  1973. func (f *UsersStoreGetByKeyIDFunc) PushHook(hook func(context.Context, int64) (*database.User, error)) {
  1974. f.mutex.Lock()
  1975. f.hooks = append(f.hooks, hook)
  1976. f.mutex.Unlock()
  1977. }
  1978. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1979. // given values.
  1980. func (f *UsersStoreGetByKeyIDFunc) SetDefaultReturn(r0 *database.User, r1 error) {
  1981. f.SetDefaultHook(func(context.Context, int64) (*database.User, error) {
  1982. return r0, r1
  1983. })
  1984. }
  1985. // PushReturn calls PushHook with a function that returns the given values.
  1986. func (f *UsersStoreGetByKeyIDFunc) PushReturn(r0 *database.User, r1 error) {
  1987. f.PushHook(func(context.Context, int64) (*database.User, error) {
  1988. return r0, r1
  1989. })
  1990. }
  1991. func (f *UsersStoreGetByKeyIDFunc) nextHook() func(context.Context, int64) (*database.User, error) {
  1992. f.mutex.Lock()
  1993. defer f.mutex.Unlock()
  1994. if len(f.hooks) == 0 {
  1995. return f.defaultHook
  1996. }
  1997. hook := f.hooks[0]
  1998. f.hooks = f.hooks[1:]
  1999. return hook
  2000. }
  2001. func (f *UsersStoreGetByKeyIDFunc) appendCall(r0 UsersStoreGetByKeyIDFuncCall) {
  2002. f.mutex.Lock()
  2003. f.history = append(f.history, r0)
  2004. f.mutex.Unlock()
  2005. }
  2006. // History returns a sequence of UsersStoreGetByKeyIDFuncCall objects
  2007. // describing the invocations of this function.
  2008. func (f *UsersStoreGetByKeyIDFunc) History() []UsersStoreGetByKeyIDFuncCall {
  2009. f.mutex.Lock()
  2010. history := make([]UsersStoreGetByKeyIDFuncCall, len(f.history))
  2011. copy(history, f.history)
  2012. f.mutex.Unlock()
  2013. return history
  2014. }
  2015. // UsersStoreGetByKeyIDFuncCall is an object that describes an invocation of
  2016. // method GetByKeyID on an instance of MockUsersStore.
  2017. type UsersStoreGetByKeyIDFuncCall struct {
  2018. // Arg0 is the value of the 1st argument passed to this method
  2019. // invocation.
  2020. Arg0 context.Context
  2021. // Arg1 is the value of the 2nd argument passed to this method
  2022. // invocation.
  2023. Arg1 int64
  2024. // Result0 is the value of the 1st result returned from this method
  2025. // invocation.
  2026. Result0 *database.User
  2027. // Result1 is the value of the 2nd result returned from this method
  2028. // invocation.
  2029. Result1 error
  2030. }
  2031. // Args returns an interface slice containing the arguments of this
  2032. // invocation.
  2033. func (c UsersStoreGetByKeyIDFuncCall) Args() []interface{} {
  2034. return []interface{}{c.Arg0, c.Arg1}
  2035. }
  2036. // Results returns an interface slice containing the results of this
  2037. // invocation.
  2038. func (c UsersStoreGetByKeyIDFuncCall) Results() []interface{} {
  2039. return []interface{}{c.Result0, c.Result1}
  2040. }
  2041. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  2042. // method of the parent MockUsersStore instance is invoked.
  2043. type UsersStoreGetByUsernameFunc struct {
  2044. defaultHook func(context.Context, string) (*database.User, error)
  2045. hooks []func(context.Context, string) (*database.User, error)
  2046. history []UsersStoreGetByUsernameFuncCall
  2047. mutex sync.Mutex
  2048. }
  2049. // GetByUsername delegates to the next hook function in the queue and stores
  2050. // the parameter and result values of this invocation.
  2051. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*database.User, error) {
  2052. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  2053. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  2054. return r0, r1
  2055. }
  2056. // SetDefaultHook sets function that is called when the GetByUsername method
  2057. // of the parent MockUsersStore instance is invoked and the hook queue is
  2058. // empty.
  2059. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*database.User, error)) {
  2060. f.defaultHook = hook
  2061. }
  2062. // PushHook adds a function to the end of hook queue. Each invocation of the
  2063. // GetByUsername method of the parent MockUsersStore instance invokes the
  2064. // hook at the front of the queue and discards it. After the queue is empty,
  2065. // the default hook function is invoked for any future action.
  2066. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*database.User, error)) {
  2067. f.mutex.Lock()
  2068. f.hooks = append(f.hooks, hook)
  2069. f.mutex.Unlock()
  2070. }
  2071. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2072. // given values.
  2073. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *database.User, r1 error) {
  2074. f.SetDefaultHook(func(context.Context, string) (*database.User, error) {
  2075. return r0, r1
  2076. })
  2077. }
  2078. // PushReturn calls PushHook with a function that returns the given values.
  2079. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *database.User, r1 error) {
  2080. f.PushHook(func(context.Context, string) (*database.User, error) {
  2081. return r0, r1
  2082. })
  2083. }
  2084. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*database.User, error) {
  2085. f.mutex.Lock()
  2086. defer f.mutex.Unlock()
  2087. if len(f.hooks) == 0 {
  2088. return f.defaultHook
  2089. }
  2090. hook := f.hooks[0]
  2091. f.hooks = f.hooks[1:]
  2092. return hook
  2093. }
  2094. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  2095. f.mutex.Lock()
  2096. f.history = append(f.history, r0)
  2097. f.mutex.Unlock()
  2098. }
  2099. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  2100. // describing the invocations of this function.
  2101. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  2102. f.mutex.Lock()
  2103. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  2104. copy(history, f.history)
  2105. f.mutex.Unlock()
  2106. return history
  2107. }
  2108. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  2109. // of method GetByUsername on an instance of MockUsersStore.
  2110. type UsersStoreGetByUsernameFuncCall struct {
  2111. // Arg0 is the value of the 1st argument passed to this method
  2112. // invocation.
  2113. Arg0 context.Context
  2114. // Arg1 is the value of the 2nd argument passed to this method
  2115. // invocation.
  2116. Arg1 string
  2117. // Result0 is the value of the 1st result returned from this method
  2118. // invocation.
  2119. Result0 *database.User
  2120. // Result1 is the value of the 2nd result returned from this method
  2121. // invocation.
  2122. Result1 error
  2123. }
  2124. // Args returns an interface slice containing the arguments of this
  2125. // invocation.
  2126. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  2127. return []interface{}{c.Arg0, c.Arg1}
  2128. }
  2129. // Results returns an interface slice containing the results of this
  2130. // invocation.
  2131. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  2132. return []interface{}{c.Result0, c.Result1}
  2133. }
  2134. // UsersStoreGetEmailFunc describes the behavior when the GetEmail method of
  2135. // the parent MockUsersStore instance is invoked.
  2136. type UsersStoreGetEmailFunc struct {
  2137. defaultHook func(context.Context, int64, string, bool) (*database.EmailAddress, error)
  2138. hooks []func(context.Context, int64, string, bool) (*database.EmailAddress, error)
  2139. history []UsersStoreGetEmailFuncCall
  2140. mutex sync.Mutex
  2141. }
  2142. // GetEmail delegates to the next hook function in the queue and stores the
  2143. // parameter and result values of this invocation.
  2144. func (m *MockUsersStore) GetEmail(v0 context.Context, v1 int64, v2 string, v3 bool) (*database.EmailAddress, error) {
  2145. r0, r1 := m.GetEmailFunc.nextHook()(v0, v1, v2, v3)
  2146. m.GetEmailFunc.appendCall(UsersStoreGetEmailFuncCall{v0, v1, v2, v3, r0, r1})
  2147. return r0, r1
  2148. }
  2149. // SetDefaultHook sets function that is called when the GetEmail method of
  2150. // the parent MockUsersStore instance is invoked and the hook queue is
  2151. // empty.
  2152. func (f *UsersStoreGetEmailFunc) SetDefaultHook(hook func(context.Context, int64, string, bool) (*database.EmailAddress, error)) {
  2153. f.defaultHook = hook
  2154. }
  2155. // PushHook adds a function to the end of hook queue. Each invocation of the
  2156. // GetEmail method of the parent MockUsersStore instance invokes the hook at
  2157. // the front of the queue and discards it. After the queue is empty, the
  2158. // default hook function is invoked for any future action.
  2159. func (f *UsersStoreGetEmailFunc) PushHook(hook func(context.Context, int64, string, bool) (*database.EmailAddress, error)) {
  2160. f.mutex.Lock()
  2161. f.hooks = append(f.hooks, hook)
  2162. f.mutex.Unlock()
  2163. }
  2164. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2165. // given values.
  2166. func (f *UsersStoreGetEmailFunc) SetDefaultReturn(r0 *database.EmailAddress, r1 error) {
  2167. f.SetDefaultHook(func(context.Context, int64, string, bool) (*database.EmailAddress, error) {
  2168. return r0, r1
  2169. })
  2170. }
  2171. // PushReturn calls PushHook with a function that returns the given values.
  2172. func (f *UsersStoreGetEmailFunc) PushReturn(r0 *database.EmailAddress, r1 error) {
  2173. f.PushHook(func(context.Context, int64, string, bool) (*database.EmailAddress, error) {
  2174. return r0, r1
  2175. })
  2176. }
  2177. func (f *UsersStoreGetEmailFunc) nextHook() func(context.Context, int64, string, bool) (*database.EmailAddress, error) {
  2178. f.mutex.Lock()
  2179. defer f.mutex.Unlock()
  2180. if len(f.hooks) == 0 {
  2181. return f.defaultHook
  2182. }
  2183. hook := f.hooks[0]
  2184. f.hooks = f.hooks[1:]
  2185. return hook
  2186. }
  2187. func (f *UsersStoreGetEmailFunc) appendCall(r0 UsersStoreGetEmailFuncCall) {
  2188. f.mutex.Lock()
  2189. f.history = append(f.history, r0)
  2190. f.mutex.Unlock()
  2191. }
  2192. // History returns a sequence of UsersStoreGetEmailFuncCall objects
  2193. // describing the invocations of this function.
  2194. func (f *UsersStoreGetEmailFunc) History() []UsersStoreGetEmailFuncCall {
  2195. f.mutex.Lock()
  2196. history := make([]UsersStoreGetEmailFuncCall, len(f.history))
  2197. copy(history, f.history)
  2198. f.mutex.Unlock()
  2199. return history
  2200. }
  2201. // UsersStoreGetEmailFuncCall is an object that describes an invocation of
  2202. // method GetEmail on an instance of MockUsersStore.
  2203. type UsersStoreGetEmailFuncCall struct {
  2204. // Arg0 is the value of the 1st argument passed to this method
  2205. // invocation.
  2206. Arg0 context.Context
  2207. // Arg1 is the value of the 2nd argument passed to this method
  2208. // invocation.
  2209. Arg1 int64
  2210. // Arg2 is the value of the 3rd argument passed to this method
  2211. // invocation.
  2212. Arg2 string
  2213. // Arg3 is the value of the 4th argument passed to this method
  2214. // invocation.
  2215. Arg3 bool
  2216. // Result0 is the value of the 1st result returned from this method
  2217. // invocation.
  2218. Result0 *database.EmailAddress
  2219. // Result1 is the value of the 2nd result returned from this method
  2220. // invocation.
  2221. Result1 error
  2222. }
  2223. // Args returns an interface slice containing the arguments of this
  2224. // invocation.
  2225. func (c UsersStoreGetEmailFuncCall) Args() []interface{} {
  2226. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2227. }
  2228. // Results returns an interface slice containing the results of this
  2229. // invocation.
  2230. func (c UsersStoreGetEmailFuncCall) Results() []interface{} {
  2231. return []interface{}{c.Result0, c.Result1}
  2232. }
  2233. // UsersStoreGetMailableEmailsByUsernamesFunc describes the behavior when
  2234. // the GetMailableEmailsByUsernames method of the parent MockUsersStore
  2235. // instance is invoked.
  2236. type UsersStoreGetMailableEmailsByUsernamesFunc struct {
  2237. defaultHook func(context.Context, []string) ([]string, error)
  2238. hooks []func(context.Context, []string) ([]string, error)
  2239. history []UsersStoreGetMailableEmailsByUsernamesFuncCall
  2240. mutex sync.Mutex
  2241. }
  2242. // GetMailableEmailsByUsernames delegates to the next hook function in the
  2243. // queue and stores the parameter and result values of this invocation.
  2244. func (m *MockUsersStore) GetMailableEmailsByUsernames(v0 context.Context, v1 []string) ([]string, error) {
  2245. r0, r1 := m.GetMailableEmailsByUsernamesFunc.nextHook()(v0, v1)
  2246. m.GetMailableEmailsByUsernamesFunc.appendCall(UsersStoreGetMailableEmailsByUsernamesFuncCall{v0, v1, r0, r1})
  2247. return r0, r1
  2248. }
  2249. // SetDefaultHook sets function that is called when the
  2250. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  2251. // is invoked and the hook queue is empty.
  2252. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultHook(hook func(context.Context, []string) ([]string, error)) {
  2253. f.defaultHook = hook
  2254. }
  2255. // PushHook adds a function to the end of hook queue. Each invocation of the
  2256. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  2257. // invokes the hook at the front of the queue and discards it. After the
  2258. // queue is empty, the default hook function is invoked for any future
  2259. // action.
  2260. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushHook(hook func(context.Context, []string) ([]string, error)) {
  2261. f.mutex.Lock()
  2262. f.hooks = append(f.hooks, hook)
  2263. f.mutex.Unlock()
  2264. }
  2265. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2266. // given values.
  2267. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultReturn(r0 []string, r1 error) {
  2268. f.SetDefaultHook(func(context.Context, []string) ([]string, error) {
  2269. return r0, r1
  2270. })
  2271. }
  2272. // PushReturn calls PushHook with a function that returns the given values.
  2273. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushReturn(r0 []string, r1 error) {
  2274. f.PushHook(func(context.Context, []string) ([]string, error) {
  2275. return r0, r1
  2276. })
  2277. }
  2278. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) nextHook() func(context.Context, []string) ([]string, error) {
  2279. f.mutex.Lock()
  2280. defer f.mutex.Unlock()
  2281. if len(f.hooks) == 0 {
  2282. return f.defaultHook
  2283. }
  2284. hook := f.hooks[0]
  2285. f.hooks = f.hooks[1:]
  2286. return hook
  2287. }
  2288. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) appendCall(r0 UsersStoreGetMailableEmailsByUsernamesFuncCall) {
  2289. f.mutex.Lock()
  2290. f.history = append(f.history, r0)
  2291. f.mutex.Unlock()
  2292. }
  2293. // History returns a sequence of
  2294. // UsersStoreGetMailableEmailsByUsernamesFuncCall objects describing the
  2295. // invocations of this function.
  2296. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) History() []UsersStoreGetMailableEmailsByUsernamesFuncCall {
  2297. f.mutex.Lock()
  2298. history := make([]UsersStoreGetMailableEmailsByUsernamesFuncCall, len(f.history))
  2299. copy(history, f.history)
  2300. f.mutex.Unlock()
  2301. return history
  2302. }
  2303. // UsersStoreGetMailableEmailsByUsernamesFuncCall is an object that
  2304. // describes an invocation of method GetMailableEmailsByUsernames on an
  2305. // instance of MockUsersStore.
  2306. type UsersStoreGetMailableEmailsByUsernamesFuncCall struct {
  2307. // Arg0 is the value of the 1st argument passed to this method
  2308. // invocation.
  2309. Arg0 context.Context
  2310. // Arg1 is the value of the 2nd argument passed to this method
  2311. // invocation.
  2312. Arg1 []string
  2313. // Result0 is the value of the 1st result returned from this method
  2314. // invocation.
  2315. Result0 []string
  2316. // Result1 is the value of the 2nd result returned from this method
  2317. // invocation.
  2318. Result1 error
  2319. }
  2320. // Args returns an interface slice containing the arguments of this
  2321. // invocation.
  2322. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Args() []interface{} {
  2323. return []interface{}{c.Arg0, c.Arg1}
  2324. }
  2325. // Results returns an interface slice containing the results of this
  2326. // invocation.
  2327. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Results() []interface{} {
  2328. return []interface{}{c.Result0, c.Result1}
  2329. }
  2330. // UsersStoreIsFollowingFunc describes the behavior when the IsFollowing
  2331. // method of the parent MockUsersStore instance is invoked.
  2332. type UsersStoreIsFollowingFunc struct {
  2333. defaultHook func(context.Context, int64, int64) bool
  2334. hooks []func(context.Context, int64, int64) bool
  2335. history []UsersStoreIsFollowingFuncCall
  2336. mutex sync.Mutex
  2337. }
  2338. // IsFollowing delegates to the next hook function in the queue and stores
  2339. // the parameter and result values of this invocation.
  2340. func (m *MockUsersStore) IsFollowing(v0 context.Context, v1 int64, v2 int64) bool {
  2341. r0 := m.IsFollowingFunc.nextHook()(v0, v1, v2)
  2342. m.IsFollowingFunc.appendCall(UsersStoreIsFollowingFuncCall{v0, v1, v2, r0})
  2343. return r0
  2344. }
  2345. // SetDefaultHook sets function that is called when the IsFollowing method
  2346. // of the parent MockUsersStore instance is invoked and the hook queue is
  2347. // empty.
  2348. func (f *UsersStoreIsFollowingFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  2349. f.defaultHook = hook
  2350. }
  2351. // PushHook adds a function to the end of hook queue. Each invocation of the
  2352. // IsFollowing method of the parent MockUsersStore instance invokes the hook
  2353. // at the front of the queue and discards it. After the queue is empty, the
  2354. // default hook function is invoked for any future action.
  2355. func (f *UsersStoreIsFollowingFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  2356. f.mutex.Lock()
  2357. f.hooks = append(f.hooks, hook)
  2358. f.mutex.Unlock()
  2359. }
  2360. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2361. // given values.
  2362. func (f *UsersStoreIsFollowingFunc) SetDefaultReturn(r0 bool) {
  2363. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  2364. return r0
  2365. })
  2366. }
  2367. // PushReturn calls PushHook with a function that returns the given values.
  2368. func (f *UsersStoreIsFollowingFunc) PushReturn(r0 bool) {
  2369. f.PushHook(func(context.Context, int64, int64) bool {
  2370. return r0
  2371. })
  2372. }
  2373. func (f *UsersStoreIsFollowingFunc) nextHook() func(context.Context, int64, int64) bool {
  2374. f.mutex.Lock()
  2375. defer f.mutex.Unlock()
  2376. if len(f.hooks) == 0 {
  2377. return f.defaultHook
  2378. }
  2379. hook := f.hooks[0]
  2380. f.hooks = f.hooks[1:]
  2381. return hook
  2382. }
  2383. func (f *UsersStoreIsFollowingFunc) appendCall(r0 UsersStoreIsFollowingFuncCall) {
  2384. f.mutex.Lock()
  2385. f.history = append(f.history, r0)
  2386. f.mutex.Unlock()
  2387. }
  2388. // History returns a sequence of UsersStoreIsFollowingFuncCall objects
  2389. // describing the invocations of this function.
  2390. func (f *UsersStoreIsFollowingFunc) History() []UsersStoreIsFollowingFuncCall {
  2391. f.mutex.Lock()
  2392. history := make([]UsersStoreIsFollowingFuncCall, len(f.history))
  2393. copy(history, f.history)
  2394. f.mutex.Unlock()
  2395. return history
  2396. }
  2397. // UsersStoreIsFollowingFuncCall is an object that describes an invocation
  2398. // of method IsFollowing on an instance of MockUsersStore.
  2399. type UsersStoreIsFollowingFuncCall struct {
  2400. // Arg0 is the value of the 1st argument passed to this method
  2401. // invocation.
  2402. Arg0 context.Context
  2403. // Arg1 is the value of the 2nd argument passed to this method
  2404. // invocation.
  2405. Arg1 int64
  2406. // Arg2 is the value of the 3rd argument passed to this method
  2407. // invocation.
  2408. Arg2 int64
  2409. // Result0 is the value of the 1st result returned from this method
  2410. // invocation.
  2411. Result0 bool
  2412. }
  2413. // Args returns an interface slice containing the arguments of this
  2414. // invocation.
  2415. func (c UsersStoreIsFollowingFuncCall) Args() []interface{} {
  2416. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2417. }
  2418. // Results returns an interface slice containing the results of this
  2419. // invocation.
  2420. func (c UsersStoreIsFollowingFuncCall) Results() []interface{} {
  2421. return []interface{}{c.Result0}
  2422. }
  2423. // UsersStoreIsUsernameUsedFunc describes the behavior when the
  2424. // IsUsernameUsed method of the parent MockUsersStore instance is invoked.
  2425. type UsersStoreIsUsernameUsedFunc struct {
  2426. defaultHook func(context.Context, string, int64) bool
  2427. hooks []func(context.Context, string, int64) bool
  2428. history []UsersStoreIsUsernameUsedFuncCall
  2429. mutex sync.Mutex
  2430. }
  2431. // IsUsernameUsed delegates to the next hook function in the queue and
  2432. // stores the parameter and result values of this invocation.
  2433. func (m *MockUsersStore) IsUsernameUsed(v0 context.Context, v1 string, v2 int64) bool {
  2434. r0 := m.IsUsernameUsedFunc.nextHook()(v0, v1, v2)
  2435. m.IsUsernameUsedFunc.appendCall(UsersStoreIsUsernameUsedFuncCall{v0, v1, v2, r0})
  2436. return r0
  2437. }
  2438. // SetDefaultHook sets function that is called when the IsUsernameUsed
  2439. // method of the parent MockUsersStore instance is invoked and the hook
  2440. // queue is empty.
  2441. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultHook(hook func(context.Context, string, int64) bool) {
  2442. f.defaultHook = hook
  2443. }
  2444. // PushHook adds a function to the end of hook queue. Each invocation of the
  2445. // IsUsernameUsed method of the parent MockUsersStore instance invokes the
  2446. // hook at the front of the queue and discards it. After the queue is empty,
  2447. // the default hook function is invoked for any future action.
  2448. func (f *UsersStoreIsUsernameUsedFunc) PushHook(hook func(context.Context, string, int64) bool) {
  2449. f.mutex.Lock()
  2450. f.hooks = append(f.hooks, hook)
  2451. f.mutex.Unlock()
  2452. }
  2453. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2454. // given values.
  2455. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultReturn(r0 bool) {
  2456. f.SetDefaultHook(func(context.Context, string, int64) bool {
  2457. return r0
  2458. })
  2459. }
  2460. // PushReturn calls PushHook with a function that returns the given values.
  2461. func (f *UsersStoreIsUsernameUsedFunc) PushReturn(r0 bool) {
  2462. f.PushHook(func(context.Context, string, int64) bool {
  2463. return r0
  2464. })
  2465. }
  2466. func (f *UsersStoreIsUsernameUsedFunc) nextHook() func(context.Context, string, int64) bool {
  2467. f.mutex.Lock()
  2468. defer f.mutex.Unlock()
  2469. if len(f.hooks) == 0 {
  2470. return f.defaultHook
  2471. }
  2472. hook := f.hooks[0]
  2473. f.hooks = f.hooks[1:]
  2474. return hook
  2475. }
  2476. func (f *UsersStoreIsUsernameUsedFunc) appendCall(r0 UsersStoreIsUsernameUsedFuncCall) {
  2477. f.mutex.Lock()
  2478. f.history = append(f.history, r0)
  2479. f.mutex.Unlock()
  2480. }
  2481. // History returns a sequence of UsersStoreIsUsernameUsedFuncCall objects
  2482. // describing the invocations of this function.
  2483. func (f *UsersStoreIsUsernameUsedFunc) History() []UsersStoreIsUsernameUsedFuncCall {
  2484. f.mutex.Lock()
  2485. history := make([]UsersStoreIsUsernameUsedFuncCall, len(f.history))
  2486. copy(history, f.history)
  2487. f.mutex.Unlock()
  2488. return history
  2489. }
  2490. // UsersStoreIsUsernameUsedFuncCall is an object that describes an
  2491. // invocation of method IsUsernameUsed on an instance of MockUsersStore.
  2492. type UsersStoreIsUsernameUsedFuncCall struct {
  2493. // Arg0 is the value of the 1st argument passed to this method
  2494. // invocation.
  2495. Arg0 context.Context
  2496. // Arg1 is the value of the 2nd argument passed to this method
  2497. // invocation.
  2498. Arg1 string
  2499. // Arg2 is the value of the 3rd argument passed to this method
  2500. // invocation.
  2501. Arg2 int64
  2502. // Result0 is the value of the 1st result returned from this method
  2503. // invocation.
  2504. Result0 bool
  2505. }
  2506. // Args returns an interface slice containing the arguments of this
  2507. // invocation.
  2508. func (c UsersStoreIsUsernameUsedFuncCall) Args() []interface{} {
  2509. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2510. }
  2511. // Results returns an interface slice containing the results of this
  2512. // invocation.
  2513. func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
  2514. return []interface{}{c.Result0}
  2515. }
  2516. // UsersStoreListFunc describes the behavior when the List method of the
  2517. // parent MockUsersStore instance is invoked.
  2518. type UsersStoreListFunc struct {
  2519. defaultHook func(context.Context, int, int) ([]*database.User, error)
  2520. hooks []func(context.Context, int, int) ([]*database.User, error)
  2521. history []UsersStoreListFuncCall
  2522. mutex sync.Mutex
  2523. }
  2524. // List delegates to the next hook function in the queue and stores the
  2525. // parameter and result values of this invocation.
  2526. func (m *MockUsersStore) List(v0 context.Context, v1 int, v2 int) ([]*database.User, error) {
  2527. r0, r1 := m.ListFunc.nextHook()(v0, v1, v2)
  2528. m.ListFunc.appendCall(UsersStoreListFuncCall{v0, v1, v2, r0, r1})
  2529. return r0, r1
  2530. }
  2531. // SetDefaultHook sets function that is called when the List method of the
  2532. // parent MockUsersStore instance is invoked and the hook queue is empty.
  2533. func (f *UsersStoreListFunc) SetDefaultHook(hook func(context.Context, int, int) ([]*database.User, error)) {
  2534. f.defaultHook = hook
  2535. }
  2536. // PushHook adds a function to the end of hook queue. Each invocation of the
  2537. // List method of the parent MockUsersStore instance invokes the hook at the
  2538. // front of the queue and discards it. After the queue is empty, the default
  2539. // hook function is invoked for any future action.
  2540. func (f *UsersStoreListFunc) PushHook(hook func(context.Context, int, int) ([]*database.User, error)) {
  2541. f.mutex.Lock()
  2542. f.hooks = append(f.hooks, hook)
  2543. f.mutex.Unlock()
  2544. }
  2545. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2546. // given values.
  2547. func (f *UsersStoreListFunc) SetDefaultReturn(r0 []*database.User, r1 error) {
  2548. f.SetDefaultHook(func(context.Context, int, int) ([]*database.User, error) {
  2549. return r0, r1
  2550. })
  2551. }
  2552. // PushReturn calls PushHook with a function that returns the given values.
  2553. func (f *UsersStoreListFunc) PushReturn(r0 []*database.User, r1 error) {
  2554. f.PushHook(func(context.Context, int, int) ([]*database.User, error) {
  2555. return r0, r1
  2556. })
  2557. }
  2558. func (f *UsersStoreListFunc) nextHook() func(context.Context, int, int) ([]*database.User, error) {
  2559. f.mutex.Lock()
  2560. defer f.mutex.Unlock()
  2561. if len(f.hooks) == 0 {
  2562. return f.defaultHook
  2563. }
  2564. hook := f.hooks[0]
  2565. f.hooks = f.hooks[1:]
  2566. return hook
  2567. }
  2568. func (f *UsersStoreListFunc) appendCall(r0 UsersStoreListFuncCall) {
  2569. f.mutex.Lock()
  2570. f.history = append(f.history, r0)
  2571. f.mutex.Unlock()
  2572. }
  2573. // History returns a sequence of UsersStoreListFuncCall objects describing
  2574. // the invocations of this function.
  2575. func (f *UsersStoreListFunc) History() []UsersStoreListFuncCall {
  2576. f.mutex.Lock()
  2577. history := make([]UsersStoreListFuncCall, len(f.history))
  2578. copy(history, f.history)
  2579. f.mutex.Unlock()
  2580. return history
  2581. }
  2582. // UsersStoreListFuncCall is an object that describes an invocation of
  2583. // method List on an instance of MockUsersStore.
  2584. type UsersStoreListFuncCall struct {
  2585. // Arg0 is the value of the 1st argument passed to this method
  2586. // invocation.
  2587. Arg0 context.Context
  2588. // Arg1 is the value of the 2nd argument passed to this method
  2589. // invocation.
  2590. Arg1 int
  2591. // Arg2 is the value of the 3rd argument passed to this method
  2592. // invocation.
  2593. Arg2 int
  2594. // Result0 is the value of the 1st result returned from this method
  2595. // invocation.
  2596. Result0 []*database.User
  2597. // Result1 is the value of the 2nd result returned from this method
  2598. // invocation.
  2599. Result1 error
  2600. }
  2601. // Args returns an interface slice containing the arguments of this
  2602. // invocation.
  2603. func (c UsersStoreListFuncCall) Args() []interface{} {
  2604. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2605. }
  2606. // Results returns an interface slice containing the results of this
  2607. // invocation.
  2608. func (c UsersStoreListFuncCall) Results() []interface{} {
  2609. return []interface{}{c.Result0, c.Result1}
  2610. }
  2611. // UsersStoreListEmailsFunc describes the behavior when the ListEmails
  2612. // method of the parent MockUsersStore instance is invoked.
  2613. type UsersStoreListEmailsFunc struct {
  2614. defaultHook func(context.Context, int64) ([]*database.EmailAddress, error)
  2615. hooks []func(context.Context, int64) ([]*database.EmailAddress, error)
  2616. history []UsersStoreListEmailsFuncCall
  2617. mutex sync.Mutex
  2618. }
  2619. // ListEmails delegates to the next hook function in the queue and stores
  2620. // the parameter and result values of this invocation.
  2621. func (m *MockUsersStore) ListEmails(v0 context.Context, v1 int64) ([]*database.EmailAddress, error) {
  2622. r0, r1 := m.ListEmailsFunc.nextHook()(v0, v1)
  2623. m.ListEmailsFunc.appendCall(UsersStoreListEmailsFuncCall{v0, v1, r0, r1})
  2624. return r0, r1
  2625. }
  2626. // SetDefaultHook sets function that is called when the ListEmails method of
  2627. // the parent MockUsersStore instance is invoked and the hook queue is
  2628. // empty.
  2629. func (f *UsersStoreListEmailsFunc) SetDefaultHook(hook func(context.Context, int64) ([]*database.EmailAddress, error)) {
  2630. f.defaultHook = hook
  2631. }
  2632. // PushHook adds a function to the end of hook queue. Each invocation of the
  2633. // ListEmails method of the parent MockUsersStore instance invokes the hook
  2634. // at the front of the queue and discards it. After the queue is empty, the
  2635. // default hook function is invoked for any future action.
  2636. func (f *UsersStoreListEmailsFunc) PushHook(hook func(context.Context, int64) ([]*database.EmailAddress, error)) {
  2637. f.mutex.Lock()
  2638. f.hooks = append(f.hooks, hook)
  2639. f.mutex.Unlock()
  2640. }
  2641. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2642. // given values.
  2643. func (f *UsersStoreListEmailsFunc) SetDefaultReturn(r0 []*database.EmailAddress, r1 error) {
  2644. f.SetDefaultHook(func(context.Context, int64) ([]*database.EmailAddress, error) {
  2645. return r0, r1
  2646. })
  2647. }
  2648. // PushReturn calls PushHook with a function that returns the given values.
  2649. func (f *UsersStoreListEmailsFunc) PushReturn(r0 []*database.EmailAddress, r1 error) {
  2650. f.PushHook(func(context.Context, int64) ([]*database.EmailAddress, error) {
  2651. return r0, r1
  2652. })
  2653. }
  2654. func (f *UsersStoreListEmailsFunc) nextHook() func(context.Context, int64) ([]*database.EmailAddress, error) {
  2655. f.mutex.Lock()
  2656. defer f.mutex.Unlock()
  2657. if len(f.hooks) == 0 {
  2658. return f.defaultHook
  2659. }
  2660. hook := f.hooks[0]
  2661. f.hooks = f.hooks[1:]
  2662. return hook
  2663. }
  2664. func (f *UsersStoreListEmailsFunc) appendCall(r0 UsersStoreListEmailsFuncCall) {
  2665. f.mutex.Lock()
  2666. f.history = append(f.history, r0)
  2667. f.mutex.Unlock()
  2668. }
  2669. // History returns a sequence of UsersStoreListEmailsFuncCall objects
  2670. // describing the invocations of this function.
  2671. func (f *UsersStoreListEmailsFunc) History() []UsersStoreListEmailsFuncCall {
  2672. f.mutex.Lock()
  2673. history := make([]UsersStoreListEmailsFuncCall, len(f.history))
  2674. copy(history, f.history)
  2675. f.mutex.Unlock()
  2676. return history
  2677. }
  2678. // UsersStoreListEmailsFuncCall is an object that describes an invocation of
  2679. // method ListEmails on an instance of MockUsersStore.
  2680. type UsersStoreListEmailsFuncCall struct {
  2681. // Arg0 is the value of the 1st argument passed to this method
  2682. // invocation.
  2683. Arg0 context.Context
  2684. // Arg1 is the value of the 2nd argument passed to this method
  2685. // invocation.
  2686. Arg1 int64
  2687. // Result0 is the value of the 1st result returned from this method
  2688. // invocation.
  2689. Result0 []*database.EmailAddress
  2690. // Result1 is the value of the 2nd result returned from this method
  2691. // invocation.
  2692. Result1 error
  2693. }
  2694. // Args returns an interface slice containing the arguments of this
  2695. // invocation.
  2696. func (c UsersStoreListEmailsFuncCall) Args() []interface{} {
  2697. return []interface{}{c.Arg0, c.Arg1}
  2698. }
  2699. // Results returns an interface slice containing the results of this
  2700. // invocation.
  2701. func (c UsersStoreListEmailsFuncCall) Results() []interface{} {
  2702. return []interface{}{c.Result0, c.Result1}
  2703. }
  2704. // UsersStoreListFollowersFunc describes the behavior when the ListFollowers
  2705. // method of the parent MockUsersStore instance is invoked.
  2706. type UsersStoreListFollowersFunc struct {
  2707. defaultHook func(context.Context, int64, int, int) ([]*database.User, error)
  2708. hooks []func(context.Context, int64, int, int) ([]*database.User, error)
  2709. history []UsersStoreListFollowersFuncCall
  2710. mutex sync.Mutex
  2711. }
  2712. // ListFollowers delegates to the next hook function in the queue and stores
  2713. // the parameter and result values of this invocation.
  2714. func (m *MockUsersStore) ListFollowers(v0 context.Context, v1 int64, v2 int, v3 int) ([]*database.User, error) {
  2715. r0, r1 := m.ListFollowersFunc.nextHook()(v0, v1, v2, v3)
  2716. m.ListFollowersFunc.appendCall(UsersStoreListFollowersFuncCall{v0, v1, v2, v3, r0, r1})
  2717. return r0, r1
  2718. }
  2719. // SetDefaultHook sets function that is called when the ListFollowers method
  2720. // of the parent MockUsersStore instance is invoked and the hook queue is
  2721. // empty.
  2722. func (f *UsersStoreListFollowersFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*database.User, error)) {
  2723. f.defaultHook = hook
  2724. }
  2725. // PushHook adds a function to the end of hook queue. Each invocation of the
  2726. // ListFollowers method of the parent MockUsersStore instance invokes the
  2727. // hook at the front of the queue and discards it. After the queue is empty,
  2728. // the default hook function is invoked for any future action.
  2729. func (f *UsersStoreListFollowersFunc) PushHook(hook func(context.Context, int64, int, int) ([]*database.User, error)) {
  2730. f.mutex.Lock()
  2731. f.hooks = append(f.hooks, hook)
  2732. f.mutex.Unlock()
  2733. }
  2734. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2735. // given values.
  2736. func (f *UsersStoreListFollowersFunc) SetDefaultReturn(r0 []*database.User, r1 error) {
  2737. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*database.User, error) {
  2738. return r0, r1
  2739. })
  2740. }
  2741. // PushReturn calls PushHook with a function that returns the given values.
  2742. func (f *UsersStoreListFollowersFunc) PushReturn(r0 []*database.User, r1 error) {
  2743. f.PushHook(func(context.Context, int64, int, int) ([]*database.User, error) {
  2744. return r0, r1
  2745. })
  2746. }
  2747. func (f *UsersStoreListFollowersFunc) nextHook() func(context.Context, int64, int, int) ([]*database.User, error) {
  2748. f.mutex.Lock()
  2749. defer f.mutex.Unlock()
  2750. if len(f.hooks) == 0 {
  2751. return f.defaultHook
  2752. }
  2753. hook := f.hooks[0]
  2754. f.hooks = f.hooks[1:]
  2755. return hook
  2756. }
  2757. func (f *UsersStoreListFollowersFunc) appendCall(r0 UsersStoreListFollowersFuncCall) {
  2758. f.mutex.Lock()
  2759. f.history = append(f.history, r0)
  2760. f.mutex.Unlock()
  2761. }
  2762. // History returns a sequence of UsersStoreListFollowersFuncCall objects
  2763. // describing the invocations of this function.
  2764. func (f *UsersStoreListFollowersFunc) History() []UsersStoreListFollowersFuncCall {
  2765. f.mutex.Lock()
  2766. history := make([]UsersStoreListFollowersFuncCall, len(f.history))
  2767. copy(history, f.history)
  2768. f.mutex.Unlock()
  2769. return history
  2770. }
  2771. // UsersStoreListFollowersFuncCall is an object that describes an invocation
  2772. // of method ListFollowers on an instance of MockUsersStore.
  2773. type UsersStoreListFollowersFuncCall struct {
  2774. // Arg0 is the value of the 1st argument passed to this method
  2775. // invocation.
  2776. Arg0 context.Context
  2777. // Arg1 is the value of the 2nd argument passed to this method
  2778. // invocation.
  2779. Arg1 int64
  2780. // Arg2 is the value of the 3rd argument passed to this method
  2781. // invocation.
  2782. Arg2 int
  2783. // Arg3 is the value of the 4th argument passed to this method
  2784. // invocation.
  2785. Arg3 int
  2786. // Result0 is the value of the 1st result returned from this method
  2787. // invocation.
  2788. Result0 []*database.User
  2789. // Result1 is the value of the 2nd result returned from this method
  2790. // invocation.
  2791. Result1 error
  2792. }
  2793. // Args returns an interface slice containing the arguments of this
  2794. // invocation.
  2795. func (c UsersStoreListFollowersFuncCall) Args() []interface{} {
  2796. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2797. }
  2798. // Results returns an interface slice containing the results of this
  2799. // invocation.
  2800. func (c UsersStoreListFollowersFuncCall) Results() []interface{} {
  2801. return []interface{}{c.Result0, c.Result1}
  2802. }
  2803. // UsersStoreListFollowingsFunc describes the behavior when the
  2804. // ListFollowings method of the parent MockUsersStore instance is invoked.
  2805. type UsersStoreListFollowingsFunc struct {
  2806. defaultHook func(context.Context, int64, int, int) ([]*database.User, error)
  2807. hooks []func(context.Context, int64, int, int) ([]*database.User, error)
  2808. history []UsersStoreListFollowingsFuncCall
  2809. mutex sync.Mutex
  2810. }
  2811. // ListFollowings delegates to the next hook function in the queue and
  2812. // stores the parameter and result values of this invocation.
  2813. func (m *MockUsersStore) ListFollowings(v0 context.Context, v1 int64, v2 int, v3 int) ([]*database.User, error) {
  2814. r0, r1 := m.ListFollowingsFunc.nextHook()(v0, v1, v2, v3)
  2815. m.ListFollowingsFunc.appendCall(UsersStoreListFollowingsFuncCall{v0, v1, v2, v3, r0, r1})
  2816. return r0, r1
  2817. }
  2818. // SetDefaultHook sets function that is called when the ListFollowings
  2819. // method of the parent MockUsersStore instance is invoked and the hook
  2820. // queue is empty.
  2821. func (f *UsersStoreListFollowingsFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*database.User, error)) {
  2822. f.defaultHook = hook
  2823. }
  2824. // PushHook adds a function to the end of hook queue. Each invocation of the
  2825. // ListFollowings method of the parent MockUsersStore instance invokes the
  2826. // hook at the front of the queue and discards it. After the queue is empty,
  2827. // the default hook function is invoked for any future action.
  2828. func (f *UsersStoreListFollowingsFunc) PushHook(hook func(context.Context, int64, int, int) ([]*database.User, error)) {
  2829. f.mutex.Lock()
  2830. f.hooks = append(f.hooks, hook)
  2831. f.mutex.Unlock()
  2832. }
  2833. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2834. // given values.
  2835. func (f *UsersStoreListFollowingsFunc) SetDefaultReturn(r0 []*database.User, r1 error) {
  2836. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*database.User, error) {
  2837. return r0, r1
  2838. })
  2839. }
  2840. // PushReturn calls PushHook with a function that returns the given values.
  2841. func (f *UsersStoreListFollowingsFunc) PushReturn(r0 []*database.User, r1 error) {
  2842. f.PushHook(func(context.Context, int64, int, int) ([]*database.User, error) {
  2843. return r0, r1
  2844. })
  2845. }
  2846. func (f *UsersStoreListFollowingsFunc) nextHook() func(context.Context, int64, int, int) ([]*database.User, error) {
  2847. f.mutex.Lock()
  2848. defer f.mutex.Unlock()
  2849. if len(f.hooks) == 0 {
  2850. return f.defaultHook
  2851. }
  2852. hook := f.hooks[0]
  2853. f.hooks = f.hooks[1:]
  2854. return hook
  2855. }
  2856. func (f *UsersStoreListFollowingsFunc) appendCall(r0 UsersStoreListFollowingsFuncCall) {
  2857. f.mutex.Lock()
  2858. f.history = append(f.history, r0)
  2859. f.mutex.Unlock()
  2860. }
  2861. // History returns a sequence of UsersStoreListFollowingsFuncCall objects
  2862. // describing the invocations of this function.
  2863. func (f *UsersStoreListFollowingsFunc) History() []UsersStoreListFollowingsFuncCall {
  2864. f.mutex.Lock()
  2865. history := make([]UsersStoreListFollowingsFuncCall, len(f.history))
  2866. copy(history, f.history)
  2867. f.mutex.Unlock()
  2868. return history
  2869. }
  2870. // UsersStoreListFollowingsFuncCall is an object that describes an
  2871. // invocation of method ListFollowings on an instance of MockUsersStore.
  2872. type UsersStoreListFollowingsFuncCall struct {
  2873. // Arg0 is the value of the 1st argument passed to this method
  2874. // invocation.
  2875. Arg0 context.Context
  2876. // Arg1 is the value of the 2nd argument passed to this method
  2877. // invocation.
  2878. Arg1 int64
  2879. // Arg2 is the value of the 3rd argument passed to this method
  2880. // invocation.
  2881. Arg2 int
  2882. // Arg3 is the value of the 4th argument passed to this method
  2883. // invocation.
  2884. Arg3 int
  2885. // Result0 is the value of the 1st result returned from this method
  2886. // invocation.
  2887. Result0 []*database.User
  2888. // Result1 is the value of the 2nd result returned from this method
  2889. // invocation.
  2890. Result1 error
  2891. }
  2892. // Args returns an interface slice containing the arguments of this
  2893. // invocation.
  2894. func (c UsersStoreListFollowingsFuncCall) Args() []interface{} {
  2895. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2896. }
  2897. // Results returns an interface slice containing the results of this
  2898. // invocation.
  2899. func (c UsersStoreListFollowingsFuncCall) Results() []interface{} {
  2900. return []interface{}{c.Result0, c.Result1}
  2901. }
  2902. // UsersStoreMarkEmailActivatedFunc describes the behavior when the
  2903. // MarkEmailActivated method of the parent MockUsersStore instance is
  2904. // invoked.
  2905. type UsersStoreMarkEmailActivatedFunc struct {
  2906. defaultHook func(context.Context, int64, string) error
  2907. hooks []func(context.Context, int64, string) error
  2908. history []UsersStoreMarkEmailActivatedFuncCall
  2909. mutex sync.Mutex
  2910. }
  2911. // MarkEmailActivated delegates to the next hook function in the queue and
  2912. // stores the parameter and result values of this invocation.
  2913. func (m *MockUsersStore) MarkEmailActivated(v0 context.Context, v1 int64, v2 string) error {
  2914. r0 := m.MarkEmailActivatedFunc.nextHook()(v0, v1, v2)
  2915. m.MarkEmailActivatedFunc.appendCall(UsersStoreMarkEmailActivatedFuncCall{v0, v1, v2, r0})
  2916. return r0
  2917. }
  2918. // SetDefaultHook sets function that is called when the MarkEmailActivated
  2919. // method of the parent MockUsersStore instance is invoked and the hook
  2920. // queue is empty.
  2921. func (f *UsersStoreMarkEmailActivatedFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  2922. f.defaultHook = hook
  2923. }
  2924. // PushHook adds a function to the end of hook queue. Each invocation of the
  2925. // MarkEmailActivated method of the parent MockUsersStore instance invokes
  2926. // the hook at the front of the queue and discards it. After the queue is
  2927. // empty, the default hook function is invoked for any future action.
  2928. func (f *UsersStoreMarkEmailActivatedFunc) PushHook(hook func(context.Context, int64, string) error) {
  2929. f.mutex.Lock()
  2930. f.hooks = append(f.hooks, hook)
  2931. f.mutex.Unlock()
  2932. }
  2933. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2934. // given values.
  2935. func (f *UsersStoreMarkEmailActivatedFunc) SetDefaultReturn(r0 error) {
  2936. f.SetDefaultHook(func(context.Context, int64, string) error {
  2937. return r0
  2938. })
  2939. }
  2940. // PushReturn calls PushHook with a function that returns the given values.
  2941. func (f *UsersStoreMarkEmailActivatedFunc) PushReturn(r0 error) {
  2942. f.PushHook(func(context.Context, int64, string) error {
  2943. return r0
  2944. })
  2945. }
  2946. func (f *UsersStoreMarkEmailActivatedFunc) nextHook() func(context.Context, int64, string) error {
  2947. f.mutex.Lock()
  2948. defer f.mutex.Unlock()
  2949. if len(f.hooks) == 0 {
  2950. return f.defaultHook
  2951. }
  2952. hook := f.hooks[0]
  2953. f.hooks = f.hooks[1:]
  2954. return hook
  2955. }
  2956. func (f *UsersStoreMarkEmailActivatedFunc) appendCall(r0 UsersStoreMarkEmailActivatedFuncCall) {
  2957. f.mutex.Lock()
  2958. f.history = append(f.history, r0)
  2959. f.mutex.Unlock()
  2960. }
  2961. // History returns a sequence of UsersStoreMarkEmailActivatedFuncCall
  2962. // objects describing the invocations of this function.
  2963. func (f *UsersStoreMarkEmailActivatedFunc) History() []UsersStoreMarkEmailActivatedFuncCall {
  2964. f.mutex.Lock()
  2965. history := make([]UsersStoreMarkEmailActivatedFuncCall, len(f.history))
  2966. copy(history, f.history)
  2967. f.mutex.Unlock()
  2968. return history
  2969. }
  2970. // UsersStoreMarkEmailActivatedFuncCall is an object that describes an
  2971. // invocation of method MarkEmailActivated on an instance of MockUsersStore.
  2972. type UsersStoreMarkEmailActivatedFuncCall struct {
  2973. // Arg0 is the value of the 1st argument passed to this method
  2974. // invocation.
  2975. Arg0 context.Context
  2976. // Arg1 is the value of the 2nd argument passed to this method
  2977. // invocation.
  2978. Arg1 int64
  2979. // Arg2 is the value of the 3rd argument passed to this method
  2980. // invocation.
  2981. Arg2 string
  2982. // Result0 is the value of the 1st result returned from this method
  2983. // invocation.
  2984. Result0 error
  2985. }
  2986. // Args returns an interface slice containing the arguments of this
  2987. // invocation.
  2988. func (c UsersStoreMarkEmailActivatedFuncCall) Args() []interface{} {
  2989. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2990. }
  2991. // Results returns an interface slice containing the results of this
  2992. // invocation.
  2993. func (c UsersStoreMarkEmailActivatedFuncCall) Results() []interface{} {
  2994. return []interface{}{c.Result0}
  2995. }
  2996. // UsersStoreMarkEmailPrimaryFunc describes the behavior when the
  2997. // MarkEmailPrimary method of the parent MockUsersStore instance is invoked.
  2998. type UsersStoreMarkEmailPrimaryFunc struct {
  2999. defaultHook func(context.Context, int64, string) error
  3000. hooks []func(context.Context, int64, string) error
  3001. history []UsersStoreMarkEmailPrimaryFuncCall
  3002. mutex sync.Mutex
  3003. }
  3004. // MarkEmailPrimary delegates to the next hook function in the queue and
  3005. // stores the parameter and result values of this invocation.
  3006. func (m *MockUsersStore) MarkEmailPrimary(v0 context.Context, v1 int64, v2 string) error {
  3007. r0 := m.MarkEmailPrimaryFunc.nextHook()(v0, v1, v2)
  3008. m.MarkEmailPrimaryFunc.appendCall(UsersStoreMarkEmailPrimaryFuncCall{v0, v1, v2, r0})
  3009. return r0
  3010. }
  3011. // SetDefaultHook sets function that is called when the MarkEmailPrimary
  3012. // method of the parent MockUsersStore instance is invoked and the hook
  3013. // queue is empty.
  3014. func (f *UsersStoreMarkEmailPrimaryFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  3015. f.defaultHook = hook
  3016. }
  3017. // PushHook adds a function to the end of hook queue. Each invocation of the
  3018. // MarkEmailPrimary method of the parent MockUsersStore instance invokes the
  3019. // hook at the front of the queue and discards it. After the queue is empty,
  3020. // the default hook function is invoked for any future action.
  3021. func (f *UsersStoreMarkEmailPrimaryFunc) PushHook(hook func(context.Context, int64, string) error) {
  3022. f.mutex.Lock()
  3023. f.hooks = append(f.hooks, hook)
  3024. f.mutex.Unlock()
  3025. }
  3026. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3027. // given values.
  3028. func (f *UsersStoreMarkEmailPrimaryFunc) SetDefaultReturn(r0 error) {
  3029. f.SetDefaultHook(func(context.Context, int64, string) error {
  3030. return r0
  3031. })
  3032. }
  3033. // PushReturn calls PushHook with a function that returns the given values.
  3034. func (f *UsersStoreMarkEmailPrimaryFunc) PushReturn(r0 error) {
  3035. f.PushHook(func(context.Context, int64, string) error {
  3036. return r0
  3037. })
  3038. }
  3039. func (f *UsersStoreMarkEmailPrimaryFunc) nextHook() func(context.Context, int64, string) error {
  3040. f.mutex.Lock()
  3041. defer f.mutex.Unlock()
  3042. if len(f.hooks) == 0 {
  3043. return f.defaultHook
  3044. }
  3045. hook := f.hooks[0]
  3046. f.hooks = f.hooks[1:]
  3047. return hook
  3048. }
  3049. func (f *UsersStoreMarkEmailPrimaryFunc) appendCall(r0 UsersStoreMarkEmailPrimaryFuncCall) {
  3050. f.mutex.Lock()
  3051. f.history = append(f.history, r0)
  3052. f.mutex.Unlock()
  3053. }
  3054. // History returns a sequence of UsersStoreMarkEmailPrimaryFuncCall objects
  3055. // describing the invocations of this function.
  3056. func (f *UsersStoreMarkEmailPrimaryFunc) History() []UsersStoreMarkEmailPrimaryFuncCall {
  3057. f.mutex.Lock()
  3058. history := make([]UsersStoreMarkEmailPrimaryFuncCall, len(f.history))
  3059. copy(history, f.history)
  3060. f.mutex.Unlock()
  3061. return history
  3062. }
  3063. // UsersStoreMarkEmailPrimaryFuncCall is an object that describes an
  3064. // invocation of method MarkEmailPrimary on an instance of MockUsersStore.
  3065. type UsersStoreMarkEmailPrimaryFuncCall struct {
  3066. // Arg0 is the value of the 1st argument passed to this method
  3067. // invocation.
  3068. Arg0 context.Context
  3069. // Arg1 is the value of the 2nd argument passed to this method
  3070. // invocation.
  3071. Arg1 int64
  3072. // Arg2 is the value of the 3rd argument passed to this method
  3073. // invocation.
  3074. Arg2 string
  3075. // Result0 is the value of the 1st result returned from this method
  3076. // invocation.
  3077. Result0 error
  3078. }
  3079. // Args returns an interface slice containing the arguments of this
  3080. // invocation.
  3081. func (c UsersStoreMarkEmailPrimaryFuncCall) Args() []interface{} {
  3082. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3083. }
  3084. // Results returns an interface slice containing the results of this
  3085. // invocation.
  3086. func (c UsersStoreMarkEmailPrimaryFuncCall) Results() []interface{} {
  3087. return []interface{}{c.Result0}
  3088. }
  3089. // UsersStoreSearchByNameFunc describes the behavior when the SearchByName
  3090. // method of the parent MockUsersStore instance is invoked.
  3091. type UsersStoreSearchByNameFunc struct {
  3092. defaultHook func(context.Context, string, int, int, string) ([]*database.User, int64, error)
  3093. hooks []func(context.Context, string, int, int, string) ([]*database.User, int64, error)
  3094. history []UsersStoreSearchByNameFuncCall
  3095. mutex sync.Mutex
  3096. }
  3097. // SearchByName delegates to the next hook function in the queue and stores
  3098. // the parameter and result values of this invocation.
  3099. func (m *MockUsersStore) SearchByName(v0 context.Context, v1 string, v2 int, v3 int, v4 string) ([]*database.User, int64, error) {
  3100. r0, r1, r2 := m.SearchByNameFunc.nextHook()(v0, v1, v2, v3, v4)
  3101. m.SearchByNameFunc.appendCall(UsersStoreSearchByNameFuncCall{v0, v1, v2, v3, v4, r0, r1, r2})
  3102. return r0, r1, r2
  3103. }
  3104. // SetDefaultHook sets function that is called when the SearchByName method
  3105. // of the parent MockUsersStore instance is invoked and the hook queue is
  3106. // empty.
  3107. func (f *UsersStoreSearchByNameFunc) SetDefaultHook(hook func(context.Context, string, int, int, string) ([]*database.User, int64, error)) {
  3108. f.defaultHook = hook
  3109. }
  3110. // PushHook adds a function to the end of hook queue. Each invocation of the
  3111. // SearchByName method of the parent MockUsersStore instance invokes the
  3112. // hook at the front of the queue and discards it. After the queue is empty,
  3113. // the default hook function is invoked for any future action.
  3114. func (f *UsersStoreSearchByNameFunc) PushHook(hook func(context.Context, string, int, int, string) ([]*database.User, int64, error)) {
  3115. f.mutex.Lock()
  3116. f.hooks = append(f.hooks, hook)
  3117. f.mutex.Unlock()
  3118. }
  3119. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3120. // given values.
  3121. func (f *UsersStoreSearchByNameFunc) SetDefaultReturn(r0 []*database.User, r1 int64, r2 error) {
  3122. f.SetDefaultHook(func(context.Context, string, int, int, string) ([]*database.User, int64, error) {
  3123. return r0, r1, r2
  3124. })
  3125. }
  3126. // PushReturn calls PushHook with a function that returns the given values.
  3127. func (f *UsersStoreSearchByNameFunc) PushReturn(r0 []*database.User, r1 int64, r2 error) {
  3128. f.PushHook(func(context.Context, string, int, int, string) ([]*database.User, int64, error) {
  3129. return r0, r1, r2
  3130. })
  3131. }
  3132. func (f *UsersStoreSearchByNameFunc) nextHook() func(context.Context, string, int, int, string) ([]*database.User, int64, error) {
  3133. f.mutex.Lock()
  3134. defer f.mutex.Unlock()
  3135. if len(f.hooks) == 0 {
  3136. return f.defaultHook
  3137. }
  3138. hook := f.hooks[0]
  3139. f.hooks = f.hooks[1:]
  3140. return hook
  3141. }
  3142. func (f *UsersStoreSearchByNameFunc) appendCall(r0 UsersStoreSearchByNameFuncCall) {
  3143. f.mutex.Lock()
  3144. f.history = append(f.history, r0)
  3145. f.mutex.Unlock()
  3146. }
  3147. // History returns a sequence of UsersStoreSearchByNameFuncCall objects
  3148. // describing the invocations of this function.
  3149. func (f *UsersStoreSearchByNameFunc) History() []UsersStoreSearchByNameFuncCall {
  3150. f.mutex.Lock()
  3151. history := make([]UsersStoreSearchByNameFuncCall, len(f.history))
  3152. copy(history, f.history)
  3153. f.mutex.Unlock()
  3154. return history
  3155. }
  3156. // UsersStoreSearchByNameFuncCall is an object that describes an invocation
  3157. // of method SearchByName on an instance of MockUsersStore.
  3158. type UsersStoreSearchByNameFuncCall struct {
  3159. // Arg0 is the value of the 1st argument passed to this method
  3160. // invocation.
  3161. Arg0 context.Context
  3162. // Arg1 is the value of the 2nd argument passed to this method
  3163. // invocation.
  3164. Arg1 string
  3165. // Arg2 is the value of the 3rd argument passed to this method
  3166. // invocation.
  3167. Arg2 int
  3168. // Arg3 is the value of the 4th argument passed to this method
  3169. // invocation.
  3170. Arg3 int
  3171. // Arg4 is the value of the 5th argument passed to this method
  3172. // invocation.
  3173. Arg4 string
  3174. // Result0 is the value of the 1st result returned from this method
  3175. // invocation.
  3176. Result0 []*database.User
  3177. // Result1 is the value of the 2nd result returned from this method
  3178. // invocation.
  3179. Result1 int64
  3180. // Result2 is the value of the 3rd result returned from this method
  3181. // invocation.
  3182. Result2 error
  3183. }
  3184. // Args returns an interface slice containing the arguments of this
  3185. // invocation.
  3186. func (c UsersStoreSearchByNameFuncCall) Args() []interface{} {
  3187. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  3188. }
  3189. // Results returns an interface slice containing the results of this
  3190. // invocation.
  3191. func (c UsersStoreSearchByNameFuncCall) Results() []interface{} {
  3192. return []interface{}{c.Result0, c.Result1, c.Result2}
  3193. }
  3194. // UsersStoreUnfollowFunc describes the behavior when the Unfollow method of
  3195. // the parent MockUsersStore instance is invoked.
  3196. type UsersStoreUnfollowFunc struct {
  3197. defaultHook func(context.Context, int64, int64) error
  3198. hooks []func(context.Context, int64, int64) error
  3199. history []UsersStoreUnfollowFuncCall
  3200. mutex sync.Mutex
  3201. }
  3202. // Unfollow delegates to the next hook function in the queue and stores the
  3203. // parameter and result values of this invocation.
  3204. func (m *MockUsersStore) Unfollow(v0 context.Context, v1 int64, v2 int64) error {
  3205. r0 := m.UnfollowFunc.nextHook()(v0, v1, v2)
  3206. m.UnfollowFunc.appendCall(UsersStoreUnfollowFuncCall{v0, v1, v2, r0})
  3207. return r0
  3208. }
  3209. // SetDefaultHook sets function that is called when the Unfollow method of
  3210. // the parent MockUsersStore instance is invoked and the hook queue is
  3211. // empty.
  3212. func (f *UsersStoreUnfollowFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  3213. f.defaultHook = hook
  3214. }
  3215. // PushHook adds a function to the end of hook queue. Each invocation of the
  3216. // Unfollow method of the parent MockUsersStore instance invokes the hook at
  3217. // the front of the queue and discards it. After the queue is empty, the
  3218. // default hook function is invoked for any future action.
  3219. func (f *UsersStoreUnfollowFunc) PushHook(hook func(context.Context, int64, int64) error) {
  3220. f.mutex.Lock()
  3221. f.hooks = append(f.hooks, hook)
  3222. f.mutex.Unlock()
  3223. }
  3224. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3225. // given values.
  3226. func (f *UsersStoreUnfollowFunc) SetDefaultReturn(r0 error) {
  3227. f.SetDefaultHook(func(context.Context, int64, int64) error {
  3228. return r0
  3229. })
  3230. }
  3231. // PushReturn calls PushHook with a function that returns the given values.
  3232. func (f *UsersStoreUnfollowFunc) PushReturn(r0 error) {
  3233. f.PushHook(func(context.Context, int64, int64) error {
  3234. return r0
  3235. })
  3236. }
  3237. func (f *UsersStoreUnfollowFunc) nextHook() func(context.Context, int64, int64) error {
  3238. f.mutex.Lock()
  3239. defer f.mutex.Unlock()
  3240. if len(f.hooks) == 0 {
  3241. return f.defaultHook
  3242. }
  3243. hook := f.hooks[0]
  3244. f.hooks = f.hooks[1:]
  3245. return hook
  3246. }
  3247. func (f *UsersStoreUnfollowFunc) appendCall(r0 UsersStoreUnfollowFuncCall) {
  3248. f.mutex.Lock()
  3249. f.history = append(f.history, r0)
  3250. f.mutex.Unlock()
  3251. }
  3252. // History returns a sequence of UsersStoreUnfollowFuncCall objects
  3253. // describing the invocations of this function.
  3254. func (f *UsersStoreUnfollowFunc) History() []UsersStoreUnfollowFuncCall {
  3255. f.mutex.Lock()
  3256. history := make([]UsersStoreUnfollowFuncCall, len(f.history))
  3257. copy(history, f.history)
  3258. f.mutex.Unlock()
  3259. return history
  3260. }
  3261. // UsersStoreUnfollowFuncCall is an object that describes an invocation of
  3262. // method Unfollow on an instance of MockUsersStore.
  3263. type UsersStoreUnfollowFuncCall struct {
  3264. // Arg0 is the value of the 1st argument passed to this method
  3265. // invocation.
  3266. Arg0 context.Context
  3267. // Arg1 is the value of the 2nd argument passed to this method
  3268. // invocation.
  3269. Arg1 int64
  3270. // Arg2 is the value of the 3rd argument passed to this method
  3271. // invocation.
  3272. Arg2 int64
  3273. // Result0 is the value of the 1st result returned from this method
  3274. // invocation.
  3275. Result0 error
  3276. }
  3277. // Args returns an interface slice containing the arguments of this
  3278. // invocation.
  3279. func (c UsersStoreUnfollowFuncCall) Args() []interface{} {
  3280. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3281. }
  3282. // Results returns an interface slice containing the results of this
  3283. // invocation.
  3284. func (c UsersStoreUnfollowFuncCall) Results() []interface{} {
  3285. return []interface{}{c.Result0}
  3286. }
  3287. // UsersStoreUpdateFunc describes the behavior when the Update method of the
  3288. // parent MockUsersStore instance is invoked.
  3289. type UsersStoreUpdateFunc struct {
  3290. defaultHook func(context.Context, int64, database.UpdateUserOptions) error
  3291. hooks []func(context.Context, int64, database.UpdateUserOptions) error
  3292. history []UsersStoreUpdateFuncCall
  3293. mutex sync.Mutex
  3294. }
  3295. // Update delegates to the next hook function in the queue and stores the
  3296. // parameter and result values of this invocation.
  3297. func (m *MockUsersStore) Update(v0 context.Context, v1 int64, v2 database.UpdateUserOptions) error {
  3298. r0 := m.UpdateFunc.nextHook()(v0, v1, v2)
  3299. m.UpdateFunc.appendCall(UsersStoreUpdateFuncCall{v0, v1, v2, r0})
  3300. return r0
  3301. }
  3302. // SetDefaultHook sets function that is called when the Update method of the
  3303. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3304. func (f *UsersStoreUpdateFunc) SetDefaultHook(hook func(context.Context, int64, database.UpdateUserOptions) error) {
  3305. f.defaultHook = hook
  3306. }
  3307. // PushHook adds a function to the end of hook queue. Each invocation of the
  3308. // Update method of the parent MockUsersStore instance invokes the hook at
  3309. // the front of the queue and discards it. After the queue is empty, the
  3310. // default hook function is invoked for any future action.
  3311. func (f *UsersStoreUpdateFunc) PushHook(hook func(context.Context, int64, database.UpdateUserOptions) error) {
  3312. f.mutex.Lock()
  3313. f.hooks = append(f.hooks, hook)
  3314. f.mutex.Unlock()
  3315. }
  3316. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3317. // given values.
  3318. func (f *UsersStoreUpdateFunc) SetDefaultReturn(r0 error) {
  3319. f.SetDefaultHook(func(context.Context, int64, database.UpdateUserOptions) error {
  3320. return r0
  3321. })
  3322. }
  3323. // PushReturn calls PushHook with a function that returns the given values.
  3324. func (f *UsersStoreUpdateFunc) PushReturn(r0 error) {
  3325. f.PushHook(func(context.Context, int64, database.UpdateUserOptions) error {
  3326. return r0
  3327. })
  3328. }
  3329. func (f *UsersStoreUpdateFunc) nextHook() func(context.Context, int64, database.UpdateUserOptions) error {
  3330. f.mutex.Lock()
  3331. defer f.mutex.Unlock()
  3332. if len(f.hooks) == 0 {
  3333. return f.defaultHook
  3334. }
  3335. hook := f.hooks[0]
  3336. f.hooks = f.hooks[1:]
  3337. return hook
  3338. }
  3339. func (f *UsersStoreUpdateFunc) appendCall(r0 UsersStoreUpdateFuncCall) {
  3340. f.mutex.Lock()
  3341. f.history = append(f.history, r0)
  3342. f.mutex.Unlock()
  3343. }
  3344. // History returns a sequence of UsersStoreUpdateFuncCall objects describing
  3345. // the invocations of this function.
  3346. func (f *UsersStoreUpdateFunc) History() []UsersStoreUpdateFuncCall {
  3347. f.mutex.Lock()
  3348. history := make([]UsersStoreUpdateFuncCall, len(f.history))
  3349. copy(history, f.history)
  3350. f.mutex.Unlock()
  3351. return history
  3352. }
  3353. // UsersStoreUpdateFuncCall is an object that describes an invocation of
  3354. // method Update on an instance of MockUsersStore.
  3355. type UsersStoreUpdateFuncCall struct {
  3356. // Arg0 is the value of the 1st argument passed to this method
  3357. // invocation.
  3358. Arg0 context.Context
  3359. // Arg1 is the value of the 2nd argument passed to this method
  3360. // invocation.
  3361. Arg1 int64
  3362. // Arg2 is the value of the 3rd argument passed to this method
  3363. // invocation.
  3364. Arg2 database.UpdateUserOptions
  3365. // Result0 is the value of the 1st result returned from this method
  3366. // invocation.
  3367. Result0 error
  3368. }
  3369. // Args returns an interface slice containing the arguments of this
  3370. // invocation.
  3371. func (c UsersStoreUpdateFuncCall) Args() []interface{} {
  3372. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3373. }
  3374. // Results returns an interface slice containing the results of this
  3375. // invocation.
  3376. func (c UsersStoreUpdateFuncCall) Results() []interface{} {
  3377. return []interface{}{c.Result0}
  3378. }
  3379. // UsersStoreUseCustomAvatarFunc describes the behavior when the
  3380. // UseCustomAvatar method of the parent MockUsersStore instance is invoked.
  3381. type UsersStoreUseCustomAvatarFunc struct {
  3382. defaultHook func(context.Context, int64, []byte) error
  3383. hooks []func(context.Context, int64, []byte) error
  3384. history []UsersStoreUseCustomAvatarFuncCall
  3385. mutex sync.Mutex
  3386. }
  3387. // UseCustomAvatar delegates to the next hook function in the queue and
  3388. // stores the parameter and result values of this invocation.
  3389. func (m *MockUsersStore) UseCustomAvatar(v0 context.Context, v1 int64, v2 []byte) error {
  3390. r0 := m.UseCustomAvatarFunc.nextHook()(v0, v1, v2)
  3391. m.UseCustomAvatarFunc.appendCall(UsersStoreUseCustomAvatarFuncCall{v0, v1, v2, r0})
  3392. return r0
  3393. }
  3394. // SetDefaultHook sets function that is called when the UseCustomAvatar
  3395. // method of the parent MockUsersStore instance is invoked and the hook
  3396. // queue is empty.
  3397. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64, []byte) error) {
  3398. f.defaultHook = hook
  3399. }
  3400. // PushHook adds a function to the end of hook queue. Each invocation of the
  3401. // UseCustomAvatar method of the parent MockUsersStore instance invokes the
  3402. // hook at the front of the queue and discards it. After the queue is empty,
  3403. // the default hook function is invoked for any future action.
  3404. func (f *UsersStoreUseCustomAvatarFunc) PushHook(hook func(context.Context, int64, []byte) error) {
  3405. f.mutex.Lock()
  3406. f.hooks = append(f.hooks, hook)
  3407. f.mutex.Unlock()
  3408. }
  3409. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3410. // given values.
  3411. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultReturn(r0 error) {
  3412. f.SetDefaultHook(func(context.Context, int64, []byte) error {
  3413. return r0
  3414. })
  3415. }
  3416. // PushReturn calls PushHook with a function that returns the given values.
  3417. func (f *UsersStoreUseCustomAvatarFunc) PushReturn(r0 error) {
  3418. f.PushHook(func(context.Context, int64, []byte) error {
  3419. return r0
  3420. })
  3421. }
  3422. func (f *UsersStoreUseCustomAvatarFunc) nextHook() func(context.Context, int64, []byte) error {
  3423. f.mutex.Lock()
  3424. defer f.mutex.Unlock()
  3425. if len(f.hooks) == 0 {
  3426. return f.defaultHook
  3427. }
  3428. hook := f.hooks[0]
  3429. f.hooks = f.hooks[1:]
  3430. return hook
  3431. }
  3432. func (f *UsersStoreUseCustomAvatarFunc) appendCall(r0 UsersStoreUseCustomAvatarFuncCall) {
  3433. f.mutex.Lock()
  3434. f.history = append(f.history, r0)
  3435. f.mutex.Unlock()
  3436. }
  3437. // History returns a sequence of UsersStoreUseCustomAvatarFuncCall objects
  3438. // describing the invocations of this function.
  3439. func (f *UsersStoreUseCustomAvatarFunc) History() []UsersStoreUseCustomAvatarFuncCall {
  3440. f.mutex.Lock()
  3441. history := make([]UsersStoreUseCustomAvatarFuncCall, len(f.history))
  3442. copy(history, f.history)
  3443. f.mutex.Unlock()
  3444. return history
  3445. }
  3446. // UsersStoreUseCustomAvatarFuncCall is an object that describes an
  3447. // invocation of method UseCustomAvatar on an instance of MockUsersStore.
  3448. type UsersStoreUseCustomAvatarFuncCall struct {
  3449. // Arg0 is the value of the 1st argument passed to this method
  3450. // invocation.
  3451. Arg0 context.Context
  3452. // Arg1 is the value of the 2nd argument passed to this method
  3453. // invocation.
  3454. Arg1 int64
  3455. // Arg2 is the value of the 3rd argument passed to this method
  3456. // invocation.
  3457. Arg2 []byte
  3458. // Result0 is the value of the 1st result returned from this method
  3459. // invocation.
  3460. Result0 error
  3461. }
  3462. // Args returns an interface slice containing the arguments of this
  3463. // invocation.
  3464. func (c UsersStoreUseCustomAvatarFuncCall) Args() []interface{} {
  3465. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3466. }
  3467. // Results returns an interface slice containing the results of this
  3468. // invocation.
  3469. func (c UsersStoreUseCustomAvatarFuncCall) Results() []interface{} {
  3470. return []interface{}{c.Result0}
  3471. }
  3472. // MockStore is a mock implementation of the Store interface (from the
  3473. // package gogs.io/gogs/internal/route/lfs) used for unit testing.
  3474. type MockStore struct {
  3475. // AuthorizeRepositoryAccessFunc is an instance of a mock function
  3476. // object controlling the behavior of the method
  3477. // AuthorizeRepositoryAccess.
  3478. AuthorizeRepositoryAccessFunc *StoreAuthorizeRepositoryAccessFunc
  3479. // CreateLFSObjectFunc is an instance of a mock function object
  3480. // controlling the behavior of the method CreateLFSObject.
  3481. CreateLFSObjectFunc *StoreCreateLFSObjectFunc
  3482. // GetAccessTokenBySHA1Func is an instance of a mock function object
  3483. // controlling the behavior of the method GetAccessTokenBySHA1.
  3484. GetAccessTokenBySHA1Func *StoreGetAccessTokenBySHA1Func
  3485. // GetLFSObjectByOIDFunc is an instance of a mock function object
  3486. // controlling the behavior of the method GetLFSObjectByOID.
  3487. GetLFSObjectByOIDFunc *StoreGetLFSObjectByOIDFunc
  3488. // GetLFSObjectsByOIDsFunc is an instance of a mock function object
  3489. // controlling the behavior of the method GetLFSObjectsByOIDs.
  3490. GetLFSObjectsByOIDsFunc *StoreGetLFSObjectsByOIDsFunc
  3491. // GetRepositoryByNameFunc is an instance of a mock function object
  3492. // controlling the behavior of the method GetRepositoryByName.
  3493. GetRepositoryByNameFunc *StoreGetRepositoryByNameFunc
  3494. // TouchAccessTokenByIDFunc is an instance of a mock function object
  3495. // controlling the behavior of the method TouchAccessTokenByID.
  3496. TouchAccessTokenByIDFunc *StoreTouchAccessTokenByIDFunc
  3497. }
  3498. // NewMockStore creates a new mock of the Store interface. All methods
  3499. // return zero values for all results, unless overwritten.
  3500. func NewMockStore() *MockStore {
  3501. return &MockStore{
  3502. AuthorizeRepositoryAccessFunc: &StoreAuthorizeRepositoryAccessFunc{
  3503. defaultHook: func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) (r0 bool) {
  3504. return
  3505. },
  3506. },
  3507. CreateLFSObjectFunc: &StoreCreateLFSObjectFunc{
  3508. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) (r0 error) {
  3509. return
  3510. },
  3511. },
  3512. GetAccessTokenBySHA1Func: &StoreGetAccessTokenBySHA1Func{
  3513. defaultHook: func(context.Context, string) (r0 *database.AccessToken, r1 error) {
  3514. return
  3515. },
  3516. },
  3517. GetLFSObjectByOIDFunc: &StoreGetLFSObjectByOIDFunc{
  3518. defaultHook: func(context.Context, int64, lfsutil.OID) (r0 *database.LFSObject, r1 error) {
  3519. return
  3520. },
  3521. },
  3522. GetLFSObjectsByOIDsFunc: &StoreGetLFSObjectsByOIDsFunc{
  3523. defaultHook: func(context.Context, int64, ...lfsutil.OID) (r0 []*database.LFSObject, r1 error) {
  3524. return
  3525. },
  3526. },
  3527. GetRepositoryByNameFunc: &StoreGetRepositoryByNameFunc{
  3528. defaultHook: func(context.Context, int64, string) (r0 *database.Repository, r1 error) {
  3529. return
  3530. },
  3531. },
  3532. TouchAccessTokenByIDFunc: &StoreTouchAccessTokenByIDFunc{
  3533. defaultHook: func(context.Context, int64) (r0 error) {
  3534. return
  3535. },
  3536. },
  3537. }
  3538. }
  3539. // NewStrictMockStore creates a new mock of the Store interface. All methods
  3540. // panic on invocation, unless overwritten.
  3541. func NewStrictMockStore() *MockStore {
  3542. return &MockStore{
  3543. AuthorizeRepositoryAccessFunc: &StoreAuthorizeRepositoryAccessFunc{
  3544. defaultHook: func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
  3545. panic("unexpected invocation of MockStore.AuthorizeRepositoryAccess")
  3546. },
  3547. },
  3548. CreateLFSObjectFunc: &StoreCreateLFSObjectFunc{
  3549. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  3550. panic("unexpected invocation of MockStore.CreateLFSObject")
  3551. },
  3552. },
  3553. GetAccessTokenBySHA1Func: &StoreGetAccessTokenBySHA1Func{
  3554. defaultHook: func(context.Context, string) (*database.AccessToken, error) {
  3555. panic("unexpected invocation of MockStore.GetAccessTokenBySHA1")
  3556. },
  3557. },
  3558. GetLFSObjectByOIDFunc: &StoreGetLFSObjectByOIDFunc{
  3559. defaultHook: func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
  3560. panic("unexpected invocation of MockStore.GetLFSObjectByOID")
  3561. },
  3562. },
  3563. GetLFSObjectsByOIDsFunc: &StoreGetLFSObjectsByOIDsFunc{
  3564. defaultHook: func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
  3565. panic("unexpected invocation of MockStore.GetLFSObjectsByOIDs")
  3566. },
  3567. },
  3568. GetRepositoryByNameFunc: &StoreGetRepositoryByNameFunc{
  3569. defaultHook: func(context.Context, int64, string) (*database.Repository, error) {
  3570. panic("unexpected invocation of MockStore.GetRepositoryByName")
  3571. },
  3572. },
  3573. TouchAccessTokenByIDFunc: &StoreTouchAccessTokenByIDFunc{
  3574. defaultHook: func(context.Context, int64) error {
  3575. panic("unexpected invocation of MockStore.TouchAccessTokenByID")
  3576. },
  3577. },
  3578. }
  3579. }
  3580. // NewMockStoreFrom creates a new mock of the MockStore interface. All
  3581. // methods delegate to the given implementation, unless overwritten.
  3582. func NewMockStoreFrom(i Store) *MockStore {
  3583. return &MockStore{
  3584. AuthorizeRepositoryAccessFunc: &StoreAuthorizeRepositoryAccessFunc{
  3585. defaultHook: i.AuthorizeRepositoryAccess,
  3586. },
  3587. CreateLFSObjectFunc: &StoreCreateLFSObjectFunc{
  3588. defaultHook: i.CreateLFSObject,
  3589. },
  3590. GetAccessTokenBySHA1Func: &StoreGetAccessTokenBySHA1Func{
  3591. defaultHook: i.GetAccessTokenBySHA1,
  3592. },
  3593. GetLFSObjectByOIDFunc: &StoreGetLFSObjectByOIDFunc{
  3594. defaultHook: i.GetLFSObjectByOID,
  3595. },
  3596. GetLFSObjectsByOIDsFunc: &StoreGetLFSObjectsByOIDsFunc{
  3597. defaultHook: i.GetLFSObjectsByOIDs,
  3598. },
  3599. GetRepositoryByNameFunc: &StoreGetRepositoryByNameFunc{
  3600. defaultHook: i.GetRepositoryByName,
  3601. },
  3602. TouchAccessTokenByIDFunc: &StoreTouchAccessTokenByIDFunc{
  3603. defaultHook: i.TouchAccessTokenByID,
  3604. },
  3605. }
  3606. }
  3607. // StoreAuthorizeRepositoryAccessFunc describes the behavior when the
  3608. // AuthorizeRepositoryAccess method of the parent MockStore instance is
  3609. // invoked.
  3610. type StoreAuthorizeRepositoryAccessFunc struct {
  3611. defaultHook func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool
  3612. hooks []func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool
  3613. history []StoreAuthorizeRepositoryAccessFuncCall
  3614. mutex sync.Mutex
  3615. }
  3616. // AuthorizeRepositoryAccess delegates to the next hook function in the
  3617. // queue and stores the parameter and result values of this invocation.
  3618. func (m *MockStore) AuthorizeRepositoryAccess(v0 context.Context, v1 int64, v2 int64, v3 database.AccessMode, v4 database.AccessModeOptions) bool {
  3619. r0 := m.AuthorizeRepositoryAccessFunc.nextHook()(v0, v1, v2, v3, v4)
  3620. m.AuthorizeRepositoryAccessFunc.appendCall(StoreAuthorizeRepositoryAccessFuncCall{v0, v1, v2, v3, v4, r0})
  3621. return r0
  3622. }
  3623. // SetDefaultHook sets function that is called when the
  3624. // AuthorizeRepositoryAccess method of the parent MockStore instance is
  3625. // invoked and the hook queue is empty.
  3626. func (f *StoreAuthorizeRepositoryAccessFunc) SetDefaultHook(hook func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool) {
  3627. f.defaultHook = hook
  3628. }
  3629. // PushHook adds a function to the end of hook queue. Each invocation of the
  3630. // AuthorizeRepositoryAccess method of the parent MockStore instance invokes
  3631. // the hook at the front of the queue and discards it. After the queue is
  3632. // empty, the default hook function is invoked for any future action.
  3633. func (f *StoreAuthorizeRepositoryAccessFunc) PushHook(hook func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool) {
  3634. f.mutex.Lock()
  3635. f.hooks = append(f.hooks, hook)
  3636. f.mutex.Unlock()
  3637. }
  3638. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3639. // given values.
  3640. func (f *StoreAuthorizeRepositoryAccessFunc) SetDefaultReturn(r0 bool) {
  3641. f.SetDefaultHook(func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
  3642. return r0
  3643. })
  3644. }
  3645. // PushReturn calls PushHook with a function that returns the given values.
  3646. func (f *StoreAuthorizeRepositoryAccessFunc) PushReturn(r0 bool) {
  3647. f.PushHook(func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
  3648. return r0
  3649. })
  3650. }
  3651. func (f *StoreAuthorizeRepositoryAccessFunc) nextHook() func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
  3652. f.mutex.Lock()
  3653. defer f.mutex.Unlock()
  3654. if len(f.hooks) == 0 {
  3655. return f.defaultHook
  3656. }
  3657. hook := f.hooks[0]
  3658. f.hooks = f.hooks[1:]
  3659. return hook
  3660. }
  3661. func (f *StoreAuthorizeRepositoryAccessFunc) appendCall(r0 StoreAuthorizeRepositoryAccessFuncCall) {
  3662. f.mutex.Lock()
  3663. f.history = append(f.history, r0)
  3664. f.mutex.Unlock()
  3665. }
  3666. // History returns a sequence of StoreAuthorizeRepositoryAccessFuncCall
  3667. // objects describing the invocations of this function.
  3668. func (f *StoreAuthorizeRepositoryAccessFunc) History() []StoreAuthorizeRepositoryAccessFuncCall {
  3669. f.mutex.Lock()
  3670. history := make([]StoreAuthorizeRepositoryAccessFuncCall, len(f.history))
  3671. copy(history, f.history)
  3672. f.mutex.Unlock()
  3673. return history
  3674. }
  3675. // StoreAuthorizeRepositoryAccessFuncCall is an object that describes an
  3676. // invocation of method AuthorizeRepositoryAccess on an instance of
  3677. // MockStore.
  3678. type StoreAuthorizeRepositoryAccessFuncCall struct {
  3679. // Arg0 is the value of the 1st argument passed to this method
  3680. // invocation.
  3681. Arg0 context.Context
  3682. // Arg1 is the value of the 2nd argument passed to this method
  3683. // invocation.
  3684. Arg1 int64
  3685. // Arg2 is the value of the 3rd argument passed to this method
  3686. // invocation.
  3687. Arg2 int64
  3688. // Arg3 is the value of the 4th argument passed to this method
  3689. // invocation.
  3690. Arg3 database.AccessMode
  3691. // Arg4 is the value of the 5th argument passed to this method
  3692. // invocation.
  3693. Arg4 database.AccessModeOptions
  3694. // Result0 is the value of the 1st result returned from this method
  3695. // invocation.
  3696. Result0 bool
  3697. }
  3698. // Args returns an interface slice containing the arguments of this
  3699. // invocation.
  3700. func (c StoreAuthorizeRepositoryAccessFuncCall) Args() []interface{} {
  3701. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  3702. }
  3703. // Results returns an interface slice containing the results of this
  3704. // invocation.
  3705. func (c StoreAuthorizeRepositoryAccessFuncCall) Results() []interface{} {
  3706. return []interface{}{c.Result0}
  3707. }
  3708. // StoreCreateLFSObjectFunc describes the behavior when the CreateLFSObject
  3709. // method of the parent MockStore instance is invoked.
  3710. type StoreCreateLFSObjectFunc struct {
  3711. defaultHook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  3712. hooks []func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  3713. history []StoreCreateLFSObjectFuncCall
  3714. mutex sync.Mutex
  3715. }
  3716. // CreateLFSObject delegates to the next hook function in the queue and
  3717. // stores the parameter and result values of this invocation.
  3718. func (m *MockStore) CreateLFSObject(v0 context.Context, v1 int64, v2 lfsutil.OID, v3 int64, v4 lfsutil.Storage) error {
  3719. r0 := m.CreateLFSObjectFunc.nextHook()(v0, v1, v2, v3, v4)
  3720. m.CreateLFSObjectFunc.appendCall(StoreCreateLFSObjectFuncCall{v0, v1, v2, v3, v4, r0})
  3721. return r0
  3722. }
  3723. // SetDefaultHook sets function that is called when the CreateLFSObject
  3724. // method of the parent MockStore instance is invoked and the hook queue is
  3725. // empty.
  3726. func (f *StoreCreateLFSObjectFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  3727. f.defaultHook = hook
  3728. }
  3729. // PushHook adds a function to the end of hook queue. Each invocation of the
  3730. // CreateLFSObject method of the parent MockStore instance invokes the hook
  3731. // at the front of the queue and discards it. After the queue is empty, the
  3732. // default hook function is invoked for any future action.
  3733. func (f *StoreCreateLFSObjectFunc) PushHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  3734. f.mutex.Lock()
  3735. f.hooks = append(f.hooks, hook)
  3736. f.mutex.Unlock()
  3737. }
  3738. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3739. // given values.
  3740. func (f *StoreCreateLFSObjectFunc) SetDefaultReturn(r0 error) {
  3741. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  3742. return r0
  3743. })
  3744. }
  3745. // PushReturn calls PushHook with a function that returns the given values.
  3746. func (f *StoreCreateLFSObjectFunc) PushReturn(r0 error) {
  3747. f.PushHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  3748. return r0
  3749. })
  3750. }
  3751. func (f *StoreCreateLFSObjectFunc) nextHook() func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  3752. f.mutex.Lock()
  3753. defer f.mutex.Unlock()
  3754. if len(f.hooks) == 0 {
  3755. return f.defaultHook
  3756. }
  3757. hook := f.hooks[0]
  3758. f.hooks = f.hooks[1:]
  3759. return hook
  3760. }
  3761. func (f *StoreCreateLFSObjectFunc) appendCall(r0 StoreCreateLFSObjectFuncCall) {
  3762. f.mutex.Lock()
  3763. f.history = append(f.history, r0)
  3764. f.mutex.Unlock()
  3765. }
  3766. // History returns a sequence of StoreCreateLFSObjectFuncCall objects
  3767. // describing the invocations of this function.
  3768. func (f *StoreCreateLFSObjectFunc) History() []StoreCreateLFSObjectFuncCall {
  3769. f.mutex.Lock()
  3770. history := make([]StoreCreateLFSObjectFuncCall, len(f.history))
  3771. copy(history, f.history)
  3772. f.mutex.Unlock()
  3773. return history
  3774. }
  3775. // StoreCreateLFSObjectFuncCall is an object that describes an invocation of
  3776. // method CreateLFSObject on an instance of MockStore.
  3777. type StoreCreateLFSObjectFuncCall struct {
  3778. // Arg0 is the value of the 1st argument passed to this method
  3779. // invocation.
  3780. Arg0 context.Context
  3781. // Arg1 is the value of the 2nd argument passed to this method
  3782. // invocation.
  3783. Arg1 int64
  3784. // Arg2 is the value of the 3rd argument passed to this method
  3785. // invocation.
  3786. Arg2 lfsutil.OID
  3787. // Arg3 is the value of the 4th argument passed to this method
  3788. // invocation.
  3789. Arg3 int64
  3790. // Arg4 is the value of the 5th argument passed to this method
  3791. // invocation.
  3792. Arg4 lfsutil.Storage
  3793. // Result0 is the value of the 1st result returned from this method
  3794. // invocation.
  3795. Result0 error
  3796. }
  3797. // Args returns an interface slice containing the arguments of this
  3798. // invocation.
  3799. func (c StoreCreateLFSObjectFuncCall) Args() []interface{} {
  3800. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  3801. }
  3802. // Results returns an interface slice containing the results of this
  3803. // invocation.
  3804. func (c StoreCreateLFSObjectFuncCall) Results() []interface{} {
  3805. return []interface{}{c.Result0}
  3806. }
  3807. // StoreGetAccessTokenBySHA1Func describes the behavior when the
  3808. // GetAccessTokenBySHA1 method of the parent MockStore instance is invoked.
  3809. type StoreGetAccessTokenBySHA1Func struct {
  3810. defaultHook func(context.Context, string) (*database.AccessToken, error)
  3811. hooks []func(context.Context, string) (*database.AccessToken, error)
  3812. history []StoreGetAccessTokenBySHA1FuncCall
  3813. mutex sync.Mutex
  3814. }
  3815. // GetAccessTokenBySHA1 delegates to the next hook function in the queue and
  3816. // stores the parameter and result values of this invocation.
  3817. func (m *MockStore) GetAccessTokenBySHA1(v0 context.Context, v1 string) (*database.AccessToken, error) {
  3818. r0, r1 := m.GetAccessTokenBySHA1Func.nextHook()(v0, v1)
  3819. m.GetAccessTokenBySHA1Func.appendCall(StoreGetAccessTokenBySHA1FuncCall{v0, v1, r0, r1})
  3820. return r0, r1
  3821. }
  3822. // SetDefaultHook sets function that is called when the GetAccessTokenBySHA1
  3823. // method of the parent MockStore instance is invoked and the hook queue is
  3824. // empty.
  3825. func (f *StoreGetAccessTokenBySHA1Func) SetDefaultHook(hook func(context.Context, string) (*database.AccessToken, error)) {
  3826. f.defaultHook = hook
  3827. }
  3828. // PushHook adds a function to the end of hook queue. Each invocation of the
  3829. // GetAccessTokenBySHA1 method of the parent MockStore instance invokes the
  3830. // hook at the front of the queue and discards it. After the queue is empty,
  3831. // the default hook function is invoked for any future action.
  3832. func (f *StoreGetAccessTokenBySHA1Func) PushHook(hook func(context.Context, string) (*database.AccessToken, error)) {
  3833. f.mutex.Lock()
  3834. f.hooks = append(f.hooks, hook)
  3835. f.mutex.Unlock()
  3836. }
  3837. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3838. // given values.
  3839. func (f *StoreGetAccessTokenBySHA1Func) SetDefaultReturn(r0 *database.AccessToken, r1 error) {
  3840. f.SetDefaultHook(func(context.Context, string) (*database.AccessToken, error) {
  3841. return r0, r1
  3842. })
  3843. }
  3844. // PushReturn calls PushHook with a function that returns the given values.
  3845. func (f *StoreGetAccessTokenBySHA1Func) PushReturn(r0 *database.AccessToken, r1 error) {
  3846. f.PushHook(func(context.Context, string) (*database.AccessToken, error) {
  3847. return r0, r1
  3848. })
  3849. }
  3850. func (f *StoreGetAccessTokenBySHA1Func) nextHook() func(context.Context, string) (*database.AccessToken, error) {
  3851. f.mutex.Lock()
  3852. defer f.mutex.Unlock()
  3853. if len(f.hooks) == 0 {
  3854. return f.defaultHook
  3855. }
  3856. hook := f.hooks[0]
  3857. f.hooks = f.hooks[1:]
  3858. return hook
  3859. }
  3860. func (f *StoreGetAccessTokenBySHA1Func) appendCall(r0 StoreGetAccessTokenBySHA1FuncCall) {
  3861. f.mutex.Lock()
  3862. f.history = append(f.history, r0)
  3863. f.mutex.Unlock()
  3864. }
  3865. // History returns a sequence of StoreGetAccessTokenBySHA1FuncCall objects
  3866. // describing the invocations of this function.
  3867. func (f *StoreGetAccessTokenBySHA1Func) History() []StoreGetAccessTokenBySHA1FuncCall {
  3868. f.mutex.Lock()
  3869. history := make([]StoreGetAccessTokenBySHA1FuncCall, len(f.history))
  3870. copy(history, f.history)
  3871. f.mutex.Unlock()
  3872. return history
  3873. }
  3874. // StoreGetAccessTokenBySHA1FuncCall is an object that describes an
  3875. // invocation of method GetAccessTokenBySHA1 on an instance of MockStore.
  3876. type StoreGetAccessTokenBySHA1FuncCall struct {
  3877. // Arg0 is the value of the 1st argument passed to this method
  3878. // invocation.
  3879. Arg0 context.Context
  3880. // Arg1 is the value of the 2nd argument passed to this method
  3881. // invocation.
  3882. Arg1 string
  3883. // Result0 is the value of the 1st result returned from this method
  3884. // invocation.
  3885. Result0 *database.AccessToken
  3886. // Result1 is the value of the 2nd result returned from this method
  3887. // invocation.
  3888. Result1 error
  3889. }
  3890. // Args returns an interface slice containing the arguments of this
  3891. // invocation.
  3892. func (c StoreGetAccessTokenBySHA1FuncCall) Args() []interface{} {
  3893. return []interface{}{c.Arg0, c.Arg1}
  3894. }
  3895. // Results returns an interface slice containing the results of this
  3896. // invocation.
  3897. func (c StoreGetAccessTokenBySHA1FuncCall) Results() []interface{} {
  3898. return []interface{}{c.Result0, c.Result1}
  3899. }
  3900. // StoreGetLFSObjectByOIDFunc describes the behavior when the
  3901. // GetLFSObjectByOID method of the parent MockStore instance is invoked.
  3902. type StoreGetLFSObjectByOIDFunc struct {
  3903. defaultHook func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)
  3904. hooks []func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)
  3905. history []StoreGetLFSObjectByOIDFuncCall
  3906. mutex sync.Mutex
  3907. }
  3908. // GetLFSObjectByOID delegates to the next hook function in the queue and
  3909. // stores the parameter and result values of this invocation.
  3910. func (m *MockStore) GetLFSObjectByOID(v0 context.Context, v1 int64, v2 lfsutil.OID) (*database.LFSObject, error) {
  3911. r0, r1 := m.GetLFSObjectByOIDFunc.nextHook()(v0, v1, v2)
  3912. m.GetLFSObjectByOIDFunc.appendCall(StoreGetLFSObjectByOIDFuncCall{v0, v1, v2, r0, r1})
  3913. return r0, r1
  3914. }
  3915. // SetDefaultHook sets function that is called when the GetLFSObjectByOID
  3916. // method of the parent MockStore instance is invoked and the hook queue is
  3917. // empty.
  3918. func (f *StoreGetLFSObjectByOIDFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)) {
  3919. f.defaultHook = hook
  3920. }
  3921. // PushHook adds a function to the end of hook queue. Each invocation of the
  3922. // GetLFSObjectByOID method of the parent MockStore instance invokes the
  3923. // hook at the front of the queue and discards it. After the queue is empty,
  3924. // the default hook function is invoked for any future action.
  3925. func (f *StoreGetLFSObjectByOIDFunc) PushHook(hook func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)) {
  3926. f.mutex.Lock()
  3927. f.hooks = append(f.hooks, hook)
  3928. f.mutex.Unlock()
  3929. }
  3930. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3931. // given values.
  3932. func (f *StoreGetLFSObjectByOIDFunc) SetDefaultReturn(r0 *database.LFSObject, r1 error) {
  3933. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
  3934. return r0, r1
  3935. })
  3936. }
  3937. // PushReturn calls PushHook with a function that returns the given values.
  3938. func (f *StoreGetLFSObjectByOIDFunc) PushReturn(r0 *database.LFSObject, r1 error) {
  3939. f.PushHook(func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
  3940. return r0, r1
  3941. })
  3942. }
  3943. func (f *StoreGetLFSObjectByOIDFunc) nextHook() func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
  3944. f.mutex.Lock()
  3945. defer f.mutex.Unlock()
  3946. if len(f.hooks) == 0 {
  3947. return f.defaultHook
  3948. }
  3949. hook := f.hooks[0]
  3950. f.hooks = f.hooks[1:]
  3951. return hook
  3952. }
  3953. func (f *StoreGetLFSObjectByOIDFunc) appendCall(r0 StoreGetLFSObjectByOIDFuncCall) {
  3954. f.mutex.Lock()
  3955. f.history = append(f.history, r0)
  3956. f.mutex.Unlock()
  3957. }
  3958. // History returns a sequence of StoreGetLFSObjectByOIDFuncCall objects
  3959. // describing the invocations of this function.
  3960. func (f *StoreGetLFSObjectByOIDFunc) History() []StoreGetLFSObjectByOIDFuncCall {
  3961. f.mutex.Lock()
  3962. history := make([]StoreGetLFSObjectByOIDFuncCall, len(f.history))
  3963. copy(history, f.history)
  3964. f.mutex.Unlock()
  3965. return history
  3966. }
  3967. // StoreGetLFSObjectByOIDFuncCall is an object that describes an invocation
  3968. // of method GetLFSObjectByOID on an instance of MockStore.
  3969. type StoreGetLFSObjectByOIDFuncCall struct {
  3970. // Arg0 is the value of the 1st argument passed to this method
  3971. // invocation.
  3972. Arg0 context.Context
  3973. // Arg1 is the value of the 2nd argument passed to this method
  3974. // invocation.
  3975. Arg1 int64
  3976. // Arg2 is the value of the 3rd argument passed to this method
  3977. // invocation.
  3978. Arg2 lfsutil.OID
  3979. // Result0 is the value of the 1st result returned from this method
  3980. // invocation.
  3981. Result0 *database.LFSObject
  3982. // Result1 is the value of the 2nd result returned from this method
  3983. // invocation.
  3984. Result1 error
  3985. }
  3986. // Args returns an interface slice containing the arguments of this
  3987. // invocation.
  3988. func (c StoreGetLFSObjectByOIDFuncCall) Args() []interface{} {
  3989. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3990. }
  3991. // Results returns an interface slice containing the results of this
  3992. // invocation.
  3993. func (c StoreGetLFSObjectByOIDFuncCall) Results() []interface{} {
  3994. return []interface{}{c.Result0, c.Result1}
  3995. }
  3996. // StoreGetLFSObjectsByOIDsFunc describes the behavior when the
  3997. // GetLFSObjectsByOIDs method of the parent MockStore instance is invoked.
  3998. type StoreGetLFSObjectsByOIDsFunc struct {
  3999. defaultHook func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)
  4000. hooks []func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)
  4001. history []StoreGetLFSObjectsByOIDsFuncCall
  4002. mutex sync.Mutex
  4003. }
  4004. // GetLFSObjectsByOIDs delegates to the next hook function in the queue and
  4005. // stores the parameter and result values of this invocation.
  4006. func (m *MockStore) GetLFSObjectsByOIDs(v0 context.Context, v1 int64, v2 ...lfsutil.OID) ([]*database.LFSObject, error) {
  4007. r0, r1 := m.GetLFSObjectsByOIDsFunc.nextHook()(v0, v1, v2...)
  4008. m.GetLFSObjectsByOIDsFunc.appendCall(StoreGetLFSObjectsByOIDsFuncCall{v0, v1, v2, r0, r1})
  4009. return r0, r1
  4010. }
  4011. // SetDefaultHook sets function that is called when the GetLFSObjectsByOIDs
  4012. // method of the parent MockStore instance is invoked and the hook queue is
  4013. // empty.
  4014. func (f *StoreGetLFSObjectsByOIDsFunc) SetDefaultHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)) {
  4015. f.defaultHook = hook
  4016. }
  4017. // PushHook adds a function to the end of hook queue. Each invocation of the
  4018. // GetLFSObjectsByOIDs method of the parent MockStore instance invokes the
  4019. // hook at the front of the queue and discards it. After the queue is empty,
  4020. // the default hook function is invoked for any future action.
  4021. func (f *StoreGetLFSObjectsByOIDsFunc) PushHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)) {
  4022. f.mutex.Lock()
  4023. f.hooks = append(f.hooks, hook)
  4024. f.mutex.Unlock()
  4025. }
  4026. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4027. // given values.
  4028. func (f *StoreGetLFSObjectsByOIDsFunc) SetDefaultReturn(r0 []*database.LFSObject, r1 error) {
  4029. f.SetDefaultHook(func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
  4030. return r0, r1
  4031. })
  4032. }
  4033. // PushReturn calls PushHook with a function that returns the given values.
  4034. func (f *StoreGetLFSObjectsByOIDsFunc) PushReturn(r0 []*database.LFSObject, r1 error) {
  4035. f.PushHook(func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
  4036. return r0, r1
  4037. })
  4038. }
  4039. func (f *StoreGetLFSObjectsByOIDsFunc) nextHook() func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
  4040. f.mutex.Lock()
  4041. defer f.mutex.Unlock()
  4042. if len(f.hooks) == 0 {
  4043. return f.defaultHook
  4044. }
  4045. hook := f.hooks[0]
  4046. f.hooks = f.hooks[1:]
  4047. return hook
  4048. }
  4049. func (f *StoreGetLFSObjectsByOIDsFunc) appendCall(r0 StoreGetLFSObjectsByOIDsFuncCall) {
  4050. f.mutex.Lock()
  4051. f.history = append(f.history, r0)
  4052. f.mutex.Unlock()
  4053. }
  4054. // History returns a sequence of StoreGetLFSObjectsByOIDsFuncCall objects
  4055. // describing the invocations of this function.
  4056. func (f *StoreGetLFSObjectsByOIDsFunc) History() []StoreGetLFSObjectsByOIDsFuncCall {
  4057. f.mutex.Lock()
  4058. history := make([]StoreGetLFSObjectsByOIDsFuncCall, len(f.history))
  4059. copy(history, f.history)
  4060. f.mutex.Unlock()
  4061. return history
  4062. }
  4063. // StoreGetLFSObjectsByOIDsFuncCall is an object that describes an
  4064. // invocation of method GetLFSObjectsByOIDs on an instance of MockStore.
  4065. type StoreGetLFSObjectsByOIDsFuncCall struct {
  4066. // Arg0 is the value of the 1st argument passed to this method
  4067. // invocation.
  4068. Arg0 context.Context
  4069. // Arg1 is the value of the 2nd argument passed to this method
  4070. // invocation.
  4071. Arg1 int64
  4072. // Arg2 is a slice containing the values of the variadic arguments
  4073. // passed to this method invocation.
  4074. Arg2 []lfsutil.OID
  4075. // Result0 is the value of the 1st result returned from this method
  4076. // invocation.
  4077. Result0 []*database.LFSObject
  4078. // Result1 is the value of the 2nd result returned from this method
  4079. // invocation.
  4080. Result1 error
  4081. }
  4082. // Args returns an interface slice containing the arguments of this
  4083. // invocation. The variadic slice argument is flattened in this array such
  4084. // that one positional argument and three variadic arguments would result in
  4085. // a slice of four, not two.
  4086. func (c StoreGetLFSObjectsByOIDsFuncCall) Args() []interface{} {
  4087. trailing := []interface{}{}
  4088. for _, val := range c.Arg2 {
  4089. trailing = append(trailing, val)
  4090. }
  4091. return append([]interface{}{c.Arg0, c.Arg1}, trailing...)
  4092. }
  4093. // Results returns an interface slice containing the results of this
  4094. // invocation.
  4095. func (c StoreGetLFSObjectsByOIDsFuncCall) Results() []interface{} {
  4096. return []interface{}{c.Result0, c.Result1}
  4097. }
  4098. // StoreGetRepositoryByNameFunc describes the behavior when the
  4099. // GetRepositoryByName method of the parent MockStore instance is invoked.
  4100. type StoreGetRepositoryByNameFunc struct {
  4101. defaultHook func(context.Context, int64, string) (*database.Repository, error)
  4102. hooks []func(context.Context, int64, string) (*database.Repository, error)
  4103. history []StoreGetRepositoryByNameFuncCall
  4104. mutex sync.Mutex
  4105. }
  4106. // GetRepositoryByName delegates to the next hook function in the queue and
  4107. // stores the parameter and result values of this invocation.
  4108. func (m *MockStore) GetRepositoryByName(v0 context.Context, v1 int64, v2 string) (*database.Repository, error) {
  4109. r0, r1 := m.GetRepositoryByNameFunc.nextHook()(v0, v1, v2)
  4110. m.GetRepositoryByNameFunc.appendCall(StoreGetRepositoryByNameFuncCall{v0, v1, v2, r0, r1})
  4111. return r0, r1
  4112. }
  4113. // SetDefaultHook sets function that is called when the GetRepositoryByName
  4114. // method of the parent MockStore instance is invoked and the hook queue is
  4115. // empty.
  4116. func (f *StoreGetRepositoryByNameFunc) SetDefaultHook(hook func(context.Context, int64, string) (*database.Repository, error)) {
  4117. f.defaultHook = hook
  4118. }
  4119. // PushHook adds a function to the end of hook queue. Each invocation of the
  4120. // GetRepositoryByName method of the parent MockStore instance invokes the
  4121. // hook at the front of the queue and discards it. After the queue is empty,
  4122. // the default hook function is invoked for any future action.
  4123. func (f *StoreGetRepositoryByNameFunc) PushHook(hook func(context.Context, int64, string) (*database.Repository, error)) {
  4124. f.mutex.Lock()
  4125. f.hooks = append(f.hooks, hook)
  4126. f.mutex.Unlock()
  4127. }
  4128. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4129. // given values.
  4130. func (f *StoreGetRepositoryByNameFunc) SetDefaultReturn(r0 *database.Repository, r1 error) {
  4131. f.SetDefaultHook(func(context.Context, int64, string) (*database.Repository, error) {
  4132. return r0, r1
  4133. })
  4134. }
  4135. // PushReturn calls PushHook with a function that returns the given values.
  4136. func (f *StoreGetRepositoryByNameFunc) PushReturn(r0 *database.Repository, r1 error) {
  4137. f.PushHook(func(context.Context, int64, string) (*database.Repository, error) {
  4138. return r0, r1
  4139. })
  4140. }
  4141. func (f *StoreGetRepositoryByNameFunc) nextHook() func(context.Context, int64, string) (*database.Repository, error) {
  4142. f.mutex.Lock()
  4143. defer f.mutex.Unlock()
  4144. if len(f.hooks) == 0 {
  4145. return f.defaultHook
  4146. }
  4147. hook := f.hooks[0]
  4148. f.hooks = f.hooks[1:]
  4149. return hook
  4150. }
  4151. func (f *StoreGetRepositoryByNameFunc) appendCall(r0 StoreGetRepositoryByNameFuncCall) {
  4152. f.mutex.Lock()
  4153. f.history = append(f.history, r0)
  4154. f.mutex.Unlock()
  4155. }
  4156. // History returns a sequence of StoreGetRepositoryByNameFuncCall objects
  4157. // describing the invocations of this function.
  4158. func (f *StoreGetRepositoryByNameFunc) History() []StoreGetRepositoryByNameFuncCall {
  4159. f.mutex.Lock()
  4160. history := make([]StoreGetRepositoryByNameFuncCall, len(f.history))
  4161. copy(history, f.history)
  4162. f.mutex.Unlock()
  4163. return history
  4164. }
  4165. // StoreGetRepositoryByNameFuncCall is an object that describes an
  4166. // invocation of method GetRepositoryByName on an instance of MockStore.
  4167. type StoreGetRepositoryByNameFuncCall struct {
  4168. // Arg0 is the value of the 1st argument passed to this method
  4169. // invocation.
  4170. Arg0 context.Context
  4171. // Arg1 is the value of the 2nd argument passed to this method
  4172. // invocation.
  4173. Arg1 int64
  4174. // Arg2 is the value of the 3rd argument passed to this method
  4175. // invocation.
  4176. Arg2 string
  4177. // Result0 is the value of the 1st result returned from this method
  4178. // invocation.
  4179. Result0 *database.Repository
  4180. // Result1 is the value of the 2nd result returned from this method
  4181. // invocation.
  4182. Result1 error
  4183. }
  4184. // Args returns an interface slice containing the arguments of this
  4185. // invocation.
  4186. func (c StoreGetRepositoryByNameFuncCall) Args() []interface{} {
  4187. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4188. }
  4189. // Results returns an interface slice containing the results of this
  4190. // invocation.
  4191. func (c StoreGetRepositoryByNameFuncCall) Results() []interface{} {
  4192. return []interface{}{c.Result0, c.Result1}
  4193. }
  4194. // StoreTouchAccessTokenByIDFunc describes the behavior when the
  4195. // TouchAccessTokenByID method of the parent MockStore instance is invoked.
  4196. type StoreTouchAccessTokenByIDFunc struct {
  4197. defaultHook func(context.Context, int64) error
  4198. hooks []func(context.Context, int64) error
  4199. history []StoreTouchAccessTokenByIDFuncCall
  4200. mutex sync.Mutex
  4201. }
  4202. // TouchAccessTokenByID delegates to the next hook function in the queue and
  4203. // stores the parameter and result values of this invocation.
  4204. func (m *MockStore) TouchAccessTokenByID(v0 context.Context, v1 int64) error {
  4205. r0 := m.TouchAccessTokenByIDFunc.nextHook()(v0, v1)
  4206. m.TouchAccessTokenByIDFunc.appendCall(StoreTouchAccessTokenByIDFuncCall{v0, v1, r0})
  4207. return r0
  4208. }
  4209. // SetDefaultHook sets function that is called when the TouchAccessTokenByID
  4210. // method of the parent MockStore instance is invoked and the hook queue is
  4211. // empty.
  4212. func (f *StoreTouchAccessTokenByIDFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  4213. f.defaultHook = hook
  4214. }
  4215. // PushHook adds a function to the end of hook queue. Each invocation of the
  4216. // TouchAccessTokenByID method of the parent MockStore instance invokes the
  4217. // hook at the front of the queue and discards it. After the queue is empty,
  4218. // the default hook function is invoked for any future action.
  4219. func (f *StoreTouchAccessTokenByIDFunc) PushHook(hook func(context.Context, int64) error) {
  4220. f.mutex.Lock()
  4221. f.hooks = append(f.hooks, hook)
  4222. f.mutex.Unlock()
  4223. }
  4224. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4225. // given values.
  4226. func (f *StoreTouchAccessTokenByIDFunc) SetDefaultReturn(r0 error) {
  4227. f.SetDefaultHook(func(context.Context, int64) error {
  4228. return r0
  4229. })
  4230. }
  4231. // PushReturn calls PushHook with a function that returns the given values.
  4232. func (f *StoreTouchAccessTokenByIDFunc) PushReturn(r0 error) {
  4233. f.PushHook(func(context.Context, int64) error {
  4234. return r0
  4235. })
  4236. }
  4237. func (f *StoreTouchAccessTokenByIDFunc) nextHook() func(context.Context, int64) error {
  4238. f.mutex.Lock()
  4239. defer f.mutex.Unlock()
  4240. if len(f.hooks) == 0 {
  4241. return f.defaultHook
  4242. }
  4243. hook := f.hooks[0]
  4244. f.hooks = f.hooks[1:]
  4245. return hook
  4246. }
  4247. func (f *StoreTouchAccessTokenByIDFunc) appendCall(r0 StoreTouchAccessTokenByIDFuncCall) {
  4248. f.mutex.Lock()
  4249. f.history = append(f.history, r0)
  4250. f.mutex.Unlock()
  4251. }
  4252. // History returns a sequence of StoreTouchAccessTokenByIDFuncCall objects
  4253. // describing the invocations of this function.
  4254. func (f *StoreTouchAccessTokenByIDFunc) History() []StoreTouchAccessTokenByIDFuncCall {
  4255. f.mutex.Lock()
  4256. history := make([]StoreTouchAccessTokenByIDFuncCall, len(f.history))
  4257. copy(history, f.history)
  4258. f.mutex.Unlock()
  4259. return history
  4260. }
  4261. // StoreTouchAccessTokenByIDFuncCall is an object that describes an
  4262. // invocation of method TouchAccessTokenByID on an instance of MockStore.
  4263. type StoreTouchAccessTokenByIDFuncCall struct {
  4264. // Arg0 is the value of the 1st argument passed to this method
  4265. // invocation.
  4266. Arg0 context.Context
  4267. // Arg1 is the value of the 2nd argument passed to this method
  4268. // invocation.
  4269. Arg1 int64
  4270. // Result0 is the value of the 1st result returned from this method
  4271. // invocation.
  4272. Result0 error
  4273. }
  4274. // Args returns an interface slice containing the arguments of this
  4275. // invocation.
  4276. func (c StoreTouchAccessTokenByIDFuncCall) Args() []interface{} {
  4277. return []interface{}{c.Arg0, c.Arg1}
  4278. }
  4279. // Results returns an interface slice containing the results of this
  4280. // invocation.
  4281. func (c StoreTouchAccessTokenByIDFuncCall) Results() []interface{} {
  4282. return []interface{}{c.Result0}
  4283. }