mocks_test.go 205 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072
  1. // Code generated by go-mockgen 2.1.1; 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. db "gogs.io/gogs/internal/db"
  11. lfsutil "gogs.io/gogs/internal/lfsutil"
  12. )
  13. // MockAccessTokensStore is a mock implementation of the AccessTokensStore
  14. // interface (from the package gogs.io/gogs/internal/db) used for unit
  15. // testing.
  16. type MockAccessTokensStore struct {
  17. // CreateFunc is an instance of a mock function object controlling the
  18. // behavior of the method Create.
  19. CreateFunc *AccessTokensStoreCreateFunc
  20. // DeleteByIDFunc is an instance of a mock function object controlling
  21. // the behavior of the method DeleteByID.
  22. DeleteByIDFunc *AccessTokensStoreDeleteByIDFunc
  23. // GetBySHA1Func is an instance of a mock function object controlling
  24. // the behavior of the method GetBySHA1.
  25. GetBySHA1Func *AccessTokensStoreGetBySHA1Func
  26. // ListFunc is an instance of a mock function object controlling the
  27. // behavior of the method List.
  28. ListFunc *AccessTokensStoreListFunc
  29. // TouchFunc is an instance of a mock function object controlling the
  30. // behavior of the method Touch.
  31. TouchFunc *AccessTokensStoreTouchFunc
  32. }
  33. // NewMockAccessTokensStore creates a new mock of the AccessTokensStore
  34. // interface. All methods return zero values for all results, unless
  35. // overwritten.
  36. func NewMockAccessTokensStore() *MockAccessTokensStore {
  37. return &MockAccessTokensStore{
  38. CreateFunc: &AccessTokensStoreCreateFunc{
  39. defaultHook: func(context.Context, int64, string) (r0 *db.AccessToken, r1 error) {
  40. return
  41. },
  42. },
  43. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  44. defaultHook: func(context.Context, int64, int64) (r0 error) {
  45. return
  46. },
  47. },
  48. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  49. defaultHook: func(context.Context, string) (r0 *db.AccessToken, r1 error) {
  50. return
  51. },
  52. },
  53. ListFunc: &AccessTokensStoreListFunc{
  54. defaultHook: func(context.Context, int64) (r0 []*db.AccessToken, r1 error) {
  55. return
  56. },
  57. },
  58. TouchFunc: &AccessTokensStoreTouchFunc{
  59. defaultHook: func(context.Context, int64) (r0 error) {
  60. return
  61. },
  62. },
  63. }
  64. }
  65. // NewStrictMockAccessTokensStore creates a new mock of the
  66. // AccessTokensStore interface. All methods panic on invocation, unless
  67. // overwritten.
  68. func NewStrictMockAccessTokensStore() *MockAccessTokensStore {
  69. return &MockAccessTokensStore{
  70. CreateFunc: &AccessTokensStoreCreateFunc{
  71. defaultHook: func(context.Context, int64, string) (*db.AccessToken, error) {
  72. panic("unexpected invocation of MockAccessTokensStore.Create")
  73. },
  74. },
  75. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  76. defaultHook: func(context.Context, int64, int64) error {
  77. panic("unexpected invocation of MockAccessTokensStore.DeleteByID")
  78. },
  79. },
  80. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  81. defaultHook: func(context.Context, string) (*db.AccessToken, error) {
  82. panic("unexpected invocation of MockAccessTokensStore.GetBySHA1")
  83. },
  84. },
  85. ListFunc: &AccessTokensStoreListFunc{
  86. defaultHook: func(context.Context, int64) ([]*db.AccessToken, error) {
  87. panic("unexpected invocation of MockAccessTokensStore.List")
  88. },
  89. },
  90. TouchFunc: &AccessTokensStoreTouchFunc{
  91. defaultHook: func(context.Context, int64) error {
  92. panic("unexpected invocation of MockAccessTokensStore.Touch")
  93. },
  94. },
  95. }
  96. }
  97. // NewMockAccessTokensStoreFrom creates a new mock of the
  98. // MockAccessTokensStore interface. All methods delegate to the given
  99. // implementation, unless overwritten.
  100. func NewMockAccessTokensStoreFrom(i db.AccessTokensStore) *MockAccessTokensStore {
  101. return &MockAccessTokensStore{
  102. CreateFunc: &AccessTokensStoreCreateFunc{
  103. defaultHook: i.Create,
  104. },
  105. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  106. defaultHook: i.DeleteByID,
  107. },
  108. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  109. defaultHook: i.GetBySHA1,
  110. },
  111. ListFunc: &AccessTokensStoreListFunc{
  112. defaultHook: i.List,
  113. },
  114. TouchFunc: &AccessTokensStoreTouchFunc{
  115. defaultHook: i.Touch,
  116. },
  117. }
  118. }
  119. // AccessTokensStoreCreateFunc describes the behavior when the Create method
  120. // of the parent MockAccessTokensStore instance is invoked.
  121. type AccessTokensStoreCreateFunc struct {
  122. defaultHook func(context.Context, int64, string) (*db.AccessToken, error)
  123. hooks []func(context.Context, int64, string) (*db.AccessToken, error)
  124. history []AccessTokensStoreCreateFuncCall
  125. mutex sync.Mutex
  126. }
  127. // Create delegates to the next hook function in the queue and stores the
  128. // parameter and result values of this invocation.
  129. func (m *MockAccessTokensStore) Create(v0 context.Context, v1 int64, v2 string) (*db.AccessToken, error) {
  130. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  131. m.CreateFunc.appendCall(AccessTokensStoreCreateFuncCall{v0, v1, v2, r0, r1})
  132. return r0, r1
  133. }
  134. // SetDefaultHook sets function that is called when the Create method of the
  135. // parent MockAccessTokensStore instance is invoked and the hook queue is
  136. // empty.
  137. func (f *AccessTokensStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string) (*db.AccessToken, error)) {
  138. f.defaultHook = hook
  139. }
  140. // PushHook adds a function to the end of hook queue. Each invocation of the
  141. // Create method of the parent MockAccessTokensStore instance invokes the
  142. // hook at the front of the queue and discards it. After the queue is empty,
  143. // the default hook function is invoked for any future action.
  144. func (f *AccessTokensStoreCreateFunc) PushHook(hook func(context.Context, int64, string) (*db.AccessToken, error)) {
  145. f.mutex.Lock()
  146. f.hooks = append(f.hooks, hook)
  147. f.mutex.Unlock()
  148. }
  149. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  150. // given values.
  151. func (f *AccessTokensStoreCreateFunc) SetDefaultReturn(r0 *db.AccessToken, r1 error) {
  152. f.SetDefaultHook(func(context.Context, int64, string) (*db.AccessToken, error) {
  153. return r0, r1
  154. })
  155. }
  156. // PushReturn calls PushHook with a function that returns the given values.
  157. func (f *AccessTokensStoreCreateFunc) PushReturn(r0 *db.AccessToken, r1 error) {
  158. f.PushHook(func(context.Context, int64, string) (*db.AccessToken, error) {
  159. return r0, r1
  160. })
  161. }
  162. func (f *AccessTokensStoreCreateFunc) nextHook() func(context.Context, int64, string) (*db.AccessToken, error) {
  163. f.mutex.Lock()
  164. defer f.mutex.Unlock()
  165. if len(f.hooks) == 0 {
  166. return f.defaultHook
  167. }
  168. hook := f.hooks[0]
  169. f.hooks = f.hooks[1:]
  170. return hook
  171. }
  172. func (f *AccessTokensStoreCreateFunc) appendCall(r0 AccessTokensStoreCreateFuncCall) {
  173. f.mutex.Lock()
  174. f.history = append(f.history, r0)
  175. f.mutex.Unlock()
  176. }
  177. // History returns a sequence of AccessTokensStoreCreateFuncCall objects
  178. // describing the invocations of this function.
  179. func (f *AccessTokensStoreCreateFunc) History() []AccessTokensStoreCreateFuncCall {
  180. f.mutex.Lock()
  181. history := make([]AccessTokensStoreCreateFuncCall, len(f.history))
  182. copy(history, f.history)
  183. f.mutex.Unlock()
  184. return history
  185. }
  186. // AccessTokensStoreCreateFuncCall is an object that describes an invocation
  187. // of method Create on an instance of MockAccessTokensStore.
  188. type AccessTokensStoreCreateFuncCall struct {
  189. // Arg0 is the value of the 1st argument passed to this method
  190. // invocation.
  191. Arg0 context.Context
  192. // Arg1 is the value of the 2nd argument passed to this method
  193. // invocation.
  194. Arg1 int64
  195. // Arg2 is the value of the 3rd argument passed to this method
  196. // invocation.
  197. Arg2 string
  198. // Result0 is the value of the 1st result returned from this method
  199. // invocation.
  200. Result0 *db.AccessToken
  201. // Result1 is the value of the 2nd result returned from this method
  202. // invocation.
  203. Result1 error
  204. }
  205. // Args returns an interface slice containing the arguments of this
  206. // invocation.
  207. func (c AccessTokensStoreCreateFuncCall) Args() []interface{} {
  208. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  209. }
  210. // Results returns an interface slice containing the results of this
  211. // invocation.
  212. func (c AccessTokensStoreCreateFuncCall) Results() []interface{} {
  213. return []interface{}{c.Result0, c.Result1}
  214. }
  215. // AccessTokensStoreDeleteByIDFunc describes the behavior when the
  216. // DeleteByID method of the parent MockAccessTokensStore instance is
  217. // invoked.
  218. type AccessTokensStoreDeleteByIDFunc struct {
  219. defaultHook func(context.Context, int64, int64) error
  220. hooks []func(context.Context, int64, int64) error
  221. history []AccessTokensStoreDeleteByIDFuncCall
  222. mutex sync.Mutex
  223. }
  224. // DeleteByID delegates to the next hook function in the queue and stores
  225. // the parameter and result values of this invocation.
  226. func (m *MockAccessTokensStore) DeleteByID(v0 context.Context, v1 int64, v2 int64) error {
  227. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  228. m.DeleteByIDFunc.appendCall(AccessTokensStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  229. return r0
  230. }
  231. // SetDefaultHook sets function that is called when the DeleteByID method of
  232. // the parent MockAccessTokensStore instance is invoked and the hook queue
  233. // is empty.
  234. func (f *AccessTokensStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  235. f.defaultHook = hook
  236. }
  237. // PushHook adds a function to the end of hook queue. Each invocation of the
  238. // DeleteByID method of the parent MockAccessTokensStore instance invokes
  239. // the hook at the front of the queue and discards it. After the queue is
  240. // empty, the default hook function is invoked for any future action.
  241. func (f *AccessTokensStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, int64) error) {
  242. f.mutex.Lock()
  243. f.hooks = append(f.hooks, hook)
  244. f.mutex.Unlock()
  245. }
  246. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  247. // given values.
  248. func (f *AccessTokensStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  249. f.SetDefaultHook(func(context.Context, int64, int64) error {
  250. return r0
  251. })
  252. }
  253. // PushReturn calls PushHook with a function that returns the given values.
  254. func (f *AccessTokensStoreDeleteByIDFunc) PushReturn(r0 error) {
  255. f.PushHook(func(context.Context, int64, int64) error {
  256. return r0
  257. })
  258. }
  259. func (f *AccessTokensStoreDeleteByIDFunc) nextHook() func(context.Context, int64, int64) error {
  260. f.mutex.Lock()
  261. defer f.mutex.Unlock()
  262. if len(f.hooks) == 0 {
  263. return f.defaultHook
  264. }
  265. hook := f.hooks[0]
  266. f.hooks = f.hooks[1:]
  267. return hook
  268. }
  269. func (f *AccessTokensStoreDeleteByIDFunc) appendCall(r0 AccessTokensStoreDeleteByIDFuncCall) {
  270. f.mutex.Lock()
  271. f.history = append(f.history, r0)
  272. f.mutex.Unlock()
  273. }
  274. // History returns a sequence of AccessTokensStoreDeleteByIDFuncCall objects
  275. // describing the invocations of this function.
  276. func (f *AccessTokensStoreDeleteByIDFunc) History() []AccessTokensStoreDeleteByIDFuncCall {
  277. f.mutex.Lock()
  278. history := make([]AccessTokensStoreDeleteByIDFuncCall, len(f.history))
  279. copy(history, f.history)
  280. f.mutex.Unlock()
  281. return history
  282. }
  283. // AccessTokensStoreDeleteByIDFuncCall is an object that describes an
  284. // invocation of method DeleteByID on an instance of MockAccessTokensStore.
  285. type AccessTokensStoreDeleteByIDFuncCall struct {
  286. // Arg0 is the value of the 1st argument passed to this method
  287. // invocation.
  288. Arg0 context.Context
  289. // Arg1 is the value of the 2nd argument passed to this method
  290. // invocation.
  291. Arg1 int64
  292. // Arg2 is the value of the 3rd argument passed to this method
  293. // invocation.
  294. Arg2 int64
  295. // Result0 is the value of the 1st result returned from this method
  296. // invocation.
  297. Result0 error
  298. }
  299. // Args returns an interface slice containing the arguments of this
  300. // invocation.
  301. func (c AccessTokensStoreDeleteByIDFuncCall) Args() []interface{} {
  302. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  303. }
  304. // Results returns an interface slice containing the results of this
  305. // invocation.
  306. func (c AccessTokensStoreDeleteByIDFuncCall) Results() []interface{} {
  307. return []interface{}{c.Result0}
  308. }
  309. // AccessTokensStoreGetBySHA1Func describes the behavior when the GetBySHA1
  310. // method of the parent MockAccessTokensStore instance is invoked.
  311. type AccessTokensStoreGetBySHA1Func struct {
  312. defaultHook func(context.Context, string) (*db.AccessToken, error)
  313. hooks []func(context.Context, string) (*db.AccessToken, error)
  314. history []AccessTokensStoreGetBySHA1FuncCall
  315. mutex sync.Mutex
  316. }
  317. // GetBySHA1 delegates to the next hook function in the queue and stores the
  318. // parameter and result values of this invocation.
  319. func (m *MockAccessTokensStore) GetBySHA1(v0 context.Context, v1 string) (*db.AccessToken, error) {
  320. r0, r1 := m.GetBySHA1Func.nextHook()(v0, v1)
  321. m.GetBySHA1Func.appendCall(AccessTokensStoreGetBySHA1FuncCall{v0, v1, r0, r1})
  322. return r0, r1
  323. }
  324. // SetDefaultHook sets function that is called when the GetBySHA1 method of
  325. // the parent MockAccessTokensStore instance is invoked and the hook queue
  326. // is empty.
  327. func (f *AccessTokensStoreGetBySHA1Func) SetDefaultHook(hook func(context.Context, string) (*db.AccessToken, error)) {
  328. f.defaultHook = hook
  329. }
  330. // PushHook adds a function to the end of hook queue. Each invocation of the
  331. // GetBySHA1 method of the parent MockAccessTokensStore instance invokes the
  332. // hook at the front of the queue and discards it. After the queue is empty,
  333. // the default hook function is invoked for any future action.
  334. func (f *AccessTokensStoreGetBySHA1Func) PushHook(hook func(context.Context, string) (*db.AccessToken, error)) {
  335. f.mutex.Lock()
  336. f.hooks = append(f.hooks, hook)
  337. f.mutex.Unlock()
  338. }
  339. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  340. // given values.
  341. func (f *AccessTokensStoreGetBySHA1Func) SetDefaultReturn(r0 *db.AccessToken, r1 error) {
  342. f.SetDefaultHook(func(context.Context, string) (*db.AccessToken, error) {
  343. return r0, r1
  344. })
  345. }
  346. // PushReturn calls PushHook with a function that returns the given values.
  347. func (f *AccessTokensStoreGetBySHA1Func) PushReturn(r0 *db.AccessToken, r1 error) {
  348. f.PushHook(func(context.Context, string) (*db.AccessToken, error) {
  349. return r0, r1
  350. })
  351. }
  352. func (f *AccessTokensStoreGetBySHA1Func) nextHook() func(context.Context, string) (*db.AccessToken, error) {
  353. f.mutex.Lock()
  354. defer f.mutex.Unlock()
  355. if len(f.hooks) == 0 {
  356. return f.defaultHook
  357. }
  358. hook := f.hooks[0]
  359. f.hooks = f.hooks[1:]
  360. return hook
  361. }
  362. func (f *AccessTokensStoreGetBySHA1Func) appendCall(r0 AccessTokensStoreGetBySHA1FuncCall) {
  363. f.mutex.Lock()
  364. f.history = append(f.history, r0)
  365. f.mutex.Unlock()
  366. }
  367. // History returns a sequence of AccessTokensStoreGetBySHA1FuncCall objects
  368. // describing the invocations of this function.
  369. func (f *AccessTokensStoreGetBySHA1Func) History() []AccessTokensStoreGetBySHA1FuncCall {
  370. f.mutex.Lock()
  371. history := make([]AccessTokensStoreGetBySHA1FuncCall, len(f.history))
  372. copy(history, f.history)
  373. f.mutex.Unlock()
  374. return history
  375. }
  376. // AccessTokensStoreGetBySHA1FuncCall is an object that describes an
  377. // invocation of method GetBySHA1 on an instance of MockAccessTokensStore.
  378. type AccessTokensStoreGetBySHA1FuncCall struct {
  379. // Arg0 is the value of the 1st argument passed to this method
  380. // invocation.
  381. Arg0 context.Context
  382. // Arg1 is the value of the 2nd argument passed to this method
  383. // invocation.
  384. Arg1 string
  385. // Result0 is the value of the 1st result returned from this method
  386. // invocation.
  387. Result0 *db.AccessToken
  388. // Result1 is the value of the 2nd result returned from this method
  389. // invocation.
  390. Result1 error
  391. }
  392. // Args returns an interface slice containing the arguments of this
  393. // invocation.
  394. func (c AccessTokensStoreGetBySHA1FuncCall) Args() []interface{} {
  395. return []interface{}{c.Arg0, c.Arg1}
  396. }
  397. // Results returns an interface slice containing the results of this
  398. // invocation.
  399. func (c AccessTokensStoreGetBySHA1FuncCall) Results() []interface{} {
  400. return []interface{}{c.Result0, c.Result1}
  401. }
  402. // AccessTokensStoreListFunc describes the behavior when the List method of
  403. // the parent MockAccessTokensStore instance is invoked.
  404. type AccessTokensStoreListFunc struct {
  405. defaultHook func(context.Context, int64) ([]*db.AccessToken, error)
  406. hooks []func(context.Context, int64) ([]*db.AccessToken, error)
  407. history []AccessTokensStoreListFuncCall
  408. mutex sync.Mutex
  409. }
  410. // List delegates to the next hook function in the queue and stores the
  411. // parameter and result values of this invocation.
  412. func (m *MockAccessTokensStore) List(v0 context.Context, v1 int64) ([]*db.AccessToken, error) {
  413. r0, r1 := m.ListFunc.nextHook()(v0, v1)
  414. m.ListFunc.appendCall(AccessTokensStoreListFuncCall{v0, v1, r0, r1})
  415. return r0, r1
  416. }
  417. // SetDefaultHook sets function that is called when the List method of the
  418. // parent MockAccessTokensStore instance is invoked and the hook queue is
  419. // empty.
  420. func (f *AccessTokensStoreListFunc) SetDefaultHook(hook func(context.Context, int64) ([]*db.AccessToken, error)) {
  421. f.defaultHook = hook
  422. }
  423. // PushHook adds a function to the end of hook queue. Each invocation of the
  424. // List method of the parent MockAccessTokensStore instance invokes the hook
  425. // at the front of the queue and discards it. After the queue is empty, the
  426. // default hook function is invoked for any future action.
  427. func (f *AccessTokensStoreListFunc) PushHook(hook func(context.Context, int64) ([]*db.AccessToken, error)) {
  428. f.mutex.Lock()
  429. f.hooks = append(f.hooks, hook)
  430. f.mutex.Unlock()
  431. }
  432. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  433. // given values.
  434. func (f *AccessTokensStoreListFunc) SetDefaultReturn(r0 []*db.AccessToken, r1 error) {
  435. f.SetDefaultHook(func(context.Context, int64) ([]*db.AccessToken, error) {
  436. return r0, r1
  437. })
  438. }
  439. // PushReturn calls PushHook with a function that returns the given values.
  440. func (f *AccessTokensStoreListFunc) PushReturn(r0 []*db.AccessToken, r1 error) {
  441. f.PushHook(func(context.Context, int64) ([]*db.AccessToken, error) {
  442. return r0, r1
  443. })
  444. }
  445. func (f *AccessTokensStoreListFunc) nextHook() func(context.Context, int64) ([]*db.AccessToken, error) {
  446. f.mutex.Lock()
  447. defer f.mutex.Unlock()
  448. if len(f.hooks) == 0 {
  449. return f.defaultHook
  450. }
  451. hook := f.hooks[0]
  452. f.hooks = f.hooks[1:]
  453. return hook
  454. }
  455. func (f *AccessTokensStoreListFunc) appendCall(r0 AccessTokensStoreListFuncCall) {
  456. f.mutex.Lock()
  457. f.history = append(f.history, r0)
  458. f.mutex.Unlock()
  459. }
  460. // History returns a sequence of AccessTokensStoreListFuncCall objects
  461. // describing the invocations of this function.
  462. func (f *AccessTokensStoreListFunc) History() []AccessTokensStoreListFuncCall {
  463. f.mutex.Lock()
  464. history := make([]AccessTokensStoreListFuncCall, len(f.history))
  465. copy(history, f.history)
  466. f.mutex.Unlock()
  467. return history
  468. }
  469. // AccessTokensStoreListFuncCall is an object that describes an invocation
  470. // of method List on an instance of MockAccessTokensStore.
  471. type AccessTokensStoreListFuncCall struct {
  472. // Arg0 is the value of the 1st argument passed to this method
  473. // invocation.
  474. Arg0 context.Context
  475. // Arg1 is the value of the 2nd argument passed to this method
  476. // invocation.
  477. Arg1 int64
  478. // Result0 is the value of the 1st result returned from this method
  479. // invocation.
  480. Result0 []*db.AccessToken
  481. // Result1 is the value of the 2nd result returned from this method
  482. // invocation.
  483. Result1 error
  484. }
  485. // Args returns an interface slice containing the arguments of this
  486. // invocation.
  487. func (c AccessTokensStoreListFuncCall) Args() []interface{} {
  488. return []interface{}{c.Arg0, c.Arg1}
  489. }
  490. // Results returns an interface slice containing the results of this
  491. // invocation.
  492. func (c AccessTokensStoreListFuncCall) Results() []interface{} {
  493. return []interface{}{c.Result0, c.Result1}
  494. }
  495. // AccessTokensStoreTouchFunc describes the behavior when the Touch method
  496. // of the parent MockAccessTokensStore instance is invoked.
  497. type AccessTokensStoreTouchFunc struct {
  498. defaultHook func(context.Context, int64) error
  499. hooks []func(context.Context, int64) error
  500. history []AccessTokensStoreTouchFuncCall
  501. mutex sync.Mutex
  502. }
  503. // Touch delegates to the next hook function in the queue and stores the
  504. // parameter and result values of this invocation.
  505. func (m *MockAccessTokensStore) Touch(v0 context.Context, v1 int64) error {
  506. r0 := m.TouchFunc.nextHook()(v0, v1)
  507. m.TouchFunc.appendCall(AccessTokensStoreTouchFuncCall{v0, v1, r0})
  508. return r0
  509. }
  510. // SetDefaultHook sets function that is called when the Touch method of the
  511. // parent MockAccessTokensStore instance is invoked and the hook queue is
  512. // empty.
  513. func (f *AccessTokensStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  514. f.defaultHook = hook
  515. }
  516. // PushHook adds a function to the end of hook queue. Each invocation of the
  517. // Touch method of the parent MockAccessTokensStore instance invokes the
  518. // hook at the front of the queue and discards it. After the queue is empty,
  519. // the default hook function is invoked for any future action.
  520. func (f *AccessTokensStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  521. f.mutex.Lock()
  522. f.hooks = append(f.hooks, hook)
  523. f.mutex.Unlock()
  524. }
  525. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  526. // given values.
  527. func (f *AccessTokensStoreTouchFunc) SetDefaultReturn(r0 error) {
  528. f.SetDefaultHook(func(context.Context, int64) error {
  529. return r0
  530. })
  531. }
  532. // PushReturn calls PushHook with a function that returns the given values.
  533. func (f *AccessTokensStoreTouchFunc) PushReturn(r0 error) {
  534. f.PushHook(func(context.Context, int64) error {
  535. return r0
  536. })
  537. }
  538. func (f *AccessTokensStoreTouchFunc) nextHook() func(context.Context, int64) error {
  539. f.mutex.Lock()
  540. defer f.mutex.Unlock()
  541. if len(f.hooks) == 0 {
  542. return f.defaultHook
  543. }
  544. hook := f.hooks[0]
  545. f.hooks = f.hooks[1:]
  546. return hook
  547. }
  548. func (f *AccessTokensStoreTouchFunc) appendCall(r0 AccessTokensStoreTouchFuncCall) {
  549. f.mutex.Lock()
  550. f.history = append(f.history, r0)
  551. f.mutex.Unlock()
  552. }
  553. // History returns a sequence of AccessTokensStoreTouchFuncCall objects
  554. // describing the invocations of this function.
  555. func (f *AccessTokensStoreTouchFunc) History() []AccessTokensStoreTouchFuncCall {
  556. f.mutex.Lock()
  557. history := make([]AccessTokensStoreTouchFuncCall, len(f.history))
  558. copy(history, f.history)
  559. f.mutex.Unlock()
  560. return history
  561. }
  562. // AccessTokensStoreTouchFuncCall is an object that describes an invocation
  563. // of method Touch on an instance of MockAccessTokensStore.
  564. type AccessTokensStoreTouchFuncCall struct {
  565. // Arg0 is the value of the 1st argument passed to this method
  566. // invocation.
  567. Arg0 context.Context
  568. // Arg1 is the value of the 2nd argument passed to this method
  569. // invocation.
  570. Arg1 int64
  571. // Result0 is the value of the 1st result returned from this method
  572. // invocation.
  573. Result0 error
  574. }
  575. // Args returns an interface slice containing the arguments of this
  576. // invocation.
  577. func (c AccessTokensStoreTouchFuncCall) Args() []interface{} {
  578. return []interface{}{c.Arg0, c.Arg1}
  579. }
  580. // Results returns an interface slice containing the results of this
  581. // invocation.
  582. func (c AccessTokensStoreTouchFuncCall) Results() []interface{} {
  583. return []interface{}{c.Result0}
  584. }
  585. // MockLFSStore is a mock implementation of the LFSStore interface (from the
  586. // package gogs.io/gogs/internal/db) used for unit testing.
  587. type MockLFSStore struct {
  588. // CreateObjectFunc is an instance of a mock function object controlling
  589. // the behavior of the method CreateObject.
  590. CreateObjectFunc *LFSStoreCreateObjectFunc
  591. // GetObjectByOIDFunc is an instance of a mock function object
  592. // controlling the behavior of the method GetObjectByOID.
  593. GetObjectByOIDFunc *LFSStoreGetObjectByOIDFunc
  594. // GetObjectsByOIDsFunc is an instance of a mock function object
  595. // controlling the behavior of the method GetObjectsByOIDs.
  596. GetObjectsByOIDsFunc *LFSStoreGetObjectsByOIDsFunc
  597. }
  598. // NewMockLFSStore creates a new mock of the LFSStore interface. All methods
  599. // return zero values for all results, unless overwritten.
  600. func NewMockLFSStore() *MockLFSStore {
  601. return &MockLFSStore{
  602. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  603. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) (r0 error) {
  604. return
  605. },
  606. },
  607. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  608. defaultHook: func(context.Context, int64, lfsutil.OID) (r0 *db.LFSObject, r1 error) {
  609. return
  610. },
  611. },
  612. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  613. defaultHook: func(context.Context, int64, ...lfsutil.OID) (r0 []*db.LFSObject, r1 error) {
  614. return
  615. },
  616. },
  617. }
  618. }
  619. // NewStrictMockLFSStore creates a new mock of the LFSStore interface. All
  620. // methods panic on invocation, unless overwritten.
  621. func NewStrictMockLFSStore() *MockLFSStore {
  622. return &MockLFSStore{
  623. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  624. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  625. panic("unexpected invocation of MockLFSStore.CreateObject")
  626. },
  627. },
  628. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  629. defaultHook: func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  630. panic("unexpected invocation of MockLFSStore.GetObjectByOID")
  631. },
  632. },
  633. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  634. defaultHook: func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  635. panic("unexpected invocation of MockLFSStore.GetObjectsByOIDs")
  636. },
  637. },
  638. }
  639. }
  640. // NewMockLFSStoreFrom creates a new mock of the MockLFSStore interface. All
  641. // methods delegate to the given implementation, unless overwritten.
  642. func NewMockLFSStoreFrom(i db.LFSStore) *MockLFSStore {
  643. return &MockLFSStore{
  644. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  645. defaultHook: i.CreateObject,
  646. },
  647. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  648. defaultHook: i.GetObjectByOID,
  649. },
  650. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  651. defaultHook: i.GetObjectsByOIDs,
  652. },
  653. }
  654. }
  655. // LFSStoreCreateObjectFunc describes the behavior when the CreateObject
  656. // method of the parent MockLFSStore instance is invoked.
  657. type LFSStoreCreateObjectFunc struct {
  658. defaultHook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  659. hooks []func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  660. history []LFSStoreCreateObjectFuncCall
  661. mutex sync.Mutex
  662. }
  663. // CreateObject delegates to the next hook function in the queue and stores
  664. // the parameter and result values of this invocation.
  665. func (m *MockLFSStore) CreateObject(v0 context.Context, v1 int64, v2 lfsutil.OID, v3 int64, v4 lfsutil.Storage) error {
  666. r0 := m.CreateObjectFunc.nextHook()(v0, v1, v2, v3, v4)
  667. m.CreateObjectFunc.appendCall(LFSStoreCreateObjectFuncCall{v0, v1, v2, v3, v4, r0})
  668. return r0
  669. }
  670. // SetDefaultHook sets function that is called when the CreateObject method
  671. // of the parent MockLFSStore instance is invoked and the hook queue is
  672. // empty.
  673. func (f *LFSStoreCreateObjectFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  674. f.defaultHook = hook
  675. }
  676. // PushHook adds a function to the end of hook queue. Each invocation of the
  677. // CreateObject method of the parent MockLFSStore instance invokes the hook
  678. // at the front of the queue and discards it. After the queue is empty, the
  679. // default hook function is invoked for any future action.
  680. func (f *LFSStoreCreateObjectFunc) PushHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  681. f.mutex.Lock()
  682. f.hooks = append(f.hooks, hook)
  683. f.mutex.Unlock()
  684. }
  685. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  686. // given values.
  687. func (f *LFSStoreCreateObjectFunc) SetDefaultReturn(r0 error) {
  688. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  689. return r0
  690. })
  691. }
  692. // PushReturn calls PushHook with a function that returns the given values.
  693. func (f *LFSStoreCreateObjectFunc) PushReturn(r0 error) {
  694. f.PushHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  695. return r0
  696. })
  697. }
  698. func (f *LFSStoreCreateObjectFunc) nextHook() func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  699. f.mutex.Lock()
  700. defer f.mutex.Unlock()
  701. if len(f.hooks) == 0 {
  702. return f.defaultHook
  703. }
  704. hook := f.hooks[0]
  705. f.hooks = f.hooks[1:]
  706. return hook
  707. }
  708. func (f *LFSStoreCreateObjectFunc) appendCall(r0 LFSStoreCreateObjectFuncCall) {
  709. f.mutex.Lock()
  710. f.history = append(f.history, r0)
  711. f.mutex.Unlock()
  712. }
  713. // History returns a sequence of LFSStoreCreateObjectFuncCall objects
  714. // describing the invocations of this function.
  715. func (f *LFSStoreCreateObjectFunc) History() []LFSStoreCreateObjectFuncCall {
  716. f.mutex.Lock()
  717. history := make([]LFSStoreCreateObjectFuncCall, len(f.history))
  718. copy(history, f.history)
  719. f.mutex.Unlock()
  720. return history
  721. }
  722. // LFSStoreCreateObjectFuncCall is an object that describes an invocation of
  723. // method CreateObject on an instance of MockLFSStore.
  724. type LFSStoreCreateObjectFuncCall struct {
  725. // Arg0 is the value of the 1st argument passed to this method
  726. // invocation.
  727. Arg0 context.Context
  728. // Arg1 is the value of the 2nd argument passed to this method
  729. // invocation.
  730. Arg1 int64
  731. // Arg2 is the value of the 3rd argument passed to this method
  732. // invocation.
  733. Arg2 lfsutil.OID
  734. // Arg3 is the value of the 4th argument passed to this method
  735. // invocation.
  736. Arg3 int64
  737. // Arg4 is the value of the 5th argument passed to this method
  738. // invocation.
  739. Arg4 lfsutil.Storage
  740. // Result0 is the value of the 1st result returned from this method
  741. // invocation.
  742. Result0 error
  743. }
  744. // Args returns an interface slice containing the arguments of this
  745. // invocation.
  746. func (c LFSStoreCreateObjectFuncCall) Args() []interface{} {
  747. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  748. }
  749. // Results returns an interface slice containing the results of this
  750. // invocation.
  751. func (c LFSStoreCreateObjectFuncCall) Results() []interface{} {
  752. return []interface{}{c.Result0}
  753. }
  754. // LFSStoreGetObjectByOIDFunc describes the behavior when the GetObjectByOID
  755. // method of the parent MockLFSStore instance is invoked.
  756. type LFSStoreGetObjectByOIDFunc struct {
  757. defaultHook func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)
  758. hooks []func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)
  759. history []LFSStoreGetObjectByOIDFuncCall
  760. mutex sync.Mutex
  761. }
  762. // GetObjectByOID delegates to the next hook function in the queue and
  763. // stores the parameter and result values of this invocation.
  764. func (m *MockLFSStore) GetObjectByOID(v0 context.Context, v1 int64, v2 lfsutil.OID) (*db.LFSObject, error) {
  765. r0, r1 := m.GetObjectByOIDFunc.nextHook()(v0, v1, v2)
  766. m.GetObjectByOIDFunc.appendCall(LFSStoreGetObjectByOIDFuncCall{v0, v1, v2, r0, r1})
  767. return r0, r1
  768. }
  769. // SetDefaultHook sets function that is called when the GetObjectByOID
  770. // method of the parent MockLFSStore instance is invoked and the hook queue
  771. // is empty.
  772. func (f *LFSStoreGetObjectByOIDFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)) {
  773. f.defaultHook = hook
  774. }
  775. // PushHook adds a function to the end of hook queue. Each invocation of the
  776. // GetObjectByOID method of the parent MockLFSStore instance invokes the
  777. // hook at the front of the queue and discards it. After the queue is empty,
  778. // the default hook function is invoked for any future action.
  779. func (f *LFSStoreGetObjectByOIDFunc) PushHook(hook func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)) {
  780. f.mutex.Lock()
  781. f.hooks = append(f.hooks, hook)
  782. f.mutex.Unlock()
  783. }
  784. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  785. // given values.
  786. func (f *LFSStoreGetObjectByOIDFunc) SetDefaultReturn(r0 *db.LFSObject, r1 error) {
  787. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  788. return r0, r1
  789. })
  790. }
  791. // PushReturn calls PushHook with a function that returns the given values.
  792. func (f *LFSStoreGetObjectByOIDFunc) PushReturn(r0 *db.LFSObject, r1 error) {
  793. f.PushHook(func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  794. return r0, r1
  795. })
  796. }
  797. func (f *LFSStoreGetObjectByOIDFunc) nextHook() func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  798. f.mutex.Lock()
  799. defer f.mutex.Unlock()
  800. if len(f.hooks) == 0 {
  801. return f.defaultHook
  802. }
  803. hook := f.hooks[0]
  804. f.hooks = f.hooks[1:]
  805. return hook
  806. }
  807. func (f *LFSStoreGetObjectByOIDFunc) appendCall(r0 LFSStoreGetObjectByOIDFuncCall) {
  808. f.mutex.Lock()
  809. f.history = append(f.history, r0)
  810. f.mutex.Unlock()
  811. }
  812. // History returns a sequence of LFSStoreGetObjectByOIDFuncCall objects
  813. // describing the invocations of this function.
  814. func (f *LFSStoreGetObjectByOIDFunc) History() []LFSStoreGetObjectByOIDFuncCall {
  815. f.mutex.Lock()
  816. history := make([]LFSStoreGetObjectByOIDFuncCall, len(f.history))
  817. copy(history, f.history)
  818. f.mutex.Unlock()
  819. return history
  820. }
  821. // LFSStoreGetObjectByOIDFuncCall is an object that describes an invocation
  822. // of method GetObjectByOID on an instance of MockLFSStore.
  823. type LFSStoreGetObjectByOIDFuncCall struct {
  824. // Arg0 is the value of the 1st argument passed to this method
  825. // invocation.
  826. Arg0 context.Context
  827. // Arg1 is the value of the 2nd argument passed to this method
  828. // invocation.
  829. Arg1 int64
  830. // Arg2 is the value of the 3rd argument passed to this method
  831. // invocation.
  832. Arg2 lfsutil.OID
  833. // Result0 is the value of the 1st result returned from this method
  834. // invocation.
  835. Result0 *db.LFSObject
  836. // Result1 is the value of the 2nd result returned from this method
  837. // invocation.
  838. Result1 error
  839. }
  840. // Args returns an interface slice containing the arguments of this
  841. // invocation.
  842. func (c LFSStoreGetObjectByOIDFuncCall) Args() []interface{} {
  843. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  844. }
  845. // Results returns an interface slice containing the results of this
  846. // invocation.
  847. func (c LFSStoreGetObjectByOIDFuncCall) Results() []interface{} {
  848. return []interface{}{c.Result0, c.Result1}
  849. }
  850. // LFSStoreGetObjectsByOIDsFunc describes the behavior when the
  851. // GetObjectsByOIDs method of the parent MockLFSStore instance is invoked.
  852. type LFSStoreGetObjectsByOIDsFunc struct {
  853. defaultHook func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)
  854. hooks []func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)
  855. history []LFSStoreGetObjectsByOIDsFuncCall
  856. mutex sync.Mutex
  857. }
  858. // GetObjectsByOIDs delegates to the next hook function in the queue and
  859. // stores the parameter and result values of this invocation.
  860. func (m *MockLFSStore) GetObjectsByOIDs(v0 context.Context, v1 int64, v2 ...lfsutil.OID) ([]*db.LFSObject, error) {
  861. r0, r1 := m.GetObjectsByOIDsFunc.nextHook()(v0, v1, v2...)
  862. m.GetObjectsByOIDsFunc.appendCall(LFSStoreGetObjectsByOIDsFuncCall{v0, v1, v2, r0, r1})
  863. return r0, r1
  864. }
  865. // SetDefaultHook sets function that is called when the GetObjectsByOIDs
  866. // method of the parent MockLFSStore instance is invoked and the hook queue
  867. // is empty.
  868. func (f *LFSStoreGetObjectsByOIDsFunc) SetDefaultHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)) {
  869. f.defaultHook = hook
  870. }
  871. // PushHook adds a function to the end of hook queue. Each invocation of the
  872. // GetObjectsByOIDs method of the parent MockLFSStore instance invokes the
  873. // hook at the front of the queue and discards it. After the queue is empty,
  874. // the default hook function is invoked for any future action.
  875. func (f *LFSStoreGetObjectsByOIDsFunc) PushHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)) {
  876. f.mutex.Lock()
  877. f.hooks = append(f.hooks, hook)
  878. f.mutex.Unlock()
  879. }
  880. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  881. // given values.
  882. func (f *LFSStoreGetObjectsByOIDsFunc) SetDefaultReturn(r0 []*db.LFSObject, r1 error) {
  883. f.SetDefaultHook(func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  884. return r0, r1
  885. })
  886. }
  887. // PushReturn calls PushHook with a function that returns the given values.
  888. func (f *LFSStoreGetObjectsByOIDsFunc) PushReturn(r0 []*db.LFSObject, r1 error) {
  889. f.PushHook(func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  890. return r0, r1
  891. })
  892. }
  893. func (f *LFSStoreGetObjectsByOIDsFunc) nextHook() func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  894. f.mutex.Lock()
  895. defer f.mutex.Unlock()
  896. if len(f.hooks) == 0 {
  897. return f.defaultHook
  898. }
  899. hook := f.hooks[0]
  900. f.hooks = f.hooks[1:]
  901. return hook
  902. }
  903. func (f *LFSStoreGetObjectsByOIDsFunc) appendCall(r0 LFSStoreGetObjectsByOIDsFuncCall) {
  904. f.mutex.Lock()
  905. f.history = append(f.history, r0)
  906. f.mutex.Unlock()
  907. }
  908. // History returns a sequence of LFSStoreGetObjectsByOIDsFuncCall objects
  909. // describing the invocations of this function.
  910. func (f *LFSStoreGetObjectsByOIDsFunc) History() []LFSStoreGetObjectsByOIDsFuncCall {
  911. f.mutex.Lock()
  912. history := make([]LFSStoreGetObjectsByOIDsFuncCall, len(f.history))
  913. copy(history, f.history)
  914. f.mutex.Unlock()
  915. return history
  916. }
  917. // LFSStoreGetObjectsByOIDsFuncCall is an object that describes an
  918. // invocation of method GetObjectsByOIDs on an instance of MockLFSStore.
  919. type LFSStoreGetObjectsByOIDsFuncCall struct {
  920. // Arg0 is the value of the 1st argument passed to this method
  921. // invocation.
  922. Arg0 context.Context
  923. // Arg1 is the value of the 2nd argument passed to this method
  924. // invocation.
  925. Arg1 int64
  926. // Arg2 is a slice containing the values of the variadic arguments
  927. // passed to this method invocation.
  928. Arg2 []lfsutil.OID
  929. // Result0 is the value of the 1st result returned from this method
  930. // invocation.
  931. Result0 []*db.LFSObject
  932. // Result1 is the value of the 2nd result returned from this method
  933. // invocation.
  934. Result1 error
  935. }
  936. // Args returns an interface slice containing the arguments of this
  937. // invocation. The variadic slice argument is flattened in this array such
  938. // that one positional argument and three variadic arguments would result in
  939. // a slice of four, not two.
  940. func (c LFSStoreGetObjectsByOIDsFuncCall) Args() []interface{} {
  941. trailing := []interface{}{}
  942. for _, val := range c.Arg2 {
  943. trailing = append(trailing, val)
  944. }
  945. return append([]interface{}{c.Arg0, c.Arg1}, trailing...)
  946. }
  947. // Results returns an interface slice containing the results of this
  948. // invocation.
  949. func (c LFSStoreGetObjectsByOIDsFuncCall) Results() []interface{} {
  950. return []interface{}{c.Result0, c.Result1}
  951. }
  952. // MockPermsStore is a mock implementation of the PermsStore interface (from
  953. // the package gogs.io/gogs/internal/db) used for unit testing.
  954. type MockPermsStore struct {
  955. // AccessModeFunc is an instance of a mock function object controlling
  956. // the behavior of the method AccessMode.
  957. AccessModeFunc *PermsStoreAccessModeFunc
  958. // AuthorizeFunc is an instance of a mock function object controlling
  959. // the behavior of the method Authorize.
  960. AuthorizeFunc *PermsStoreAuthorizeFunc
  961. // SetRepoPermsFunc is an instance of a mock function object controlling
  962. // the behavior of the method SetRepoPerms.
  963. SetRepoPermsFunc *PermsStoreSetRepoPermsFunc
  964. }
  965. // NewMockPermsStore creates a new mock of the PermsStore interface. All
  966. // methods return zero values for all results, unless overwritten.
  967. func NewMockPermsStore() *MockPermsStore {
  968. return &MockPermsStore{
  969. AccessModeFunc: &PermsStoreAccessModeFunc{
  970. defaultHook: func(context.Context, int64, int64, db.AccessModeOptions) (r0 db.AccessMode) {
  971. return
  972. },
  973. },
  974. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  975. defaultHook: func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) (r0 bool) {
  976. return
  977. },
  978. },
  979. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  980. defaultHook: func(context.Context, int64, map[int64]db.AccessMode) (r0 error) {
  981. return
  982. },
  983. },
  984. }
  985. }
  986. // NewStrictMockPermsStore creates a new mock of the PermsStore interface.
  987. // All methods panic on invocation, unless overwritten.
  988. func NewStrictMockPermsStore() *MockPermsStore {
  989. return &MockPermsStore{
  990. AccessModeFunc: &PermsStoreAccessModeFunc{
  991. defaultHook: func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  992. panic("unexpected invocation of MockPermsStore.AccessMode")
  993. },
  994. },
  995. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  996. defaultHook: func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  997. panic("unexpected invocation of MockPermsStore.Authorize")
  998. },
  999. },
  1000. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1001. defaultHook: func(context.Context, int64, map[int64]db.AccessMode) error {
  1002. panic("unexpected invocation of MockPermsStore.SetRepoPerms")
  1003. },
  1004. },
  1005. }
  1006. }
  1007. // NewMockPermsStoreFrom creates a new mock of the MockPermsStore interface.
  1008. // All methods delegate to the given implementation, unless overwritten.
  1009. func NewMockPermsStoreFrom(i db.PermsStore) *MockPermsStore {
  1010. return &MockPermsStore{
  1011. AccessModeFunc: &PermsStoreAccessModeFunc{
  1012. defaultHook: i.AccessMode,
  1013. },
  1014. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  1015. defaultHook: i.Authorize,
  1016. },
  1017. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1018. defaultHook: i.SetRepoPerms,
  1019. },
  1020. }
  1021. }
  1022. // PermsStoreAccessModeFunc describes the behavior when the AccessMode
  1023. // method of the parent MockPermsStore instance is invoked.
  1024. type PermsStoreAccessModeFunc struct {
  1025. defaultHook func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode
  1026. hooks []func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode
  1027. history []PermsStoreAccessModeFuncCall
  1028. mutex sync.Mutex
  1029. }
  1030. // AccessMode delegates to the next hook function in the queue and stores
  1031. // the parameter and result values of this invocation.
  1032. func (m *MockPermsStore) AccessMode(v0 context.Context, v1 int64, v2 int64, v3 db.AccessModeOptions) db.AccessMode {
  1033. r0 := m.AccessModeFunc.nextHook()(v0, v1, v2, v3)
  1034. m.AccessModeFunc.appendCall(PermsStoreAccessModeFuncCall{v0, v1, v2, v3, r0})
  1035. return r0
  1036. }
  1037. // SetDefaultHook sets function that is called when the AccessMode method of
  1038. // the parent MockPermsStore instance is invoked and the hook queue is
  1039. // empty.
  1040. func (f *PermsStoreAccessModeFunc) SetDefaultHook(hook func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode) {
  1041. f.defaultHook = hook
  1042. }
  1043. // PushHook adds a function to the end of hook queue. Each invocation of the
  1044. // AccessMode method of the parent MockPermsStore instance invokes the hook
  1045. // at the front of the queue and discards it. After the queue is empty, the
  1046. // default hook function is invoked for any future action.
  1047. func (f *PermsStoreAccessModeFunc) PushHook(hook func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode) {
  1048. f.mutex.Lock()
  1049. f.hooks = append(f.hooks, hook)
  1050. f.mutex.Unlock()
  1051. }
  1052. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1053. // given values.
  1054. func (f *PermsStoreAccessModeFunc) SetDefaultReturn(r0 db.AccessMode) {
  1055. f.SetDefaultHook(func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  1056. return r0
  1057. })
  1058. }
  1059. // PushReturn calls PushHook with a function that returns the given values.
  1060. func (f *PermsStoreAccessModeFunc) PushReturn(r0 db.AccessMode) {
  1061. f.PushHook(func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  1062. return r0
  1063. })
  1064. }
  1065. func (f *PermsStoreAccessModeFunc) nextHook() func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  1066. f.mutex.Lock()
  1067. defer f.mutex.Unlock()
  1068. if len(f.hooks) == 0 {
  1069. return f.defaultHook
  1070. }
  1071. hook := f.hooks[0]
  1072. f.hooks = f.hooks[1:]
  1073. return hook
  1074. }
  1075. func (f *PermsStoreAccessModeFunc) appendCall(r0 PermsStoreAccessModeFuncCall) {
  1076. f.mutex.Lock()
  1077. f.history = append(f.history, r0)
  1078. f.mutex.Unlock()
  1079. }
  1080. // History returns a sequence of PermsStoreAccessModeFuncCall objects
  1081. // describing the invocations of this function.
  1082. func (f *PermsStoreAccessModeFunc) History() []PermsStoreAccessModeFuncCall {
  1083. f.mutex.Lock()
  1084. history := make([]PermsStoreAccessModeFuncCall, len(f.history))
  1085. copy(history, f.history)
  1086. f.mutex.Unlock()
  1087. return history
  1088. }
  1089. // PermsStoreAccessModeFuncCall is an object that describes an invocation of
  1090. // method AccessMode on an instance of MockPermsStore.
  1091. type PermsStoreAccessModeFuncCall struct {
  1092. // Arg0 is the value of the 1st argument passed to this method
  1093. // invocation.
  1094. Arg0 context.Context
  1095. // Arg1 is the value of the 2nd argument passed to this method
  1096. // invocation.
  1097. Arg1 int64
  1098. // Arg2 is the value of the 3rd argument passed to this method
  1099. // invocation.
  1100. Arg2 int64
  1101. // Arg3 is the value of the 4th argument passed to this method
  1102. // invocation.
  1103. Arg3 db.AccessModeOptions
  1104. // Result0 is the value of the 1st result returned from this method
  1105. // invocation.
  1106. Result0 db.AccessMode
  1107. }
  1108. // Args returns an interface slice containing the arguments of this
  1109. // invocation.
  1110. func (c PermsStoreAccessModeFuncCall) Args() []interface{} {
  1111. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1112. }
  1113. // Results returns an interface slice containing the results of this
  1114. // invocation.
  1115. func (c PermsStoreAccessModeFuncCall) Results() []interface{} {
  1116. return []interface{}{c.Result0}
  1117. }
  1118. // PermsStoreAuthorizeFunc describes the behavior when the Authorize method
  1119. // of the parent MockPermsStore instance is invoked.
  1120. type PermsStoreAuthorizeFunc struct {
  1121. defaultHook func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool
  1122. hooks []func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool
  1123. history []PermsStoreAuthorizeFuncCall
  1124. mutex sync.Mutex
  1125. }
  1126. // Authorize delegates to the next hook function in the queue and stores the
  1127. // parameter and result values of this invocation.
  1128. func (m *MockPermsStore) Authorize(v0 context.Context, v1 int64, v2 int64, v3 db.AccessMode, v4 db.AccessModeOptions) bool {
  1129. r0 := m.AuthorizeFunc.nextHook()(v0, v1, v2, v3, v4)
  1130. m.AuthorizeFunc.appendCall(PermsStoreAuthorizeFuncCall{v0, v1, v2, v3, v4, r0})
  1131. return r0
  1132. }
  1133. // SetDefaultHook sets function that is called when the Authorize method of
  1134. // the parent MockPermsStore instance is invoked and the hook queue is
  1135. // empty.
  1136. func (f *PermsStoreAuthorizeFunc) SetDefaultHook(hook func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool) {
  1137. f.defaultHook = hook
  1138. }
  1139. // PushHook adds a function to the end of hook queue. Each invocation of the
  1140. // Authorize method of the parent MockPermsStore instance invokes the hook
  1141. // at the front of the queue and discards it. After the queue is empty, the
  1142. // default hook function is invoked for any future action.
  1143. func (f *PermsStoreAuthorizeFunc) PushHook(hook func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool) {
  1144. f.mutex.Lock()
  1145. f.hooks = append(f.hooks, hook)
  1146. f.mutex.Unlock()
  1147. }
  1148. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1149. // given values.
  1150. func (f *PermsStoreAuthorizeFunc) SetDefaultReturn(r0 bool) {
  1151. f.SetDefaultHook(func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  1152. return r0
  1153. })
  1154. }
  1155. // PushReturn calls PushHook with a function that returns the given values.
  1156. func (f *PermsStoreAuthorizeFunc) PushReturn(r0 bool) {
  1157. f.PushHook(func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  1158. return r0
  1159. })
  1160. }
  1161. func (f *PermsStoreAuthorizeFunc) nextHook() func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  1162. f.mutex.Lock()
  1163. defer f.mutex.Unlock()
  1164. if len(f.hooks) == 0 {
  1165. return f.defaultHook
  1166. }
  1167. hook := f.hooks[0]
  1168. f.hooks = f.hooks[1:]
  1169. return hook
  1170. }
  1171. func (f *PermsStoreAuthorizeFunc) appendCall(r0 PermsStoreAuthorizeFuncCall) {
  1172. f.mutex.Lock()
  1173. f.history = append(f.history, r0)
  1174. f.mutex.Unlock()
  1175. }
  1176. // History returns a sequence of PermsStoreAuthorizeFuncCall objects
  1177. // describing the invocations of this function.
  1178. func (f *PermsStoreAuthorizeFunc) History() []PermsStoreAuthorizeFuncCall {
  1179. f.mutex.Lock()
  1180. history := make([]PermsStoreAuthorizeFuncCall, len(f.history))
  1181. copy(history, f.history)
  1182. f.mutex.Unlock()
  1183. return history
  1184. }
  1185. // PermsStoreAuthorizeFuncCall is an object that describes an invocation of
  1186. // method Authorize on an instance of MockPermsStore.
  1187. type PermsStoreAuthorizeFuncCall struct {
  1188. // Arg0 is the value of the 1st argument passed to this method
  1189. // invocation.
  1190. Arg0 context.Context
  1191. // Arg1 is the value of the 2nd argument passed to this method
  1192. // invocation.
  1193. Arg1 int64
  1194. // Arg2 is the value of the 3rd argument passed to this method
  1195. // invocation.
  1196. Arg2 int64
  1197. // Arg3 is the value of the 4th argument passed to this method
  1198. // invocation.
  1199. Arg3 db.AccessMode
  1200. // Arg4 is the value of the 5th argument passed to this method
  1201. // invocation.
  1202. Arg4 db.AccessModeOptions
  1203. // Result0 is the value of the 1st result returned from this method
  1204. // invocation.
  1205. Result0 bool
  1206. }
  1207. // Args returns an interface slice containing the arguments of this
  1208. // invocation.
  1209. func (c PermsStoreAuthorizeFuncCall) Args() []interface{} {
  1210. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  1211. }
  1212. // Results returns an interface slice containing the results of this
  1213. // invocation.
  1214. func (c PermsStoreAuthorizeFuncCall) Results() []interface{} {
  1215. return []interface{}{c.Result0}
  1216. }
  1217. // PermsStoreSetRepoPermsFunc describes the behavior when the SetRepoPerms
  1218. // method of the parent MockPermsStore instance is invoked.
  1219. type PermsStoreSetRepoPermsFunc struct {
  1220. defaultHook func(context.Context, int64, map[int64]db.AccessMode) error
  1221. hooks []func(context.Context, int64, map[int64]db.AccessMode) error
  1222. history []PermsStoreSetRepoPermsFuncCall
  1223. mutex sync.Mutex
  1224. }
  1225. // SetRepoPerms delegates to the next hook function in the queue and stores
  1226. // the parameter and result values of this invocation.
  1227. func (m *MockPermsStore) SetRepoPerms(v0 context.Context, v1 int64, v2 map[int64]db.AccessMode) error {
  1228. r0 := m.SetRepoPermsFunc.nextHook()(v0, v1, v2)
  1229. m.SetRepoPermsFunc.appendCall(PermsStoreSetRepoPermsFuncCall{v0, v1, v2, r0})
  1230. return r0
  1231. }
  1232. // SetDefaultHook sets function that is called when the SetRepoPerms method
  1233. // of the parent MockPermsStore instance is invoked and the hook queue is
  1234. // empty.
  1235. func (f *PermsStoreSetRepoPermsFunc) SetDefaultHook(hook func(context.Context, int64, map[int64]db.AccessMode) error) {
  1236. f.defaultHook = hook
  1237. }
  1238. // PushHook adds a function to the end of hook queue. Each invocation of the
  1239. // SetRepoPerms method of the parent MockPermsStore instance invokes the
  1240. // hook at the front of the queue and discards it. After the queue is empty,
  1241. // the default hook function is invoked for any future action.
  1242. func (f *PermsStoreSetRepoPermsFunc) PushHook(hook func(context.Context, int64, map[int64]db.AccessMode) error) {
  1243. f.mutex.Lock()
  1244. f.hooks = append(f.hooks, hook)
  1245. f.mutex.Unlock()
  1246. }
  1247. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1248. // given values.
  1249. func (f *PermsStoreSetRepoPermsFunc) SetDefaultReturn(r0 error) {
  1250. f.SetDefaultHook(func(context.Context, int64, map[int64]db.AccessMode) error {
  1251. return r0
  1252. })
  1253. }
  1254. // PushReturn calls PushHook with a function that returns the given values.
  1255. func (f *PermsStoreSetRepoPermsFunc) PushReturn(r0 error) {
  1256. f.PushHook(func(context.Context, int64, map[int64]db.AccessMode) error {
  1257. return r0
  1258. })
  1259. }
  1260. func (f *PermsStoreSetRepoPermsFunc) nextHook() func(context.Context, int64, map[int64]db.AccessMode) error {
  1261. f.mutex.Lock()
  1262. defer f.mutex.Unlock()
  1263. if len(f.hooks) == 0 {
  1264. return f.defaultHook
  1265. }
  1266. hook := f.hooks[0]
  1267. f.hooks = f.hooks[1:]
  1268. return hook
  1269. }
  1270. func (f *PermsStoreSetRepoPermsFunc) appendCall(r0 PermsStoreSetRepoPermsFuncCall) {
  1271. f.mutex.Lock()
  1272. f.history = append(f.history, r0)
  1273. f.mutex.Unlock()
  1274. }
  1275. // History returns a sequence of PermsStoreSetRepoPermsFuncCall objects
  1276. // describing the invocations of this function.
  1277. func (f *PermsStoreSetRepoPermsFunc) History() []PermsStoreSetRepoPermsFuncCall {
  1278. f.mutex.Lock()
  1279. history := make([]PermsStoreSetRepoPermsFuncCall, len(f.history))
  1280. copy(history, f.history)
  1281. f.mutex.Unlock()
  1282. return history
  1283. }
  1284. // PermsStoreSetRepoPermsFuncCall is an object that describes an invocation
  1285. // of method SetRepoPerms on an instance of MockPermsStore.
  1286. type PermsStoreSetRepoPermsFuncCall struct {
  1287. // Arg0 is the value of the 1st argument passed to this method
  1288. // invocation.
  1289. Arg0 context.Context
  1290. // Arg1 is the value of the 2nd argument passed to this method
  1291. // invocation.
  1292. Arg1 int64
  1293. // Arg2 is the value of the 3rd argument passed to this method
  1294. // invocation.
  1295. Arg2 map[int64]db.AccessMode
  1296. // Result0 is the value of the 1st result returned from this method
  1297. // invocation.
  1298. Result0 error
  1299. }
  1300. // Args returns an interface slice containing the arguments of this
  1301. // invocation.
  1302. func (c PermsStoreSetRepoPermsFuncCall) Args() []interface{} {
  1303. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1304. }
  1305. // Results returns an interface slice containing the results of this
  1306. // invocation.
  1307. func (c PermsStoreSetRepoPermsFuncCall) Results() []interface{} {
  1308. return []interface{}{c.Result0}
  1309. }
  1310. // MockReposStore is a mock implementation of the ReposStore interface (from
  1311. // the package gogs.io/gogs/internal/db) used for unit testing.
  1312. type MockReposStore struct {
  1313. // CreateFunc is an instance of a mock function object controlling the
  1314. // behavior of the method Create.
  1315. CreateFunc *ReposStoreCreateFunc
  1316. // GetByCollaboratorIDFunc is an instance of a mock function object
  1317. // controlling the behavior of the method GetByCollaboratorID.
  1318. GetByCollaboratorIDFunc *ReposStoreGetByCollaboratorIDFunc
  1319. // GetByCollaboratorIDWithAccessModeFunc is an instance of a mock
  1320. // function object controlling the behavior of the method
  1321. // GetByCollaboratorIDWithAccessMode.
  1322. GetByCollaboratorIDWithAccessModeFunc *ReposStoreGetByCollaboratorIDWithAccessModeFunc
  1323. // GetByIDFunc is an instance of a mock function object controlling the
  1324. // behavior of the method GetByID.
  1325. GetByIDFunc *ReposStoreGetByIDFunc
  1326. // GetByNameFunc is an instance of a mock function object controlling
  1327. // the behavior of the method GetByName.
  1328. GetByNameFunc *ReposStoreGetByNameFunc
  1329. // HasForkedByFunc is an instance of a mock function object controlling
  1330. // the behavior of the method HasForkedBy.
  1331. HasForkedByFunc *ReposStoreHasForkedByFunc
  1332. // ListWatchesFunc is an instance of a mock function object controlling
  1333. // the behavior of the method ListWatches.
  1334. ListWatchesFunc *ReposStoreListWatchesFunc
  1335. // StarFunc is an instance of a mock function object controlling the
  1336. // behavior of the method Star.
  1337. StarFunc *ReposStoreStarFunc
  1338. // TouchFunc is an instance of a mock function object controlling the
  1339. // behavior of the method Touch.
  1340. TouchFunc *ReposStoreTouchFunc
  1341. // WatchFunc is an instance of a mock function object controlling the
  1342. // behavior of the method Watch.
  1343. WatchFunc *ReposStoreWatchFunc
  1344. }
  1345. // NewMockReposStore creates a new mock of the ReposStore interface. All
  1346. // methods return zero values for all results, unless overwritten.
  1347. func NewMockReposStore() *MockReposStore {
  1348. return &MockReposStore{
  1349. CreateFunc: &ReposStoreCreateFunc{
  1350. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (r0 *db.Repository, r1 error) {
  1351. return
  1352. },
  1353. },
  1354. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1355. defaultHook: func(context.Context, int64, int, string) (r0 []*db.Repository, r1 error) {
  1356. return
  1357. },
  1358. },
  1359. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1360. defaultHook: func(context.Context, int64) (r0 map[*db.Repository]db.AccessMode, r1 error) {
  1361. return
  1362. },
  1363. },
  1364. GetByIDFunc: &ReposStoreGetByIDFunc{
  1365. defaultHook: func(context.Context, int64) (r0 *db.Repository, r1 error) {
  1366. return
  1367. },
  1368. },
  1369. GetByNameFunc: &ReposStoreGetByNameFunc{
  1370. defaultHook: func(context.Context, int64, string) (r0 *db.Repository, r1 error) {
  1371. return
  1372. },
  1373. },
  1374. HasForkedByFunc: &ReposStoreHasForkedByFunc{
  1375. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  1376. return
  1377. },
  1378. },
  1379. ListWatchesFunc: &ReposStoreListWatchesFunc{
  1380. defaultHook: func(context.Context, int64) (r0 []*db.Watch, r1 error) {
  1381. return
  1382. },
  1383. },
  1384. StarFunc: &ReposStoreStarFunc{
  1385. defaultHook: func(context.Context, int64, int64) (r0 error) {
  1386. return
  1387. },
  1388. },
  1389. TouchFunc: &ReposStoreTouchFunc{
  1390. defaultHook: func(context.Context, int64) (r0 error) {
  1391. return
  1392. },
  1393. },
  1394. WatchFunc: &ReposStoreWatchFunc{
  1395. defaultHook: func(context.Context, int64, int64) (r0 error) {
  1396. return
  1397. },
  1398. },
  1399. }
  1400. }
  1401. // NewStrictMockReposStore creates a new mock of the ReposStore interface.
  1402. // All methods panic on invocation, unless overwritten.
  1403. func NewStrictMockReposStore() *MockReposStore {
  1404. return &MockReposStore{
  1405. CreateFunc: &ReposStoreCreateFunc{
  1406. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1407. panic("unexpected invocation of MockReposStore.Create")
  1408. },
  1409. },
  1410. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1411. defaultHook: func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1412. panic("unexpected invocation of MockReposStore.GetByCollaboratorID")
  1413. },
  1414. },
  1415. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1416. defaultHook: func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1417. panic("unexpected invocation of MockReposStore.GetByCollaboratorIDWithAccessMode")
  1418. },
  1419. },
  1420. GetByIDFunc: &ReposStoreGetByIDFunc{
  1421. defaultHook: func(context.Context, int64) (*db.Repository, error) {
  1422. panic("unexpected invocation of MockReposStore.GetByID")
  1423. },
  1424. },
  1425. GetByNameFunc: &ReposStoreGetByNameFunc{
  1426. defaultHook: func(context.Context, int64, string) (*db.Repository, error) {
  1427. panic("unexpected invocation of MockReposStore.GetByName")
  1428. },
  1429. },
  1430. HasForkedByFunc: &ReposStoreHasForkedByFunc{
  1431. defaultHook: func(context.Context, int64, int64) bool {
  1432. panic("unexpected invocation of MockReposStore.HasForkedBy")
  1433. },
  1434. },
  1435. ListWatchesFunc: &ReposStoreListWatchesFunc{
  1436. defaultHook: func(context.Context, int64) ([]*db.Watch, error) {
  1437. panic("unexpected invocation of MockReposStore.ListWatches")
  1438. },
  1439. },
  1440. StarFunc: &ReposStoreStarFunc{
  1441. defaultHook: func(context.Context, int64, int64) error {
  1442. panic("unexpected invocation of MockReposStore.Star")
  1443. },
  1444. },
  1445. TouchFunc: &ReposStoreTouchFunc{
  1446. defaultHook: func(context.Context, int64) error {
  1447. panic("unexpected invocation of MockReposStore.Touch")
  1448. },
  1449. },
  1450. WatchFunc: &ReposStoreWatchFunc{
  1451. defaultHook: func(context.Context, int64, int64) error {
  1452. panic("unexpected invocation of MockReposStore.Watch")
  1453. },
  1454. },
  1455. }
  1456. }
  1457. // NewMockReposStoreFrom creates a new mock of the MockReposStore interface.
  1458. // All methods delegate to the given implementation, unless overwritten.
  1459. func NewMockReposStoreFrom(i db.ReposStore) *MockReposStore {
  1460. return &MockReposStore{
  1461. CreateFunc: &ReposStoreCreateFunc{
  1462. defaultHook: i.Create,
  1463. },
  1464. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1465. defaultHook: i.GetByCollaboratorID,
  1466. },
  1467. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1468. defaultHook: i.GetByCollaboratorIDWithAccessMode,
  1469. },
  1470. GetByIDFunc: &ReposStoreGetByIDFunc{
  1471. defaultHook: i.GetByID,
  1472. },
  1473. GetByNameFunc: &ReposStoreGetByNameFunc{
  1474. defaultHook: i.GetByName,
  1475. },
  1476. HasForkedByFunc: &ReposStoreHasForkedByFunc{
  1477. defaultHook: i.HasForkedBy,
  1478. },
  1479. ListWatchesFunc: &ReposStoreListWatchesFunc{
  1480. defaultHook: i.ListWatches,
  1481. },
  1482. StarFunc: &ReposStoreStarFunc{
  1483. defaultHook: i.Star,
  1484. },
  1485. TouchFunc: &ReposStoreTouchFunc{
  1486. defaultHook: i.Touch,
  1487. },
  1488. WatchFunc: &ReposStoreWatchFunc{
  1489. defaultHook: i.Watch,
  1490. },
  1491. }
  1492. }
  1493. // ReposStoreCreateFunc describes the behavior when the Create method of the
  1494. // parent MockReposStore instance is invoked.
  1495. type ReposStoreCreateFunc struct {
  1496. defaultHook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1497. hooks []func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1498. history []ReposStoreCreateFuncCall
  1499. mutex sync.Mutex
  1500. }
  1501. // Create delegates to the next hook function in the queue and stores the
  1502. // parameter and result values of this invocation.
  1503. func (m *MockReposStore) Create(v0 context.Context, v1 int64, v2 db.CreateRepoOptions) (*db.Repository, error) {
  1504. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  1505. m.CreateFunc.appendCall(ReposStoreCreateFuncCall{v0, v1, v2, r0, r1})
  1506. return r0, r1
  1507. }
  1508. // SetDefaultHook sets function that is called when the Create method of the
  1509. // parent MockReposStore instance is invoked and the hook queue is empty.
  1510. func (f *ReposStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1511. f.defaultHook = hook
  1512. }
  1513. // PushHook adds a function to the end of hook queue. Each invocation of the
  1514. // Create method of the parent MockReposStore instance invokes the hook at
  1515. // 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 *ReposStoreCreateFunc) PushHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, 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 *ReposStoreCreateFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1525. f.SetDefaultHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1526. return r0, r1
  1527. })
  1528. }
  1529. // PushReturn calls PushHook with a function that returns the given values.
  1530. func (f *ReposStoreCreateFunc) PushReturn(r0 *db.Repository, r1 error) {
  1531. f.PushHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1532. return r0, r1
  1533. })
  1534. }
  1535. func (f *ReposStoreCreateFunc) nextHook() func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, 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 *ReposStoreCreateFunc) appendCall(r0 ReposStoreCreateFuncCall) {
  1546. f.mutex.Lock()
  1547. f.history = append(f.history, r0)
  1548. f.mutex.Unlock()
  1549. }
  1550. // History returns a sequence of ReposStoreCreateFuncCall objects describing
  1551. // the invocations of this function.
  1552. func (f *ReposStoreCreateFunc) History() []ReposStoreCreateFuncCall {
  1553. f.mutex.Lock()
  1554. history := make([]ReposStoreCreateFuncCall, len(f.history))
  1555. copy(history, f.history)
  1556. f.mutex.Unlock()
  1557. return history
  1558. }
  1559. // ReposStoreCreateFuncCall is an object that describes an invocation of
  1560. // method Create on an instance of MockReposStore.
  1561. type ReposStoreCreateFuncCall 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 db.CreateRepoOptions
  1571. // Result0 is the value of the 1st result returned from this method
  1572. // invocation.
  1573. Result0 *db.Repository
  1574. // Result1 is the value of the 2nd result returned from this method
  1575. // invocation.
  1576. Result1 error
  1577. }
  1578. // Args returns an interface slice containing the arguments of this
  1579. // invocation.
  1580. func (c ReposStoreCreateFuncCall) Args() []interface{} {
  1581. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1582. }
  1583. // Results returns an interface slice containing the results of this
  1584. // invocation.
  1585. func (c ReposStoreCreateFuncCall) Results() []interface{} {
  1586. return []interface{}{c.Result0, c.Result1}
  1587. }
  1588. // ReposStoreGetByCollaboratorIDFunc describes the behavior when the
  1589. // GetByCollaboratorID method of the parent MockReposStore instance is
  1590. // invoked.
  1591. type ReposStoreGetByCollaboratorIDFunc struct {
  1592. defaultHook func(context.Context, int64, int, string) ([]*db.Repository, error)
  1593. hooks []func(context.Context, int64, int, string) ([]*db.Repository, error)
  1594. history []ReposStoreGetByCollaboratorIDFuncCall
  1595. mutex sync.Mutex
  1596. }
  1597. // GetByCollaboratorID delegates to the next hook function in the queue and
  1598. // stores the parameter and result values of this invocation.
  1599. func (m *MockReposStore) GetByCollaboratorID(v0 context.Context, v1 int64, v2 int, v3 string) ([]*db.Repository, error) {
  1600. r0, r1 := m.GetByCollaboratorIDFunc.nextHook()(v0, v1, v2, v3)
  1601. m.GetByCollaboratorIDFunc.appendCall(ReposStoreGetByCollaboratorIDFuncCall{v0, v1, v2, v3, r0, r1})
  1602. return r0, r1
  1603. }
  1604. // SetDefaultHook sets function that is called when the GetByCollaboratorID
  1605. // method of the parent MockReposStore instance is invoked and the hook
  1606. // queue is empty.
  1607. func (f *ReposStoreGetByCollaboratorIDFunc) SetDefaultHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1608. f.defaultHook = hook
  1609. }
  1610. // PushHook adds a function to the end of hook queue. Each invocation of the
  1611. // GetByCollaboratorID method of the parent MockReposStore instance invokes
  1612. // the hook at the front of the queue and discards it. After the queue is
  1613. // empty, the default hook function is invoked for any future action.
  1614. func (f *ReposStoreGetByCollaboratorIDFunc) PushHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1615. f.mutex.Lock()
  1616. f.hooks = append(f.hooks, hook)
  1617. f.mutex.Unlock()
  1618. }
  1619. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1620. // given values.
  1621. func (f *ReposStoreGetByCollaboratorIDFunc) SetDefaultReturn(r0 []*db.Repository, r1 error) {
  1622. f.SetDefaultHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1623. return r0, r1
  1624. })
  1625. }
  1626. // PushReturn calls PushHook with a function that returns the given values.
  1627. func (f *ReposStoreGetByCollaboratorIDFunc) PushReturn(r0 []*db.Repository, r1 error) {
  1628. f.PushHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1629. return r0, r1
  1630. })
  1631. }
  1632. func (f *ReposStoreGetByCollaboratorIDFunc) nextHook() func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1633. f.mutex.Lock()
  1634. defer f.mutex.Unlock()
  1635. if len(f.hooks) == 0 {
  1636. return f.defaultHook
  1637. }
  1638. hook := f.hooks[0]
  1639. f.hooks = f.hooks[1:]
  1640. return hook
  1641. }
  1642. func (f *ReposStoreGetByCollaboratorIDFunc) appendCall(r0 ReposStoreGetByCollaboratorIDFuncCall) {
  1643. f.mutex.Lock()
  1644. f.history = append(f.history, r0)
  1645. f.mutex.Unlock()
  1646. }
  1647. // History returns a sequence of ReposStoreGetByCollaboratorIDFuncCall
  1648. // objects describing the invocations of this function.
  1649. func (f *ReposStoreGetByCollaboratorIDFunc) History() []ReposStoreGetByCollaboratorIDFuncCall {
  1650. f.mutex.Lock()
  1651. history := make([]ReposStoreGetByCollaboratorIDFuncCall, len(f.history))
  1652. copy(history, f.history)
  1653. f.mutex.Unlock()
  1654. return history
  1655. }
  1656. // ReposStoreGetByCollaboratorIDFuncCall is an object that describes an
  1657. // invocation of method GetByCollaboratorID on an instance of
  1658. // MockReposStore.
  1659. type ReposStoreGetByCollaboratorIDFuncCall struct {
  1660. // Arg0 is the value of the 1st argument passed to this method
  1661. // invocation.
  1662. Arg0 context.Context
  1663. // Arg1 is the value of the 2nd argument passed to this method
  1664. // invocation.
  1665. Arg1 int64
  1666. // Arg2 is the value of the 3rd argument passed to this method
  1667. // invocation.
  1668. Arg2 int
  1669. // Arg3 is the value of the 4th argument passed to this method
  1670. // invocation.
  1671. Arg3 string
  1672. // Result0 is the value of the 1st result returned from this method
  1673. // invocation.
  1674. Result0 []*db.Repository
  1675. // Result1 is the value of the 2nd result returned from this method
  1676. // invocation.
  1677. Result1 error
  1678. }
  1679. // Args returns an interface slice containing the arguments of this
  1680. // invocation.
  1681. func (c ReposStoreGetByCollaboratorIDFuncCall) Args() []interface{} {
  1682. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1683. }
  1684. // Results returns an interface slice containing the results of this
  1685. // invocation.
  1686. func (c ReposStoreGetByCollaboratorIDFuncCall) Results() []interface{} {
  1687. return []interface{}{c.Result0, c.Result1}
  1688. }
  1689. // ReposStoreGetByCollaboratorIDWithAccessModeFunc describes the behavior
  1690. // when the GetByCollaboratorIDWithAccessMode method of the parent
  1691. // MockReposStore instance is invoked.
  1692. type ReposStoreGetByCollaboratorIDWithAccessModeFunc struct {
  1693. defaultHook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1694. hooks []func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1695. history []ReposStoreGetByCollaboratorIDWithAccessModeFuncCall
  1696. mutex sync.Mutex
  1697. }
  1698. // GetByCollaboratorIDWithAccessMode delegates to the next hook function in
  1699. // the queue and stores the parameter and result values of this invocation.
  1700. func (m *MockReposStore) GetByCollaboratorIDWithAccessMode(v0 context.Context, v1 int64) (map[*db.Repository]db.AccessMode, error) {
  1701. r0, r1 := m.GetByCollaboratorIDWithAccessModeFunc.nextHook()(v0, v1)
  1702. m.GetByCollaboratorIDWithAccessModeFunc.appendCall(ReposStoreGetByCollaboratorIDWithAccessModeFuncCall{v0, v1, r0, r1})
  1703. return r0, r1
  1704. }
  1705. // SetDefaultHook sets function that is called when the
  1706. // GetByCollaboratorIDWithAccessMode method of the parent MockReposStore
  1707. // instance is invoked and the hook queue is empty.
  1708. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1709. f.defaultHook = hook
  1710. }
  1711. // PushHook adds a function to the end of hook queue. Each invocation of the
  1712. // GetByCollaboratorIDWithAccessMode method of the parent MockReposStore
  1713. // instance invokes the hook at the front of the queue and discards it.
  1714. // After the queue is empty, the default hook function is invoked for any
  1715. // future action.
  1716. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) PushHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1717. f.mutex.Lock()
  1718. f.hooks = append(f.hooks, hook)
  1719. f.mutex.Unlock()
  1720. }
  1721. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1722. // given values.
  1723. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1724. f.SetDefaultHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1725. return r0, r1
  1726. })
  1727. }
  1728. // PushReturn calls PushHook with a function that returns the given values.
  1729. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) PushReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1730. f.PushHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1731. return r0, r1
  1732. })
  1733. }
  1734. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) nextHook() func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1735. f.mutex.Lock()
  1736. defer f.mutex.Unlock()
  1737. if len(f.hooks) == 0 {
  1738. return f.defaultHook
  1739. }
  1740. hook := f.hooks[0]
  1741. f.hooks = f.hooks[1:]
  1742. return hook
  1743. }
  1744. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) appendCall(r0 ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) {
  1745. f.mutex.Lock()
  1746. f.history = append(f.history, r0)
  1747. f.mutex.Unlock()
  1748. }
  1749. // History returns a sequence of
  1750. // ReposStoreGetByCollaboratorIDWithAccessModeFuncCall objects describing
  1751. // the invocations of this function.
  1752. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) History() []ReposStoreGetByCollaboratorIDWithAccessModeFuncCall {
  1753. f.mutex.Lock()
  1754. history := make([]ReposStoreGetByCollaboratorIDWithAccessModeFuncCall, len(f.history))
  1755. copy(history, f.history)
  1756. f.mutex.Unlock()
  1757. return history
  1758. }
  1759. // ReposStoreGetByCollaboratorIDWithAccessModeFuncCall is an object that
  1760. // describes an invocation of method GetByCollaboratorIDWithAccessMode on an
  1761. // instance of MockReposStore.
  1762. type ReposStoreGetByCollaboratorIDWithAccessModeFuncCall struct {
  1763. // Arg0 is the value of the 1st argument passed to this method
  1764. // invocation.
  1765. Arg0 context.Context
  1766. // Arg1 is the value of the 2nd argument passed to this method
  1767. // invocation.
  1768. Arg1 int64
  1769. // Result0 is the value of the 1st result returned from this method
  1770. // invocation.
  1771. Result0 map[*db.Repository]db.AccessMode
  1772. // Result1 is the value of the 2nd result returned from this method
  1773. // invocation.
  1774. Result1 error
  1775. }
  1776. // Args returns an interface slice containing the arguments of this
  1777. // invocation.
  1778. func (c ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) Args() []interface{} {
  1779. return []interface{}{c.Arg0, c.Arg1}
  1780. }
  1781. // Results returns an interface slice containing the results of this
  1782. // invocation.
  1783. func (c ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) Results() []interface{} {
  1784. return []interface{}{c.Result0, c.Result1}
  1785. }
  1786. // ReposStoreGetByIDFunc describes the behavior when the GetByID method of
  1787. // the parent MockReposStore instance is invoked.
  1788. type ReposStoreGetByIDFunc struct {
  1789. defaultHook func(context.Context, int64) (*db.Repository, error)
  1790. hooks []func(context.Context, int64) (*db.Repository, error)
  1791. history []ReposStoreGetByIDFuncCall
  1792. mutex sync.Mutex
  1793. }
  1794. // GetByID delegates to the next hook function in the queue and stores the
  1795. // parameter and result values of this invocation.
  1796. func (m *MockReposStore) GetByID(v0 context.Context, v1 int64) (*db.Repository, error) {
  1797. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  1798. m.GetByIDFunc.appendCall(ReposStoreGetByIDFuncCall{v0, v1, r0, r1})
  1799. return r0, r1
  1800. }
  1801. // SetDefaultHook sets function that is called when the GetByID method of
  1802. // the parent MockReposStore instance is invoked and the hook queue is
  1803. // empty.
  1804. func (f *ReposStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.Repository, error)) {
  1805. f.defaultHook = hook
  1806. }
  1807. // PushHook adds a function to the end of hook queue. Each invocation of the
  1808. // GetByID method of the parent MockReposStore instance invokes the hook at
  1809. // the front of the queue and discards it. After the queue is empty, the
  1810. // default hook function is invoked for any future action.
  1811. func (f *ReposStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.Repository, error)) {
  1812. f.mutex.Lock()
  1813. f.hooks = append(f.hooks, hook)
  1814. f.mutex.Unlock()
  1815. }
  1816. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1817. // given values.
  1818. func (f *ReposStoreGetByIDFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1819. f.SetDefaultHook(func(context.Context, int64) (*db.Repository, error) {
  1820. return r0, r1
  1821. })
  1822. }
  1823. // PushReturn calls PushHook with a function that returns the given values.
  1824. func (f *ReposStoreGetByIDFunc) PushReturn(r0 *db.Repository, r1 error) {
  1825. f.PushHook(func(context.Context, int64) (*db.Repository, error) {
  1826. return r0, r1
  1827. })
  1828. }
  1829. func (f *ReposStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.Repository, error) {
  1830. f.mutex.Lock()
  1831. defer f.mutex.Unlock()
  1832. if len(f.hooks) == 0 {
  1833. return f.defaultHook
  1834. }
  1835. hook := f.hooks[0]
  1836. f.hooks = f.hooks[1:]
  1837. return hook
  1838. }
  1839. func (f *ReposStoreGetByIDFunc) appendCall(r0 ReposStoreGetByIDFuncCall) {
  1840. f.mutex.Lock()
  1841. f.history = append(f.history, r0)
  1842. f.mutex.Unlock()
  1843. }
  1844. // History returns a sequence of ReposStoreGetByIDFuncCall objects
  1845. // describing the invocations of this function.
  1846. func (f *ReposStoreGetByIDFunc) History() []ReposStoreGetByIDFuncCall {
  1847. f.mutex.Lock()
  1848. history := make([]ReposStoreGetByIDFuncCall, len(f.history))
  1849. copy(history, f.history)
  1850. f.mutex.Unlock()
  1851. return history
  1852. }
  1853. // ReposStoreGetByIDFuncCall is an object that describes an invocation of
  1854. // method GetByID on an instance of MockReposStore.
  1855. type ReposStoreGetByIDFuncCall struct {
  1856. // Arg0 is the value of the 1st argument passed to this method
  1857. // invocation.
  1858. Arg0 context.Context
  1859. // Arg1 is the value of the 2nd argument passed to this method
  1860. // invocation.
  1861. Arg1 int64
  1862. // Result0 is the value of the 1st result returned from this method
  1863. // invocation.
  1864. Result0 *db.Repository
  1865. // Result1 is the value of the 2nd result returned from this method
  1866. // invocation.
  1867. Result1 error
  1868. }
  1869. // Args returns an interface slice containing the arguments of this
  1870. // invocation.
  1871. func (c ReposStoreGetByIDFuncCall) Args() []interface{} {
  1872. return []interface{}{c.Arg0, c.Arg1}
  1873. }
  1874. // Results returns an interface slice containing the results of this
  1875. // invocation.
  1876. func (c ReposStoreGetByIDFuncCall) Results() []interface{} {
  1877. return []interface{}{c.Result0, c.Result1}
  1878. }
  1879. // ReposStoreGetByNameFunc describes the behavior when the GetByName method
  1880. // of the parent MockReposStore instance is invoked.
  1881. type ReposStoreGetByNameFunc struct {
  1882. defaultHook func(context.Context, int64, string) (*db.Repository, error)
  1883. hooks []func(context.Context, int64, string) (*db.Repository, error)
  1884. history []ReposStoreGetByNameFuncCall
  1885. mutex sync.Mutex
  1886. }
  1887. // GetByName delegates to the next hook function in the queue and stores the
  1888. // parameter and result values of this invocation.
  1889. func (m *MockReposStore) GetByName(v0 context.Context, v1 int64, v2 string) (*db.Repository, error) {
  1890. r0, r1 := m.GetByNameFunc.nextHook()(v0, v1, v2)
  1891. m.GetByNameFunc.appendCall(ReposStoreGetByNameFuncCall{v0, v1, v2, r0, r1})
  1892. return r0, r1
  1893. }
  1894. // SetDefaultHook sets function that is called when the GetByName method of
  1895. // the parent MockReposStore instance is invoked and the hook queue is
  1896. // empty.
  1897. func (f *ReposStoreGetByNameFunc) SetDefaultHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1898. f.defaultHook = hook
  1899. }
  1900. // PushHook adds a function to the end of hook queue. Each invocation of the
  1901. // GetByName method of the parent MockReposStore instance invokes the hook
  1902. // at the front of the queue and discards it. After the queue is empty, the
  1903. // default hook function is invoked for any future action.
  1904. func (f *ReposStoreGetByNameFunc) PushHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1905. f.mutex.Lock()
  1906. f.hooks = append(f.hooks, hook)
  1907. f.mutex.Unlock()
  1908. }
  1909. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1910. // given values.
  1911. func (f *ReposStoreGetByNameFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1912. f.SetDefaultHook(func(context.Context, int64, string) (*db.Repository, error) {
  1913. return r0, r1
  1914. })
  1915. }
  1916. // PushReturn calls PushHook with a function that returns the given values.
  1917. func (f *ReposStoreGetByNameFunc) PushReturn(r0 *db.Repository, r1 error) {
  1918. f.PushHook(func(context.Context, int64, string) (*db.Repository, error) {
  1919. return r0, r1
  1920. })
  1921. }
  1922. func (f *ReposStoreGetByNameFunc) nextHook() func(context.Context, int64, string) (*db.Repository, error) {
  1923. f.mutex.Lock()
  1924. defer f.mutex.Unlock()
  1925. if len(f.hooks) == 0 {
  1926. return f.defaultHook
  1927. }
  1928. hook := f.hooks[0]
  1929. f.hooks = f.hooks[1:]
  1930. return hook
  1931. }
  1932. func (f *ReposStoreGetByNameFunc) appendCall(r0 ReposStoreGetByNameFuncCall) {
  1933. f.mutex.Lock()
  1934. f.history = append(f.history, r0)
  1935. f.mutex.Unlock()
  1936. }
  1937. // History returns a sequence of ReposStoreGetByNameFuncCall objects
  1938. // describing the invocations of this function.
  1939. func (f *ReposStoreGetByNameFunc) History() []ReposStoreGetByNameFuncCall {
  1940. f.mutex.Lock()
  1941. history := make([]ReposStoreGetByNameFuncCall, len(f.history))
  1942. copy(history, f.history)
  1943. f.mutex.Unlock()
  1944. return history
  1945. }
  1946. // ReposStoreGetByNameFuncCall is an object that describes an invocation of
  1947. // method GetByName on an instance of MockReposStore.
  1948. type ReposStoreGetByNameFuncCall struct {
  1949. // Arg0 is the value of the 1st argument passed to this method
  1950. // invocation.
  1951. Arg0 context.Context
  1952. // Arg1 is the value of the 2nd argument passed to this method
  1953. // invocation.
  1954. Arg1 int64
  1955. // Arg2 is the value of the 3rd argument passed to this method
  1956. // invocation.
  1957. Arg2 string
  1958. // Result0 is the value of the 1st result returned from this method
  1959. // invocation.
  1960. Result0 *db.Repository
  1961. // Result1 is the value of the 2nd result returned from this method
  1962. // invocation.
  1963. Result1 error
  1964. }
  1965. // Args returns an interface slice containing the arguments of this
  1966. // invocation.
  1967. func (c ReposStoreGetByNameFuncCall) Args() []interface{} {
  1968. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1969. }
  1970. // Results returns an interface slice containing the results of this
  1971. // invocation.
  1972. func (c ReposStoreGetByNameFuncCall) Results() []interface{} {
  1973. return []interface{}{c.Result0, c.Result1}
  1974. }
  1975. // ReposStoreHasForkedByFunc describes the behavior when the HasForkedBy
  1976. // method of the parent MockReposStore instance is invoked.
  1977. type ReposStoreHasForkedByFunc struct {
  1978. defaultHook func(context.Context, int64, int64) bool
  1979. hooks []func(context.Context, int64, int64) bool
  1980. history []ReposStoreHasForkedByFuncCall
  1981. mutex sync.Mutex
  1982. }
  1983. // HasForkedBy delegates to the next hook function in the queue and stores
  1984. // the parameter and result values of this invocation.
  1985. func (m *MockReposStore) HasForkedBy(v0 context.Context, v1 int64, v2 int64) bool {
  1986. r0 := m.HasForkedByFunc.nextHook()(v0, v1, v2)
  1987. m.HasForkedByFunc.appendCall(ReposStoreHasForkedByFuncCall{v0, v1, v2, r0})
  1988. return r0
  1989. }
  1990. // SetDefaultHook sets function that is called when the HasForkedBy method
  1991. // of the parent MockReposStore instance is invoked and the hook queue is
  1992. // empty.
  1993. func (f *ReposStoreHasForkedByFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  1994. f.defaultHook = hook
  1995. }
  1996. // PushHook adds a function to the end of hook queue. Each invocation of the
  1997. // HasForkedBy method of the parent MockReposStore instance invokes the hook
  1998. // at the front of the queue and discards it. After the queue is empty, the
  1999. // default hook function is invoked for any future action.
  2000. func (f *ReposStoreHasForkedByFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  2001. f.mutex.Lock()
  2002. f.hooks = append(f.hooks, hook)
  2003. f.mutex.Unlock()
  2004. }
  2005. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2006. // given values.
  2007. func (f *ReposStoreHasForkedByFunc) SetDefaultReturn(r0 bool) {
  2008. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  2009. return r0
  2010. })
  2011. }
  2012. // PushReturn calls PushHook with a function that returns the given values.
  2013. func (f *ReposStoreHasForkedByFunc) PushReturn(r0 bool) {
  2014. f.PushHook(func(context.Context, int64, int64) bool {
  2015. return r0
  2016. })
  2017. }
  2018. func (f *ReposStoreHasForkedByFunc) nextHook() func(context.Context, int64, int64) bool {
  2019. f.mutex.Lock()
  2020. defer f.mutex.Unlock()
  2021. if len(f.hooks) == 0 {
  2022. return f.defaultHook
  2023. }
  2024. hook := f.hooks[0]
  2025. f.hooks = f.hooks[1:]
  2026. return hook
  2027. }
  2028. func (f *ReposStoreHasForkedByFunc) appendCall(r0 ReposStoreHasForkedByFuncCall) {
  2029. f.mutex.Lock()
  2030. f.history = append(f.history, r0)
  2031. f.mutex.Unlock()
  2032. }
  2033. // History returns a sequence of ReposStoreHasForkedByFuncCall objects
  2034. // describing the invocations of this function.
  2035. func (f *ReposStoreHasForkedByFunc) History() []ReposStoreHasForkedByFuncCall {
  2036. f.mutex.Lock()
  2037. history := make([]ReposStoreHasForkedByFuncCall, len(f.history))
  2038. copy(history, f.history)
  2039. f.mutex.Unlock()
  2040. return history
  2041. }
  2042. // ReposStoreHasForkedByFuncCall is an object that describes an invocation
  2043. // of method HasForkedBy on an instance of MockReposStore.
  2044. type ReposStoreHasForkedByFuncCall struct {
  2045. // Arg0 is the value of the 1st argument passed to this method
  2046. // invocation.
  2047. Arg0 context.Context
  2048. // Arg1 is the value of the 2nd argument passed to this method
  2049. // invocation.
  2050. Arg1 int64
  2051. // Arg2 is the value of the 3rd argument passed to this method
  2052. // invocation.
  2053. Arg2 int64
  2054. // Result0 is the value of the 1st result returned from this method
  2055. // invocation.
  2056. Result0 bool
  2057. }
  2058. // Args returns an interface slice containing the arguments of this
  2059. // invocation.
  2060. func (c ReposStoreHasForkedByFuncCall) Args() []interface{} {
  2061. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2062. }
  2063. // Results returns an interface slice containing the results of this
  2064. // invocation.
  2065. func (c ReposStoreHasForkedByFuncCall) Results() []interface{} {
  2066. return []interface{}{c.Result0}
  2067. }
  2068. // ReposStoreListWatchesFunc describes the behavior when the ListWatches
  2069. // method of the parent MockReposStore instance is invoked.
  2070. type ReposStoreListWatchesFunc struct {
  2071. defaultHook func(context.Context, int64) ([]*db.Watch, error)
  2072. hooks []func(context.Context, int64) ([]*db.Watch, error)
  2073. history []ReposStoreListWatchesFuncCall
  2074. mutex sync.Mutex
  2075. }
  2076. // ListWatches delegates to the next hook function in the queue and stores
  2077. // the parameter and result values of this invocation.
  2078. func (m *MockReposStore) ListWatches(v0 context.Context, v1 int64) ([]*db.Watch, error) {
  2079. r0, r1 := m.ListWatchesFunc.nextHook()(v0, v1)
  2080. m.ListWatchesFunc.appendCall(ReposStoreListWatchesFuncCall{v0, v1, r0, r1})
  2081. return r0, r1
  2082. }
  2083. // SetDefaultHook sets function that is called when the ListWatches method
  2084. // of the parent MockReposStore instance is invoked and the hook queue is
  2085. // empty.
  2086. func (f *ReposStoreListWatchesFunc) SetDefaultHook(hook func(context.Context, int64) ([]*db.Watch, error)) {
  2087. f.defaultHook = hook
  2088. }
  2089. // PushHook adds a function to the end of hook queue. Each invocation of the
  2090. // ListWatches method of the parent MockReposStore instance invokes the hook
  2091. // at the front of the queue and discards it. After the queue is empty, the
  2092. // default hook function is invoked for any future action.
  2093. func (f *ReposStoreListWatchesFunc) PushHook(hook func(context.Context, int64) ([]*db.Watch, error)) {
  2094. f.mutex.Lock()
  2095. f.hooks = append(f.hooks, hook)
  2096. f.mutex.Unlock()
  2097. }
  2098. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2099. // given values.
  2100. func (f *ReposStoreListWatchesFunc) SetDefaultReturn(r0 []*db.Watch, r1 error) {
  2101. f.SetDefaultHook(func(context.Context, int64) ([]*db.Watch, error) {
  2102. return r0, r1
  2103. })
  2104. }
  2105. // PushReturn calls PushHook with a function that returns the given values.
  2106. func (f *ReposStoreListWatchesFunc) PushReturn(r0 []*db.Watch, r1 error) {
  2107. f.PushHook(func(context.Context, int64) ([]*db.Watch, error) {
  2108. return r0, r1
  2109. })
  2110. }
  2111. func (f *ReposStoreListWatchesFunc) nextHook() func(context.Context, int64) ([]*db.Watch, error) {
  2112. f.mutex.Lock()
  2113. defer f.mutex.Unlock()
  2114. if len(f.hooks) == 0 {
  2115. return f.defaultHook
  2116. }
  2117. hook := f.hooks[0]
  2118. f.hooks = f.hooks[1:]
  2119. return hook
  2120. }
  2121. func (f *ReposStoreListWatchesFunc) appendCall(r0 ReposStoreListWatchesFuncCall) {
  2122. f.mutex.Lock()
  2123. f.history = append(f.history, r0)
  2124. f.mutex.Unlock()
  2125. }
  2126. // History returns a sequence of ReposStoreListWatchesFuncCall objects
  2127. // describing the invocations of this function.
  2128. func (f *ReposStoreListWatchesFunc) History() []ReposStoreListWatchesFuncCall {
  2129. f.mutex.Lock()
  2130. history := make([]ReposStoreListWatchesFuncCall, len(f.history))
  2131. copy(history, f.history)
  2132. f.mutex.Unlock()
  2133. return history
  2134. }
  2135. // ReposStoreListWatchesFuncCall is an object that describes an invocation
  2136. // of method ListWatches on an instance of MockReposStore.
  2137. type ReposStoreListWatchesFuncCall struct {
  2138. // Arg0 is the value of the 1st argument passed to this method
  2139. // invocation.
  2140. Arg0 context.Context
  2141. // Arg1 is the value of the 2nd argument passed to this method
  2142. // invocation.
  2143. Arg1 int64
  2144. // Result0 is the value of the 1st result returned from this method
  2145. // invocation.
  2146. Result0 []*db.Watch
  2147. // Result1 is the value of the 2nd result returned from this method
  2148. // invocation.
  2149. Result1 error
  2150. }
  2151. // Args returns an interface slice containing the arguments of this
  2152. // invocation.
  2153. func (c ReposStoreListWatchesFuncCall) Args() []interface{} {
  2154. return []interface{}{c.Arg0, c.Arg1}
  2155. }
  2156. // Results returns an interface slice containing the results of this
  2157. // invocation.
  2158. func (c ReposStoreListWatchesFuncCall) Results() []interface{} {
  2159. return []interface{}{c.Result0, c.Result1}
  2160. }
  2161. // ReposStoreStarFunc describes the behavior when the Star method of the
  2162. // parent MockReposStore instance is invoked.
  2163. type ReposStoreStarFunc struct {
  2164. defaultHook func(context.Context, int64, int64) error
  2165. hooks []func(context.Context, int64, int64) error
  2166. history []ReposStoreStarFuncCall
  2167. mutex sync.Mutex
  2168. }
  2169. // Star delegates to the next hook function in the queue and stores the
  2170. // parameter and result values of this invocation.
  2171. func (m *MockReposStore) Star(v0 context.Context, v1 int64, v2 int64) error {
  2172. r0 := m.StarFunc.nextHook()(v0, v1, v2)
  2173. m.StarFunc.appendCall(ReposStoreStarFuncCall{v0, v1, v2, r0})
  2174. return r0
  2175. }
  2176. // SetDefaultHook sets function that is called when the Star method of the
  2177. // parent MockReposStore instance is invoked and the hook queue is empty.
  2178. func (f *ReposStoreStarFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  2179. f.defaultHook = hook
  2180. }
  2181. // PushHook adds a function to the end of hook queue. Each invocation of the
  2182. // Star method of the parent MockReposStore instance invokes the hook at the
  2183. // front of the queue and discards it. After the queue is empty, the default
  2184. // hook function is invoked for any future action.
  2185. func (f *ReposStoreStarFunc) PushHook(hook func(context.Context, int64, int64) error) {
  2186. f.mutex.Lock()
  2187. f.hooks = append(f.hooks, hook)
  2188. f.mutex.Unlock()
  2189. }
  2190. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2191. // given values.
  2192. func (f *ReposStoreStarFunc) SetDefaultReturn(r0 error) {
  2193. f.SetDefaultHook(func(context.Context, int64, int64) error {
  2194. return r0
  2195. })
  2196. }
  2197. // PushReturn calls PushHook with a function that returns the given values.
  2198. func (f *ReposStoreStarFunc) PushReturn(r0 error) {
  2199. f.PushHook(func(context.Context, int64, int64) error {
  2200. return r0
  2201. })
  2202. }
  2203. func (f *ReposStoreStarFunc) nextHook() func(context.Context, int64, int64) error {
  2204. f.mutex.Lock()
  2205. defer f.mutex.Unlock()
  2206. if len(f.hooks) == 0 {
  2207. return f.defaultHook
  2208. }
  2209. hook := f.hooks[0]
  2210. f.hooks = f.hooks[1:]
  2211. return hook
  2212. }
  2213. func (f *ReposStoreStarFunc) appendCall(r0 ReposStoreStarFuncCall) {
  2214. f.mutex.Lock()
  2215. f.history = append(f.history, r0)
  2216. f.mutex.Unlock()
  2217. }
  2218. // History returns a sequence of ReposStoreStarFuncCall objects describing
  2219. // the invocations of this function.
  2220. func (f *ReposStoreStarFunc) History() []ReposStoreStarFuncCall {
  2221. f.mutex.Lock()
  2222. history := make([]ReposStoreStarFuncCall, len(f.history))
  2223. copy(history, f.history)
  2224. f.mutex.Unlock()
  2225. return history
  2226. }
  2227. // ReposStoreStarFuncCall is an object that describes an invocation of
  2228. // method Star on an instance of MockReposStore.
  2229. type ReposStoreStarFuncCall struct {
  2230. // Arg0 is the value of the 1st argument passed to this method
  2231. // invocation.
  2232. Arg0 context.Context
  2233. // Arg1 is the value of the 2nd argument passed to this method
  2234. // invocation.
  2235. Arg1 int64
  2236. // Arg2 is the value of the 3rd argument passed to this method
  2237. // invocation.
  2238. Arg2 int64
  2239. // Result0 is the value of the 1st result returned from this method
  2240. // invocation.
  2241. Result0 error
  2242. }
  2243. // Args returns an interface slice containing the arguments of this
  2244. // invocation.
  2245. func (c ReposStoreStarFuncCall) Args() []interface{} {
  2246. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2247. }
  2248. // Results returns an interface slice containing the results of this
  2249. // invocation.
  2250. func (c ReposStoreStarFuncCall) Results() []interface{} {
  2251. return []interface{}{c.Result0}
  2252. }
  2253. // ReposStoreTouchFunc describes the behavior when the Touch method of the
  2254. // parent MockReposStore instance is invoked.
  2255. type ReposStoreTouchFunc struct {
  2256. defaultHook func(context.Context, int64) error
  2257. hooks []func(context.Context, int64) error
  2258. history []ReposStoreTouchFuncCall
  2259. mutex sync.Mutex
  2260. }
  2261. // Touch delegates to the next hook function in the queue and stores the
  2262. // parameter and result values of this invocation.
  2263. func (m *MockReposStore) Touch(v0 context.Context, v1 int64) error {
  2264. r0 := m.TouchFunc.nextHook()(v0, v1)
  2265. m.TouchFunc.appendCall(ReposStoreTouchFuncCall{v0, v1, r0})
  2266. return r0
  2267. }
  2268. // SetDefaultHook sets function that is called when the Touch method of the
  2269. // parent MockReposStore instance is invoked and the hook queue is empty.
  2270. func (f *ReposStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  2271. f.defaultHook = hook
  2272. }
  2273. // PushHook adds a function to the end of hook queue. Each invocation of the
  2274. // Touch method of the parent MockReposStore instance invokes the hook at
  2275. // the front of the queue and discards it. After the queue is empty, the
  2276. // default hook function is invoked for any future action.
  2277. func (f *ReposStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  2278. f.mutex.Lock()
  2279. f.hooks = append(f.hooks, hook)
  2280. f.mutex.Unlock()
  2281. }
  2282. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2283. // given values.
  2284. func (f *ReposStoreTouchFunc) SetDefaultReturn(r0 error) {
  2285. f.SetDefaultHook(func(context.Context, int64) error {
  2286. return r0
  2287. })
  2288. }
  2289. // PushReturn calls PushHook with a function that returns the given values.
  2290. func (f *ReposStoreTouchFunc) PushReturn(r0 error) {
  2291. f.PushHook(func(context.Context, int64) error {
  2292. return r0
  2293. })
  2294. }
  2295. func (f *ReposStoreTouchFunc) nextHook() func(context.Context, int64) error {
  2296. f.mutex.Lock()
  2297. defer f.mutex.Unlock()
  2298. if len(f.hooks) == 0 {
  2299. return f.defaultHook
  2300. }
  2301. hook := f.hooks[0]
  2302. f.hooks = f.hooks[1:]
  2303. return hook
  2304. }
  2305. func (f *ReposStoreTouchFunc) appendCall(r0 ReposStoreTouchFuncCall) {
  2306. f.mutex.Lock()
  2307. f.history = append(f.history, r0)
  2308. f.mutex.Unlock()
  2309. }
  2310. // History returns a sequence of ReposStoreTouchFuncCall objects describing
  2311. // the invocations of this function.
  2312. func (f *ReposStoreTouchFunc) History() []ReposStoreTouchFuncCall {
  2313. f.mutex.Lock()
  2314. history := make([]ReposStoreTouchFuncCall, len(f.history))
  2315. copy(history, f.history)
  2316. f.mutex.Unlock()
  2317. return history
  2318. }
  2319. // ReposStoreTouchFuncCall is an object that describes an invocation of
  2320. // method Touch on an instance of MockReposStore.
  2321. type ReposStoreTouchFuncCall struct {
  2322. // Arg0 is the value of the 1st argument passed to this method
  2323. // invocation.
  2324. Arg0 context.Context
  2325. // Arg1 is the value of the 2nd argument passed to this method
  2326. // invocation.
  2327. Arg1 int64
  2328. // Result0 is the value of the 1st result returned from this method
  2329. // invocation.
  2330. Result0 error
  2331. }
  2332. // Args returns an interface slice containing the arguments of this
  2333. // invocation.
  2334. func (c ReposStoreTouchFuncCall) Args() []interface{} {
  2335. return []interface{}{c.Arg0, c.Arg1}
  2336. }
  2337. // Results returns an interface slice containing the results of this
  2338. // invocation.
  2339. func (c ReposStoreTouchFuncCall) Results() []interface{} {
  2340. return []interface{}{c.Result0}
  2341. }
  2342. // ReposStoreWatchFunc describes the behavior when the Watch method of the
  2343. // parent MockReposStore instance is invoked.
  2344. type ReposStoreWatchFunc struct {
  2345. defaultHook func(context.Context, int64, int64) error
  2346. hooks []func(context.Context, int64, int64) error
  2347. history []ReposStoreWatchFuncCall
  2348. mutex sync.Mutex
  2349. }
  2350. // Watch delegates to the next hook function in the queue and stores the
  2351. // parameter and result values of this invocation.
  2352. func (m *MockReposStore) Watch(v0 context.Context, v1 int64, v2 int64) error {
  2353. r0 := m.WatchFunc.nextHook()(v0, v1, v2)
  2354. m.WatchFunc.appendCall(ReposStoreWatchFuncCall{v0, v1, v2, r0})
  2355. return r0
  2356. }
  2357. // SetDefaultHook sets function that is called when the Watch method of the
  2358. // parent MockReposStore instance is invoked and the hook queue is empty.
  2359. func (f *ReposStoreWatchFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  2360. f.defaultHook = hook
  2361. }
  2362. // PushHook adds a function to the end of hook queue. Each invocation of the
  2363. // Watch method of the parent MockReposStore instance invokes the hook at
  2364. // the front of the queue and discards it. After the queue is empty, the
  2365. // default hook function is invoked for any future action.
  2366. func (f *ReposStoreWatchFunc) PushHook(hook func(context.Context, int64, int64) error) {
  2367. f.mutex.Lock()
  2368. f.hooks = append(f.hooks, hook)
  2369. f.mutex.Unlock()
  2370. }
  2371. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2372. // given values.
  2373. func (f *ReposStoreWatchFunc) SetDefaultReturn(r0 error) {
  2374. f.SetDefaultHook(func(context.Context, int64, int64) error {
  2375. return r0
  2376. })
  2377. }
  2378. // PushReturn calls PushHook with a function that returns the given values.
  2379. func (f *ReposStoreWatchFunc) PushReturn(r0 error) {
  2380. f.PushHook(func(context.Context, int64, int64) error {
  2381. return r0
  2382. })
  2383. }
  2384. func (f *ReposStoreWatchFunc) nextHook() func(context.Context, int64, int64) error {
  2385. f.mutex.Lock()
  2386. defer f.mutex.Unlock()
  2387. if len(f.hooks) == 0 {
  2388. return f.defaultHook
  2389. }
  2390. hook := f.hooks[0]
  2391. f.hooks = f.hooks[1:]
  2392. return hook
  2393. }
  2394. func (f *ReposStoreWatchFunc) appendCall(r0 ReposStoreWatchFuncCall) {
  2395. f.mutex.Lock()
  2396. f.history = append(f.history, r0)
  2397. f.mutex.Unlock()
  2398. }
  2399. // History returns a sequence of ReposStoreWatchFuncCall objects describing
  2400. // the invocations of this function.
  2401. func (f *ReposStoreWatchFunc) History() []ReposStoreWatchFuncCall {
  2402. f.mutex.Lock()
  2403. history := make([]ReposStoreWatchFuncCall, len(f.history))
  2404. copy(history, f.history)
  2405. f.mutex.Unlock()
  2406. return history
  2407. }
  2408. // ReposStoreWatchFuncCall is an object that describes an invocation of
  2409. // method Watch on an instance of MockReposStore.
  2410. type ReposStoreWatchFuncCall struct {
  2411. // Arg0 is the value of the 1st argument passed to this method
  2412. // invocation.
  2413. Arg0 context.Context
  2414. // Arg1 is the value of the 2nd argument passed to this method
  2415. // invocation.
  2416. Arg1 int64
  2417. // Arg2 is the value of the 3rd argument passed to this method
  2418. // invocation.
  2419. Arg2 int64
  2420. // Result0 is the value of the 1st result returned from this method
  2421. // invocation.
  2422. Result0 error
  2423. }
  2424. // Args returns an interface slice containing the arguments of this
  2425. // invocation.
  2426. func (c ReposStoreWatchFuncCall) Args() []interface{} {
  2427. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2428. }
  2429. // Results returns an interface slice containing the results of this
  2430. // invocation.
  2431. func (c ReposStoreWatchFuncCall) Results() []interface{} {
  2432. return []interface{}{c.Result0}
  2433. }
  2434. // MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
  2435. // interface (from the package gogs.io/gogs/internal/db) used for unit
  2436. // testing.
  2437. type MockTwoFactorsStore struct {
  2438. // CreateFunc is an instance of a mock function object controlling the
  2439. // behavior of the method Create.
  2440. CreateFunc *TwoFactorsStoreCreateFunc
  2441. // GetByUserIDFunc is an instance of a mock function object controlling
  2442. // the behavior of the method GetByUserID.
  2443. GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
  2444. // IsEnabledFunc is an instance of a mock function object controlling
  2445. // the behavior of the method IsEnabled.
  2446. IsEnabledFunc *TwoFactorsStoreIsEnabledFunc
  2447. // UseRecoveryCodeFunc is an instance of a mock function object
  2448. // controlling the behavior of the method UseRecoveryCode.
  2449. UseRecoveryCodeFunc *TwoFactorsStoreUseRecoveryCodeFunc
  2450. }
  2451. // NewMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2452. // interface. All methods return zero values for all results, unless
  2453. // overwritten.
  2454. func NewMockTwoFactorsStore() *MockTwoFactorsStore {
  2455. return &MockTwoFactorsStore{
  2456. CreateFunc: &TwoFactorsStoreCreateFunc{
  2457. defaultHook: func(context.Context, int64, string, string) (r0 error) {
  2458. return
  2459. },
  2460. },
  2461. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2462. defaultHook: func(context.Context, int64) (r0 *db.TwoFactor, r1 error) {
  2463. return
  2464. },
  2465. },
  2466. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2467. defaultHook: func(context.Context, int64) (r0 bool) {
  2468. return
  2469. },
  2470. },
  2471. UseRecoveryCodeFunc: &TwoFactorsStoreUseRecoveryCodeFunc{
  2472. defaultHook: func(context.Context, int64, string) (r0 error) {
  2473. return
  2474. },
  2475. },
  2476. }
  2477. }
  2478. // NewStrictMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2479. // interface. All methods panic on invocation, unless overwritten.
  2480. func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
  2481. return &MockTwoFactorsStore{
  2482. CreateFunc: &TwoFactorsStoreCreateFunc{
  2483. defaultHook: func(context.Context, int64, string, string) error {
  2484. panic("unexpected invocation of MockTwoFactorsStore.Create")
  2485. },
  2486. },
  2487. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2488. defaultHook: func(context.Context, int64) (*db.TwoFactor, error) {
  2489. panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
  2490. },
  2491. },
  2492. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2493. defaultHook: func(context.Context, int64) bool {
  2494. panic("unexpected invocation of MockTwoFactorsStore.IsEnabled")
  2495. },
  2496. },
  2497. UseRecoveryCodeFunc: &TwoFactorsStoreUseRecoveryCodeFunc{
  2498. defaultHook: func(context.Context, int64, string) error {
  2499. panic("unexpected invocation of MockTwoFactorsStore.UseRecoveryCode")
  2500. },
  2501. },
  2502. }
  2503. }
  2504. // NewMockTwoFactorsStoreFrom creates a new mock of the MockTwoFactorsStore
  2505. // interface. All methods delegate to the given implementation, unless
  2506. // overwritten.
  2507. func NewMockTwoFactorsStoreFrom(i db.TwoFactorsStore) *MockTwoFactorsStore {
  2508. return &MockTwoFactorsStore{
  2509. CreateFunc: &TwoFactorsStoreCreateFunc{
  2510. defaultHook: i.Create,
  2511. },
  2512. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2513. defaultHook: i.GetByUserID,
  2514. },
  2515. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2516. defaultHook: i.IsEnabled,
  2517. },
  2518. UseRecoveryCodeFunc: &TwoFactorsStoreUseRecoveryCodeFunc{
  2519. defaultHook: i.UseRecoveryCode,
  2520. },
  2521. }
  2522. }
  2523. // TwoFactorsStoreCreateFunc describes the behavior when the Create method
  2524. // of the parent MockTwoFactorsStore instance is invoked.
  2525. type TwoFactorsStoreCreateFunc struct {
  2526. defaultHook func(context.Context, int64, string, string) error
  2527. hooks []func(context.Context, int64, string, string) error
  2528. history []TwoFactorsStoreCreateFuncCall
  2529. mutex sync.Mutex
  2530. }
  2531. // Create delegates to the next hook function in the queue and stores the
  2532. // parameter and result values of this invocation.
  2533. func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
  2534. r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2535. m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
  2536. return r0
  2537. }
  2538. // SetDefaultHook sets function that is called when the Create method of the
  2539. // parent MockTwoFactorsStore instance is invoked and the hook queue is
  2540. // empty.
  2541. func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
  2542. f.defaultHook = hook
  2543. }
  2544. // PushHook adds a function to the end of hook queue. Each invocation of the
  2545. // Create method of the parent MockTwoFactorsStore instance invokes the hook
  2546. // at the front of the queue and discards it. After the queue is empty, the
  2547. // default hook function is invoked for any future action.
  2548. func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
  2549. f.mutex.Lock()
  2550. f.hooks = append(f.hooks, hook)
  2551. f.mutex.Unlock()
  2552. }
  2553. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2554. // given values.
  2555. func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
  2556. f.SetDefaultHook(func(context.Context, int64, string, string) error {
  2557. return r0
  2558. })
  2559. }
  2560. // PushReturn calls PushHook with a function that returns the given values.
  2561. func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
  2562. f.PushHook(func(context.Context, int64, string, string) error {
  2563. return r0
  2564. })
  2565. }
  2566. func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
  2567. f.mutex.Lock()
  2568. defer f.mutex.Unlock()
  2569. if len(f.hooks) == 0 {
  2570. return f.defaultHook
  2571. }
  2572. hook := f.hooks[0]
  2573. f.hooks = f.hooks[1:]
  2574. return hook
  2575. }
  2576. func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
  2577. f.mutex.Lock()
  2578. f.history = append(f.history, r0)
  2579. f.mutex.Unlock()
  2580. }
  2581. // History returns a sequence of TwoFactorsStoreCreateFuncCall objects
  2582. // describing the invocations of this function.
  2583. func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
  2584. f.mutex.Lock()
  2585. history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
  2586. copy(history, f.history)
  2587. f.mutex.Unlock()
  2588. return history
  2589. }
  2590. // TwoFactorsStoreCreateFuncCall is an object that describes an invocation
  2591. // of method Create on an instance of MockTwoFactorsStore.
  2592. type TwoFactorsStoreCreateFuncCall struct {
  2593. // Arg0 is the value of the 1st argument passed to this method
  2594. // invocation.
  2595. Arg0 context.Context
  2596. // Arg1 is the value of the 2nd argument passed to this method
  2597. // invocation.
  2598. Arg1 int64
  2599. // Arg2 is the value of the 3rd argument passed to this method
  2600. // invocation.
  2601. Arg2 string
  2602. // Arg3 is the value of the 4th argument passed to this method
  2603. // invocation.
  2604. Arg3 string
  2605. // Result0 is the value of the 1st result returned from this method
  2606. // invocation.
  2607. Result0 error
  2608. }
  2609. // Args returns an interface slice containing the arguments of this
  2610. // invocation.
  2611. func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
  2612. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2613. }
  2614. // Results returns an interface slice containing the results of this
  2615. // invocation.
  2616. func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
  2617. return []interface{}{c.Result0}
  2618. }
  2619. // TwoFactorsStoreGetByUserIDFunc describes the behavior when the
  2620. // GetByUserID method of the parent MockTwoFactorsStore instance is invoked.
  2621. type TwoFactorsStoreGetByUserIDFunc struct {
  2622. defaultHook func(context.Context, int64) (*db.TwoFactor, error)
  2623. hooks []func(context.Context, int64) (*db.TwoFactor, error)
  2624. history []TwoFactorsStoreGetByUserIDFuncCall
  2625. mutex sync.Mutex
  2626. }
  2627. // GetByUserID delegates to the next hook function in the queue and stores
  2628. // the parameter and result values of this invocation.
  2629. func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*db.TwoFactor, error) {
  2630. r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
  2631. m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
  2632. return r0, r1
  2633. }
  2634. // SetDefaultHook sets function that is called when the GetByUserID method
  2635. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  2636. // is empty.
  2637. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2638. f.defaultHook = hook
  2639. }
  2640. // PushHook adds a function to the end of hook queue. Each invocation of the
  2641. // GetByUserID method of the parent MockTwoFactorsStore instance invokes the
  2642. // hook at the front of the queue and discards it. After the queue is empty,
  2643. // the default hook function is invoked for any future action.
  2644. func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2645. f.mutex.Lock()
  2646. f.hooks = append(f.hooks, hook)
  2647. f.mutex.Unlock()
  2648. }
  2649. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2650. // given values.
  2651. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *db.TwoFactor, r1 error) {
  2652. f.SetDefaultHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2653. return r0, r1
  2654. })
  2655. }
  2656. // PushReturn calls PushHook with a function that returns the given values.
  2657. func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *db.TwoFactor, r1 error) {
  2658. f.PushHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2659. return r0, r1
  2660. })
  2661. }
  2662. func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*db.TwoFactor, error) {
  2663. f.mutex.Lock()
  2664. defer f.mutex.Unlock()
  2665. if len(f.hooks) == 0 {
  2666. return f.defaultHook
  2667. }
  2668. hook := f.hooks[0]
  2669. f.hooks = f.hooks[1:]
  2670. return hook
  2671. }
  2672. func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
  2673. f.mutex.Lock()
  2674. f.history = append(f.history, r0)
  2675. f.mutex.Unlock()
  2676. }
  2677. // History returns a sequence of TwoFactorsStoreGetByUserIDFuncCall objects
  2678. // describing the invocations of this function.
  2679. func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
  2680. f.mutex.Lock()
  2681. history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
  2682. copy(history, f.history)
  2683. f.mutex.Unlock()
  2684. return history
  2685. }
  2686. // TwoFactorsStoreGetByUserIDFuncCall is an object that describes an
  2687. // invocation of method GetByUserID on an instance of MockTwoFactorsStore.
  2688. type TwoFactorsStoreGetByUserIDFuncCall struct {
  2689. // Arg0 is the value of the 1st argument passed to this method
  2690. // invocation.
  2691. Arg0 context.Context
  2692. // Arg1 is the value of the 2nd argument passed to this method
  2693. // invocation.
  2694. Arg1 int64
  2695. // Result0 is the value of the 1st result returned from this method
  2696. // invocation.
  2697. Result0 *db.TwoFactor
  2698. // Result1 is the value of the 2nd result returned from this method
  2699. // invocation.
  2700. Result1 error
  2701. }
  2702. // Args returns an interface slice containing the arguments of this
  2703. // invocation.
  2704. func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
  2705. return []interface{}{c.Arg0, c.Arg1}
  2706. }
  2707. // Results returns an interface slice containing the results of this
  2708. // invocation.
  2709. func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
  2710. return []interface{}{c.Result0, c.Result1}
  2711. }
  2712. // TwoFactorsStoreIsEnabledFunc describes the behavior when the IsEnabled
  2713. // method of the parent MockTwoFactorsStore instance is invoked.
  2714. type TwoFactorsStoreIsEnabledFunc struct {
  2715. defaultHook func(context.Context, int64) bool
  2716. hooks []func(context.Context, int64) bool
  2717. history []TwoFactorsStoreIsEnabledFuncCall
  2718. mutex sync.Mutex
  2719. }
  2720. // IsEnabled delegates to the next hook function in the queue and stores the
  2721. // parameter and result values of this invocation.
  2722. func (m *MockTwoFactorsStore) IsEnabled(v0 context.Context, v1 int64) bool {
  2723. r0 := m.IsEnabledFunc.nextHook()(v0, v1)
  2724. m.IsEnabledFunc.appendCall(TwoFactorsStoreIsEnabledFuncCall{v0, v1, r0})
  2725. return r0
  2726. }
  2727. // SetDefaultHook sets function that is called when the IsEnabled method of
  2728. // the parent MockTwoFactorsStore instance is invoked and the hook queue is
  2729. // empty.
  2730. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
  2731. f.defaultHook = hook
  2732. }
  2733. // PushHook adds a function to the end of hook queue. Each invocation of the
  2734. // IsEnabled method of the parent MockTwoFactorsStore instance invokes the
  2735. // hook at the front of the queue and discards it. After the queue is empty,
  2736. // the default hook function is invoked for any future action.
  2737. func (f *TwoFactorsStoreIsEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
  2738. f.mutex.Lock()
  2739. f.hooks = append(f.hooks, hook)
  2740. f.mutex.Unlock()
  2741. }
  2742. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2743. // given values.
  2744. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultReturn(r0 bool) {
  2745. f.SetDefaultHook(func(context.Context, int64) bool {
  2746. return r0
  2747. })
  2748. }
  2749. // PushReturn calls PushHook with a function that returns the given values.
  2750. func (f *TwoFactorsStoreIsEnabledFunc) PushReturn(r0 bool) {
  2751. f.PushHook(func(context.Context, int64) bool {
  2752. return r0
  2753. })
  2754. }
  2755. func (f *TwoFactorsStoreIsEnabledFunc) nextHook() func(context.Context, int64) bool {
  2756. f.mutex.Lock()
  2757. defer f.mutex.Unlock()
  2758. if len(f.hooks) == 0 {
  2759. return f.defaultHook
  2760. }
  2761. hook := f.hooks[0]
  2762. f.hooks = f.hooks[1:]
  2763. return hook
  2764. }
  2765. func (f *TwoFactorsStoreIsEnabledFunc) appendCall(r0 TwoFactorsStoreIsEnabledFuncCall) {
  2766. f.mutex.Lock()
  2767. f.history = append(f.history, r0)
  2768. f.mutex.Unlock()
  2769. }
  2770. // History returns a sequence of TwoFactorsStoreIsEnabledFuncCall objects
  2771. // describing the invocations of this function.
  2772. func (f *TwoFactorsStoreIsEnabledFunc) History() []TwoFactorsStoreIsEnabledFuncCall {
  2773. f.mutex.Lock()
  2774. history := make([]TwoFactorsStoreIsEnabledFuncCall, len(f.history))
  2775. copy(history, f.history)
  2776. f.mutex.Unlock()
  2777. return history
  2778. }
  2779. // TwoFactorsStoreIsEnabledFuncCall is an object that describes an
  2780. // invocation of method IsEnabled on an instance of MockTwoFactorsStore.
  2781. type TwoFactorsStoreIsEnabledFuncCall struct {
  2782. // Arg0 is the value of the 1st argument passed to this method
  2783. // invocation.
  2784. Arg0 context.Context
  2785. // Arg1 is the value of the 2nd argument passed to this method
  2786. // invocation.
  2787. Arg1 int64
  2788. // Result0 is the value of the 1st result returned from this method
  2789. // invocation.
  2790. Result0 bool
  2791. }
  2792. // Args returns an interface slice containing the arguments of this
  2793. // invocation.
  2794. func (c TwoFactorsStoreIsEnabledFuncCall) Args() []interface{} {
  2795. return []interface{}{c.Arg0, c.Arg1}
  2796. }
  2797. // Results returns an interface slice containing the results of this
  2798. // invocation.
  2799. func (c TwoFactorsStoreIsEnabledFuncCall) Results() []interface{} {
  2800. return []interface{}{c.Result0}
  2801. }
  2802. // TwoFactorsStoreUseRecoveryCodeFunc describes the behavior when the
  2803. // UseRecoveryCode method of the parent MockTwoFactorsStore instance is
  2804. // invoked.
  2805. type TwoFactorsStoreUseRecoveryCodeFunc struct {
  2806. defaultHook func(context.Context, int64, string) error
  2807. hooks []func(context.Context, int64, string) error
  2808. history []TwoFactorsStoreUseRecoveryCodeFuncCall
  2809. mutex sync.Mutex
  2810. }
  2811. // UseRecoveryCode delegates to the next hook function in the queue and
  2812. // stores the parameter and result values of this invocation.
  2813. func (m *MockTwoFactorsStore) UseRecoveryCode(v0 context.Context, v1 int64, v2 string) error {
  2814. r0 := m.UseRecoveryCodeFunc.nextHook()(v0, v1, v2)
  2815. m.UseRecoveryCodeFunc.appendCall(TwoFactorsStoreUseRecoveryCodeFuncCall{v0, v1, v2, r0})
  2816. return r0
  2817. }
  2818. // SetDefaultHook sets function that is called when the UseRecoveryCode
  2819. // method of the parent MockTwoFactorsStore instance is invoked and the hook
  2820. // queue is empty.
  2821. func (f *TwoFactorsStoreUseRecoveryCodeFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  2822. f.defaultHook = hook
  2823. }
  2824. // PushHook adds a function to the end of hook queue. Each invocation of the
  2825. // UseRecoveryCode method of the parent MockTwoFactorsStore instance invokes
  2826. // the hook at the front of the queue and discards it. After the queue is
  2827. // empty, the default hook function is invoked for any future action.
  2828. func (f *TwoFactorsStoreUseRecoveryCodeFunc) PushHook(hook func(context.Context, int64, string) 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 *TwoFactorsStoreUseRecoveryCodeFunc) SetDefaultReturn(r0 error) {
  2836. f.SetDefaultHook(func(context.Context, int64, string) error {
  2837. return r0
  2838. })
  2839. }
  2840. // PushReturn calls PushHook with a function that returns the given values.
  2841. func (f *TwoFactorsStoreUseRecoveryCodeFunc) PushReturn(r0 error) {
  2842. f.PushHook(func(context.Context, int64, string) error {
  2843. return r0
  2844. })
  2845. }
  2846. func (f *TwoFactorsStoreUseRecoveryCodeFunc) nextHook() func(context.Context, int64, string) 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 *TwoFactorsStoreUseRecoveryCodeFunc) appendCall(r0 TwoFactorsStoreUseRecoveryCodeFuncCall) {
  2857. f.mutex.Lock()
  2858. f.history = append(f.history, r0)
  2859. f.mutex.Unlock()
  2860. }
  2861. // History returns a sequence of TwoFactorsStoreUseRecoveryCodeFuncCall
  2862. // objects describing the invocations of this function.
  2863. func (f *TwoFactorsStoreUseRecoveryCodeFunc) History() []TwoFactorsStoreUseRecoveryCodeFuncCall {
  2864. f.mutex.Lock()
  2865. history := make([]TwoFactorsStoreUseRecoveryCodeFuncCall, len(f.history))
  2866. copy(history, f.history)
  2867. f.mutex.Unlock()
  2868. return history
  2869. }
  2870. // TwoFactorsStoreUseRecoveryCodeFuncCall is an object that describes an
  2871. // invocation of method UseRecoveryCode on an instance of
  2872. // MockTwoFactorsStore.
  2873. type TwoFactorsStoreUseRecoveryCodeFuncCall struct {
  2874. // Arg0 is the value of the 1st argument passed to this method
  2875. // invocation.
  2876. Arg0 context.Context
  2877. // Arg1 is the value of the 2nd argument passed to this method
  2878. // invocation.
  2879. Arg1 int64
  2880. // Arg2 is the value of the 3rd argument passed to this method
  2881. // invocation.
  2882. Arg2 string
  2883. // Result0 is the value of the 1st result returned from this method
  2884. // invocation.
  2885. Result0 error
  2886. }
  2887. // Args returns an interface slice containing the arguments of this
  2888. // invocation.
  2889. func (c TwoFactorsStoreUseRecoveryCodeFuncCall) Args() []interface{} {
  2890. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2891. }
  2892. // Results returns an interface slice containing the results of this
  2893. // invocation.
  2894. func (c TwoFactorsStoreUseRecoveryCodeFuncCall) Results() []interface{} {
  2895. return []interface{}{c.Result0}
  2896. }
  2897. // MockUsersStore is a mock implementation of the UsersStore interface (from
  2898. // the package gogs.io/gogs/internal/db) used for unit testing.
  2899. type MockUsersStore struct {
  2900. // AuthenticateFunc is an instance of a mock function object controlling
  2901. // the behavior of the method Authenticate.
  2902. AuthenticateFunc *UsersStoreAuthenticateFunc
  2903. // ChangeUsernameFunc is an instance of a mock function object
  2904. // controlling the behavior of the method ChangeUsername.
  2905. ChangeUsernameFunc *UsersStoreChangeUsernameFunc
  2906. // CountFunc is an instance of a mock function object controlling the
  2907. // behavior of the method Count.
  2908. CountFunc *UsersStoreCountFunc
  2909. // CreateFunc is an instance of a mock function object controlling the
  2910. // behavior of the method Create.
  2911. CreateFunc *UsersStoreCreateFunc
  2912. // DeleteByIDFunc is an instance of a mock function object controlling
  2913. // the behavior of the method DeleteByID.
  2914. DeleteByIDFunc *UsersStoreDeleteByIDFunc
  2915. // DeleteCustomAvatarFunc is an instance of a mock function object
  2916. // controlling the behavior of the method DeleteCustomAvatar.
  2917. DeleteCustomAvatarFunc *UsersStoreDeleteCustomAvatarFunc
  2918. // DeleteInactivatedFunc is an instance of a mock function object
  2919. // controlling the behavior of the method DeleteInactivated.
  2920. DeleteInactivatedFunc *UsersStoreDeleteInactivatedFunc
  2921. // FollowFunc is an instance of a mock function object controlling the
  2922. // behavior of the method Follow.
  2923. FollowFunc *UsersStoreFollowFunc
  2924. // GetByEmailFunc is an instance of a mock function object controlling
  2925. // the behavior of the method GetByEmail.
  2926. GetByEmailFunc *UsersStoreGetByEmailFunc
  2927. // GetByIDFunc is an instance of a mock function object controlling the
  2928. // behavior of the method GetByID.
  2929. GetByIDFunc *UsersStoreGetByIDFunc
  2930. // GetByKeyIDFunc is an instance of a mock function object controlling
  2931. // the behavior of the method GetByKeyID.
  2932. GetByKeyIDFunc *UsersStoreGetByKeyIDFunc
  2933. // GetByUsernameFunc is an instance of a mock function object
  2934. // controlling the behavior of the method GetByUsername.
  2935. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  2936. // GetMailableEmailsByUsernamesFunc is an instance of a mock function
  2937. // object controlling the behavior of the method
  2938. // GetMailableEmailsByUsernames.
  2939. GetMailableEmailsByUsernamesFunc *UsersStoreGetMailableEmailsByUsernamesFunc
  2940. // IsFollowingFunc is an instance of a mock function object controlling
  2941. // the behavior of the method IsFollowing.
  2942. IsFollowingFunc *UsersStoreIsFollowingFunc
  2943. // IsUsernameUsedFunc is an instance of a mock function object
  2944. // controlling the behavior of the method IsUsernameUsed.
  2945. IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
  2946. // ListFunc is an instance of a mock function object controlling the
  2947. // behavior of the method List.
  2948. ListFunc *UsersStoreListFunc
  2949. // ListFollowersFunc is an instance of a mock function object
  2950. // controlling the behavior of the method ListFollowers.
  2951. ListFollowersFunc *UsersStoreListFollowersFunc
  2952. // ListFollowingsFunc is an instance of a mock function object
  2953. // controlling the behavior of the method ListFollowings.
  2954. ListFollowingsFunc *UsersStoreListFollowingsFunc
  2955. // SearchByNameFunc is an instance of a mock function object controlling
  2956. // the behavior of the method SearchByName.
  2957. SearchByNameFunc *UsersStoreSearchByNameFunc
  2958. // UnfollowFunc is an instance of a mock function object controlling the
  2959. // behavior of the method Unfollow.
  2960. UnfollowFunc *UsersStoreUnfollowFunc
  2961. // UpdateFunc is an instance of a mock function object controlling the
  2962. // behavior of the method Update.
  2963. UpdateFunc *UsersStoreUpdateFunc
  2964. // UseCustomAvatarFunc is an instance of a mock function object
  2965. // controlling the behavior of the method UseCustomAvatar.
  2966. UseCustomAvatarFunc *UsersStoreUseCustomAvatarFunc
  2967. }
  2968. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  2969. // methods return zero values for all results, unless overwritten.
  2970. func NewMockUsersStore() *MockUsersStore {
  2971. return &MockUsersStore{
  2972. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2973. defaultHook: func(context.Context, string, string, int64) (r0 *db.User, r1 error) {
  2974. return
  2975. },
  2976. },
  2977. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2978. defaultHook: func(context.Context, int64, string) (r0 error) {
  2979. return
  2980. },
  2981. },
  2982. CountFunc: &UsersStoreCountFunc{
  2983. defaultHook: func(context.Context) (r0 int64) {
  2984. return
  2985. },
  2986. },
  2987. CreateFunc: &UsersStoreCreateFunc{
  2988. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (r0 *db.User, r1 error) {
  2989. return
  2990. },
  2991. },
  2992. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  2993. defaultHook: func(context.Context, int64, bool) (r0 error) {
  2994. return
  2995. },
  2996. },
  2997. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2998. defaultHook: func(context.Context, int64) (r0 error) {
  2999. return
  3000. },
  3001. },
  3002. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  3003. defaultHook: func() (r0 error) {
  3004. return
  3005. },
  3006. },
  3007. FollowFunc: &UsersStoreFollowFunc{
  3008. defaultHook: func(context.Context, int64, int64) (r0 error) {
  3009. return
  3010. },
  3011. },
  3012. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  3013. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  3014. return
  3015. },
  3016. },
  3017. GetByIDFunc: &UsersStoreGetByIDFunc{
  3018. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  3019. return
  3020. },
  3021. },
  3022. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  3023. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  3024. return
  3025. },
  3026. },
  3027. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  3028. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  3029. return
  3030. },
  3031. },
  3032. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  3033. defaultHook: func(context.Context, []string) (r0 []string, r1 error) {
  3034. return
  3035. },
  3036. },
  3037. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  3038. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  3039. return
  3040. },
  3041. },
  3042. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  3043. defaultHook: func(context.Context, string, int64) (r0 bool) {
  3044. return
  3045. },
  3046. },
  3047. ListFunc: &UsersStoreListFunc{
  3048. defaultHook: func(context.Context, int, int) (r0 []*db.User, r1 error) {
  3049. return
  3050. },
  3051. },
  3052. ListFollowersFunc: &UsersStoreListFollowersFunc{
  3053. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  3054. return
  3055. },
  3056. },
  3057. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  3058. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  3059. return
  3060. },
  3061. },
  3062. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  3063. defaultHook: func(context.Context, string, int, int, string) (r0 []*db.User, r1 int64, r2 error) {
  3064. return
  3065. },
  3066. },
  3067. UnfollowFunc: &UsersStoreUnfollowFunc{
  3068. defaultHook: func(context.Context, int64, int64) (r0 error) {
  3069. return
  3070. },
  3071. },
  3072. UpdateFunc: &UsersStoreUpdateFunc{
  3073. defaultHook: func(context.Context, int64, db.UpdateUserOptions) (r0 error) {
  3074. return
  3075. },
  3076. },
  3077. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  3078. defaultHook: func(context.Context, int64, []byte) (r0 error) {
  3079. return
  3080. },
  3081. },
  3082. }
  3083. }
  3084. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  3085. // All methods panic on invocation, unless overwritten.
  3086. func NewStrictMockUsersStore() *MockUsersStore {
  3087. return &MockUsersStore{
  3088. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  3089. defaultHook: func(context.Context, string, string, int64) (*db.User, error) {
  3090. panic("unexpected invocation of MockUsersStore.Authenticate")
  3091. },
  3092. },
  3093. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  3094. defaultHook: func(context.Context, int64, string) error {
  3095. panic("unexpected invocation of MockUsersStore.ChangeUsername")
  3096. },
  3097. },
  3098. CountFunc: &UsersStoreCountFunc{
  3099. defaultHook: func(context.Context) int64 {
  3100. panic("unexpected invocation of MockUsersStore.Count")
  3101. },
  3102. },
  3103. CreateFunc: &UsersStoreCreateFunc{
  3104. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3105. panic("unexpected invocation of MockUsersStore.Create")
  3106. },
  3107. },
  3108. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  3109. defaultHook: func(context.Context, int64, bool) error {
  3110. panic("unexpected invocation of MockUsersStore.DeleteByID")
  3111. },
  3112. },
  3113. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  3114. defaultHook: func(context.Context, int64) error {
  3115. panic("unexpected invocation of MockUsersStore.DeleteCustomAvatar")
  3116. },
  3117. },
  3118. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  3119. defaultHook: func() error {
  3120. panic("unexpected invocation of MockUsersStore.DeleteInactivated")
  3121. },
  3122. },
  3123. FollowFunc: &UsersStoreFollowFunc{
  3124. defaultHook: func(context.Context, int64, int64) error {
  3125. panic("unexpected invocation of MockUsersStore.Follow")
  3126. },
  3127. },
  3128. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  3129. defaultHook: func(context.Context, string) (*db.User, error) {
  3130. panic("unexpected invocation of MockUsersStore.GetByEmail")
  3131. },
  3132. },
  3133. GetByIDFunc: &UsersStoreGetByIDFunc{
  3134. defaultHook: func(context.Context, int64) (*db.User, error) {
  3135. panic("unexpected invocation of MockUsersStore.GetByID")
  3136. },
  3137. },
  3138. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  3139. defaultHook: func(context.Context, int64) (*db.User, error) {
  3140. panic("unexpected invocation of MockUsersStore.GetByKeyID")
  3141. },
  3142. },
  3143. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  3144. defaultHook: func(context.Context, string) (*db.User, error) {
  3145. panic("unexpected invocation of MockUsersStore.GetByUsername")
  3146. },
  3147. },
  3148. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  3149. defaultHook: func(context.Context, []string) ([]string, error) {
  3150. panic("unexpected invocation of MockUsersStore.GetMailableEmailsByUsernames")
  3151. },
  3152. },
  3153. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  3154. defaultHook: func(context.Context, int64, int64) bool {
  3155. panic("unexpected invocation of MockUsersStore.IsFollowing")
  3156. },
  3157. },
  3158. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  3159. defaultHook: func(context.Context, string, int64) bool {
  3160. panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
  3161. },
  3162. },
  3163. ListFunc: &UsersStoreListFunc{
  3164. defaultHook: func(context.Context, int, int) ([]*db.User, error) {
  3165. panic("unexpected invocation of MockUsersStore.List")
  3166. },
  3167. },
  3168. ListFollowersFunc: &UsersStoreListFollowersFunc{
  3169. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  3170. panic("unexpected invocation of MockUsersStore.ListFollowers")
  3171. },
  3172. },
  3173. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  3174. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  3175. panic("unexpected invocation of MockUsersStore.ListFollowings")
  3176. },
  3177. },
  3178. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  3179. defaultHook: func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  3180. panic("unexpected invocation of MockUsersStore.SearchByName")
  3181. },
  3182. },
  3183. UnfollowFunc: &UsersStoreUnfollowFunc{
  3184. defaultHook: func(context.Context, int64, int64) error {
  3185. panic("unexpected invocation of MockUsersStore.Unfollow")
  3186. },
  3187. },
  3188. UpdateFunc: &UsersStoreUpdateFunc{
  3189. defaultHook: func(context.Context, int64, db.UpdateUserOptions) error {
  3190. panic("unexpected invocation of MockUsersStore.Update")
  3191. },
  3192. },
  3193. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  3194. defaultHook: func(context.Context, int64, []byte) error {
  3195. panic("unexpected invocation of MockUsersStore.UseCustomAvatar")
  3196. },
  3197. },
  3198. }
  3199. }
  3200. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  3201. // All methods delegate to the given implementation, unless overwritten.
  3202. func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
  3203. return &MockUsersStore{
  3204. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  3205. defaultHook: i.Authenticate,
  3206. },
  3207. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  3208. defaultHook: i.ChangeUsername,
  3209. },
  3210. CountFunc: &UsersStoreCountFunc{
  3211. defaultHook: i.Count,
  3212. },
  3213. CreateFunc: &UsersStoreCreateFunc{
  3214. defaultHook: i.Create,
  3215. },
  3216. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  3217. defaultHook: i.DeleteByID,
  3218. },
  3219. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  3220. defaultHook: i.DeleteCustomAvatar,
  3221. },
  3222. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  3223. defaultHook: i.DeleteInactivated,
  3224. },
  3225. FollowFunc: &UsersStoreFollowFunc{
  3226. defaultHook: i.Follow,
  3227. },
  3228. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  3229. defaultHook: i.GetByEmail,
  3230. },
  3231. GetByIDFunc: &UsersStoreGetByIDFunc{
  3232. defaultHook: i.GetByID,
  3233. },
  3234. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  3235. defaultHook: i.GetByKeyID,
  3236. },
  3237. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  3238. defaultHook: i.GetByUsername,
  3239. },
  3240. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  3241. defaultHook: i.GetMailableEmailsByUsernames,
  3242. },
  3243. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  3244. defaultHook: i.IsFollowing,
  3245. },
  3246. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  3247. defaultHook: i.IsUsernameUsed,
  3248. },
  3249. ListFunc: &UsersStoreListFunc{
  3250. defaultHook: i.List,
  3251. },
  3252. ListFollowersFunc: &UsersStoreListFollowersFunc{
  3253. defaultHook: i.ListFollowers,
  3254. },
  3255. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  3256. defaultHook: i.ListFollowings,
  3257. },
  3258. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  3259. defaultHook: i.SearchByName,
  3260. },
  3261. UnfollowFunc: &UsersStoreUnfollowFunc{
  3262. defaultHook: i.Unfollow,
  3263. },
  3264. UpdateFunc: &UsersStoreUpdateFunc{
  3265. defaultHook: i.Update,
  3266. },
  3267. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  3268. defaultHook: i.UseCustomAvatar,
  3269. },
  3270. }
  3271. }
  3272. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  3273. // method of the parent MockUsersStore instance is invoked.
  3274. type UsersStoreAuthenticateFunc struct {
  3275. defaultHook func(context.Context, string, string, int64) (*db.User, error)
  3276. hooks []func(context.Context, string, string, int64) (*db.User, error)
  3277. history []UsersStoreAuthenticateFuncCall
  3278. mutex sync.Mutex
  3279. }
  3280. // Authenticate delegates to the next hook function in the queue and stores
  3281. // the parameter and result values of this invocation.
  3282. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*db.User, error) {
  3283. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  3284. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  3285. return r0, r1
  3286. }
  3287. // SetDefaultHook sets function that is called when the Authenticate method
  3288. // of the parent MockUsersStore instance is invoked and the hook queue is
  3289. // empty.
  3290. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  3291. f.defaultHook = hook
  3292. }
  3293. // PushHook adds a function to the end of hook queue. Each invocation of the
  3294. // Authenticate method of the parent MockUsersStore instance invokes the
  3295. // hook at the front of the queue and discards it. After the queue is empty,
  3296. // the default hook function is invoked for any future action.
  3297. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  3298. f.mutex.Lock()
  3299. f.hooks = append(f.hooks, hook)
  3300. f.mutex.Unlock()
  3301. }
  3302. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3303. // given values.
  3304. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3305. f.SetDefaultHook(func(context.Context, string, string, int64) (*db.User, error) {
  3306. return r0, r1
  3307. })
  3308. }
  3309. // PushReturn calls PushHook with a function that returns the given values.
  3310. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *db.User, r1 error) {
  3311. f.PushHook(func(context.Context, string, string, int64) (*db.User, error) {
  3312. return r0, r1
  3313. })
  3314. }
  3315. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*db.User, error) {
  3316. f.mutex.Lock()
  3317. defer f.mutex.Unlock()
  3318. if len(f.hooks) == 0 {
  3319. return f.defaultHook
  3320. }
  3321. hook := f.hooks[0]
  3322. f.hooks = f.hooks[1:]
  3323. return hook
  3324. }
  3325. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  3326. f.mutex.Lock()
  3327. f.history = append(f.history, r0)
  3328. f.mutex.Unlock()
  3329. }
  3330. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  3331. // describing the invocations of this function.
  3332. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  3333. f.mutex.Lock()
  3334. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  3335. copy(history, f.history)
  3336. f.mutex.Unlock()
  3337. return history
  3338. }
  3339. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  3340. // of method Authenticate on an instance of MockUsersStore.
  3341. type UsersStoreAuthenticateFuncCall struct {
  3342. // Arg0 is the value of the 1st argument passed to this method
  3343. // invocation.
  3344. Arg0 context.Context
  3345. // Arg1 is the value of the 2nd argument passed to this method
  3346. // invocation.
  3347. Arg1 string
  3348. // Arg2 is the value of the 3rd argument passed to this method
  3349. // invocation.
  3350. Arg2 string
  3351. // Arg3 is the value of the 4th argument passed to this method
  3352. // invocation.
  3353. Arg3 int64
  3354. // Result0 is the value of the 1st result returned from this method
  3355. // invocation.
  3356. Result0 *db.User
  3357. // Result1 is the value of the 2nd result returned from this method
  3358. // invocation.
  3359. Result1 error
  3360. }
  3361. // Args returns an interface slice containing the arguments of this
  3362. // invocation.
  3363. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  3364. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3365. }
  3366. // Results returns an interface slice containing the results of this
  3367. // invocation.
  3368. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  3369. return []interface{}{c.Result0, c.Result1}
  3370. }
  3371. // UsersStoreChangeUsernameFunc describes the behavior when the
  3372. // ChangeUsername method of the parent MockUsersStore instance is invoked.
  3373. type UsersStoreChangeUsernameFunc struct {
  3374. defaultHook func(context.Context, int64, string) error
  3375. hooks []func(context.Context, int64, string) error
  3376. history []UsersStoreChangeUsernameFuncCall
  3377. mutex sync.Mutex
  3378. }
  3379. // ChangeUsername delegates to the next hook function in the queue and
  3380. // stores the parameter and result values of this invocation.
  3381. func (m *MockUsersStore) ChangeUsername(v0 context.Context, v1 int64, v2 string) error {
  3382. r0 := m.ChangeUsernameFunc.nextHook()(v0, v1, v2)
  3383. m.ChangeUsernameFunc.appendCall(UsersStoreChangeUsernameFuncCall{v0, v1, v2, r0})
  3384. return r0
  3385. }
  3386. // SetDefaultHook sets function that is called when the ChangeUsername
  3387. // method of the parent MockUsersStore instance is invoked and the hook
  3388. // queue is empty.
  3389. func (f *UsersStoreChangeUsernameFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  3390. f.defaultHook = hook
  3391. }
  3392. // PushHook adds a function to the end of hook queue. Each invocation of the
  3393. // ChangeUsername method of the parent MockUsersStore instance invokes the
  3394. // hook at the front of the queue and discards it. After the queue is empty,
  3395. // the default hook function is invoked for any future action.
  3396. func (f *UsersStoreChangeUsernameFunc) PushHook(hook func(context.Context, int64, string) error) {
  3397. f.mutex.Lock()
  3398. f.hooks = append(f.hooks, hook)
  3399. f.mutex.Unlock()
  3400. }
  3401. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3402. // given values.
  3403. func (f *UsersStoreChangeUsernameFunc) SetDefaultReturn(r0 error) {
  3404. f.SetDefaultHook(func(context.Context, int64, string) error {
  3405. return r0
  3406. })
  3407. }
  3408. // PushReturn calls PushHook with a function that returns the given values.
  3409. func (f *UsersStoreChangeUsernameFunc) PushReturn(r0 error) {
  3410. f.PushHook(func(context.Context, int64, string) error {
  3411. return r0
  3412. })
  3413. }
  3414. func (f *UsersStoreChangeUsernameFunc) nextHook() func(context.Context, int64, string) error {
  3415. f.mutex.Lock()
  3416. defer f.mutex.Unlock()
  3417. if len(f.hooks) == 0 {
  3418. return f.defaultHook
  3419. }
  3420. hook := f.hooks[0]
  3421. f.hooks = f.hooks[1:]
  3422. return hook
  3423. }
  3424. func (f *UsersStoreChangeUsernameFunc) appendCall(r0 UsersStoreChangeUsernameFuncCall) {
  3425. f.mutex.Lock()
  3426. f.history = append(f.history, r0)
  3427. f.mutex.Unlock()
  3428. }
  3429. // History returns a sequence of UsersStoreChangeUsernameFuncCall objects
  3430. // describing the invocations of this function.
  3431. func (f *UsersStoreChangeUsernameFunc) History() []UsersStoreChangeUsernameFuncCall {
  3432. f.mutex.Lock()
  3433. history := make([]UsersStoreChangeUsernameFuncCall, len(f.history))
  3434. copy(history, f.history)
  3435. f.mutex.Unlock()
  3436. return history
  3437. }
  3438. // UsersStoreChangeUsernameFuncCall is an object that describes an
  3439. // invocation of method ChangeUsername on an instance of MockUsersStore.
  3440. type UsersStoreChangeUsernameFuncCall struct {
  3441. // Arg0 is the value of the 1st argument passed to this method
  3442. // invocation.
  3443. Arg0 context.Context
  3444. // Arg1 is the value of the 2nd argument passed to this method
  3445. // invocation.
  3446. Arg1 int64
  3447. // Arg2 is the value of the 3rd argument passed to this method
  3448. // invocation.
  3449. Arg2 string
  3450. // Result0 is the value of the 1st result returned from this method
  3451. // invocation.
  3452. Result0 error
  3453. }
  3454. // Args returns an interface slice containing the arguments of this
  3455. // invocation.
  3456. func (c UsersStoreChangeUsernameFuncCall) Args() []interface{} {
  3457. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3458. }
  3459. // Results returns an interface slice containing the results of this
  3460. // invocation.
  3461. func (c UsersStoreChangeUsernameFuncCall) Results() []interface{} {
  3462. return []interface{}{c.Result0}
  3463. }
  3464. // UsersStoreCountFunc describes the behavior when the Count method of the
  3465. // parent MockUsersStore instance is invoked.
  3466. type UsersStoreCountFunc struct {
  3467. defaultHook func(context.Context) int64
  3468. hooks []func(context.Context) int64
  3469. history []UsersStoreCountFuncCall
  3470. mutex sync.Mutex
  3471. }
  3472. // Count delegates to the next hook function in the queue and stores the
  3473. // parameter and result values of this invocation.
  3474. func (m *MockUsersStore) Count(v0 context.Context) int64 {
  3475. r0 := m.CountFunc.nextHook()(v0)
  3476. m.CountFunc.appendCall(UsersStoreCountFuncCall{v0, r0})
  3477. return r0
  3478. }
  3479. // SetDefaultHook sets function that is called when the Count method of the
  3480. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3481. func (f *UsersStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  3482. f.defaultHook = hook
  3483. }
  3484. // PushHook adds a function to the end of hook queue. Each invocation of the
  3485. // Count method of the parent MockUsersStore instance invokes the hook at
  3486. // the front of the queue and discards it. After the queue is empty, the
  3487. // default hook function is invoked for any future action.
  3488. func (f *UsersStoreCountFunc) PushHook(hook func(context.Context) int64) {
  3489. f.mutex.Lock()
  3490. f.hooks = append(f.hooks, hook)
  3491. f.mutex.Unlock()
  3492. }
  3493. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3494. // given values.
  3495. func (f *UsersStoreCountFunc) SetDefaultReturn(r0 int64) {
  3496. f.SetDefaultHook(func(context.Context) int64 {
  3497. return r0
  3498. })
  3499. }
  3500. // PushReturn calls PushHook with a function that returns the given values.
  3501. func (f *UsersStoreCountFunc) PushReturn(r0 int64) {
  3502. f.PushHook(func(context.Context) int64 {
  3503. return r0
  3504. })
  3505. }
  3506. func (f *UsersStoreCountFunc) nextHook() func(context.Context) int64 {
  3507. f.mutex.Lock()
  3508. defer f.mutex.Unlock()
  3509. if len(f.hooks) == 0 {
  3510. return f.defaultHook
  3511. }
  3512. hook := f.hooks[0]
  3513. f.hooks = f.hooks[1:]
  3514. return hook
  3515. }
  3516. func (f *UsersStoreCountFunc) appendCall(r0 UsersStoreCountFuncCall) {
  3517. f.mutex.Lock()
  3518. f.history = append(f.history, r0)
  3519. f.mutex.Unlock()
  3520. }
  3521. // History returns a sequence of UsersStoreCountFuncCall objects describing
  3522. // the invocations of this function.
  3523. func (f *UsersStoreCountFunc) History() []UsersStoreCountFuncCall {
  3524. f.mutex.Lock()
  3525. history := make([]UsersStoreCountFuncCall, len(f.history))
  3526. copy(history, f.history)
  3527. f.mutex.Unlock()
  3528. return history
  3529. }
  3530. // UsersStoreCountFuncCall is an object that describes an invocation of
  3531. // method Count on an instance of MockUsersStore.
  3532. type UsersStoreCountFuncCall struct {
  3533. // Arg0 is the value of the 1st argument passed to this method
  3534. // invocation.
  3535. Arg0 context.Context
  3536. // Result0 is the value of the 1st result returned from this method
  3537. // invocation.
  3538. Result0 int64
  3539. }
  3540. // Args returns an interface slice containing the arguments of this
  3541. // invocation.
  3542. func (c UsersStoreCountFuncCall) Args() []interface{} {
  3543. return []interface{}{c.Arg0}
  3544. }
  3545. // Results returns an interface slice containing the results of this
  3546. // invocation.
  3547. func (c UsersStoreCountFuncCall) Results() []interface{} {
  3548. return []interface{}{c.Result0}
  3549. }
  3550. // UsersStoreCreateFunc describes the behavior when the Create method of the
  3551. // parent MockUsersStore instance is invoked.
  3552. type UsersStoreCreateFunc struct {
  3553. defaultHook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  3554. hooks []func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  3555. history []UsersStoreCreateFuncCall
  3556. mutex sync.Mutex
  3557. }
  3558. // Create delegates to the next hook function in the queue and stores the
  3559. // parameter and result values of this invocation.
  3560. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.CreateUserOptions) (*db.User, error) {
  3561. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  3562. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  3563. return r0, r1
  3564. }
  3565. // SetDefaultHook sets function that is called when the Create method of the
  3566. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3567. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  3568. f.defaultHook = hook
  3569. }
  3570. // PushHook adds a function to the end of hook queue. Each invocation of the
  3571. // Create method of the parent MockUsersStore instance invokes the hook at
  3572. // the front of the queue and discards it. After the queue is empty, the
  3573. // default hook function is invoked for any future action.
  3574. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  3575. f.mutex.Lock()
  3576. f.hooks = append(f.hooks, hook)
  3577. f.mutex.Unlock()
  3578. }
  3579. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3580. // given values.
  3581. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3582. f.SetDefaultHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3583. return r0, r1
  3584. })
  3585. }
  3586. // PushReturn calls PushHook with a function that returns the given values.
  3587. func (f *UsersStoreCreateFunc) PushReturn(r0 *db.User, r1 error) {
  3588. f.PushHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3589. return r0, r1
  3590. })
  3591. }
  3592. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3593. f.mutex.Lock()
  3594. defer f.mutex.Unlock()
  3595. if len(f.hooks) == 0 {
  3596. return f.defaultHook
  3597. }
  3598. hook := f.hooks[0]
  3599. f.hooks = f.hooks[1:]
  3600. return hook
  3601. }
  3602. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  3603. f.mutex.Lock()
  3604. f.history = append(f.history, r0)
  3605. f.mutex.Unlock()
  3606. }
  3607. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  3608. // the invocations of this function.
  3609. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  3610. f.mutex.Lock()
  3611. history := make([]UsersStoreCreateFuncCall, len(f.history))
  3612. copy(history, f.history)
  3613. f.mutex.Unlock()
  3614. return history
  3615. }
  3616. // UsersStoreCreateFuncCall is an object that describes an invocation of
  3617. // method Create on an instance of MockUsersStore.
  3618. type UsersStoreCreateFuncCall struct {
  3619. // Arg0 is the value of the 1st argument passed to this method
  3620. // invocation.
  3621. Arg0 context.Context
  3622. // Arg1 is the value of the 2nd argument passed to this method
  3623. // invocation.
  3624. Arg1 string
  3625. // Arg2 is the value of the 3rd argument passed to this method
  3626. // invocation.
  3627. Arg2 string
  3628. // Arg3 is the value of the 4th argument passed to this method
  3629. // invocation.
  3630. Arg3 db.CreateUserOptions
  3631. // Result0 is the value of the 1st result returned from this method
  3632. // invocation.
  3633. Result0 *db.User
  3634. // Result1 is the value of the 2nd result returned from this method
  3635. // invocation.
  3636. Result1 error
  3637. }
  3638. // Args returns an interface slice containing the arguments of this
  3639. // invocation.
  3640. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  3641. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3642. }
  3643. // Results returns an interface slice containing the results of this
  3644. // invocation.
  3645. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  3646. return []interface{}{c.Result0, c.Result1}
  3647. }
  3648. // UsersStoreDeleteByIDFunc describes the behavior when the DeleteByID
  3649. // method of the parent MockUsersStore instance is invoked.
  3650. type UsersStoreDeleteByIDFunc struct {
  3651. defaultHook func(context.Context, int64, bool) error
  3652. hooks []func(context.Context, int64, bool) error
  3653. history []UsersStoreDeleteByIDFuncCall
  3654. mutex sync.Mutex
  3655. }
  3656. // DeleteByID delegates to the next hook function in the queue and stores
  3657. // the parameter and result values of this invocation.
  3658. func (m *MockUsersStore) DeleteByID(v0 context.Context, v1 int64, v2 bool) error {
  3659. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  3660. m.DeleteByIDFunc.appendCall(UsersStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  3661. return r0
  3662. }
  3663. // SetDefaultHook sets function that is called when the DeleteByID method of
  3664. // the parent MockUsersStore instance is invoked and the hook queue is
  3665. // empty.
  3666. func (f *UsersStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, bool) error) {
  3667. f.defaultHook = hook
  3668. }
  3669. // PushHook adds a function to the end of hook queue. Each invocation of the
  3670. // DeleteByID method of the parent MockUsersStore instance invokes the hook
  3671. // at the front of the queue and discards it. After the queue is empty, the
  3672. // default hook function is invoked for any future action.
  3673. func (f *UsersStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, bool) error) {
  3674. f.mutex.Lock()
  3675. f.hooks = append(f.hooks, hook)
  3676. f.mutex.Unlock()
  3677. }
  3678. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3679. // given values.
  3680. func (f *UsersStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  3681. f.SetDefaultHook(func(context.Context, int64, bool) error {
  3682. return r0
  3683. })
  3684. }
  3685. // PushReturn calls PushHook with a function that returns the given values.
  3686. func (f *UsersStoreDeleteByIDFunc) PushReturn(r0 error) {
  3687. f.PushHook(func(context.Context, int64, bool) error {
  3688. return r0
  3689. })
  3690. }
  3691. func (f *UsersStoreDeleteByIDFunc) nextHook() func(context.Context, int64, bool) error {
  3692. f.mutex.Lock()
  3693. defer f.mutex.Unlock()
  3694. if len(f.hooks) == 0 {
  3695. return f.defaultHook
  3696. }
  3697. hook := f.hooks[0]
  3698. f.hooks = f.hooks[1:]
  3699. return hook
  3700. }
  3701. func (f *UsersStoreDeleteByIDFunc) appendCall(r0 UsersStoreDeleteByIDFuncCall) {
  3702. f.mutex.Lock()
  3703. f.history = append(f.history, r0)
  3704. f.mutex.Unlock()
  3705. }
  3706. // History returns a sequence of UsersStoreDeleteByIDFuncCall objects
  3707. // describing the invocations of this function.
  3708. func (f *UsersStoreDeleteByIDFunc) History() []UsersStoreDeleteByIDFuncCall {
  3709. f.mutex.Lock()
  3710. history := make([]UsersStoreDeleteByIDFuncCall, len(f.history))
  3711. copy(history, f.history)
  3712. f.mutex.Unlock()
  3713. return history
  3714. }
  3715. // UsersStoreDeleteByIDFuncCall is an object that describes an invocation of
  3716. // method DeleteByID on an instance of MockUsersStore.
  3717. type UsersStoreDeleteByIDFuncCall struct {
  3718. // Arg0 is the value of the 1st argument passed to this method
  3719. // invocation.
  3720. Arg0 context.Context
  3721. // Arg1 is the value of the 2nd argument passed to this method
  3722. // invocation.
  3723. Arg1 int64
  3724. // Arg2 is the value of the 3rd argument passed to this method
  3725. // invocation.
  3726. Arg2 bool
  3727. // Result0 is the value of the 1st result returned from this method
  3728. // invocation.
  3729. Result0 error
  3730. }
  3731. // Args returns an interface slice containing the arguments of this
  3732. // invocation.
  3733. func (c UsersStoreDeleteByIDFuncCall) Args() []interface{} {
  3734. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3735. }
  3736. // Results returns an interface slice containing the results of this
  3737. // invocation.
  3738. func (c UsersStoreDeleteByIDFuncCall) Results() []interface{} {
  3739. return []interface{}{c.Result0}
  3740. }
  3741. // UsersStoreDeleteCustomAvatarFunc describes the behavior when the
  3742. // DeleteCustomAvatar method of the parent MockUsersStore instance is
  3743. // invoked.
  3744. type UsersStoreDeleteCustomAvatarFunc struct {
  3745. defaultHook func(context.Context, int64) error
  3746. hooks []func(context.Context, int64) error
  3747. history []UsersStoreDeleteCustomAvatarFuncCall
  3748. mutex sync.Mutex
  3749. }
  3750. // DeleteCustomAvatar delegates to the next hook function in the queue and
  3751. // stores the parameter and result values of this invocation.
  3752. func (m *MockUsersStore) DeleteCustomAvatar(v0 context.Context, v1 int64) error {
  3753. r0 := m.DeleteCustomAvatarFunc.nextHook()(v0, v1)
  3754. m.DeleteCustomAvatarFunc.appendCall(UsersStoreDeleteCustomAvatarFuncCall{v0, v1, r0})
  3755. return r0
  3756. }
  3757. // SetDefaultHook sets function that is called when the DeleteCustomAvatar
  3758. // method of the parent MockUsersStore instance is invoked and the hook
  3759. // queue is empty.
  3760. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  3761. f.defaultHook = hook
  3762. }
  3763. // PushHook adds a function to the end of hook queue. Each invocation of the
  3764. // DeleteCustomAvatar method of the parent MockUsersStore instance invokes
  3765. // the hook at the front of the queue and discards it. After the queue is
  3766. // empty, the default hook function is invoked for any future action.
  3767. func (f *UsersStoreDeleteCustomAvatarFunc) PushHook(hook func(context.Context, int64) error) {
  3768. f.mutex.Lock()
  3769. f.hooks = append(f.hooks, hook)
  3770. f.mutex.Unlock()
  3771. }
  3772. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3773. // given values.
  3774. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultReturn(r0 error) {
  3775. f.SetDefaultHook(func(context.Context, int64) error {
  3776. return r0
  3777. })
  3778. }
  3779. // PushReturn calls PushHook with a function that returns the given values.
  3780. func (f *UsersStoreDeleteCustomAvatarFunc) PushReturn(r0 error) {
  3781. f.PushHook(func(context.Context, int64) error {
  3782. return r0
  3783. })
  3784. }
  3785. func (f *UsersStoreDeleteCustomAvatarFunc) nextHook() func(context.Context, int64) error {
  3786. f.mutex.Lock()
  3787. defer f.mutex.Unlock()
  3788. if len(f.hooks) == 0 {
  3789. return f.defaultHook
  3790. }
  3791. hook := f.hooks[0]
  3792. f.hooks = f.hooks[1:]
  3793. return hook
  3794. }
  3795. func (f *UsersStoreDeleteCustomAvatarFunc) appendCall(r0 UsersStoreDeleteCustomAvatarFuncCall) {
  3796. f.mutex.Lock()
  3797. f.history = append(f.history, r0)
  3798. f.mutex.Unlock()
  3799. }
  3800. // History returns a sequence of UsersStoreDeleteCustomAvatarFuncCall
  3801. // objects describing the invocations of this function.
  3802. func (f *UsersStoreDeleteCustomAvatarFunc) History() []UsersStoreDeleteCustomAvatarFuncCall {
  3803. f.mutex.Lock()
  3804. history := make([]UsersStoreDeleteCustomAvatarFuncCall, len(f.history))
  3805. copy(history, f.history)
  3806. f.mutex.Unlock()
  3807. return history
  3808. }
  3809. // UsersStoreDeleteCustomAvatarFuncCall is an object that describes an
  3810. // invocation of method DeleteCustomAvatar on an instance of MockUsersStore.
  3811. type UsersStoreDeleteCustomAvatarFuncCall struct {
  3812. // Arg0 is the value of the 1st argument passed to this method
  3813. // invocation.
  3814. Arg0 context.Context
  3815. // Arg1 is the value of the 2nd argument passed to this method
  3816. // invocation.
  3817. Arg1 int64
  3818. // Result0 is the value of the 1st result returned from this method
  3819. // invocation.
  3820. Result0 error
  3821. }
  3822. // Args returns an interface slice containing the arguments of this
  3823. // invocation.
  3824. func (c UsersStoreDeleteCustomAvatarFuncCall) Args() []interface{} {
  3825. return []interface{}{c.Arg0, c.Arg1}
  3826. }
  3827. // Results returns an interface slice containing the results of this
  3828. // invocation.
  3829. func (c UsersStoreDeleteCustomAvatarFuncCall) Results() []interface{} {
  3830. return []interface{}{c.Result0}
  3831. }
  3832. // UsersStoreDeleteInactivatedFunc describes the behavior when the
  3833. // DeleteInactivated method of the parent MockUsersStore instance is
  3834. // invoked.
  3835. type UsersStoreDeleteInactivatedFunc struct {
  3836. defaultHook func() error
  3837. hooks []func() error
  3838. history []UsersStoreDeleteInactivatedFuncCall
  3839. mutex sync.Mutex
  3840. }
  3841. // DeleteInactivated delegates to the next hook function in the queue and
  3842. // stores the parameter and result values of this invocation.
  3843. func (m *MockUsersStore) DeleteInactivated() error {
  3844. r0 := m.DeleteInactivatedFunc.nextHook()()
  3845. m.DeleteInactivatedFunc.appendCall(UsersStoreDeleteInactivatedFuncCall{r0})
  3846. return r0
  3847. }
  3848. // SetDefaultHook sets function that is called when the DeleteInactivated
  3849. // method of the parent MockUsersStore instance is invoked and the hook
  3850. // queue is empty.
  3851. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultHook(hook func() error) {
  3852. f.defaultHook = hook
  3853. }
  3854. // PushHook adds a function to the end of hook queue. Each invocation of the
  3855. // DeleteInactivated method of the parent MockUsersStore instance invokes
  3856. // the hook at the front of the queue and discards it. After the queue is
  3857. // empty, the default hook function is invoked for any future action.
  3858. func (f *UsersStoreDeleteInactivatedFunc) PushHook(hook func() error) {
  3859. f.mutex.Lock()
  3860. f.hooks = append(f.hooks, hook)
  3861. f.mutex.Unlock()
  3862. }
  3863. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3864. // given values.
  3865. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultReturn(r0 error) {
  3866. f.SetDefaultHook(func() error {
  3867. return r0
  3868. })
  3869. }
  3870. // PushReturn calls PushHook with a function that returns the given values.
  3871. func (f *UsersStoreDeleteInactivatedFunc) PushReturn(r0 error) {
  3872. f.PushHook(func() error {
  3873. return r0
  3874. })
  3875. }
  3876. func (f *UsersStoreDeleteInactivatedFunc) nextHook() func() error {
  3877. f.mutex.Lock()
  3878. defer f.mutex.Unlock()
  3879. if len(f.hooks) == 0 {
  3880. return f.defaultHook
  3881. }
  3882. hook := f.hooks[0]
  3883. f.hooks = f.hooks[1:]
  3884. return hook
  3885. }
  3886. func (f *UsersStoreDeleteInactivatedFunc) appendCall(r0 UsersStoreDeleteInactivatedFuncCall) {
  3887. f.mutex.Lock()
  3888. f.history = append(f.history, r0)
  3889. f.mutex.Unlock()
  3890. }
  3891. // History returns a sequence of UsersStoreDeleteInactivatedFuncCall objects
  3892. // describing the invocations of this function.
  3893. func (f *UsersStoreDeleteInactivatedFunc) History() []UsersStoreDeleteInactivatedFuncCall {
  3894. f.mutex.Lock()
  3895. history := make([]UsersStoreDeleteInactivatedFuncCall, len(f.history))
  3896. copy(history, f.history)
  3897. f.mutex.Unlock()
  3898. return history
  3899. }
  3900. // UsersStoreDeleteInactivatedFuncCall is an object that describes an
  3901. // invocation of method DeleteInactivated on an instance of MockUsersStore.
  3902. type UsersStoreDeleteInactivatedFuncCall struct {
  3903. // Result0 is the value of the 1st result returned from this method
  3904. // invocation.
  3905. Result0 error
  3906. }
  3907. // Args returns an interface slice containing the arguments of this
  3908. // invocation.
  3909. func (c UsersStoreDeleteInactivatedFuncCall) Args() []interface{} {
  3910. return []interface{}{}
  3911. }
  3912. // Results returns an interface slice containing the results of this
  3913. // invocation.
  3914. func (c UsersStoreDeleteInactivatedFuncCall) Results() []interface{} {
  3915. return []interface{}{c.Result0}
  3916. }
  3917. // UsersStoreFollowFunc describes the behavior when the Follow method of the
  3918. // parent MockUsersStore instance is invoked.
  3919. type UsersStoreFollowFunc struct {
  3920. defaultHook func(context.Context, int64, int64) error
  3921. hooks []func(context.Context, int64, int64) error
  3922. history []UsersStoreFollowFuncCall
  3923. mutex sync.Mutex
  3924. }
  3925. // Follow delegates to the next hook function in the queue and stores the
  3926. // parameter and result values of this invocation.
  3927. func (m *MockUsersStore) Follow(v0 context.Context, v1 int64, v2 int64) error {
  3928. r0 := m.FollowFunc.nextHook()(v0, v1, v2)
  3929. m.FollowFunc.appendCall(UsersStoreFollowFuncCall{v0, v1, v2, r0})
  3930. return r0
  3931. }
  3932. // SetDefaultHook sets function that is called when the Follow method of the
  3933. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3934. func (f *UsersStoreFollowFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  3935. f.defaultHook = hook
  3936. }
  3937. // PushHook adds a function to the end of hook queue. Each invocation of the
  3938. // Follow method of the parent MockUsersStore instance invokes the hook at
  3939. // the front of the queue and discards it. After the queue is empty, the
  3940. // default hook function is invoked for any future action.
  3941. func (f *UsersStoreFollowFunc) PushHook(hook func(context.Context, int64, int64) error) {
  3942. f.mutex.Lock()
  3943. f.hooks = append(f.hooks, hook)
  3944. f.mutex.Unlock()
  3945. }
  3946. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3947. // given values.
  3948. func (f *UsersStoreFollowFunc) SetDefaultReturn(r0 error) {
  3949. f.SetDefaultHook(func(context.Context, int64, int64) error {
  3950. return r0
  3951. })
  3952. }
  3953. // PushReturn calls PushHook with a function that returns the given values.
  3954. func (f *UsersStoreFollowFunc) PushReturn(r0 error) {
  3955. f.PushHook(func(context.Context, int64, int64) error {
  3956. return r0
  3957. })
  3958. }
  3959. func (f *UsersStoreFollowFunc) nextHook() func(context.Context, int64, int64) error {
  3960. f.mutex.Lock()
  3961. defer f.mutex.Unlock()
  3962. if len(f.hooks) == 0 {
  3963. return f.defaultHook
  3964. }
  3965. hook := f.hooks[0]
  3966. f.hooks = f.hooks[1:]
  3967. return hook
  3968. }
  3969. func (f *UsersStoreFollowFunc) appendCall(r0 UsersStoreFollowFuncCall) {
  3970. f.mutex.Lock()
  3971. f.history = append(f.history, r0)
  3972. f.mutex.Unlock()
  3973. }
  3974. // History returns a sequence of UsersStoreFollowFuncCall objects describing
  3975. // the invocations of this function.
  3976. func (f *UsersStoreFollowFunc) History() []UsersStoreFollowFuncCall {
  3977. f.mutex.Lock()
  3978. history := make([]UsersStoreFollowFuncCall, len(f.history))
  3979. copy(history, f.history)
  3980. f.mutex.Unlock()
  3981. return history
  3982. }
  3983. // UsersStoreFollowFuncCall is an object that describes an invocation of
  3984. // method Follow on an instance of MockUsersStore.
  3985. type UsersStoreFollowFuncCall struct {
  3986. // Arg0 is the value of the 1st argument passed to this method
  3987. // invocation.
  3988. Arg0 context.Context
  3989. // Arg1 is the value of the 2nd argument passed to this method
  3990. // invocation.
  3991. Arg1 int64
  3992. // Arg2 is the value of the 3rd argument passed to this method
  3993. // invocation.
  3994. Arg2 int64
  3995. // Result0 is the value of the 1st result returned from this method
  3996. // invocation.
  3997. Result0 error
  3998. }
  3999. // Args returns an interface slice containing the arguments of this
  4000. // invocation.
  4001. func (c UsersStoreFollowFuncCall) Args() []interface{} {
  4002. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4003. }
  4004. // Results returns an interface slice containing the results of this
  4005. // invocation.
  4006. func (c UsersStoreFollowFuncCall) Results() []interface{} {
  4007. return []interface{}{c.Result0}
  4008. }
  4009. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  4010. // method of the parent MockUsersStore instance is invoked.
  4011. type UsersStoreGetByEmailFunc struct {
  4012. defaultHook func(context.Context, string) (*db.User, error)
  4013. hooks []func(context.Context, string) (*db.User, error)
  4014. history []UsersStoreGetByEmailFuncCall
  4015. mutex sync.Mutex
  4016. }
  4017. // GetByEmail delegates to the next hook function in the queue and stores
  4018. // the parameter and result values of this invocation.
  4019. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*db.User, error) {
  4020. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  4021. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  4022. return r0, r1
  4023. }
  4024. // SetDefaultHook sets function that is called when the GetByEmail method of
  4025. // the parent MockUsersStore instance is invoked and the hook queue is
  4026. // empty.
  4027. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  4028. f.defaultHook = hook
  4029. }
  4030. // PushHook adds a function to the end of hook queue. Each invocation of the
  4031. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  4032. // at the front of the queue and discards it. After the queue is empty, the
  4033. // default hook function is invoked for any future action.
  4034. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  4035. f.mutex.Lock()
  4036. f.hooks = append(f.hooks, hook)
  4037. f.mutex.Unlock()
  4038. }
  4039. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4040. // given values.
  4041. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4042. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  4043. return r0, r1
  4044. })
  4045. }
  4046. // PushReturn calls PushHook with a function that returns the given values.
  4047. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *db.User, r1 error) {
  4048. f.PushHook(func(context.Context, string) (*db.User, error) {
  4049. return r0, r1
  4050. })
  4051. }
  4052. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*db.User, error) {
  4053. f.mutex.Lock()
  4054. defer f.mutex.Unlock()
  4055. if len(f.hooks) == 0 {
  4056. return f.defaultHook
  4057. }
  4058. hook := f.hooks[0]
  4059. f.hooks = f.hooks[1:]
  4060. return hook
  4061. }
  4062. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  4063. f.mutex.Lock()
  4064. f.history = append(f.history, r0)
  4065. f.mutex.Unlock()
  4066. }
  4067. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  4068. // describing the invocations of this function.
  4069. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  4070. f.mutex.Lock()
  4071. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  4072. copy(history, f.history)
  4073. f.mutex.Unlock()
  4074. return history
  4075. }
  4076. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  4077. // method GetByEmail on an instance of MockUsersStore.
  4078. type UsersStoreGetByEmailFuncCall struct {
  4079. // Arg0 is the value of the 1st argument passed to this method
  4080. // invocation.
  4081. Arg0 context.Context
  4082. // Arg1 is the value of the 2nd argument passed to this method
  4083. // invocation.
  4084. Arg1 string
  4085. // Result0 is the value of the 1st result returned from this method
  4086. // invocation.
  4087. Result0 *db.User
  4088. // Result1 is the value of the 2nd result returned from this method
  4089. // invocation.
  4090. Result1 error
  4091. }
  4092. // Args returns an interface slice containing the arguments of this
  4093. // invocation.
  4094. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  4095. return []interface{}{c.Arg0, c.Arg1}
  4096. }
  4097. // Results returns an interface slice containing the results of this
  4098. // invocation.
  4099. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  4100. return []interface{}{c.Result0, c.Result1}
  4101. }
  4102. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  4103. // the parent MockUsersStore instance is invoked.
  4104. type UsersStoreGetByIDFunc struct {
  4105. defaultHook func(context.Context, int64) (*db.User, error)
  4106. hooks []func(context.Context, int64) (*db.User, error)
  4107. history []UsersStoreGetByIDFuncCall
  4108. mutex sync.Mutex
  4109. }
  4110. // GetByID delegates to the next hook function in the queue and stores the
  4111. // parameter and result values of this invocation.
  4112. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*db.User, error) {
  4113. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  4114. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  4115. return r0, r1
  4116. }
  4117. // SetDefaultHook sets function that is called when the GetByID method of
  4118. // the parent MockUsersStore instance is invoked and the hook queue is
  4119. // empty.
  4120. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  4121. f.defaultHook = hook
  4122. }
  4123. // PushHook adds a function to the end of hook queue. Each invocation of the
  4124. // GetByID method of the parent MockUsersStore instance invokes the hook at
  4125. // the front of the queue and discards it. After the queue is empty, the
  4126. // default hook function is invoked for any future action.
  4127. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  4128. f.mutex.Lock()
  4129. f.hooks = append(f.hooks, hook)
  4130. f.mutex.Unlock()
  4131. }
  4132. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4133. // given values.
  4134. func (f *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4135. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  4136. return r0, r1
  4137. })
  4138. }
  4139. // PushReturn calls PushHook with a function that returns the given values.
  4140. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *db.User, r1 error) {
  4141. f.PushHook(func(context.Context, int64) (*db.User, error) {
  4142. return r0, r1
  4143. })
  4144. }
  4145. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  4146. f.mutex.Lock()
  4147. defer f.mutex.Unlock()
  4148. if len(f.hooks) == 0 {
  4149. return f.defaultHook
  4150. }
  4151. hook := f.hooks[0]
  4152. f.hooks = f.hooks[1:]
  4153. return hook
  4154. }
  4155. func (f *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  4156. f.mutex.Lock()
  4157. f.history = append(f.history, r0)
  4158. f.mutex.Unlock()
  4159. }
  4160. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  4161. // describing the invocations of this function.
  4162. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  4163. f.mutex.Lock()
  4164. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  4165. copy(history, f.history)
  4166. f.mutex.Unlock()
  4167. return history
  4168. }
  4169. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  4170. // method GetByID on an instance of MockUsersStore.
  4171. type UsersStoreGetByIDFuncCall struct {
  4172. // Arg0 is the value of the 1st argument passed to this method
  4173. // invocation.
  4174. Arg0 context.Context
  4175. // Arg1 is the value of the 2nd argument passed to this method
  4176. // invocation.
  4177. Arg1 int64
  4178. // Result0 is the value of the 1st result returned from this method
  4179. // invocation.
  4180. Result0 *db.User
  4181. // Result1 is the value of the 2nd result returned from this method
  4182. // invocation.
  4183. Result1 error
  4184. }
  4185. // Args returns an interface slice containing the arguments of this
  4186. // invocation.
  4187. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  4188. return []interface{}{c.Arg0, c.Arg1}
  4189. }
  4190. // Results returns an interface slice containing the results of this
  4191. // invocation.
  4192. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  4193. return []interface{}{c.Result0, c.Result1}
  4194. }
  4195. // UsersStoreGetByKeyIDFunc describes the behavior when the GetByKeyID
  4196. // method of the parent MockUsersStore instance is invoked.
  4197. type UsersStoreGetByKeyIDFunc struct {
  4198. defaultHook func(context.Context, int64) (*db.User, error)
  4199. hooks []func(context.Context, int64) (*db.User, error)
  4200. history []UsersStoreGetByKeyIDFuncCall
  4201. mutex sync.Mutex
  4202. }
  4203. // GetByKeyID delegates to the next hook function in the queue and stores
  4204. // the parameter and result values of this invocation.
  4205. func (m *MockUsersStore) GetByKeyID(v0 context.Context, v1 int64) (*db.User, error) {
  4206. r0, r1 := m.GetByKeyIDFunc.nextHook()(v0, v1)
  4207. m.GetByKeyIDFunc.appendCall(UsersStoreGetByKeyIDFuncCall{v0, v1, r0, r1})
  4208. return r0, r1
  4209. }
  4210. // SetDefaultHook sets function that is called when the GetByKeyID method of
  4211. // the parent MockUsersStore instance is invoked and the hook queue is
  4212. // empty.
  4213. func (f *UsersStoreGetByKeyIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  4214. f.defaultHook = hook
  4215. }
  4216. // PushHook adds a function to the end of hook queue. Each invocation of the
  4217. // GetByKeyID method of the parent MockUsersStore instance invokes the hook
  4218. // at the front of the queue and discards it. After the queue is empty, the
  4219. // default hook function is invoked for any future action.
  4220. func (f *UsersStoreGetByKeyIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  4221. f.mutex.Lock()
  4222. f.hooks = append(f.hooks, hook)
  4223. f.mutex.Unlock()
  4224. }
  4225. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4226. // given values.
  4227. func (f *UsersStoreGetByKeyIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4228. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  4229. return r0, r1
  4230. })
  4231. }
  4232. // PushReturn calls PushHook with a function that returns the given values.
  4233. func (f *UsersStoreGetByKeyIDFunc) PushReturn(r0 *db.User, r1 error) {
  4234. f.PushHook(func(context.Context, int64) (*db.User, error) {
  4235. return r0, r1
  4236. })
  4237. }
  4238. func (f *UsersStoreGetByKeyIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  4239. f.mutex.Lock()
  4240. defer f.mutex.Unlock()
  4241. if len(f.hooks) == 0 {
  4242. return f.defaultHook
  4243. }
  4244. hook := f.hooks[0]
  4245. f.hooks = f.hooks[1:]
  4246. return hook
  4247. }
  4248. func (f *UsersStoreGetByKeyIDFunc) appendCall(r0 UsersStoreGetByKeyIDFuncCall) {
  4249. f.mutex.Lock()
  4250. f.history = append(f.history, r0)
  4251. f.mutex.Unlock()
  4252. }
  4253. // History returns a sequence of UsersStoreGetByKeyIDFuncCall objects
  4254. // describing the invocations of this function.
  4255. func (f *UsersStoreGetByKeyIDFunc) History() []UsersStoreGetByKeyIDFuncCall {
  4256. f.mutex.Lock()
  4257. history := make([]UsersStoreGetByKeyIDFuncCall, len(f.history))
  4258. copy(history, f.history)
  4259. f.mutex.Unlock()
  4260. return history
  4261. }
  4262. // UsersStoreGetByKeyIDFuncCall is an object that describes an invocation of
  4263. // method GetByKeyID on an instance of MockUsersStore.
  4264. type UsersStoreGetByKeyIDFuncCall struct {
  4265. // Arg0 is the value of the 1st argument passed to this method
  4266. // invocation.
  4267. Arg0 context.Context
  4268. // Arg1 is the value of the 2nd argument passed to this method
  4269. // invocation.
  4270. Arg1 int64
  4271. // Result0 is the value of the 1st result returned from this method
  4272. // invocation.
  4273. Result0 *db.User
  4274. // Result1 is the value of the 2nd result returned from this method
  4275. // invocation.
  4276. Result1 error
  4277. }
  4278. // Args returns an interface slice containing the arguments of this
  4279. // invocation.
  4280. func (c UsersStoreGetByKeyIDFuncCall) Args() []interface{} {
  4281. return []interface{}{c.Arg0, c.Arg1}
  4282. }
  4283. // Results returns an interface slice containing the results of this
  4284. // invocation.
  4285. func (c UsersStoreGetByKeyIDFuncCall) Results() []interface{} {
  4286. return []interface{}{c.Result0, c.Result1}
  4287. }
  4288. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  4289. // method of the parent MockUsersStore instance is invoked.
  4290. type UsersStoreGetByUsernameFunc struct {
  4291. defaultHook func(context.Context, string) (*db.User, error)
  4292. hooks []func(context.Context, string) (*db.User, error)
  4293. history []UsersStoreGetByUsernameFuncCall
  4294. mutex sync.Mutex
  4295. }
  4296. // GetByUsername delegates to the next hook function in the queue and stores
  4297. // the parameter and result values of this invocation.
  4298. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*db.User, error) {
  4299. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  4300. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  4301. return r0, r1
  4302. }
  4303. // SetDefaultHook sets function that is called when the GetByUsername method
  4304. // of the parent MockUsersStore instance is invoked and the hook queue is
  4305. // empty.
  4306. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  4307. f.defaultHook = hook
  4308. }
  4309. // PushHook adds a function to the end of hook queue. Each invocation of the
  4310. // GetByUsername method of the parent MockUsersStore instance invokes the
  4311. // hook at the front of the queue and discards it. After the queue is empty,
  4312. // the default hook function is invoked for any future action.
  4313. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  4314. f.mutex.Lock()
  4315. f.hooks = append(f.hooks, hook)
  4316. f.mutex.Unlock()
  4317. }
  4318. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4319. // given values.
  4320. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4321. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  4322. return r0, r1
  4323. })
  4324. }
  4325. // PushReturn calls PushHook with a function that returns the given values.
  4326. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *db.User, r1 error) {
  4327. f.PushHook(func(context.Context, string) (*db.User, error) {
  4328. return r0, r1
  4329. })
  4330. }
  4331. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*db.User, error) {
  4332. f.mutex.Lock()
  4333. defer f.mutex.Unlock()
  4334. if len(f.hooks) == 0 {
  4335. return f.defaultHook
  4336. }
  4337. hook := f.hooks[0]
  4338. f.hooks = f.hooks[1:]
  4339. return hook
  4340. }
  4341. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  4342. f.mutex.Lock()
  4343. f.history = append(f.history, r0)
  4344. f.mutex.Unlock()
  4345. }
  4346. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  4347. // describing the invocations of this function.
  4348. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  4349. f.mutex.Lock()
  4350. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  4351. copy(history, f.history)
  4352. f.mutex.Unlock()
  4353. return history
  4354. }
  4355. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  4356. // of method GetByUsername on an instance of MockUsersStore.
  4357. type UsersStoreGetByUsernameFuncCall struct {
  4358. // Arg0 is the value of the 1st argument passed to this method
  4359. // invocation.
  4360. Arg0 context.Context
  4361. // Arg1 is the value of the 2nd argument passed to this method
  4362. // invocation.
  4363. Arg1 string
  4364. // Result0 is the value of the 1st result returned from this method
  4365. // invocation.
  4366. Result0 *db.User
  4367. // Result1 is the value of the 2nd result returned from this method
  4368. // invocation.
  4369. Result1 error
  4370. }
  4371. // Args returns an interface slice containing the arguments of this
  4372. // invocation.
  4373. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  4374. return []interface{}{c.Arg0, c.Arg1}
  4375. }
  4376. // Results returns an interface slice containing the results of this
  4377. // invocation.
  4378. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  4379. return []interface{}{c.Result0, c.Result1}
  4380. }
  4381. // UsersStoreGetMailableEmailsByUsernamesFunc describes the behavior when
  4382. // the GetMailableEmailsByUsernames method of the parent MockUsersStore
  4383. // instance is invoked.
  4384. type UsersStoreGetMailableEmailsByUsernamesFunc struct {
  4385. defaultHook func(context.Context, []string) ([]string, error)
  4386. hooks []func(context.Context, []string) ([]string, error)
  4387. history []UsersStoreGetMailableEmailsByUsernamesFuncCall
  4388. mutex sync.Mutex
  4389. }
  4390. // GetMailableEmailsByUsernames delegates to the next hook function in the
  4391. // queue and stores the parameter and result values of this invocation.
  4392. func (m *MockUsersStore) GetMailableEmailsByUsernames(v0 context.Context, v1 []string) ([]string, error) {
  4393. r0, r1 := m.GetMailableEmailsByUsernamesFunc.nextHook()(v0, v1)
  4394. m.GetMailableEmailsByUsernamesFunc.appendCall(UsersStoreGetMailableEmailsByUsernamesFuncCall{v0, v1, r0, r1})
  4395. return r0, r1
  4396. }
  4397. // SetDefaultHook sets function that is called when the
  4398. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  4399. // is invoked and the hook queue is empty.
  4400. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultHook(hook func(context.Context, []string) ([]string, error)) {
  4401. f.defaultHook = hook
  4402. }
  4403. // PushHook adds a function to the end of hook queue. Each invocation of the
  4404. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  4405. // invokes the hook at the front of the queue and discards it. After the
  4406. // queue is empty, the default hook function is invoked for any future
  4407. // action.
  4408. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushHook(hook func(context.Context, []string) ([]string, error)) {
  4409. f.mutex.Lock()
  4410. f.hooks = append(f.hooks, hook)
  4411. f.mutex.Unlock()
  4412. }
  4413. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4414. // given values.
  4415. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultReturn(r0 []string, r1 error) {
  4416. f.SetDefaultHook(func(context.Context, []string) ([]string, error) {
  4417. return r0, r1
  4418. })
  4419. }
  4420. // PushReturn calls PushHook with a function that returns the given values.
  4421. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushReturn(r0 []string, r1 error) {
  4422. f.PushHook(func(context.Context, []string) ([]string, error) {
  4423. return r0, r1
  4424. })
  4425. }
  4426. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) nextHook() func(context.Context, []string) ([]string, error) {
  4427. f.mutex.Lock()
  4428. defer f.mutex.Unlock()
  4429. if len(f.hooks) == 0 {
  4430. return f.defaultHook
  4431. }
  4432. hook := f.hooks[0]
  4433. f.hooks = f.hooks[1:]
  4434. return hook
  4435. }
  4436. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) appendCall(r0 UsersStoreGetMailableEmailsByUsernamesFuncCall) {
  4437. f.mutex.Lock()
  4438. f.history = append(f.history, r0)
  4439. f.mutex.Unlock()
  4440. }
  4441. // History returns a sequence of
  4442. // UsersStoreGetMailableEmailsByUsernamesFuncCall objects describing the
  4443. // invocations of this function.
  4444. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) History() []UsersStoreGetMailableEmailsByUsernamesFuncCall {
  4445. f.mutex.Lock()
  4446. history := make([]UsersStoreGetMailableEmailsByUsernamesFuncCall, len(f.history))
  4447. copy(history, f.history)
  4448. f.mutex.Unlock()
  4449. return history
  4450. }
  4451. // UsersStoreGetMailableEmailsByUsernamesFuncCall is an object that
  4452. // describes an invocation of method GetMailableEmailsByUsernames on an
  4453. // instance of MockUsersStore.
  4454. type UsersStoreGetMailableEmailsByUsernamesFuncCall struct {
  4455. // Arg0 is the value of the 1st argument passed to this method
  4456. // invocation.
  4457. Arg0 context.Context
  4458. // Arg1 is the value of the 2nd argument passed to this method
  4459. // invocation.
  4460. Arg1 []string
  4461. // Result0 is the value of the 1st result returned from this method
  4462. // invocation.
  4463. Result0 []string
  4464. // Result1 is the value of the 2nd result returned from this method
  4465. // invocation.
  4466. Result1 error
  4467. }
  4468. // Args returns an interface slice containing the arguments of this
  4469. // invocation.
  4470. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Args() []interface{} {
  4471. return []interface{}{c.Arg0, c.Arg1}
  4472. }
  4473. // Results returns an interface slice containing the results of this
  4474. // invocation.
  4475. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Results() []interface{} {
  4476. return []interface{}{c.Result0, c.Result1}
  4477. }
  4478. // UsersStoreIsFollowingFunc describes the behavior when the IsFollowing
  4479. // method of the parent MockUsersStore instance is invoked.
  4480. type UsersStoreIsFollowingFunc struct {
  4481. defaultHook func(context.Context, int64, int64) bool
  4482. hooks []func(context.Context, int64, int64) bool
  4483. history []UsersStoreIsFollowingFuncCall
  4484. mutex sync.Mutex
  4485. }
  4486. // IsFollowing delegates to the next hook function in the queue and stores
  4487. // the parameter and result values of this invocation.
  4488. func (m *MockUsersStore) IsFollowing(v0 context.Context, v1 int64, v2 int64) bool {
  4489. r0 := m.IsFollowingFunc.nextHook()(v0, v1, v2)
  4490. m.IsFollowingFunc.appendCall(UsersStoreIsFollowingFuncCall{v0, v1, v2, r0})
  4491. return r0
  4492. }
  4493. // SetDefaultHook sets function that is called when the IsFollowing method
  4494. // of the parent MockUsersStore instance is invoked and the hook queue is
  4495. // empty.
  4496. func (f *UsersStoreIsFollowingFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  4497. f.defaultHook = hook
  4498. }
  4499. // PushHook adds a function to the end of hook queue. Each invocation of the
  4500. // IsFollowing method of the parent MockUsersStore instance invokes the hook
  4501. // at the front of the queue and discards it. After the queue is empty, the
  4502. // default hook function is invoked for any future action.
  4503. func (f *UsersStoreIsFollowingFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  4504. f.mutex.Lock()
  4505. f.hooks = append(f.hooks, hook)
  4506. f.mutex.Unlock()
  4507. }
  4508. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4509. // given values.
  4510. func (f *UsersStoreIsFollowingFunc) SetDefaultReturn(r0 bool) {
  4511. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  4512. return r0
  4513. })
  4514. }
  4515. // PushReturn calls PushHook with a function that returns the given values.
  4516. func (f *UsersStoreIsFollowingFunc) PushReturn(r0 bool) {
  4517. f.PushHook(func(context.Context, int64, int64) bool {
  4518. return r0
  4519. })
  4520. }
  4521. func (f *UsersStoreIsFollowingFunc) nextHook() func(context.Context, int64, int64) bool {
  4522. f.mutex.Lock()
  4523. defer f.mutex.Unlock()
  4524. if len(f.hooks) == 0 {
  4525. return f.defaultHook
  4526. }
  4527. hook := f.hooks[0]
  4528. f.hooks = f.hooks[1:]
  4529. return hook
  4530. }
  4531. func (f *UsersStoreIsFollowingFunc) appendCall(r0 UsersStoreIsFollowingFuncCall) {
  4532. f.mutex.Lock()
  4533. f.history = append(f.history, r0)
  4534. f.mutex.Unlock()
  4535. }
  4536. // History returns a sequence of UsersStoreIsFollowingFuncCall objects
  4537. // describing the invocations of this function.
  4538. func (f *UsersStoreIsFollowingFunc) History() []UsersStoreIsFollowingFuncCall {
  4539. f.mutex.Lock()
  4540. history := make([]UsersStoreIsFollowingFuncCall, len(f.history))
  4541. copy(history, f.history)
  4542. f.mutex.Unlock()
  4543. return history
  4544. }
  4545. // UsersStoreIsFollowingFuncCall is an object that describes an invocation
  4546. // of method IsFollowing on an instance of MockUsersStore.
  4547. type UsersStoreIsFollowingFuncCall struct {
  4548. // Arg0 is the value of the 1st argument passed to this method
  4549. // invocation.
  4550. Arg0 context.Context
  4551. // Arg1 is the value of the 2nd argument passed to this method
  4552. // invocation.
  4553. Arg1 int64
  4554. // Arg2 is the value of the 3rd argument passed to this method
  4555. // invocation.
  4556. Arg2 int64
  4557. // Result0 is the value of the 1st result returned from this method
  4558. // invocation.
  4559. Result0 bool
  4560. }
  4561. // Args returns an interface slice containing the arguments of this
  4562. // invocation.
  4563. func (c UsersStoreIsFollowingFuncCall) Args() []interface{} {
  4564. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4565. }
  4566. // Results returns an interface slice containing the results of this
  4567. // invocation.
  4568. func (c UsersStoreIsFollowingFuncCall) Results() []interface{} {
  4569. return []interface{}{c.Result0}
  4570. }
  4571. // UsersStoreIsUsernameUsedFunc describes the behavior when the
  4572. // IsUsernameUsed method of the parent MockUsersStore instance is invoked.
  4573. type UsersStoreIsUsernameUsedFunc struct {
  4574. defaultHook func(context.Context, string, int64) bool
  4575. hooks []func(context.Context, string, int64) bool
  4576. history []UsersStoreIsUsernameUsedFuncCall
  4577. mutex sync.Mutex
  4578. }
  4579. // IsUsernameUsed delegates to the next hook function in the queue and
  4580. // stores the parameter and result values of this invocation.
  4581. func (m *MockUsersStore) IsUsernameUsed(v0 context.Context, v1 string, v2 int64) bool {
  4582. r0 := m.IsUsernameUsedFunc.nextHook()(v0, v1, v2)
  4583. m.IsUsernameUsedFunc.appendCall(UsersStoreIsUsernameUsedFuncCall{v0, v1, v2, r0})
  4584. return r0
  4585. }
  4586. // SetDefaultHook sets function that is called when the IsUsernameUsed
  4587. // method of the parent MockUsersStore instance is invoked and the hook
  4588. // queue is empty.
  4589. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultHook(hook func(context.Context, string, int64) bool) {
  4590. f.defaultHook = hook
  4591. }
  4592. // PushHook adds a function to the end of hook queue. Each invocation of the
  4593. // IsUsernameUsed method of the parent MockUsersStore instance invokes the
  4594. // hook at the front of the queue and discards it. After the queue is empty,
  4595. // the default hook function is invoked for any future action.
  4596. func (f *UsersStoreIsUsernameUsedFunc) PushHook(hook func(context.Context, string, int64) bool) {
  4597. f.mutex.Lock()
  4598. f.hooks = append(f.hooks, hook)
  4599. f.mutex.Unlock()
  4600. }
  4601. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4602. // given values.
  4603. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultReturn(r0 bool) {
  4604. f.SetDefaultHook(func(context.Context, string, int64) bool {
  4605. return r0
  4606. })
  4607. }
  4608. // PushReturn calls PushHook with a function that returns the given values.
  4609. func (f *UsersStoreIsUsernameUsedFunc) PushReturn(r0 bool) {
  4610. f.PushHook(func(context.Context, string, int64) bool {
  4611. return r0
  4612. })
  4613. }
  4614. func (f *UsersStoreIsUsernameUsedFunc) nextHook() func(context.Context, string, int64) bool {
  4615. f.mutex.Lock()
  4616. defer f.mutex.Unlock()
  4617. if len(f.hooks) == 0 {
  4618. return f.defaultHook
  4619. }
  4620. hook := f.hooks[0]
  4621. f.hooks = f.hooks[1:]
  4622. return hook
  4623. }
  4624. func (f *UsersStoreIsUsernameUsedFunc) appendCall(r0 UsersStoreIsUsernameUsedFuncCall) {
  4625. f.mutex.Lock()
  4626. f.history = append(f.history, r0)
  4627. f.mutex.Unlock()
  4628. }
  4629. // History returns a sequence of UsersStoreIsUsernameUsedFuncCall objects
  4630. // describing the invocations of this function.
  4631. func (f *UsersStoreIsUsernameUsedFunc) History() []UsersStoreIsUsernameUsedFuncCall {
  4632. f.mutex.Lock()
  4633. history := make([]UsersStoreIsUsernameUsedFuncCall, len(f.history))
  4634. copy(history, f.history)
  4635. f.mutex.Unlock()
  4636. return history
  4637. }
  4638. // UsersStoreIsUsernameUsedFuncCall is an object that describes an
  4639. // invocation of method IsUsernameUsed on an instance of MockUsersStore.
  4640. type UsersStoreIsUsernameUsedFuncCall struct {
  4641. // Arg0 is the value of the 1st argument passed to this method
  4642. // invocation.
  4643. Arg0 context.Context
  4644. // Arg1 is the value of the 2nd argument passed to this method
  4645. // invocation.
  4646. Arg1 string
  4647. // Arg2 is the value of the 3rd argument passed to this method
  4648. // invocation.
  4649. Arg2 int64
  4650. // Result0 is the value of the 1st result returned from this method
  4651. // invocation.
  4652. Result0 bool
  4653. }
  4654. // Args returns an interface slice containing the arguments of this
  4655. // invocation.
  4656. func (c UsersStoreIsUsernameUsedFuncCall) Args() []interface{} {
  4657. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4658. }
  4659. // Results returns an interface slice containing the results of this
  4660. // invocation.
  4661. func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
  4662. return []interface{}{c.Result0}
  4663. }
  4664. // UsersStoreListFunc describes the behavior when the List method of the
  4665. // parent MockUsersStore instance is invoked.
  4666. type UsersStoreListFunc struct {
  4667. defaultHook func(context.Context, int, int) ([]*db.User, error)
  4668. hooks []func(context.Context, int, int) ([]*db.User, error)
  4669. history []UsersStoreListFuncCall
  4670. mutex sync.Mutex
  4671. }
  4672. // List delegates to the next hook function in the queue and stores the
  4673. // parameter and result values of this invocation.
  4674. func (m *MockUsersStore) List(v0 context.Context, v1 int, v2 int) ([]*db.User, error) {
  4675. r0, r1 := m.ListFunc.nextHook()(v0, v1, v2)
  4676. m.ListFunc.appendCall(UsersStoreListFuncCall{v0, v1, v2, r0, r1})
  4677. return r0, r1
  4678. }
  4679. // SetDefaultHook sets function that is called when the List method of the
  4680. // parent MockUsersStore instance is invoked and the hook queue is empty.
  4681. func (f *UsersStoreListFunc) SetDefaultHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  4682. f.defaultHook = hook
  4683. }
  4684. // PushHook adds a function to the end of hook queue. Each invocation of the
  4685. // List method of the parent MockUsersStore instance invokes the hook at the
  4686. // front of the queue and discards it. After the queue is empty, the default
  4687. // hook function is invoked for any future action.
  4688. func (f *UsersStoreListFunc) PushHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  4689. f.mutex.Lock()
  4690. f.hooks = append(f.hooks, hook)
  4691. f.mutex.Unlock()
  4692. }
  4693. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4694. // given values.
  4695. func (f *UsersStoreListFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4696. f.SetDefaultHook(func(context.Context, int, int) ([]*db.User, error) {
  4697. return r0, r1
  4698. })
  4699. }
  4700. // PushReturn calls PushHook with a function that returns the given values.
  4701. func (f *UsersStoreListFunc) PushReturn(r0 []*db.User, r1 error) {
  4702. f.PushHook(func(context.Context, int, int) ([]*db.User, error) {
  4703. return r0, r1
  4704. })
  4705. }
  4706. func (f *UsersStoreListFunc) nextHook() func(context.Context, int, int) ([]*db.User, error) {
  4707. f.mutex.Lock()
  4708. defer f.mutex.Unlock()
  4709. if len(f.hooks) == 0 {
  4710. return f.defaultHook
  4711. }
  4712. hook := f.hooks[0]
  4713. f.hooks = f.hooks[1:]
  4714. return hook
  4715. }
  4716. func (f *UsersStoreListFunc) appendCall(r0 UsersStoreListFuncCall) {
  4717. f.mutex.Lock()
  4718. f.history = append(f.history, r0)
  4719. f.mutex.Unlock()
  4720. }
  4721. // History returns a sequence of UsersStoreListFuncCall objects describing
  4722. // the invocations of this function.
  4723. func (f *UsersStoreListFunc) History() []UsersStoreListFuncCall {
  4724. f.mutex.Lock()
  4725. history := make([]UsersStoreListFuncCall, len(f.history))
  4726. copy(history, f.history)
  4727. f.mutex.Unlock()
  4728. return history
  4729. }
  4730. // UsersStoreListFuncCall is an object that describes an invocation of
  4731. // method List on an instance of MockUsersStore.
  4732. type UsersStoreListFuncCall struct {
  4733. // Arg0 is the value of the 1st argument passed to this method
  4734. // invocation.
  4735. Arg0 context.Context
  4736. // Arg1 is the value of the 2nd argument passed to this method
  4737. // invocation.
  4738. Arg1 int
  4739. // Arg2 is the value of the 3rd argument passed to this method
  4740. // invocation.
  4741. Arg2 int
  4742. // Result0 is the value of the 1st result returned from this method
  4743. // invocation.
  4744. Result0 []*db.User
  4745. // Result1 is the value of the 2nd result returned from this method
  4746. // invocation.
  4747. Result1 error
  4748. }
  4749. // Args returns an interface slice containing the arguments of this
  4750. // invocation.
  4751. func (c UsersStoreListFuncCall) Args() []interface{} {
  4752. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4753. }
  4754. // Results returns an interface slice containing the results of this
  4755. // invocation.
  4756. func (c UsersStoreListFuncCall) Results() []interface{} {
  4757. return []interface{}{c.Result0, c.Result1}
  4758. }
  4759. // UsersStoreListFollowersFunc describes the behavior when the ListFollowers
  4760. // method of the parent MockUsersStore instance is invoked.
  4761. type UsersStoreListFollowersFunc struct {
  4762. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  4763. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  4764. history []UsersStoreListFollowersFuncCall
  4765. mutex sync.Mutex
  4766. }
  4767. // ListFollowers delegates to the next hook function in the queue and stores
  4768. // the parameter and result values of this invocation.
  4769. func (m *MockUsersStore) ListFollowers(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  4770. r0, r1 := m.ListFollowersFunc.nextHook()(v0, v1, v2, v3)
  4771. m.ListFollowersFunc.appendCall(UsersStoreListFollowersFuncCall{v0, v1, v2, v3, r0, r1})
  4772. return r0, r1
  4773. }
  4774. // SetDefaultHook sets function that is called when the ListFollowers method
  4775. // of the parent MockUsersStore instance is invoked and the hook queue is
  4776. // empty.
  4777. func (f *UsersStoreListFollowersFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4778. f.defaultHook = hook
  4779. }
  4780. // PushHook adds a function to the end of hook queue. Each invocation of the
  4781. // ListFollowers method of the parent MockUsersStore instance invokes the
  4782. // hook at the front of the queue and discards it. After the queue is empty,
  4783. // the default hook function is invoked for any future action.
  4784. func (f *UsersStoreListFollowersFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4785. f.mutex.Lock()
  4786. f.hooks = append(f.hooks, hook)
  4787. f.mutex.Unlock()
  4788. }
  4789. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4790. // given values.
  4791. func (f *UsersStoreListFollowersFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4792. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4793. return r0, r1
  4794. })
  4795. }
  4796. // PushReturn calls PushHook with a function that returns the given values.
  4797. func (f *UsersStoreListFollowersFunc) PushReturn(r0 []*db.User, r1 error) {
  4798. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4799. return r0, r1
  4800. })
  4801. }
  4802. func (f *UsersStoreListFollowersFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  4803. f.mutex.Lock()
  4804. defer f.mutex.Unlock()
  4805. if len(f.hooks) == 0 {
  4806. return f.defaultHook
  4807. }
  4808. hook := f.hooks[0]
  4809. f.hooks = f.hooks[1:]
  4810. return hook
  4811. }
  4812. func (f *UsersStoreListFollowersFunc) appendCall(r0 UsersStoreListFollowersFuncCall) {
  4813. f.mutex.Lock()
  4814. f.history = append(f.history, r0)
  4815. f.mutex.Unlock()
  4816. }
  4817. // History returns a sequence of UsersStoreListFollowersFuncCall objects
  4818. // describing the invocations of this function.
  4819. func (f *UsersStoreListFollowersFunc) History() []UsersStoreListFollowersFuncCall {
  4820. f.mutex.Lock()
  4821. history := make([]UsersStoreListFollowersFuncCall, len(f.history))
  4822. copy(history, f.history)
  4823. f.mutex.Unlock()
  4824. return history
  4825. }
  4826. // UsersStoreListFollowersFuncCall is an object that describes an invocation
  4827. // of method ListFollowers on an instance of MockUsersStore.
  4828. type UsersStoreListFollowersFuncCall struct {
  4829. // Arg0 is the value of the 1st argument passed to this method
  4830. // invocation.
  4831. Arg0 context.Context
  4832. // Arg1 is the value of the 2nd argument passed to this method
  4833. // invocation.
  4834. Arg1 int64
  4835. // Arg2 is the value of the 3rd argument passed to this method
  4836. // invocation.
  4837. Arg2 int
  4838. // Arg3 is the value of the 4th argument passed to this method
  4839. // invocation.
  4840. Arg3 int
  4841. // Result0 is the value of the 1st result returned from this method
  4842. // invocation.
  4843. Result0 []*db.User
  4844. // Result1 is the value of the 2nd result returned from this method
  4845. // invocation.
  4846. Result1 error
  4847. }
  4848. // Args returns an interface slice containing the arguments of this
  4849. // invocation.
  4850. func (c UsersStoreListFollowersFuncCall) Args() []interface{} {
  4851. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  4852. }
  4853. // Results returns an interface slice containing the results of this
  4854. // invocation.
  4855. func (c UsersStoreListFollowersFuncCall) Results() []interface{} {
  4856. return []interface{}{c.Result0, c.Result1}
  4857. }
  4858. // UsersStoreListFollowingsFunc describes the behavior when the
  4859. // ListFollowings method of the parent MockUsersStore instance is invoked.
  4860. type UsersStoreListFollowingsFunc struct {
  4861. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  4862. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  4863. history []UsersStoreListFollowingsFuncCall
  4864. mutex sync.Mutex
  4865. }
  4866. // ListFollowings delegates to the next hook function in the queue and
  4867. // stores the parameter and result values of this invocation.
  4868. func (m *MockUsersStore) ListFollowings(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  4869. r0, r1 := m.ListFollowingsFunc.nextHook()(v0, v1, v2, v3)
  4870. m.ListFollowingsFunc.appendCall(UsersStoreListFollowingsFuncCall{v0, v1, v2, v3, r0, r1})
  4871. return r0, r1
  4872. }
  4873. // SetDefaultHook sets function that is called when the ListFollowings
  4874. // method of the parent MockUsersStore instance is invoked and the hook
  4875. // queue is empty.
  4876. func (f *UsersStoreListFollowingsFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4877. f.defaultHook = hook
  4878. }
  4879. // PushHook adds a function to the end of hook queue. Each invocation of the
  4880. // ListFollowings method of the parent MockUsersStore instance invokes the
  4881. // hook at the front of the queue and discards it. After the queue is empty,
  4882. // the default hook function is invoked for any future action.
  4883. func (f *UsersStoreListFollowingsFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4884. f.mutex.Lock()
  4885. f.hooks = append(f.hooks, hook)
  4886. f.mutex.Unlock()
  4887. }
  4888. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4889. // given values.
  4890. func (f *UsersStoreListFollowingsFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4891. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4892. return r0, r1
  4893. })
  4894. }
  4895. // PushReturn calls PushHook with a function that returns the given values.
  4896. func (f *UsersStoreListFollowingsFunc) PushReturn(r0 []*db.User, r1 error) {
  4897. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4898. return r0, r1
  4899. })
  4900. }
  4901. func (f *UsersStoreListFollowingsFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  4902. f.mutex.Lock()
  4903. defer f.mutex.Unlock()
  4904. if len(f.hooks) == 0 {
  4905. return f.defaultHook
  4906. }
  4907. hook := f.hooks[0]
  4908. f.hooks = f.hooks[1:]
  4909. return hook
  4910. }
  4911. func (f *UsersStoreListFollowingsFunc) appendCall(r0 UsersStoreListFollowingsFuncCall) {
  4912. f.mutex.Lock()
  4913. f.history = append(f.history, r0)
  4914. f.mutex.Unlock()
  4915. }
  4916. // History returns a sequence of UsersStoreListFollowingsFuncCall objects
  4917. // describing the invocations of this function.
  4918. func (f *UsersStoreListFollowingsFunc) History() []UsersStoreListFollowingsFuncCall {
  4919. f.mutex.Lock()
  4920. history := make([]UsersStoreListFollowingsFuncCall, len(f.history))
  4921. copy(history, f.history)
  4922. f.mutex.Unlock()
  4923. return history
  4924. }
  4925. // UsersStoreListFollowingsFuncCall is an object that describes an
  4926. // invocation of method ListFollowings on an instance of MockUsersStore.
  4927. type UsersStoreListFollowingsFuncCall struct {
  4928. // Arg0 is the value of the 1st argument passed to this method
  4929. // invocation.
  4930. Arg0 context.Context
  4931. // Arg1 is the value of the 2nd argument passed to this method
  4932. // invocation.
  4933. Arg1 int64
  4934. // Arg2 is the value of the 3rd argument passed to this method
  4935. // invocation.
  4936. Arg2 int
  4937. // Arg3 is the value of the 4th argument passed to this method
  4938. // invocation.
  4939. Arg3 int
  4940. // Result0 is the value of the 1st result returned from this method
  4941. // invocation.
  4942. Result0 []*db.User
  4943. // Result1 is the value of the 2nd result returned from this method
  4944. // invocation.
  4945. Result1 error
  4946. }
  4947. // Args returns an interface slice containing the arguments of this
  4948. // invocation.
  4949. func (c UsersStoreListFollowingsFuncCall) Args() []interface{} {
  4950. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  4951. }
  4952. // Results returns an interface slice containing the results of this
  4953. // invocation.
  4954. func (c UsersStoreListFollowingsFuncCall) Results() []interface{} {
  4955. return []interface{}{c.Result0, c.Result1}
  4956. }
  4957. // UsersStoreSearchByNameFunc describes the behavior when the SearchByName
  4958. // method of the parent MockUsersStore instance is invoked.
  4959. type UsersStoreSearchByNameFunc struct {
  4960. defaultHook func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  4961. hooks []func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  4962. history []UsersStoreSearchByNameFuncCall
  4963. mutex sync.Mutex
  4964. }
  4965. // SearchByName delegates to the next hook function in the queue and stores
  4966. // the parameter and result values of this invocation.
  4967. func (m *MockUsersStore) SearchByName(v0 context.Context, v1 string, v2 int, v3 int, v4 string) ([]*db.User, int64, error) {
  4968. r0, r1, r2 := m.SearchByNameFunc.nextHook()(v0, v1, v2, v3, v4)
  4969. m.SearchByNameFunc.appendCall(UsersStoreSearchByNameFuncCall{v0, v1, v2, v3, v4, r0, r1, r2})
  4970. return r0, r1, r2
  4971. }
  4972. // SetDefaultHook sets function that is called when the SearchByName method
  4973. // of the parent MockUsersStore instance is invoked and the hook queue is
  4974. // empty.
  4975. func (f *UsersStoreSearchByNameFunc) SetDefaultHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  4976. f.defaultHook = hook
  4977. }
  4978. // PushHook adds a function to the end of hook queue. Each invocation of the
  4979. // SearchByName method of the parent MockUsersStore instance invokes the
  4980. // hook at the front of the queue and discards it. After the queue is empty,
  4981. // the default hook function is invoked for any future action.
  4982. func (f *UsersStoreSearchByNameFunc) PushHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  4983. f.mutex.Lock()
  4984. f.hooks = append(f.hooks, hook)
  4985. f.mutex.Unlock()
  4986. }
  4987. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4988. // given values.
  4989. func (f *UsersStoreSearchByNameFunc) SetDefaultReturn(r0 []*db.User, r1 int64, r2 error) {
  4990. f.SetDefaultHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4991. return r0, r1, r2
  4992. })
  4993. }
  4994. // PushReturn calls PushHook with a function that returns the given values.
  4995. func (f *UsersStoreSearchByNameFunc) PushReturn(r0 []*db.User, r1 int64, r2 error) {
  4996. f.PushHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4997. return r0, r1, r2
  4998. })
  4999. }
  5000. func (f *UsersStoreSearchByNameFunc) nextHook() func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  5001. f.mutex.Lock()
  5002. defer f.mutex.Unlock()
  5003. if len(f.hooks) == 0 {
  5004. return f.defaultHook
  5005. }
  5006. hook := f.hooks[0]
  5007. f.hooks = f.hooks[1:]
  5008. return hook
  5009. }
  5010. func (f *UsersStoreSearchByNameFunc) appendCall(r0 UsersStoreSearchByNameFuncCall) {
  5011. f.mutex.Lock()
  5012. f.history = append(f.history, r0)
  5013. f.mutex.Unlock()
  5014. }
  5015. // History returns a sequence of UsersStoreSearchByNameFuncCall objects
  5016. // describing the invocations of this function.
  5017. func (f *UsersStoreSearchByNameFunc) History() []UsersStoreSearchByNameFuncCall {
  5018. f.mutex.Lock()
  5019. history := make([]UsersStoreSearchByNameFuncCall, len(f.history))
  5020. copy(history, f.history)
  5021. f.mutex.Unlock()
  5022. return history
  5023. }
  5024. // UsersStoreSearchByNameFuncCall is an object that describes an invocation
  5025. // of method SearchByName on an instance of MockUsersStore.
  5026. type UsersStoreSearchByNameFuncCall struct {
  5027. // Arg0 is the value of the 1st argument passed to this method
  5028. // invocation.
  5029. Arg0 context.Context
  5030. // Arg1 is the value of the 2nd argument passed to this method
  5031. // invocation.
  5032. Arg1 string
  5033. // Arg2 is the value of the 3rd argument passed to this method
  5034. // invocation.
  5035. Arg2 int
  5036. // Arg3 is the value of the 4th argument passed to this method
  5037. // invocation.
  5038. Arg3 int
  5039. // Arg4 is the value of the 5th argument passed to this method
  5040. // invocation.
  5041. Arg4 string
  5042. // Result0 is the value of the 1st result returned from this method
  5043. // invocation.
  5044. Result0 []*db.User
  5045. // Result1 is the value of the 2nd result returned from this method
  5046. // invocation.
  5047. Result1 int64
  5048. // Result2 is the value of the 3rd result returned from this method
  5049. // invocation.
  5050. Result2 error
  5051. }
  5052. // Args returns an interface slice containing the arguments of this
  5053. // invocation.
  5054. func (c UsersStoreSearchByNameFuncCall) Args() []interface{} {
  5055. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  5056. }
  5057. // Results returns an interface slice containing the results of this
  5058. // invocation.
  5059. func (c UsersStoreSearchByNameFuncCall) Results() []interface{} {
  5060. return []interface{}{c.Result0, c.Result1, c.Result2}
  5061. }
  5062. // UsersStoreUnfollowFunc describes the behavior when the Unfollow method of
  5063. // the parent MockUsersStore instance is invoked.
  5064. type UsersStoreUnfollowFunc struct {
  5065. defaultHook func(context.Context, int64, int64) error
  5066. hooks []func(context.Context, int64, int64) error
  5067. history []UsersStoreUnfollowFuncCall
  5068. mutex sync.Mutex
  5069. }
  5070. // Unfollow delegates to the next hook function in the queue and stores the
  5071. // parameter and result values of this invocation.
  5072. func (m *MockUsersStore) Unfollow(v0 context.Context, v1 int64, v2 int64) error {
  5073. r0 := m.UnfollowFunc.nextHook()(v0, v1, v2)
  5074. m.UnfollowFunc.appendCall(UsersStoreUnfollowFuncCall{v0, v1, v2, r0})
  5075. return r0
  5076. }
  5077. // SetDefaultHook sets function that is called when the Unfollow method of
  5078. // the parent MockUsersStore instance is invoked and the hook queue is
  5079. // empty.
  5080. func (f *UsersStoreUnfollowFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  5081. f.defaultHook = hook
  5082. }
  5083. // PushHook adds a function to the end of hook queue. Each invocation of the
  5084. // Unfollow method of the parent MockUsersStore instance invokes the hook at
  5085. // the front of the queue and discards it. After the queue is empty, the
  5086. // default hook function is invoked for any future action.
  5087. func (f *UsersStoreUnfollowFunc) PushHook(hook func(context.Context, int64, int64) error) {
  5088. f.mutex.Lock()
  5089. f.hooks = append(f.hooks, hook)
  5090. f.mutex.Unlock()
  5091. }
  5092. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5093. // given values.
  5094. func (f *UsersStoreUnfollowFunc) SetDefaultReturn(r0 error) {
  5095. f.SetDefaultHook(func(context.Context, int64, int64) error {
  5096. return r0
  5097. })
  5098. }
  5099. // PushReturn calls PushHook with a function that returns the given values.
  5100. func (f *UsersStoreUnfollowFunc) PushReturn(r0 error) {
  5101. f.PushHook(func(context.Context, int64, int64) error {
  5102. return r0
  5103. })
  5104. }
  5105. func (f *UsersStoreUnfollowFunc) nextHook() func(context.Context, int64, int64) error {
  5106. f.mutex.Lock()
  5107. defer f.mutex.Unlock()
  5108. if len(f.hooks) == 0 {
  5109. return f.defaultHook
  5110. }
  5111. hook := f.hooks[0]
  5112. f.hooks = f.hooks[1:]
  5113. return hook
  5114. }
  5115. func (f *UsersStoreUnfollowFunc) appendCall(r0 UsersStoreUnfollowFuncCall) {
  5116. f.mutex.Lock()
  5117. f.history = append(f.history, r0)
  5118. f.mutex.Unlock()
  5119. }
  5120. // History returns a sequence of UsersStoreUnfollowFuncCall objects
  5121. // describing the invocations of this function.
  5122. func (f *UsersStoreUnfollowFunc) History() []UsersStoreUnfollowFuncCall {
  5123. f.mutex.Lock()
  5124. history := make([]UsersStoreUnfollowFuncCall, len(f.history))
  5125. copy(history, f.history)
  5126. f.mutex.Unlock()
  5127. return history
  5128. }
  5129. // UsersStoreUnfollowFuncCall is an object that describes an invocation of
  5130. // method Unfollow on an instance of MockUsersStore.
  5131. type UsersStoreUnfollowFuncCall struct {
  5132. // Arg0 is the value of the 1st argument passed to this method
  5133. // invocation.
  5134. Arg0 context.Context
  5135. // Arg1 is the value of the 2nd argument passed to this method
  5136. // invocation.
  5137. Arg1 int64
  5138. // Arg2 is the value of the 3rd argument passed to this method
  5139. // invocation.
  5140. Arg2 int64
  5141. // Result0 is the value of the 1st result returned from this method
  5142. // invocation.
  5143. Result0 error
  5144. }
  5145. // Args returns an interface slice containing the arguments of this
  5146. // invocation.
  5147. func (c UsersStoreUnfollowFuncCall) Args() []interface{} {
  5148. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5149. }
  5150. // Results returns an interface slice containing the results of this
  5151. // invocation.
  5152. func (c UsersStoreUnfollowFuncCall) Results() []interface{} {
  5153. return []interface{}{c.Result0}
  5154. }
  5155. // UsersStoreUpdateFunc describes the behavior when the Update method of the
  5156. // parent MockUsersStore instance is invoked.
  5157. type UsersStoreUpdateFunc struct {
  5158. defaultHook func(context.Context, int64, db.UpdateUserOptions) error
  5159. hooks []func(context.Context, int64, db.UpdateUserOptions) error
  5160. history []UsersStoreUpdateFuncCall
  5161. mutex sync.Mutex
  5162. }
  5163. // Update delegates to the next hook function in the queue and stores the
  5164. // parameter and result values of this invocation.
  5165. func (m *MockUsersStore) Update(v0 context.Context, v1 int64, v2 db.UpdateUserOptions) error {
  5166. r0 := m.UpdateFunc.nextHook()(v0, v1, v2)
  5167. m.UpdateFunc.appendCall(UsersStoreUpdateFuncCall{v0, v1, v2, r0})
  5168. return r0
  5169. }
  5170. // SetDefaultHook sets function that is called when the Update method of the
  5171. // parent MockUsersStore instance is invoked and the hook queue is empty.
  5172. func (f *UsersStoreUpdateFunc) SetDefaultHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  5173. f.defaultHook = hook
  5174. }
  5175. // PushHook adds a function to the end of hook queue. Each invocation of the
  5176. // Update method of the parent MockUsersStore instance invokes the hook at
  5177. // the front of the queue and discards it. After the queue is empty, the
  5178. // default hook function is invoked for any future action.
  5179. func (f *UsersStoreUpdateFunc) PushHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  5180. f.mutex.Lock()
  5181. f.hooks = append(f.hooks, hook)
  5182. f.mutex.Unlock()
  5183. }
  5184. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5185. // given values.
  5186. func (f *UsersStoreUpdateFunc) SetDefaultReturn(r0 error) {
  5187. f.SetDefaultHook(func(context.Context, int64, db.UpdateUserOptions) error {
  5188. return r0
  5189. })
  5190. }
  5191. // PushReturn calls PushHook with a function that returns the given values.
  5192. func (f *UsersStoreUpdateFunc) PushReturn(r0 error) {
  5193. f.PushHook(func(context.Context, int64, db.UpdateUserOptions) error {
  5194. return r0
  5195. })
  5196. }
  5197. func (f *UsersStoreUpdateFunc) nextHook() func(context.Context, int64, db.UpdateUserOptions) error {
  5198. f.mutex.Lock()
  5199. defer f.mutex.Unlock()
  5200. if len(f.hooks) == 0 {
  5201. return f.defaultHook
  5202. }
  5203. hook := f.hooks[0]
  5204. f.hooks = f.hooks[1:]
  5205. return hook
  5206. }
  5207. func (f *UsersStoreUpdateFunc) appendCall(r0 UsersStoreUpdateFuncCall) {
  5208. f.mutex.Lock()
  5209. f.history = append(f.history, r0)
  5210. f.mutex.Unlock()
  5211. }
  5212. // History returns a sequence of UsersStoreUpdateFuncCall objects describing
  5213. // the invocations of this function.
  5214. func (f *UsersStoreUpdateFunc) History() []UsersStoreUpdateFuncCall {
  5215. f.mutex.Lock()
  5216. history := make([]UsersStoreUpdateFuncCall, len(f.history))
  5217. copy(history, f.history)
  5218. f.mutex.Unlock()
  5219. return history
  5220. }
  5221. // UsersStoreUpdateFuncCall is an object that describes an invocation of
  5222. // method Update on an instance of MockUsersStore.
  5223. type UsersStoreUpdateFuncCall struct {
  5224. // Arg0 is the value of the 1st argument passed to this method
  5225. // invocation.
  5226. Arg0 context.Context
  5227. // Arg1 is the value of the 2nd argument passed to this method
  5228. // invocation.
  5229. Arg1 int64
  5230. // Arg2 is the value of the 3rd argument passed to this method
  5231. // invocation.
  5232. Arg2 db.UpdateUserOptions
  5233. // Result0 is the value of the 1st result returned from this method
  5234. // invocation.
  5235. Result0 error
  5236. }
  5237. // Args returns an interface slice containing the arguments of this
  5238. // invocation.
  5239. func (c UsersStoreUpdateFuncCall) Args() []interface{} {
  5240. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5241. }
  5242. // Results returns an interface slice containing the results of this
  5243. // invocation.
  5244. func (c UsersStoreUpdateFuncCall) Results() []interface{} {
  5245. return []interface{}{c.Result0}
  5246. }
  5247. // UsersStoreUseCustomAvatarFunc describes the behavior when the
  5248. // UseCustomAvatar method of the parent MockUsersStore instance is invoked.
  5249. type UsersStoreUseCustomAvatarFunc struct {
  5250. defaultHook func(context.Context, int64, []byte) error
  5251. hooks []func(context.Context, int64, []byte) error
  5252. history []UsersStoreUseCustomAvatarFuncCall
  5253. mutex sync.Mutex
  5254. }
  5255. // UseCustomAvatar delegates to the next hook function in the queue and
  5256. // stores the parameter and result values of this invocation.
  5257. func (m *MockUsersStore) UseCustomAvatar(v0 context.Context, v1 int64, v2 []byte) error {
  5258. r0 := m.UseCustomAvatarFunc.nextHook()(v0, v1, v2)
  5259. m.UseCustomAvatarFunc.appendCall(UsersStoreUseCustomAvatarFuncCall{v0, v1, v2, r0})
  5260. return r0
  5261. }
  5262. // SetDefaultHook sets function that is called when the UseCustomAvatar
  5263. // method of the parent MockUsersStore instance is invoked and the hook
  5264. // queue is empty.
  5265. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64, []byte) error) {
  5266. f.defaultHook = hook
  5267. }
  5268. // PushHook adds a function to the end of hook queue. Each invocation of the
  5269. // UseCustomAvatar method of the parent MockUsersStore instance invokes the
  5270. // hook at the front of the queue and discards it. After the queue is empty,
  5271. // the default hook function is invoked for any future action.
  5272. func (f *UsersStoreUseCustomAvatarFunc) PushHook(hook func(context.Context, int64, []byte) error) {
  5273. f.mutex.Lock()
  5274. f.hooks = append(f.hooks, hook)
  5275. f.mutex.Unlock()
  5276. }
  5277. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5278. // given values.
  5279. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultReturn(r0 error) {
  5280. f.SetDefaultHook(func(context.Context, int64, []byte) error {
  5281. return r0
  5282. })
  5283. }
  5284. // PushReturn calls PushHook with a function that returns the given values.
  5285. func (f *UsersStoreUseCustomAvatarFunc) PushReturn(r0 error) {
  5286. f.PushHook(func(context.Context, int64, []byte) error {
  5287. return r0
  5288. })
  5289. }
  5290. func (f *UsersStoreUseCustomAvatarFunc) nextHook() func(context.Context, int64, []byte) error {
  5291. f.mutex.Lock()
  5292. defer f.mutex.Unlock()
  5293. if len(f.hooks) == 0 {
  5294. return f.defaultHook
  5295. }
  5296. hook := f.hooks[0]
  5297. f.hooks = f.hooks[1:]
  5298. return hook
  5299. }
  5300. func (f *UsersStoreUseCustomAvatarFunc) appendCall(r0 UsersStoreUseCustomAvatarFuncCall) {
  5301. f.mutex.Lock()
  5302. f.history = append(f.history, r0)
  5303. f.mutex.Unlock()
  5304. }
  5305. // History returns a sequence of UsersStoreUseCustomAvatarFuncCall objects
  5306. // describing the invocations of this function.
  5307. func (f *UsersStoreUseCustomAvatarFunc) History() []UsersStoreUseCustomAvatarFuncCall {
  5308. f.mutex.Lock()
  5309. history := make([]UsersStoreUseCustomAvatarFuncCall, len(f.history))
  5310. copy(history, f.history)
  5311. f.mutex.Unlock()
  5312. return history
  5313. }
  5314. // UsersStoreUseCustomAvatarFuncCall is an object that describes an
  5315. // invocation of method UseCustomAvatar on an instance of MockUsersStore.
  5316. type UsersStoreUseCustomAvatarFuncCall struct {
  5317. // Arg0 is the value of the 1st argument passed to this method
  5318. // invocation.
  5319. Arg0 context.Context
  5320. // Arg1 is the value of the 2nd argument passed to this method
  5321. // invocation.
  5322. Arg1 int64
  5323. // Arg2 is the value of the 3rd argument passed to this method
  5324. // invocation.
  5325. Arg2 []byte
  5326. // Result0 is the value of the 1st result returned from this method
  5327. // invocation.
  5328. Result0 error
  5329. }
  5330. // Args returns an interface slice containing the arguments of this
  5331. // invocation.
  5332. func (c UsersStoreUseCustomAvatarFuncCall) Args() []interface{} {
  5333. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5334. }
  5335. // Results returns an interface slice containing the results of this
  5336. // invocation.
  5337. func (c UsersStoreUseCustomAvatarFuncCall) Results() []interface{} {
  5338. return []interface{}{c.Result0}
  5339. }