mocks_test.go 215 KB

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