mocks_test.go 201 KB

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