mocks_test.go 229 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713
  1. // Code generated by go-mockgen 1.3.7; DO NOT EDIT.
  2. //
  3. // This file was generated by running `go-mockgen` at the root of this repository.
  4. // To add additional mocks to this or another package, add a new entry to the
  5. // mockgen.yaml file in the root of this repository.
  6. package lfs
  7. import (
  8. "context"
  9. "sync"
  10. 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. // MockRepositoriesStore is a mock implementation of the RepositoriesStore
  1311. // interface (from the package gogs.io/gogs/internal/db) used for unit
  1312. // testing.
  1313. type MockRepositoriesStore struct {
  1314. // CreateFunc is an instance of a mock function object controlling the
  1315. // behavior of the method Create.
  1316. CreateFunc *RepositoriesStoreCreateFunc
  1317. // GetByCollaboratorIDFunc is an instance of a mock function object
  1318. // controlling the behavior of the method GetByCollaboratorID.
  1319. GetByCollaboratorIDFunc *RepositoriesStoreGetByCollaboratorIDFunc
  1320. // GetByCollaboratorIDWithAccessModeFunc is an instance of a mock
  1321. // function object controlling the behavior of the method
  1322. // GetByCollaboratorIDWithAccessMode.
  1323. GetByCollaboratorIDWithAccessModeFunc *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc
  1324. // GetByIDFunc is an instance of a mock function object controlling the
  1325. // behavior of the method GetByID.
  1326. GetByIDFunc *RepositoriesStoreGetByIDFunc
  1327. // GetByNameFunc is an instance of a mock function object controlling
  1328. // the behavior of the method GetByName.
  1329. GetByNameFunc *RepositoriesStoreGetByNameFunc
  1330. // HasForkedByFunc is an instance of a mock function object controlling
  1331. // the behavior of the method HasForkedBy.
  1332. HasForkedByFunc *RepositoriesStoreHasForkedByFunc
  1333. // ListWatchesFunc is an instance of a mock function object controlling
  1334. // the behavior of the method ListWatches.
  1335. ListWatchesFunc *RepositoriesStoreListWatchesFunc
  1336. // StarFunc is an instance of a mock function object controlling the
  1337. // behavior of the method Star.
  1338. StarFunc *RepositoriesStoreStarFunc
  1339. // TouchFunc is an instance of a mock function object controlling the
  1340. // behavior of the method Touch.
  1341. TouchFunc *RepositoriesStoreTouchFunc
  1342. // WatchFunc is an instance of a mock function object controlling the
  1343. // behavior of the method Watch.
  1344. WatchFunc *RepositoriesStoreWatchFunc
  1345. }
  1346. // NewMockRepositoriesStore creates a new mock of the RepositoriesStore
  1347. // interface. All methods return zero values for all results, unless
  1348. // overwritten.
  1349. func NewMockRepositoriesStore() *MockRepositoriesStore {
  1350. return &MockRepositoriesStore{
  1351. CreateFunc: &RepositoriesStoreCreateFunc{
  1352. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (r0 *db.Repository, r1 error) {
  1353. return
  1354. },
  1355. },
  1356. GetByCollaboratorIDFunc: &RepositoriesStoreGetByCollaboratorIDFunc{
  1357. defaultHook: func(context.Context, int64, int, string) (r0 []*db.Repository, r1 error) {
  1358. return
  1359. },
  1360. },
  1361. GetByCollaboratorIDWithAccessModeFunc: &RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc{
  1362. defaultHook: func(context.Context, int64) (r0 map[*db.Repository]db.AccessMode, r1 error) {
  1363. return
  1364. },
  1365. },
  1366. GetByIDFunc: &RepositoriesStoreGetByIDFunc{
  1367. defaultHook: func(context.Context, int64) (r0 *db.Repository, r1 error) {
  1368. return
  1369. },
  1370. },
  1371. GetByNameFunc: &RepositoriesStoreGetByNameFunc{
  1372. defaultHook: func(context.Context, int64, string) (r0 *db.Repository, r1 error) {
  1373. return
  1374. },
  1375. },
  1376. HasForkedByFunc: &RepositoriesStoreHasForkedByFunc{
  1377. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  1378. return
  1379. },
  1380. },
  1381. ListWatchesFunc: &RepositoriesStoreListWatchesFunc{
  1382. defaultHook: func(context.Context, int64) (r0 []*db.Watch, r1 error) {
  1383. return
  1384. },
  1385. },
  1386. StarFunc: &RepositoriesStoreStarFunc{
  1387. defaultHook: func(context.Context, int64, int64) (r0 error) {
  1388. return
  1389. },
  1390. },
  1391. TouchFunc: &RepositoriesStoreTouchFunc{
  1392. defaultHook: func(context.Context, int64) (r0 error) {
  1393. return
  1394. },
  1395. },
  1396. WatchFunc: &RepositoriesStoreWatchFunc{
  1397. defaultHook: func(context.Context, int64, int64) (r0 error) {
  1398. return
  1399. },
  1400. },
  1401. }
  1402. }
  1403. // NewStrictMockRepositoriesStore creates a new mock of the
  1404. // RepositoriesStore interface. All methods panic on invocation, unless
  1405. // overwritten.
  1406. func NewStrictMockRepositoriesStore() *MockRepositoriesStore {
  1407. return &MockRepositoriesStore{
  1408. CreateFunc: &RepositoriesStoreCreateFunc{
  1409. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1410. panic("unexpected invocation of MockRepositoriesStore.Create")
  1411. },
  1412. },
  1413. GetByCollaboratorIDFunc: &RepositoriesStoreGetByCollaboratorIDFunc{
  1414. defaultHook: func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1415. panic("unexpected invocation of MockRepositoriesStore.GetByCollaboratorID")
  1416. },
  1417. },
  1418. GetByCollaboratorIDWithAccessModeFunc: &RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc{
  1419. defaultHook: func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1420. panic("unexpected invocation of MockRepositoriesStore.GetByCollaboratorIDWithAccessMode")
  1421. },
  1422. },
  1423. GetByIDFunc: &RepositoriesStoreGetByIDFunc{
  1424. defaultHook: func(context.Context, int64) (*db.Repository, error) {
  1425. panic("unexpected invocation of MockRepositoriesStore.GetByID")
  1426. },
  1427. },
  1428. GetByNameFunc: &RepositoriesStoreGetByNameFunc{
  1429. defaultHook: func(context.Context, int64, string) (*db.Repository, error) {
  1430. panic("unexpected invocation of MockRepositoriesStore.GetByName")
  1431. },
  1432. },
  1433. HasForkedByFunc: &RepositoriesStoreHasForkedByFunc{
  1434. defaultHook: func(context.Context, int64, int64) bool {
  1435. panic("unexpected invocation of MockRepositoriesStore.HasForkedBy")
  1436. },
  1437. },
  1438. ListWatchesFunc: &RepositoriesStoreListWatchesFunc{
  1439. defaultHook: func(context.Context, int64) ([]*db.Watch, error) {
  1440. panic("unexpected invocation of MockRepositoriesStore.ListWatches")
  1441. },
  1442. },
  1443. StarFunc: &RepositoriesStoreStarFunc{
  1444. defaultHook: func(context.Context, int64, int64) error {
  1445. panic("unexpected invocation of MockRepositoriesStore.Star")
  1446. },
  1447. },
  1448. TouchFunc: &RepositoriesStoreTouchFunc{
  1449. defaultHook: func(context.Context, int64) error {
  1450. panic("unexpected invocation of MockRepositoriesStore.Touch")
  1451. },
  1452. },
  1453. WatchFunc: &RepositoriesStoreWatchFunc{
  1454. defaultHook: func(context.Context, int64, int64) error {
  1455. panic("unexpected invocation of MockRepositoriesStore.Watch")
  1456. },
  1457. },
  1458. }
  1459. }
  1460. // NewMockRepositoriesStoreFrom creates a new mock of the
  1461. // MockRepositoriesStore interface. All methods delegate to the given
  1462. // implementation, unless overwritten.
  1463. func NewMockRepositoriesStoreFrom(i db.RepositoriesStore) *MockRepositoriesStore {
  1464. return &MockRepositoriesStore{
  1465. CreateFunc: &RepositoriesStoreCreateFunc{
  1466. defaultHook: i.Create,
  1467. },
  1468. GetByCollaboratorIDFunc: &RepositoriesStoreGetByCollaboratorIDFunc{
  1469. defaultHook: i.GetByCollaboratorID,
  1470. },
  1471. GetByCollaboratorIDWithAccessModeFunc: &RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc{
  1472. defaultHook: i.GetByCollaboratorIDWithAccessMode,
  1473. },
  1474. GetByIDFunc: &RepositoriesStoreGetByIDFunc{
  1475. defaultHook: i.GetByID,
  1476. },
  1477. GetByNameFunc: &RepositoriesStoreGetByNameFunc{
  1478. defaultHook: i.GetByName,
  1479. },
  1480. HasForkedByFunc: &RepositoriesStoreHasForkedByFunc{
  1481. defaultHook: i.HasForkedBy,
  1482. },
  1483. ListWatchesFunc: &RepositoriesStoreListWatchesFunc{
  1484. defaultHook: i.ListWatches,
  1485. },
  1486. StarFunc: &RepositoriesStoreStarFunc{
  1487. defaultHook: i.Star,
  1488. },
  1489. TouchFunc: &RepositoriesStoreTouchFunc{
  1490. defaultHook: i.Touch,
  1491. },
  1492. WatchFunc: &RepositoriesStoreWatchFunc{
  1493. defaultHook: i.Watch,
  1494. },
  1495. }
  1496. }
  1497. // RepositoriesStoreCreateFunc describes the behavior when the Create method
  1498. // of the parent MockRepositoriesStore instance is invoked.
  1499. type RepositoriesStoreCreateFunc struct {
  1500. defaultHook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1501. hooks []func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1502. history []RepositoriesStoreCreateFuncCall
  1503. mutex sync.Mutex
  1504. }
  1505. // Create delegates to the next hook function in the queue and stores the
  1506. // parameter and result values of this invocation.
  1507. func (m *MockRepositoriesStore) Create(v0 context.Context, v1 int64, v2 db.CreateRepoOptions) (*db.Repository, error) {
  1508. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  1509. m.CreateFunc.appendCall(RepositoriesStoreCreateFuncCall{v0, v1, v2, r0, r1})
  1510. return r0, r1
  1511. }
  1512. // SetDefaultHook sets function that is called when the Create method of the
  1513. // parent MockRepositoriesStore instance is invoked and the hook queue is
  1514. // empty.
  1515. func (f *RepositoriesStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1516. f.defaultHook = hook
  1517. }
  1518. // PushHook adds a function to the end of hook queue. Each invocation of the
  1519. // Create method of the parent MockRepositoriesStore instance invokes the
  1520. // hook at the front of the queue and discards it. After the queue is empty,
  1521. // the default hook function is invoked for any future action.
  1522. func (f *RepositoriesStoreCreateFunc) PushHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1523. f.mutex.Lock()
  1524. f.hooks = append(f.hooks, hook)
  1525. f.mutex.Unlock()
  1526. }
  1527. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1528. // given values.
  1529. func (f *RepositoriesStoreCreateFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1530. f.SetDefaultHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1531. return r0, r1
  1532. })
  1533. }
  1534. // PushReturn calls PushHook with a function that returns the given values.
  1535. func (f *RepositoriesStoreCreateFunc) PushReturn(r0 *db.Repository, r1 error) {
  1536. f.PushHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1537. return r0, r1
  1538. })
  1539. }
  1540. func (f *RepositoriesStoreCreateFunc) nextHook() func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1541. f.mutex.Lock()
  1542. defer f.mutex.Unlock()
  1543. if len(f.hooks) == 0 {
  1544. return f.defaultHook
  1545. }
  1546. hook := f.hooks[0]
  1547. f.hooks = f.hooks[1:]
  1548. return hook
  1549. }
  1550. func (f *RepositoriesStoreCreateFunc) appendCall(r0 RepositoriesStoreCreateFuncCall) {
  1551. f.mutex.Lock()
  1552. f.history = append(f.history, r0)
  1553. f.mutex.Unlock()
  1554. }
  1555. // History returns a sequence of RepositoriesStoreCreateFuncCall objects
  1556. // describing the invocations of this function.
  1557. func (f *RepositoriesStoreCreateFunc) History() []RepositoriesStoreCreateFuncCall {
  1558. f.mutex.Lock()
  1559. history := make([]RepositoriesStoreCreateFuncCall, len(f.history))
  1560. copy(history, f.history)
  1561. f.mutex.Unlock()
  1562. return history
  1563. }
  1564. // RepositoriesStoreCreateFuncCall is an object that describes an invocation
  1565. // of method Create on an instance of MockRepositoriesStore.
  1566. type RepositoriesStoreCreateFuncCall struct {
  1567. // Arg0 is the value of the 1st argument passed to this method
  1568. // invocation.
  1569. Arg0 context.Context
  1570. // Arg1 is the value of the 2nd argument passed to this method
  1571. // invocation.
  1572. Arg1 int64
  1573. // Arg2 is the value of the 3rd argument passed to this method
  1574. // invocation.
  1575. Arg2 db.CreateRepoOptions
  1576. // Result0 is the value of the 1st result returned from this method
  1577. // invocation.
  1578. Result0 *db.Repository
  1579. // Result1 is the value of the 2nd result returned from this method
  1580. // invocation.
  1581. Result1 error
  1582. }
  1583. // Args returns an interface slice containing the arguments of this
  1584. // invocation.
  1585. func (c RepositoriesStoreCreateFuncCall) Args() []interface{} {
  1586. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1587. }
  1588. // Results returns an interface slice containing the results of this
  1589. // invocation.
  1590. func (c RepositoriesStoreCreateFuncCall) Results() []interface{} {
  1591. return []interface{}{c.Result0, c.Result1}
  1592. }
  1593. // RepositoriesStoreGetByCollaboratorIDFunc describes the behavior when the
  1594. // GetByCollaboratorID method of the parent MockRepositoriesStore instance
  1595. // is invoked.
  1596. type RepositoriesStoreGetByCollaboratorIDFunc struct {
  1597. defaultHook func(context.Context, int64, int, string) ([]*db.Repository, error)
  1598. hooks []func(context.Context, int64, int, string) ([]*db.Repository, error)
  1599. history []RepositoriesStoreGetByCollaboratorIDFuncCall
  1600. mutex sync.Mutex
  1601. }
  1602. // GetByCollaboratorID delegates to the next hook function in the queue and
  1603. // stores the parameter and result values of this invocation.
  1604. func (m *MockRepositoriesStore) GetByCollaboratorID(v0 context.Context, v1 int64, v2 int, v3 string) ([]*db.Repository, error) {
  1605. r0, r1 := m.GetByCollaboratorIDFunc.nextHook()(v0, v1, v2, v3)
  1606. m.GetByCollaboratorIDFunc.appendCall(RepositoriesStoreGetByCollaboratorIDFuncCall{v0, v1, v2, v3, r0, r1})
  1607. return r0, r1
  1608. }
  1609. // SetDefaultHook sets function that is called when the GetByCollaboratorID
  1610. // method of the parent MockRepositoriesStore instance is invoked and the
  1611. // hook queue is empty.
  1612. func (f *RepositoriesStoreGetByCollaboratorIDFunc) SetDefaultHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1613. f.defaultHook = hook
  1614. }
  1615. // PushHook adds a function to the end of hook queue. Each invocation of the
  1616. // GetByCollaboratorID method of the parent MockRepositoriesStore instance
  1617. // invokes the hook at the front of the queue and discards it. After the
  1618. // queue is empty, the default hook function is invoked for any future
  1619. // action.
  1620. func (f *RepositoriesStoreGetByCollaboratorIDFunc) PushHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1621. f.mutex.Lock()
  1622. f.hooks = append(f.hooks, hook)
  1623. f.mutex.Unlock()
  1624. }
  1625. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1626. // given values.
  1627. func (f *RepositoriesStoreGetByCollaboratorIDFunc) SetDefaultReturn(r0 []*db.Repository, r1 error) {
  1628. f.SetDefaultHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1629. return r0, r1
  1630. })
  1631. }
  1632. // PushReturn calls PushHook with a function that returns the given values.
  1633. func (f *RepositoriesStoreGetByCollaboratorIDFunc) PushReturn(r0 []*db.Repository, r1 error) {
  1634. f.PushHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1635. return r0, r1
  1636. })
  1637. }
  1638. func (f *RepositoriesStoreGetByCollaboratorIDFunc) nextHook() func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1639. f.mutex.Lock()
  1640. defer f.mutex.Unlock()
  1641. if len(f.hooks) == 0 {
  1642. return f.defaultHook
  1643. }
  1644. hook := f.hooks[0]
  1645. f.hooks = f.hooks[1:]
  1646. return hook
  1647. }
  1648. func (f *RepositoriesStoreGetByCollaboratorIDFunc) appendCall(r0 RepositoriesStoreGetByCollaboratorIDFuncCall) {
  1649. f.mutex.Lock()
  1650. f.history = append(f.history, r0)
  1651. f.mutex.Unlock()
  1652. }
  1653. // History returns a sequence of
  1654. // RepositoriesStoreGetByCollaboratorIDFuncCall objects describing the
  1655. // invocations of this function.
  1656. func (f *RepositoriesStoreGetByCollaboratorIDFunc) History() []RepositoriesStoreGetByCollaboratorIDFuncCall {
  1657. f.mutex.Lock()
  1658. history := make([]RepositoriesStoreGetByCollaboratorIDFuncCall, len(f.history))
  1659. copy(history, f.history)
  1660. f.mutex.Unlock()
  1661. return history
  1662. }
  1663. // RepositoriesStoreGetByCollaboratorIDFuncCall is an object that describes
  1664. // an invocation of method GetByCollaboratorID on an instance of
  1665. // MockRepositoriesStore.
  1666. type RepositoriesStoreGetByCollaboratorIDFuncCall struct {
  1667. // Arg0 is the value of the 1st argument passed to this method
  1668. // invocation.
  1669. Arg0 context.Context
  1670. // Arg1 is the value of the 2nd argument passed to this method
  1671. // invocation.
  1672. Arg1 int64
  1673. // Arg2 is the value of the 3rd argument passed to this method
  1674. // invocation.
  1675. Arg2 int
  1676. // Arg3 is the value of the 4th argument passed to this method
  1677. // invocation.
  1678. Arg3 string
  1679. // Result0 is the value of the 1st result returned from this method
  1680. // invocation.
  1681. Result0 []*db.Repository
  1682. // Result1 is the value of the 2nd result returned from this method
  1683. // invocation.
  1684. Result1 error
  1685. }
  1686. // Args returns an interface slice containing the arguments of this
  1687. // invocation.
  1688. func (c RepositoriesStoreGetByCollaboratorIDFuncCall) Args() []interface{} {
  1689. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1690. }
  1691. // Results returns an interface slice containing the results of this
  1692. // invocation.
  1693. func (c RepositoriesStoreGetByCollaboratorIDFuncCall) Results() []interface{} {
  1694. return []interface{}{c.Result0, c.Result1}
  1695. }
  1696. // RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc describes the
  1697. // behavior when the GetByCollaboratorIDWithAccessMode method of the parent
  1698. // MockRepositoriesStore instance is invoked.
  1699. type RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc struct {
  1700. defaultHook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1701. hooks []func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1702. history []RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall
  1703. mutex sync.Mutex
  1704. }
  1705. // GetByCollaboratorIDWithAccessMode delegates to the next hook function in
  1706. // the queue and stores the parameter and result values of this invocation.
  1707. func (m *MockRepositoriesStore) GetByCollaboratorIDWithAccessMode(v0 context.Context, v1 int64) (map[*db.Repository]db.AccessMode, error) {
  1708. r0, r1 := m.GetByCollaboratorIDWithAccessModeFunc.nextHook()(v0, v1)
  1709. m.GetByCollaboratorIDWithAccessModeFunc.appendCall(RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall{v0, v1, r0, r1})
  1710. return r0, r1
  1711. }
  1712. // SetDefaultHook sets function that is called when the
  1713. // GetByCollaboratorIDWithAccessMode method of the parent
  1714. // MockRepositoriesStore instance is invoked and the hook queue is empty.
  1715. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1716. f.defaultHook = hook
  1717. }
  1718. // PushHook adds a function to the end of hook queue. Each invocation of the
  1719. // GetByCollaboratorIDWithAccessMode method of the parent
  1720. // MockRepositoriesStore instance invokes the hook at the front of the queue
  1721. // and discards it. After the queue is empty, the default hook function is
  1722. // invoked for any future action.
  1723. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) PushHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1724. f.mutex.Lock()
  1725. f.hooks = append(f.hooks, hook)
  1726. f.mutex.Unlock()
  1727. }
  1728. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1729. // given values.
  1730. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1731. f.SetDefaultHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1732. return r0, r1
  1733. })
  1734. }
  1735. // PushReturn calls PushHook with a function that returns the given values.
  1736. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) PushReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1737. f.PushHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1738. return r0, r1
  1739. })
  1740. }
  1741. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) nextHook() func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1742. f.mutex.Lock()
  1743. defer f.mutex.Unlock()
  1744. if len(f.hooks) == 0 {
  1745. return f.defaultHook
  1746. }
  1747. hook := f.hooks[0]
  1748. f.hooks = f.hooks[1:]
  1749. return hook
  1750. }
  1751. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) appendCall(r0 RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall) {
  1752. f.mutex.Lock()
  1753. f.history = append(f.history, r0)
  1754. f.mutex.Unlock()
  1755. }
  1756. // History returns a sequence of
  1757. // RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall objects
  1758. // describing the invocations of this function.
  1759. func (f *RepositoriesStoreGetByCollaboratorIDWithAccessModeFunc) History() []RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall {
  1760. f.mutex.Lock()
  1761. history := make([]RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall, len(f.history))
  1762. copy(history, f.history)
  1763. f.mutex.Unlock()
  1764. return history
  1765. }
  1766. // RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall is an object
  1767. // that describes an invocation of method GetByCollaboratorIDWithAccessMode
  1768. // on an instance of MockRepositoriesStore.
  1769. type RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall struct {
  1770. // Arg0 is the value of the 1st argument passed to this method
  1771. // invocation.
  1772. Arg0 context.Context
  1773. // Arg1 is the value of the 2nd argument passed to this method
  1774. // invocation.
  1775. Arg1 int64
  1776. // Result0 is the value of the 1st result returned from this method
  1777. // invocation.
  1778. Result0 map[*db.Repository]db.AccessMode
  1779. // Result1 is the value of the 2nd result returned from this method
  1780. // invocation.
  1781. Result1 error
  1782. }
  1783. // Args returns an interface slice containing the arguments of this
  1784. // invocation.
  1785. func (c RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall) Args() []interface{} {
  1786. return []interface{}{c.Arg0, c.Arg1}
  1787. }
  1788. // Results returns an interface slice containing the results of this
  1789. // invocation.
  1790. func (c RepositoriesStoreGetByCollaboratorIDWithAccessModeFuncCall) Results() []interface{} {
  1791. return []interface{}{c.Result0, c.Result1}
  1792. }
  1793. // RepositoriesStoreGetByIDFunc describes the behavior when the GetByID
  1794. // method of the parent MockRepositoriesStore instance is invoked.
  1795. type RepositoriesStoreGetByIDFunc struct {
  1796. defaultHook func(context.Context, int64) (*db.Repository, error)
  1797. hooks []func(context.Context, int64) (*db.Repository, error)
  1798. history []RepositoriesStoreGetByIDFuncCall
  1799. mutex sync.Mutex
  1800. }
  1801. // GetByID delegates to the next hook function in the queue and stores the
  1802. // parameter and result values of this invocation.
  1803. func (m *MockRepositoriesStore) GetByID(v0 context.Context, v1 int64) (*db.Repository, error) {
  1804. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  1805. m.GetByIDFunc.appendCall(RepositoriesStoreGetByIDFuncCall{v0, v1, r0, r1})
  1806. return r0, r1
  1807. }
  1808. // SetDefaultHook sets function that is called when the GetByID method of
  1809. // the parent MockRepositoriesStore instance is invoked and the hook queue
  1810. // is empty.
  1811. func (f *RepositoriesStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.Repository, error)) {
  1812. f.defaultHook = hook
  1813. }
  1814. // PushHook adds a function to the end of hook queue. Each invocation of the
  1815. // GetByID method of the parent MockRepositoriesStore instance invokes the
  1816. // hook at the front of the queue and discards it. After the queue is empty,
  1817. // the default hook function is invoked for any future action.
  1818. func (f *RepositoriesStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.Repository, error)) {
  1819. f.mutex.Lock()
  1820. f.hooks = append(f.hooks, hook)
  1821. f.mutex.Unlock()
  1822. }
  1823. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1824. // given values.
  1825. func (f *RepositoriesStoreGetByIDFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1826. f.SetDefaultHook(func(context.Context, int64) (*db.Repository, error) {
  1827. return r0, r1
  1828. })
  1829. }
  1830. // PushReturn calls PushHook with a function that returns the given values.
  1831. func (f *RepositoriesStoreGetByIDFunc) PushReturn(r0 *db.Repository, r1 error) {
  1832. f.PushHook(func(context.Context, int64) (*db.Repository, error) {
  1833. return r0, r1
  1834. })
  1835. }
  1836. func (f *RepositoriesStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.Repository, error) {
  1837. f.mutex.Lock()
  1838. defer f.mutex.Unlock()
  1839. if len(f.hooks) == 0 {
  1840. return f.defaultHook
  1841. }
  1842. hook := f.hooks[0]
  1843. f.hooks = f.hooks[1:]
  1844. return hook
  1845. }
  1846. func (f *RepositoriesStoreGetByIDFunc) appendCall(r0 RepositoriesStoreGetByIDFuncCall) {
  1847. f.mutex.Lock()
  1848. f.history = append(f.history, r0)
  1849. f.mutex.Unlock()
  1850. }
  1851. // History returns a sequence of RepositoriesStoreGetByIDFuncCall objects
  1852. // describing the invocations of this function.
  1853. func (f *RepositoriesStoreGetByIDFunc) History() []RepositoriesStoreGetByIDFuncCall {
  1854. f.mutex.Lock()
  1855. history := make([]RepositoriesStoreGetByIDFuncCall, len(f.history))
  1856. copy(history, f.history)
  1857. f.mutex.Unlock()
  1858. return history
  1859. }
  1860. // RepositoriesStoreGetByIDFuncCall is an object that describes an
  1861. // invocation of method GetByID on an instance of MockRepositoriesStore.
  1862. type RepositoriesStoreGetByIDFuncCall struct {
  1863. // Arg0 is the value of the 1st argument passed to this method
  1864. // invocation.
  1865. Arg0 context.Context
  1866. // Arg1 is the value of the 2nd argument passed to this method
  1867. // invocation.
  1868. Arg1 int64
  1869. // Result0 is the value of the 1st result returned from this method
  1870. // invocation.
  1871. Result0 *db.Repository
  1872. // Result1 is the value of the 2nd result returned from this method
  1873. // invocation.
  1874. Result1 error
  1875. }
  1876. // Args returns an interface slice containing the arguments of this
  1877. // invocation.
  1878. func (c RepositoriesStoreGetByIDFuncCall) Args() []interface{} {
  1879. return []interface{}{c.Arg0, c.Arg1}
  1880. }
  1881. // Results returns an interface slice containing the results of this
  1882. // invocation.
  1883. func (c RepositoriesStoreGetByIDFuncCall) Results() []interface{} {
  1884. return []interface{}{c.Result0, c.Result1}
  1885. }
  1886. // RepositoriesStoreGetByNameFunc describes the behavior when the GetByName
  1887. // method of the parent MockRepositoriesStore instance is invoked.
  1888. type RepositoriesStoreGetByNameFunc struct {
  1889. defaultHook func(context.Context, int64, string) (*db.Repository, error)
  1890. hooks []func(context.Context, int64, string) (*db.Repository, error)
  1891. history []RepositoriesStoreGetByNameFuncCall
  1892. mutex sync.Mutex
  1893. }
  1894. // GetByName delegates to the next hook function in the queue and stores the
  1895. // parameter and result values of this invocation.
  1896. func (m *MockRepositoriesStore) GetByName(v0 context.Context, v1 int64, v2 string) (*db.Repository, error) {
  1897. r0, r1 := m.GetByNameFunc.nextHook()(v0, v1, v2)
  1898. m.GetByNameFunc.appendCall(RepositoriesStoreGetByNameFuncCall{v0, v1, v2, r0, r1})
  1899. return r0, r1
  1900. }
  1901. // SetDefaultHook sets function that is called when the GetByName method of
  1902. // the parent MockRepositoriesStore instance is invoked and the hook queue
  1903. // is empty.
  1904. func (f *RepositoriesStoreGetByNameFunc) SetDefaultHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1905. f.defaultHook = hook
  1906. }
  1907. // PushHook adds a function to the end of hook queue. Each invocation of the
  1908. // GetByName method of the parent MockRepositoriesStore instance invokes the
  1909. // hook at the front of the queue and discards it. After the queue is empty,
  1910. // the default hook function is invoked for any future action.
  1911. func (f *RepositoriesStoreGetByNameFunc) PushHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1912. f.mutex.Lock()
  1913. f.hooks = append(f.hooks, hook)
  1914. f.mutex.Unlock()
  1915. }
  1916. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1917. // given values.
  1918. func (f *RepositoriesStoreGetByNameFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1919. f.SetDefaultHook(func(context.Context, int64, string) (*db.Repository, error) {
  1920. return r0, r1
  1921. })
  1922. }
  1923. // PushReturn calls PushHook with a function that returns the given values.
  1924. func (f *RepositoriesStoreGetByNameFunc) PushReturn(r0 *db.Repository, r1 error) {
  1925. f.PushHook(func(context.Context, int64, string) (*db.Repository, error) {
  1926. return r0, r1
  1927. })
  1928. }
  1929. func (f *RepositoriesStoreGetByNameFunc) nextHook() func(context.Context, int64, string) (*db.Repository, error) {
  1930. f.mutex.Lock()
  1931. defer f.mutex.Unlock()
  1932. if len(f.hooks) == 0 {
  1933. return f.defaultHook
  1934. }
  1935. hook := f.hooks[0]
  1936. f.hooks = f.hooks[1:]
  1937. return hook
  1938. }
  1939. func (f *RepositoriesStoreGetByNameFunc) appendCall(r0 RepositoriesStoreGetByNameFuncCall) {
  1940. f.mutex.Lock()
  1941. f.history = append(f.history, r0)
  1942. f.mutex.Unlock()
  1943. }
  1944. // History returns a sequence of RepositoriesStoreGetByNameFuncCall objects
  1945. // describing the invocations of this function.
  1946. func (f *RepositoriesStoreGetByNameFunc) History() []RepositoriesStoreGetByNameFuncCall {
  1947. f.mutex.Lock()
  1948. history := make([]RepositoriesStoreGetByNameFuncCall, len(f.history))
  1949. copy(history, f.history)
  1950. f.mutex.Unlock()
  1951. return history
  1952. }
  1953. // RepositoriesStoreGetByNameFuncCall is an object that describes an
  1954. // invocation of method GetByName on an instance of MockRepositoriesStore.
  1955. type RepositoriesStoreGetByNameFuncCall struct {
  1956. // Arg0 is the value of the 1st argument passed to this method
  1957. // invocation.
  1958. Arg0 context.Context
  1959. // Arg1 is the value of the 2nd argument passed to this method
  1960. // invocation.
  1961. Arg1 int64
  1962. // Arg2 is the value of the 3rd argument passed to this method
  1963. // invocation.
  1964. Arg2 string
  1965. // Result0 is the value of the 1st result returned from this method
  1966. // invocation.
  1967. Result0 *db.Repository
  1968. // Result1 is the value of the 2nd result returned from this method
  1969. // invocation.
  1970. Result1 error
  1971. }
  1972. // Args returns an interface slice containing the arguments of this
  1973. // invocation.
  1974. func (c RepositoriesStoreGetByNameFuncCall) Args() []interface{} {
  1975. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1976. }
  1977. // Results returns an interface slice containing the results of this
  1978. // invocation.
  1979. func (c RepositoriesStoreGetByNameFuncCall) Results() []interface{} {
  1980. return []interface{}{c.Result0, c.Result1}
  1981. }
  1982. // RepositoriesStoreHasForkedByFunc describes the behavior when the
  1983. // HasForkedBy method of the parent MockRepositoriesStore instance is
  1984. // invoked.
  1985. type RepositoriesStoreHasForkedByFunc struct {
  1986. defaultHook func(context.Context, int64, int64) bool
  1987. hooks []func(context.Context, int64, int64) bool
  1988. history []RepositoriesStoreHasForkedByFuncCall
  1989. mutex sync.Mutex
  1990. }
  1991. // HasForkedBy delegates to the next hook function in the queue and stores
  1992. // the parameter and result values of this invocation.
  1993. func (m *MockRepositoriesStore) HasForkedBy(v0 context.Context, v1 int64, v2 int64) bool {
  1994. r0 := m.HasForkedByFunc.nextHook()(v0, v1, v2)
  1995. m.HasForkedByFunc.appendCall(RepositoriesStoreHasForkedByFuncCall{v0, v1, v2, r0})
  1996. return r0
  1997. }
  1998. // SetDefaultHook sets function that is called when the HasForkedBy method
  1999. // of the parent MockRepositoriesStore instance is invoked and the hook
  2000. // queue is empty.
  2001. func (f *RepositoriesStoreHasForkedByFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  2002. f.defaultHook = hook
  2003. }
  2004. // PushHook adds a function to the end of hook queue. Each invocation of the
  2005. // HasForkedBy method of the parent MockRepositoriesStore instance invokes
  2006. // the hook at the front of the queue and discards it. After the queue is
  2007. // empty, the default hook function is invoked for any future action.
  2008. func (f *RepositoriesStoreHasForkedByFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  2009. f.mutex.Lock()
  2010. f.hooks = append(f.hooks, hook)
  2011. f.mutex.Unlock()
  2012. }
  2013. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2014. // given values.
  2015. func (f *RepositoriesStoreHasForkedByFunc) SetDefaultReturn(r0 bool) {
  2016. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  2017. return r0
  2018. })
  2019. }
  2020. // PushReturn calls PushHook with a function that returns the given values.
  2021. func (f *RepositoriesStoreHasForkedByFunc) PushReturn(r0 bool) {
  2022. f.PushHook(func(context.Context, int64, int64) bool {
  2023. return r0
  2024. })
  2025. }
  2026. func (f *RepositoriesStoreHasForkedByFunc) nextHook() func(context.Context, int64, int64) bool {
  2027. f.mutex.Lock()
  2028. defer f.mutex.Unlock()
  2029. if len(f.hooks) == 0 {
  2030. return f.defaultHook
  2031. }
  2032. hook := f.hooks[0]
  2033. f.hooks = f.hooks[1:]
  2034. return hook
  2035. }
  2036. func (f *RepositoriesStoreHasForkedByFunc) appendCall(r0 RepositoriesStoreHasForkedByFuncCall) {
  2037. f.mutex.Lock()
  2038. f.history = append(f.history, r0)
  2039. f.mutex.Unlock()
  2040. }
  2041. // History returns a sequence of RepositoriesStoreHasForkedByFuncCall
  2042. // objects describing the invocations of this function.
  2043. func (f *RepositoriesStoreHasForkedByFunc) History() []RepositoriesStoreHasForkedByFuncCall {
  2044. f.mutex.Lock()
  2045. history := make([]RepositoriesStoreHasForkedByFuncCall, len(f.history))
  2046. copy(history, f.history)
  2047. f.mutex.Unlock()
  2048. return history
  2049. }
  2050. // RepositoriesStoreHasForkedByFuncCall is an object that describes an
  2051. // invocation of method HasForkedBy on an instance of MockRepositoriesStore.
  2052. type RepositoriesStoreHasForkedByFuncCall struct {
  2053. // Arg0 is the value of the 1st argument passed to this method
  2054. // invocation.
  2055. Arg0 context.Context
  2056. // Arg1 is the value of the 2nd argument passed to this method
  2057. // invocation.
  2058. Arg1 int64
  2059. // Arg2 is the value of the 3rd argument passed to this method
  2060. // invocation.
  2061. Arg2 int64
  2062. // Result0 is the value of the 1st result returned from this method
  2063. // invocation.
  2064. Result0 bool
  2065. }
  2066. // Args returns an interface slice containing the arguments of this
  2067. // invocation.
  2068. func (c RepositoriesStoreHasForkedByFuncCall) Args() []interface{} {
  2069. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2070. }
  2071. // Results returns an interface slice containing the results of this
  2072. // invocation.
  2073. func (c RepositoriesStoreHasForkedByFuncCall) Results() []interface{} {
  2074. return []interface{}{c.Result0}
  2075. }
  2076. // RepositoriesStoreListWatchesFunc describes the behavior when the
  2077. // ListWatches method of the parent MockRepositoriesStore instance is
  2078. // invoked.
  2079. type RepositoriesStoreListWatchesFunc struct {
  2080. defaultHook func(context.Context, int64) ([]*db.Watch, error)
  2081. hooks []func(context.Context, int64) ([]*db.Watch, error)
  2082. history []RepositoriesStoreListWatchesFuncCall
  2083. mutex sync.Mutex
  2084. }
  2085. // ListWatches delegates to the next hook function in the queue and stores
  2086. // the parameter and result values of this invocation.
  2087. func (m *MockRepositoriesStore) ListWatches(v0 context.Context, v1 int64) ([]*db.Watch, error) {
  2088. r0, r1 := m.ListWatchesFunc.nextHook()(v0, v1)
  2089. m.ListWatchesFunc.appendCall(RepositoriesStoreListWatchesFuncCall{v0, v1, r0, r1})
  2090. return r0, r1
  2091. }
  2092. // SetDefaultHook sets function that is called when the ListWatches method
  2093. // of the parent MockRepositoriesStore instance is invoked and the hook
  2094. // queue is empty.
  2095. func (f *RepositoriesStoreListWatchesFunc) SetDefaultHook(hook func(context.Context, int64) ([]*db.Watch, error)) {
  2096. f.defaultHook = hook
  2097. }
  2098. // PushHook adds a function to the end of hook queue. Each invocation of the
  2099. // ListWatches method of the parent MockRepositoriesStore instance invokes
  2100. // the hook at the front of the queue and discards it. After the queue is
  2101. // empty, the default hook function is invoked for any future action.
  2102. func (f *RepositoriesStoreListWatchesFunc) PushHook(hook func(context.Context, int64) ([]*db.Watch, error)) {
  2103. f.mutex.Lock()
  2104. f.hooks = append(f.hooks, hook)
  2105. f.mutex.Unlock()
  2106. }
  2107. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2108. // given values.
  2109. func (f *RepositoriesStoreListWatchesFunc) SetDefaultReturn(r0 []*db.Watch, r1 error) {
  2110. f.SetDefaultHook(func(context.Context, int64) ([]*db.Watch, error) {
  2111. return r0, r1
  2112. })
  2113. }
  2114. // PushReturn calls PushHook with a function that returns the given values.
  2115. func (f *RepositoriesStoreListWatchesFunc) PushReturn(r0 []*db.Watch, r1 error) {
  2116. f.PushHook(func(context.Context, int64) ([]*db.Watch, error) {
  2117. return r0, r1
  2118. })
  2119. }
  2120. func (f *RepositoriesStoreListWatchesFunc) nextHook() func(context.Context, int64) ([]*db.Watch, error) {
  2121. f.mutex.Lock()
  2122. defer f.mutex.Unlock()
  2123. if len(f.hooks) == 0 {
  2124. return f.defaultHook
  2125. }
  2126. hook := f.hooks[0]
  2127. f.hooks = f.hooks[1:]
  2128. return hook
  2129. }
  2130. func (f *RepositoriesStoreListWatchesFunc) appendCall(r0 RepositoriesStoreListWatchesFuncCall) {
  2131. f.mutex.Lock()
  2132. f.history = append(f.history, r0)
  2133. f.mutex.Unlock()
  2134. }
  2135. // History returns a sequence of RepositoriesStoreListWatchesFuncCall
  2136. // objects describing the invocations of this function.
  2137. func (f *RepositoriesStoreListWatchesFunc) History() []RepositoriesStoreListWatchesFuncCall {
  2138. f.mutex.Lock()
  2139. history := make([]RepositoriesStoreListWatchesFuncCall, len(f.history))
  2140. copy(history, f.history)
  2141. f.mutex.Unlock()
  2142. return history
  2143. }
  2144. // RepositoriesStoreListWatchesFuncCall is an object that describes an
  2145. // invocation of method ListWatches on an instance of MockRepositoriesStore.
  2146. type RepositoriesStoreListWatchesFuncCall struct {
  2147. // Arg0 is the value of the 1st argument passed to this method
  2148. // invocation.
  2149. Arg0 context.Context
  2150. // Arg1 is the value of the 2nd argument passed to this method
  2151. // invocation.
  2152. Arg1 int64
  2153. // Result0 is the value of the 1st result returned from this method
  2154. // invocation.
  2155. Result0 []*db.Watch
  2156. // Result1 is the value of the 2nd result returned from this method
  2157. // invocation.
  2158. Result1 error
  2159. }
  2160. // Args returns an interface slice containing the arguments of this
  2161. // invocation.
  2162. func (c RepositoriesStoreListWatchesFuncCall) Args() []interface{} {
  2163. return []interface{}{c.Arg0, c.Arg1}
  2164. }
  2165. // Results returns an interface slice containing the results of this
  2166. // invocation.
  2167. func (c RepositoriesStoreListWatchesFuncCall) Results() []interface{} {
  2168. return []interface{}{c.Result0, c.Result1}
  2169. }
  2170. // RepositoriesStoreStarFunc describes the behavior when the Star method of
  2171. // the parent MockRepositoriesStore instance is invoked.
  2172. type RepositoriesStoreStarFunc struct {
  2173. defaultHook func(context.Context, int64, int64) error
  2174. hooks []func(context.Context, int64, int64) error
  2175. history []RepositoriesStoreStarFuncCall
  2176. mutex sync.Mutex
  2177. }
  2178. // Star delegates to the next hook function in the queue and stores the
  2179. // parameter and result values of this invocation.
  2180. func (m *MockRepositoriesStore) Star(v0 context.Context, v1 int64, v2 int64) error {
  2181. r0 := m.StarFunc.nextHook()(v0, v1, v2)
  2182. m.StarFunc.appendCall(RepositoriesStoreStarFuncCall{v0, v1, v2, r0})
  2183. return r0
  2184. }
  2185. // SetDefaultHook sets function that is called when the Star method of the
  2186. // parent MockRepositoriesStore instance is invoked and the hook queue is
  2187. // empty.
  2188. func (f *RepositoriesStoreStarFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  2189. f.defaultHook = hook
  2190. }
  2191. // PushHook adds a function to the end of hook queue. Each invocation of the
  2192. // Star method of the parent MockRepositoriesStore instance invokes the hook
  2193. // at the front of the queue and discards it. After the queue is empty, the
  2194. // default hook function is invoked for any future action.
  2195. func (f *RepositoriesStoreStarFunc) PushHook(hook func(context.Context, int64, int64) error) {
  2196. f.mutex.Lock()
  2197. f.hooks = append(f.hooks, hook)
  2198. f.mutex.Unlock()
  2199. }
  2200. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2201. // given values.
  2202. func (f *RepositoriesStoreStarFunc) SetDefaultReturn(r0 error) {
  2203. f.SetDefaultHook(func(context.Context, int64, int64) error {
  2204. return r0
  2205. })
  2206. }
  2207. // PushReturn calls PushHook with a function that returns the given values.
  2208. func (f *RepositoriesStoreStarFunc) PushReturn(r0 error) {
  2209. f.PushHook(func(context.Context, int64, int64) error {
  2210. return r0
  2211. })
  2212. }
  2213. func (f *RepositoriesStoreStarFunc) nextHook() func(context.Context, int64, int64) error {
  2214. f.mutex.Lock()
  2215. defer f.mutex.Unlock()
  2216. if len(f.hooks) == 0 {
  2217. return f.defaultHook
  2218. }
  2219. hook := f.hooks[0]
  2220. f.hooks = f.hooks[1:]
  2221. return hook
  2222. }
  2223. func (f *RepositoriesStoreStarFunc) appendCall(r0 RepositoriesStoreStarFuncCall) {
  2224. f.mutex.Lock()
  2225. f.history = append(f.history, r0)
  2226. f.mutex.Unlock()
  2227. }
  2228. // History returns a sequence of RepositoriesStoreStarFuncCall objects
  2229. // describing the invocations of this function.
  2230. func (f *RepositoriesStoreStarFunc) History() []RepositoriesStoreStarFuncCall {
  2231. f.mutex.Lock()
  2232. history := make([]RepositoriesStoreStarFuncCall, len(f.history))
  2233. copy(history, f.history)
  2234. f.mutex.Unlock()
  2235. return history
  2236. }
  2237. // RepositoriesStoreStarFuncCall is an object that describes an invocation
  2238. // of method Star on an instance of MockRepositoriesStore.
  2239. type RepositoriesStoreStarFuncCall struct {
  2240. // Arg0 is the value of the 1st argument passed to this method
  2241. // invocation.
  2242. Arg0 context.Context
  2243. // Arg1 is the value of the 2nd argument passed to this method
  2244. // invocation.
  2245. Arg1 int64
  2246. // Arg2 is the value of the 3rd argument passed to this method
  2247. // invocation.
  2248. Arg2 int64
  2249. // Result0 is the value of the 1st result returned from this method
  2250. // invocation.
  2251. Result0 error
  2252. }
  2253. // Args returns an interface slice containing the arguments of this
  2254. // invocation.
  2255. func (c RepositoriesStoreStarFuncCall) Args() []interface{} {
  2256. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2257. }
  2258. // Results returns an interface slice containing the results of this
  2259. // invocation.
  2260. func (c RepositoriesStoreStarFuncCall) Results() []interface{} {
  2261. return []interface{}{c.Result0}
  2262. }
  2263. // RepositoriesStoreTouchFunc describes the behavior when the Touch method
  2264. // of the parent MockRepositoriesStore instance is invoked.
  2265. type RepositoriesStoreTouchFunc struct {
  2266. defaultHook func(context.Context, int64) error
  2267. hooks []func(context.Context, int64) error
  2268. history []RepositoriesStoreTouchFuncCall
  2269. mutex sync.Mutex
  2270. }
  2271. // Touch delegates to the next hook function in the queue and stores the
  2272. // parameter and result values of this invocation.
  2273. func (m *MockRepositoriesStore) Touch(v0 context.Context, v1 int64) error {
  2274. r0 := m.TouchFunc.nextHook()(v0, v1)
  2275. m.TouchFunc.appendCall(RepositoriesStoreTouchFuncCall{v0, v1, r0})
  2276. return r0
  2277. }
  2278. // SetDefaultHook sets function that is called when the Touch method of the
  2279. // parent MockRepositoriesStore instance is invoked and the hook queue is
  2280. // empty.
  2281. func (f *RepositoriesStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  2282. f.defaultHook = hook
  2283. }
  2284. // PushHook adds a function to the end of hook queue. Each invocation of the
  2285. // Touch method of the parent MockRepositoriesStore instance invokes the
  2286. // hook at the front of the queue and discards it. After the queue is empty,
  2287. // the default hook function is invoked for any future action.
  2288. func (f *RepositoriesStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  2289. f.mutex.Lock()
  2290. f.hooks = append(f.hooks, hook)
  2291. f.mutex.Unlock()
  2292. }
  2293. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2294. // given values.
  2295. func (f *RepositoriesStoreTouchFunc) SetDefaultReturn(r0 error) {
  2296. f.SetDefaultHook(func(context.Context, int64) error {
  2297. return r0
  2298. })
  2299. }
  2300. // PushReturn calls PushHook with a function that returns the given values.
  2301. func (f *RepositoriesStoreTouchFunc) PushReturn(r0 error) {
  2302. f.PushHook(func(context.Context, int64) error {
  2303. return r0
  2304. })
  2305. }
  2306. func (f *RepositoriesStoreTouchFunc) nextHook() func(context.Context, int64) error {
  2307. f.mutex.Lock()
  2308. defer f.mutex.Unlock()
  2309. if len(f.hooks) == 0 {
  2310. return f.defaultHook
  2311. }
  2312. hook := f.hooks[0]
  2313. f.hooks = f.hooks[1:]
  2314. return hook
  2315. }
  2316. func (f *RepositoriesStoreTouchFunc) appendCall(r0 RepositoriesStoreTouchFuncCall) {
  2317. f.mutex.Lock()
  2318. f.history = append(f.history, r0)
  2319. f.mutex.Unlock()
  2320. }
  2321. // History returns a sequence of RepositoriesStoreTouchFuncCall objects
  2322. // describing the invocations of this function.
  2323. func (f *RepositoriesStoreTouchFunc) History() []RepositoriesStoreTouchFuncCall {
  2324. f.mutex.Lock()
  2325. history := make([]RepositoriesStoreTouchFuncCall, len(f.history))
  2326. copy(history, f.history)
  2327. f.mutex.Unlock()
  2328. return history
  2329. }
  2330. // RepositoriesStoreTouchFuncCall is an object that describes an invocation
  2331. // of method Touch on an instance of MockRepositoriesStore.
  2332. type RepositoriesStoreTouchFuncCall struct {
  2333. // Arg0 is the value of the 1st argument passed to this method
  2334. // invocation.
  2335. Arg0 context.Context
  2336. // Arg1 is the value of the 2nd argument passed to this method
  2337. // invocation.
  2338. Arg1 int64
  2339. // Result0 is the value of the 1st result returned from this method
  2340. // invocation.
  2341. Result0 error
  2342. }
  2343. // Args returns an interface slice containing the arguments of this
  2344. // invocation.
  2345. func (c RepositoriesStoreTouchFuncCall) Args() []interface{} {
  2346. return []interface{}{c.Arg0, c.Arg1}
  2347. }
  2348. // Results returns an interface slice containing the results of this
  2349. // invocation.
  2350. func (c RepositoriesStoreTouchFuncCall) Results() []interface{} {
  2351. return []interface{}{c.Result0}
  2352. }
  2353. // RepositoriesStoreWatchFunc describes the behavior when the Watch method
  2354. // of the parent MockRepositoriesStore instance is invoked.
  2355. type RepositoriesStoreWatchFunc struct {
  2356. defaultHook func(context.Context, int64, int64) error
  2357. hooks []func(context.Context, int64, int64) error
  2358. history []RepositoriesStoreWatchFuncCall
  2359. mutex sync.Mutex
  2360. }
  2361. // Watch delegates to the next hook function in the queue and stores the
  2362. // parameter and result values of this invocation.
  2363. func (m *MockRepositoriesStore) Watch(v0 context.Context, v1 int64, v2 int64) error {
  2364. r0 := m.WatchFunc.nextHook()(v0, v1, v2)
  2365. m.WatchFunc.appendCall(RepositoriesStoreWatchFuncCall{v0, v1, v2, r0})
  2366. return r0
  2367. }
  2368. // SetDefaultHook sets function that is called when the Watch method of the
  2369. // parent MockRepositoriesStore instance is invoked and the hook queue is
  2370. // empty.
  2371. func (f *RepositoriesStoreWatchFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  2372. f.defaultHook = hook
  2373. }
  2374. // PushHook adds a function to the end of hook queue. Each invocation of the
  2375. // Watch method of the parent MockRepositoriesStore instance invokes the
  2376. // hook at the front of the queue and discards it. After the queue is empty,
  2377. // the default hook function is invoked for any future action.
  2378. func (f *RepositoriesStoreWatchFunc) PushHook(hook func(context.Context, int64, int64) error) {
  2379. f.mutex.Lock()
  2380. f.hooks = append(f.hooks, hook)
  2381. f.mutex.Unlock()
  2382. }
  2383. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2384. // given values.
  2385. func (f *RepositoriesStoreWatchFunc) SetDefaultReturn(r0 error) {
  2386. f.SetDefaultHook(func(context.Context, int64, int64) error {
  2387. return r0
  2388. })
  2389. }
  2390. // PushReturn calls PushHook with a function that returns the given values.
  2391. func (f *RepositoriesStoreWatchFunc) PushReturn(r0 error) {
  2392. f.PushHook(func(context.Context, int64, int64) error {
  2393. return r0
  2394. })
  2395. }
  2396. func (f *RepositoriesStoreWatchFunc) nextHook() func(context.Context, int64, int64) error {
  2397. f.mutex.Lock()
  2398. defer f.mutex.Unlock()
  2399. if len(f.hooks) == 0 {
  2400. return f.defaultHook
  2401. }
  2402. hook := f.hooks[0]
  2403. f.hooks = f.hooks[1:]
  2404. return hook
  2405. }
  2406. func (f *RepositoriesStoreWatchFunc) appendCall(r0 RepositoriesStoreWatchFuncCall) {
  2407. f.mutex.Lock()
  2408. f.history = append(f.history, r0)
  2409. f.mutex.Unlock()
  2410. }
  2411. // History returns a sequence of RepositoriesStoreWatchFuncCall objects
  2412. // describing the invocations of this function.
  2413. func (f *RepositoriesStoreWatchFunc) History() []RepositoriesStoreWatchFuncCall {
  2414. f.mutex.Lock()
  2415. history := make([]RepositoriesStoreWatchFuncCall, len(f.history))
  2416. copy(history, f.history)
  2417. f.mutex.Unlock()
  2418. return history
  2419. }
  2420. // RepositoriesStoreWatchFuncCall is an object that describes an invocation
  2421. // of method Watch on an instance of MockRepositoriesStore.
  2422. type RepositoriesStoreWatchFuncCall struct {
  2423. // Arg0 is the value of the 1st argument passed to this method
  2424. // invocation.
  2425. Arg0 context.Context
  2426. // Arg1 is the value of the 2nd argument passed to this method
  2427. // invocation.
  2428. Arg1 int64
  2429. // Arg2 is the value of the 3rd argument passed to this method
  2430. // invocation.
  2431. Arg2 int64
  2432. // Result0 is the value of the 1st result returned from this method
  2433. // invocation.
  2434. Result0 error
  2435. }
  2436. // Args returns an interface slice containing the arguments of this
  2437. // invocation.
  2438. func (c RepositoriesStoreWatchFuncCall) Args() []interface{} {
  2439. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2440. }
  2441. // Results returns an interface slice containing the results of this
  2442. // invocation.
  2443. func (c RepositoriesStoreWatchFuncCall) Results() []interface{} {
  2444. return []interface{}{c.Result0}
  2445. }
  2446. // MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
  2447. // interface (from the package gogs.io/gogs/internal/db) used for unit
  2448. // testing.
  2449. type MockTwoFactorsStore struct {
  2450. // CreateFunc is an instance of a mock function object controlling the
  2451. // behavior of the method Create.
  2452. CreateFunc *TwoFactorsStoreCreateFunc
  2453. // GetByUserIDFunc is an instance of a mock function object controlling
  2454. // the behavior of the method GetByUserID.
  2455. GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
  2456. // IsEnabledFunc is an instance of a mock function object controlling
  2457. // the behavior of the method IsEnabled.
  2458. IsEnabledFunc *TwoFactorsStoreIsEnabledFunc
  2459. }
  2460. // NewMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2461. // interface. All methods return zero values for all results, unless
  2462. // overwritten.
  2463. func NewMockTwoFactorsStore() *MockTwoFactorsStore {
  2464. return &MockTwoFactorsStore{
  2465. CreateFunc: &TwoFactorsStoreCreateFunc{
  2466. defaultHook: func(context.Context, int64, string, string) (r0 error) {
  2467. return
  2468. },
  2469. },
  2470. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2471. defaultHook: func(context.Context, int64) (r0 *db.TwoFactor, r1 error) {
  2472. return
  2473. },
  2474. },
  2475. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2476. defaultHook: func(context.Context, int64) (r0 bool) {
  2477. return
  2478. },
  2479. },
  2480. }
  2481. }
  2482. // NewStrictMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2483. // interface. All methods panic on invocation, unless overwritten.
  2484. func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
  2485. return &MockTwoFactorsStore{
  2486. CreateFunc: &TwoFactorsStoreCreateFunc{
  2487. defaultHook: func(context.Context, int64, string, string) error {
  2488. panic("unexpected invocation of MockTwoFactorsStore.Create")
  2489. },
  2490. },
  2491. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2492. defaultHook: func(context.Context, int64) (*db.TwoFactor, error) {
  2493. panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
  2494. },
  2495. },
  2496. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2497. defaultHook: func(context.Context, int64) bool {
  2498. panic("unexpected invocation of MockTwoFactorsStore.IsEnabled")
  2499. },
  2500. },
  2501. }
  2502. }
  2503. // NewMockTwoFactorsStoreFrom creates a new mock of the MockTwoFactorsStore
  2504. // interface. All methods delegate to the given implementation, unless
  2505. // overwritten.
  2506. func NewMockTwoFactorsStoreFrom(i db.TwoFactorsStore) *MockTwoFactorsStore {
  2507. return &MockTwoFactorsStore{
  2508. CreateFunc: &TwoFactorsStoreCreateFunc{
  2509. defaultHook: i.Create,
  2510. },
  2511. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2512. defaultHook: i.GetByUserID,
  2513. },
  2514. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2515. defaultHook: i.IsEnabled,
  2516. },
  2517. }
  2518. }
  2519. // TwoFactorsStoreCreateFunc describes the behavior when the Create method
  2520. // of the parent MockTwoFactorsStore instance is invoked.
  2521. type TwoFactorsStoreCreateFunc struct {
  2522. defaultHook func(context.Context, int64, string, string) error
  2523. hooks []func(context.Context, int64, string, string) error
  2524. history []TwoFactorsStoreCreateFuncCall
  2525. mutex sync.Mutex
  2526. }
  2527. // Create delegates to the next hook function in the queue and stores the
  2528. // parameter and result values of this invocation.
  2529. func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
  2530. r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2531. m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
  2532. return r0
  2533. }
  2534. // SetDefaultHook sets function that is called when the Create method of the
  2535. // parent MockTwoFactorsStore instance is invoked and the hook queue is
  2536. // empty.
  2537. func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
  2538. f.defaultHook = hook
  2539. }
  2540. // PushHook adds a function to the end of hook queue. Each invocation of the
  2541. // Create method of the parent MockTwoFactorsStore instance invokes the hook
  2542. // at the front of the queue and discards it. After the queue is empty, the
  2543. // default hook function is invoked for any future action.
  2544. func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
  2545. f.mutex.Lock()
  2546. f.hooks = append(f.hooks, hook)
  2547. f.mutex.Unlock()
  2548. }
  2549. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2550. // given values.
  2551. func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
  2552. f.SetDefaultHook(func(context.Context, int64, string, string) error {
  2553. return r0
  2554. })
  2555. }
  2556. // PushReturn calls PushHook with a function that returns the given values.
  2557. func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
  2558. f.PushHook(func(context.Context, int64, string, string) error {
  2559. return r0
  2560. })
  2561. }
  2562. func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
  2563. f.mutex.Lock()
  2564. defer f.mutex.Unlock()
  2565. if len(f.hooks) == 0 {
  2566. return f.defaultHook
  2567. }
  2568. hook := f.hooks[0]
  2569. f.hooks = f.hooks[1:]
  2570. return hook
  2571. }
  2572. func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
  2573. f.mutex.Lock()
  2574. f.history = append(f.history, r0)
  2575. f.mutex.Unlock()
  2576. }
  2577. // History returns a sequence of TwoFactorsStoreCreateFuncCall objects
  2578. // describing the invocations of this function.
  2579. func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
  2580. f.mutex.Lock()
  2581. history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
  2582. copy(history, f.history)
  2583. f.mutex.Unlock()
  2584. return history
  2585. }
  2586. // TwoFactorsStoreCreateFuncCall is an object that describes an invocation
  2587. // of method Create on an instance of MockTwoFactorsStore.
  2588. type TwoFactorsStoreCreateFuncCall struct {
  2589. // Arg0 is the value of the 1st argument passed to this method
  2590. // invocation.
  2591. Arg0 context.Context
  2592. // Arg1 is the value of the 2nd argument passed to this method
  2593. // invocation.
  2594. Arg1 int64
  2595. // Arg2 is the value of the 3rd argument passed to this method
  2596. // invocation.
  2597. Arg2 string
  2598. // Arg3 is the value of the 4th argument passed to this method
  2599. // invocation.
  2600. Arg3 string
  2601. // Result0 is the value of the 1st result returned from this method
  2602. // invocation.
  2603. Result0 error
  2604. }
  2605. // Args returns an interface slice containing the arguments of this
  2606. // invocation.
  2607. func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
  2608. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2609. }
  2610. // Results returns an interface slice containing the results of this
  2611. // invocation.
  2612. func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
  2613. return []interface{}{c.Result0}
  2614. }
  2615. // TwoFactorsStoreGetByUserIDFunc describes the behavior when the
  2616. // GetByUserID method of the parent MockTwoFactorsStore instance is invoked.
  2617. type TwoFactorsStoreGetByUserIDFunc struct {
  2618. defaultHook func(context.Context, int64) (*db.TwoFactor, error)
  2619. hooks []func(context.Context, int64) (*db.TwoFactor, error)
  2620. history []TwoFactorsStoreGetByUserIDFuncCall
  2621. mutex sync.Mutex
  2622. }
  2623. // GetByUserID delegates to the next hook function in the queue and stores
  2624. // the parameter and result values of this invocation.
  2625. func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*db.TwoFactor, error) {
  2626. r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
  2627. m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
  2628. return r0, r1
  2629. }
  2630. // SetDefaultHook sets function that is called when the GetByUserID method
  2631. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  2632. // is empty.
  2633. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2634. f.defaultHook = hook
  2635. }
  2636. // PushHook adds a function to the end of hook queue. Each invocation of the
  2637. // GetByUserID method of the parent MockTwoFactorsStore instance invokes the
  2638. // hook at the front of the queue and discards it. After the queue is empty,
  2639. // the default hook function is invoked for any future action.
  2640. func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2641. f.mutex.Lock()
  2642. f.hooks = append(f.hooks, hook)
  2643. f.mutex.Unlock()
  2644. }
  2645. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2646. // given values.
  2647. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *db.TwoFactor, r1 error) {
  2648. f.SetDefaultHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2649. return r0, r1
  2650. })
  2651. }
  2652. // PushReturn calls PushHook with a function that returns the given values.
  2653. func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *db.TwoFactor, r1 error) {
  2654. f.PushHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2655. return r0, r1
  2656. })
  2657. }
  2658. func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*db.TwoFactor, error) {
  2659. f.mutex.Lock()
  2660. defer f.mutex.Unlock()
  2661. if len(f.hooks) == 0 {
  2662. return f.defaultHook
  2663. }
  2664. hook := f.hooks[0]
  2665. f.hooks = f.hooks[1:]
  2666. return hook
  2667. }
  2668. func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
  2669. f.mutex.Lock()
  2670. f.history = append(f.history, r0)
  2671. f.mutex.Unlock()
  2672. }
  2673. // History returns a sequence of TwoFactorsStoreGetByUserIDFuncCall objects
  2674. // describing the invocations of this function.
  2675. func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
  2676. f.mutex.Lock()
  2677. history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
  2678. copy(history, f.history)
  2679. f.mutex.Unlock()
  2680. return history
  2681. }
  2682. // TwoFactorsStoreGetByUserIDFuncCall is an object that describes an
  2683. // invocation of method GetByUserID on an instance of MockTwoFactorsStore.
  2684. type TwoFactorsStoreGetByUserIDFuncCall struct {
  2685. // Arg0 is the value of the 1st argument passed to this method
  2686. // invocation.
  2687. Arg0 context.Context
  2688. // Arg1 is the value of the 2nd argument passed to this method
  2689. // invocation.
  2690. Arg1 int64
  2691. // Result0 is the value of the 1st result returned from this method
  2692. // invocation.
  2693. Result0 *db.TwoFactor
  2694. // Result1 is the value of the 2nd result returned from this method
  2695. // invocation.
  2696. Result1 error
  2697. }
  2698. // Args returns an interface slice containing the arguments of this
  2699. // invocation.
  2700. func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
  2701. return []interface{}{c.Arg0, c.Arg1}
  2702. }
  2703. // Results returns an interface slice containing the results of this
  2704. // invocation.
  2705. func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
  2706. return []interface{}{c.Result0, c.Result1}
  2707. }
  2708. // TwoFactorsStoreIsEnabledFunc describes the behavior when the IsEnabled
  2709. // method of the parent MockTwoFactorsStore instance is invoked.
  2710. type TwoFactorsStoreIsEnabledFunc struct {
  2711. defaultHook func(context.Context, int64) bool
  2712. hooks []func(context.Context, int64) bool
  2713. history []TwoFactorsStoreIsEnabledFuncCall
  2714. mutex sync.Mutex
  2715. }
  2716. // IsEnabled delegates to the next hook function in the queue and stores the
  2717. // parameter and result values of this invocation.
  2718. func (m *MockTwoFactorsStore) IsEnabled(v0 context.Context, v1 int64) bool {
  2719. r0 := m.IsEnabledFunc.nextHook()(v0, v1)
  2720. m.IsEnabledFunc.appendCall(TwoFactorsStoreIsEnabledFuncCall{v0, v1, r0})
  2721. return r0
  2722. }
  2723. // SetDefaultHook sets function that is called when the IsEnabled method of
  2724. // the parent MockTwoFactorsStore instance is invoked and the hook queue is
  2725. // empty.
  2726. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
  2727. f.defaultHook = hook
  2728. }
  2729. // PushHook adds a function to the end of hook queue. Each invocation of the
  2730. // IsEnabled method of the parent MockTwoFactorsStore instance invokes the
  2731. // hook at the front of the queue and discards it. After the queue is empty,
  2732. // the default hook function is invoked for any future action.
  2733. func (f *TwoFactorsStoreIsEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
  2734. f.mutex.Lock()
  2735. f.hooks = append(f.hooks, hook)
  2736. f.mutex.Unlock()
  2737. }
  2738. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2739. // given values.
  2740. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultReturn(r0 bool) {
  2741. f.SetDefaultHook(func(context.Context, int64) bool {
  2742. return r0
  2743. })
  2744. }
  2745. // PushReturn calls PushHook with a function that returns the given values.
  2746. func (f *TwoFactorsStoreIsEnabledFunc) PushReturn(r0 bool) {
  2747. f.PushHook(func(context.Context, int64) bool {
  2748. return r0
  2749. })
  2750. }
  2751. func (f *TwoFactorsStoreIsEnabledFunc) nextHook() func(context.Context, int64) bool {
  2752. f.mutex.Lock()
  2753. defer f.mutex.Unlock()
  2754. if len(f.hooks) == 0 {
  2755. return f.defaultHook
  2756. }
  2757. hook := f.hooks[0]
  2758. f.hooks = f.hooks[1:]
  2759. return hook
  2760. }
  2761. func (f *TwoFactorsStoreIsEnabledFunc) appendCall(r0 TwoFactorsStoreIsEnabledFuncCall) {
  2762. f.mutex.Lock()
  2763. f.history = append(f.history, r0)
  2764. f.mutex.Unlock()
  2765. }
  2766. // History returns a sequence of TwoFactorsStoreIsEnabledFuncCall objects
  2767. // describing the invocations of this function.
  2768. func (f *TwoFactorsStoreIsEnabledFunc) History() []TwoFactorsStoreIsEnabledFuncCall {
  2769. f.mutex.Lock()
  2770. history := make([]TwoFactorsStoreIsEnabledFuncCall, len(f.history))
  2771. copy(history, f.history)
  2772. f.mutex.Unlock()
  2773. return history
  2774. }
  2775. // TwoFactorsStoreIsEnabledFuncCall is an object that describes an
  2776. // invocation of method IsEnabled on an instance of MockTwoFactorsStore.
  2777. type TwoFactorsStoreIsEnabledFuncCall struct {
  2778. // Arg0 is the value of the 1st argument passed to this method
  2779. // invocation.
  2780. Arg0 context.Context
  2781. // Arg1 is the value of the 2nd argument passed to this method
  2782. // invocation.
  2783. Arg1 int64
  2784. // Result0 is the value of the 1st result returned from this method
  2785. // invocation.
  2786. Result0 bool
  2787. }
  2788. // Args returns an interface slice containing the arguments of this
  2789. // invocation.
  2790. func (c TwoFactorsStoreIsEnabledFuncCall) Args() []interface{} {
  2791. return []interface{}{c.Arg0, c.Arg1}
  2792. }
  2793. // Results returns an interface slice containing the results of this
  2794. // invocation.
  2795. func (c TwoFactorsStoreIsEnabledFuncCall) Results() []interface{} {
  2796. return []interface{}{c.Result0}
  2797. }
  2798. // MockUsersStore is a mock implementation of the UsersStore interface (from
  2799. // the package gogs.io/gogs/internal/db) used for unit testing.
  2800. type MockUsersStore struct {
  2801. // AddEmailFunc is an instance of a mock function object controlling the
  2802. // behavior of the method AddEmail.
  2803. AddEmailFunc *UsersStoreAddEmailFunc
  2804. // AuthenticateFunc is an instance of a mock function object controlling
  2805. // the behavior of the method Authenticate.
  2806. AuthenticateFunc *UsersStoreAuthenticateFunc
  2807. // ChangeUsernameFunc is an instance of a mock function object
  2808. // controlling the behavior of the method ChangeUsername.
  2809. ChangeUsernameFunc *UsersStoreChangeUsernameFunc
  2810. // CountFunc is an instance of a mock function object controlling the
  2811. // behavior of the method Count.
  2812. CountFunc *UsersStoreCountFunc
  2813. // CreateFunc is an instance of a mock function object controlling the
  2814. // behavior of the method Create.
  2815. CreateFunc *UsersStoreCreateFunc
  2816. // DeleteByIDFunc is an instance of a mock function object controlling
  2817. // the behavior of the method DeleteByID.
  2818. DeleteByIDFunc *UsersStoreDeleteByIDFunc
  2819. // DeleteCustomAvatarFunc is an instance of a mock function object
  2820. // controlling the behavior of the method DeleteCustomAvatar.
  2821. DeleteCustomAvatarFunc *UsersStoreDeleteCustomAvatarFunc
  2822. // DeleteEmailFunc is an instance of a mock function object controlling
  2823. // the behavior of the method DeleteEmail.
  2824. DeleteEmailFunc *UsersStoreDeleteEmailFunc
  2825. // DeleteInactivatedFunc is an instance of a mock function object
  2826. // controlling the behavior of the method DeleteInactivated.
  2827. DeleteInactivatedFunc *UsersStoreDeleteInactivatedFunc
  2828. // FollowFunc is an instance of a mock function object controlling the
  2829. // behavior of the method Follow.
  2830. FollowFunc *UsersStoreFollowFunc
  2831. // GetByEmailFunc is an instance of a mock function object controlling
  2832. // the behavior of the method GetByEmail.
  2833. GetByEmailFunc *UsersStoreGetByEmailFunc
  2834. // GetByIDFunc is an instance of a mock function object controlling the
  2835. // behavior of the method GetByID.
  2836. GetByIDFunc *UsersStoreGetByIDFunc
  2837. // GetByKeyIDFunc is an instance of a mock function object controlling
  2838. // the behavior of the method GetByKeyID.
  2839. GetByKeyIDFunc *UsersStoreGetByKeyIDFunc
  2840. // GetByUsernameFunc is an instance of a mock function object
  2841. // controlling the behavior of the method GetByUsername.
  2842. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  2843. // GetEmailFunc is an instance of a mock function object controlling the
  2844. // behavior of the method GetEmail.
  2845. GetEmailFunc *UsersStoreGetEmailFunc
  2846. // GetMailableEmailsByUsernamesFunc is an instance of a mock function
  2847. // object controlling the behavior of the method
  2848. // GetMailableEmailsByUsernames.
  2849. GetMailableEmailsByUsernamesFunc *UsersStoreGetMailableEmailsByUsernamesFunc
  2850. // IsFollowingFunc is an instance of a mock function object controlling
  2851. // the behavior of the method IsFollowing.
  2852. IsFollowingFunc *UsersStoreIsFollowingFunc
  2853. // IsUsernameUsedFunc is an instance of a mock function object
  2854. // controlling the behavior of the method IsUsernameUsed.
  2855. IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
  2856. // ListFunc is an instance of a mock function object controlling the
  2857. // behavior of the method List.
  2858. ListFunc *UsersStoreListFunc
  2859. // ListEmailsFunc is an instance of a mock function object controlling
  2860. // the behavior of the method ListEmails.
  2861. ListEmailsFunc *UsersStoreListEmailsFunc
  2862. // ListFollowersFunc is an instance of a mock function object
  2863. // controlling the behavior of the method ListFollowers.
  2864. ListFollowersFunc *UsersStoreListFollowersFunc
  2865. // ListFollowingsFunc is an instance of a mock function object
  2866. // controlling the behavior of the method ListFollowings.
  2867. ListFollowingsFunc *UsersStoreListFollowingsFunc
  2868. // MarkEmailActivatedFunc is an instance of a mock function object
  2869. // controlling the behavior of the method MarkEmailActivated.
  2870. MarkEmailActivatedFunc *UsersStoreMarkEmailActivatedFunc
  2871. // MarkEmailPrimaryFunc is an instance of a mock function object
  2872. // controlling the behavior of the method MarkEmailPrimary.
  2873. MarkEmailPrimaryFunc *UsersStoreMarkEmailPrimaryFunc
  2874. // SearchByNameFunc is an instance of a mock function object controlling
  2875. // the behavior of the method SearchByName.
  2876. SearchByNameFunc *UsersStoreSearchByNameFunc
  2877. // UnfollowFunc is an instance of a mock function object controlling the
  2878. // behavior of the method Unfollow.
  2879. UnfollowFunc *UsersStoreUnfollowFunc
  2880. // UpdateFunc is an instance of a mock function object controlling the
  2881. // behavior of the method Update.
  2882. UpdateFunc *UsersStoreUpdateFunc
  2883. // UseCustomAvatarFunc is an instance of a mock function object
  2884. // controlling the behavior of the method UseCustomAvatar.
  2885. UseCustomAvatarFunc *UsersStoreUseCustomAvatarFunc
  2886. }
  2887. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  2888. // methods return zero values for all results, unless overwritten.
  2889. func NewMockUsersStore() *MockUsersStore {
  2890. return &MockUsersStore{
  2891. AddEmailFunc: &UsersStoreAddEmailFunc{
  2892. defaultHook: func(context.Context, int64, string, bool) (r0 error) {
  2893. return
  2894. },
  2895. },
  2896. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2897. defaultHook: func(context.Context, string, string, int64) (r0 *db.User, r1 error) {
  2898. return
  2899. },
  2900. },
  2901. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2902. defaultHook: func(context.Context, int64, string) (r0 error) {
  2903. return
  2904. },
  2905. },
  2906. CountFunc: &UsersStoreCountFunc{
  2907. defaultHook: func(context.Context) (r0 int64) {
  2908. return
  2909. },
  2910. },
  2911. CreateFunc: &UsersStoreCreateFunc{
  2912. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (r0 *db.User, r1 error) {
  2913. return
  2914. },
  2915. },
  2916. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  2917. defaultHook: func(context.Context, int64, bool) (r0 error) {
  2918. return
  2919. },
  2920. },
  2921. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2922. defaultHook: func(context.Context, int64) (r0 error) {
  2923. return
  2924. },
  2925. },
  2926. DeleteEmailFunc: &UsersStoreDeleteEmailFunc{
  2927. defaultHook: func(context.Context, int64, string) (r0 error) {
  2928. return
  2929. },
  2930. },
  2931. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  2932. defaultHook: func() (r0 error) {
  2933. return
  2934. },
  2935. },
  2936. FollowFunc: &UsersStoreFollowFunc{
  2937. defaultHook: func(context.Context, int64, int64) (r0 error) {
  2938. return
  2939. },
  2940. },
  2941. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2942. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  2943. return
  2944. },
  2945. },
  2946. GetByIDFunc: &UsersStoreGetByIDFunc{
  2947. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  2948. return
  2949. },
  2950. },
  2951. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2952. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  2953. return
  2954. },
  2955. },
  2956. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2957. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  2958. return
  2959. },
  2960. },
  2961. GetEmailFunc: &UsersStoreGetEmailFunc{
  2962. defaultHook: func(context.Context, int64, string, bool) (r0 *db.EmailAddress, r1 error) {
  2963. return
  2964. },
  2965. },
  2966. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2967. defaultHook: func(context.Context, []string) (r0 []string, r1 error) {
  2968. return
  2969. },
  2970. },
  2971. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  2972. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  2973. return
  2974. },
  2975. },
  2976. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2977. defaultHook: func(context.Context, string, int64) (r0 bool) {
  2978. return
  2979. },
  2980. },
  2981. ListFunc: &UsersStoreListFunc{
  2982. defaultHook: func(context.Context, int, int) (r0 []*db.User, r1 error) {
  2983. return
  2984. },
  2985. },
  2986. ListEmailsFunc: &UsersStoreListEmailsFunc{
  2987. defaultHook: func(context.Context, int64) (r0 []*db.EmailAddress, r1 error) {
  2988. return
  2989. },
  2990. },
  2991. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2992. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  2993. return
  2994. },
  2995. },
  2996. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2997. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  2998. return
  2999. },
  3000. },
  3001. MarkEmailActivatedFunc: &UsersStoreMarkEmailActivatedFunc{
  3002. defaultHook: func(context.Context, int64, string) (r0 error) {
  3003. return
  3004. },
  3005. },
  3006. MarkEmailPrimaryFunc: &UsersStoreMarkEmailPrimaryFunc{
  3007. defaultHook: func(context.Context, int64, string) (r0 error) {
  3008. return
  3009. },
  3010. },
  3011. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  3012. defaultHook: func(context.Context, string, int, int, string) (r0 []*db.User, r1 int64, r2 error) {
  3013. return
  3014. },
  3015. },
  3016. UnfollowFunc: &UsersStoreUnfollowFunc{
  3017. defaultHook: func(context.Context, int64, int64) (r0 error) {
  3018. return
  3019. },
  3020. },
  3021. UpdateFunc: &UsersStoreUpdateFunc{
  3022. defaultHook: func(context.Context, int64, db.UpdateUserOptions) (r0 error) {
  3023. return
  3024. },
  3025. },
  3026. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  3027. defaultHook: func(context.Context, int64, []byte) (r0 error) {
  3028. return
  3029. },
  3030. },
  3031. }
  3032. }
  3033. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  3034. // All methods panic on invocation, unless overwritten.
  3035. func NewStrictMockUsersStore() *MockUsersStore {
  3036. return &MockUsersStore{
  3037. AddEmailFunc: &UsersStoreAddEmailFunc{
  3038. defaultHook: func(context.Context, int64, string, bool) error {
  3039. panic("unexpected invocation of MockUsersStore.AddEmail")
  3040. },
  3041. },
  3042. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  3043. defaultHook: func(context.Context, string, string, int64) (*db.User, error) {
  3044. panic("unexpected invocation of MockUsersStore.Authenticate")
  3045. },
  3046. },
  3047. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  3048. defaultHook: func(context.Context, int64, string) error {
  3049. panic("unexpected invocation of MockUsersStore.ChangeUsername")
  3050. },
  3051. },
  3052. CountFunc: &UsersStoreCountFunc{
  3053. defaultHook: func(context.Context) int64 {
  3054. panic("unexpected invocation of MockUsersStore.Count")
  3055. },
  3056. },
  3057. CreateFunc: &UsersStoreCreateFunc{
  3058. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3059. panic("unexpected invocation of MockUsersStore.Create")
  3060. },
  3061. },
  3062. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  3063. defaultHook: func(context.Context, int64, bool) error {
  3064. panic("unexpected invocation of MockUsersStore.DeleteByID")
  3065. },
  3066. },
  3067. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  3068. defaultHook: func(context.Context, int64) error {
  3069. panic("unexpected invocation of MockUsersStore.DeleteCustomAvatar")
  3070. },
  3071. },
  3072. DeleteEmailFunc: &UsersStoreDeleteEmailFunc{
  3073. defaultHook: func(context.Context, int64, string) error {
  3074. panic("unexpected invocation of MockUsersStore.DeleteEmail")
  3075. },
  3076. },
  3077. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  3078. defaultHook: func() error {
  3079. panic("unexpected invocation of MockUsersStore.DeleteInactivated")
  3080. },
  3081. },
  3082. FollowFunc: &UsersStoreFollowFunc{
  3083. defaultHook: func(context.Context, int64, int64) error {
  3084. panic("unexpected invocation of MockUsersStore.Follow")
  3085. },
  3086. },
  3087. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  3088. defaultHook: func(context.Context, string) (*db.User, error) {
  3089. panic("unexpected invocation of MockUsersStore.GetByEmail")
  3090. },
  3091. },
  3092. GetByIDFunc: &UsersStoreGetByIDFunc{
  3093. defaultHook: func(context.Context, int64) (*db.User, error) {
  3094. panic("unexpected invocation of MockUsersStore.GetByID")
  3095. },
  3096. },
  3097. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  3098. defaultHook: func(context.Context, int64) (*db.User, error) {
  3099. panic("unexpected invocation of MockUsersStore.GetByKeyID")
  3100. },
  3101. },
  3102. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  3103. defaultHook: func(context.Context, string) (*db.User, error) {
  3104. panic("unexpected invocation of MockUsersStore.GetByUsername")
  3105. },
  3106. },
  3107. GetEmailFunc: &UsersStoreGetEmailFunc{
  3108. defaultHook: func(context.Context, int64, string, bool) (*db.EmailAddress, error) {
  3109. panic("unexpected invocation of MockUsersStore.GetEmail")
  3110. },
  3111. },
  3112. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  3113. defaultHook: func(context.Context, []string) ([]string, error) {
  3114. panic("unexpected invocation of MockUsersStore.GetMailableEmailsByUsernames")
  3115. },
  3116. },
  3117. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  3118. defaultHook: func(context.Context, int64, int64) bool {
  3119. panic("unexpected invocation of MockUsersStore.IsFollowing")
  3120. },
  3121. },
  3122. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  3123. defaultHook: func(context.Context, string, int64) bool {
  3124. panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
  3125. },
  3126. },
  3127. ListFunc: &UsersStoreListFunc{
  3128. defaultHook: func(context.Context, int, int) ([]*db.User, error) {
  3129. panic("unexpected invocation of MockUsersStore.List")
  3130. },
  3131. },
  3132. ListEmailsFunc: &UsersStoreListEmailsFunc{
  3133. defaultHook: func(context.Context, int64) ([]*db.EmailAddress, error) {
  3134. panic("unexpected invocation of MockUsersStore.ListEmails")
  3135. },
  3136. },
  3137. ListFollowersFunc: &UsersStoreListFollowersFunc{
  3138. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  3139. panic("unexpected invocation of MockUsersStore.ListFollowers")
  3140. },
  3141. },
  3142. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  3143. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  3144. panic("unexpected invocation of MockUsersStore.ListFollowings")
  3145. },
  3146. },
  3147. MarkEmailActivatedFunc: &UsersStoreMarkEmailActivatedFunc{
  3148. defaultHook: func(context.Context, int64, string) error {
  3149. panic("unexpected invocation of MockUsersStore.MarkEmailActivated")
  3150. },
  3151. },
  3152. MarkEmailPrimaryFunc: &UsersStoreMarkEmailPrimaryFunc{
  3153. defaultHook: func(context.Context, int64, string) error {
  3154. panic("unexpected invocation of MockUsersStore.MarkEmailPrimary")
  3155. },
  3156. },
  3157. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  3158. defaultHook: func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  3159. panic("unexpected invocation of MockUsersStore.SearchByName")
  3160. },
  3161. },
  3162. UnfollowFunc: &UsersStoreUnfollowFunc{
  3163. defaultHook: func(context.Context, int64, int64) error {
  3164. panic("unexpected invocation of MockUsersStore.Unfollow")
  3165. },
  3166. },
  3167. UpdateFunc: &UsersStoreUpdateFunc{
  3168. defaultHook: func(context.Context, int64, db.UpdateUserOptions) error {
  3169. panic("unexpected invocation of MockUsersStore.Update")
  3170. },
  3171. },
  3172. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  3173. defaultHook: func(context.Context, int64, []byte) error {
  3174. panic("unexpected invocation of MockUsersStore.UseCustomAvatar")
  3175. },
  3176. },
  3177. }
  3178. }
  3179. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  3180. // All methods delegate to the given implementation, unless overwritten.
  3181. func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
  3182. return &MockUsersStore{
  3183. AddEmailFunc: &UsersStoreAddEmailFunc{
  3184. defaultHook: i.AddEmail,
  3185. },
  3186. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  3187. defaultHook: i.Authenticate,
  3188. },
  3189. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  3190. defaultHook: i.ChangeUsername,
  3191. },
  3192. CountFunc: &UsersStoreCountFunc{
  3193. defaultHook: i.Count,
  3194. },
  3195. CreateFunc: &UsersStoreCreateFunc{
  3196. defaultHook: i.Create,
  3197. },
  3198. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  3199. defaultHook: i.DeleteByID,
  3200. },
  3201. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  3202. defaultHook: i.DeleteCustomAvatar,
  3203. },
  3204. DeleteEmailFunc: &UsersStoreDeleteEmailFunc{
  3205. defaultHook: i.DeleteEmail,
  3206. },
  3207. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  3208. defaultHook: i.DeleteInactivated,
  3209. },
  3210. FollowFunc: &UsersStoreFollowFunc{
  3211. defaultHook: i.Follow,
  3212. },
  3213. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  3214. defaultHook: i.GetByEmail,
  3215. },
  3216. GetByIDFunc: &UsersStoreGetByIDFunc{
  3217. defaultHook: i.GetByID,
  3218. },
  3219. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  3220. defaultHook: i.GetByKeyID,
  3221. },
  3222. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  3223. defaultHook: i.GetByUsername,
  3224. },
  3225. GetEmailFunc: &UsersStoreGetEmailFunc{
  3226. defaultHook: i.GetEmail,
  3227. },
  3228. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  3229. defaultHook: i.GetMailableEmailsByUsernames,
  3230. },
  3231. IsFollowingFunc: &UsersStoreIsFollowingFunc{
  3232. defaultHook: i.IsFollowing,
  3233. },
  3234. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  3235. defaultHook: i.IsUsernameUsed,
  3236. },
  3237. ListFunc: &UsersStoreListFunc{
  3238. defaultHook: i.List,
  3239. },
  3240. ListEmailsFunc: &UsersStoreListEmailsFunc{
  3241. defaultHook: i.ListEmails,
  3242. },
  3243. ListFollowersFunc: &UsersStoreListFollowersFunc{
  3244. defaultHook: i.ListFollowers,
  3245. },
  3246. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  3247. defaultHook: i.ListFollowings,
  3248. },
  3249. MarkEmailActivatedFunc: &UsersStoreMarkEmailActivatedFunc{
  3250. defaultHook: i.MarkEmailActivated,
  3251. },
  3252. MarkEmailPrimaryFunc: &UsersStoreMarkEmailPrimaryFunc{
  3253. defaultHook: i.MarkEmailPrimary,
  3254. },
  3255. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  3256. defaultHook: i.SearchByName,
  3257. },
  3258. UnfollowFunc: &UsersStoreUnfollowFunc{
  3259. defaultHook: i.Unfollow,
  3260. },
  3261. UpdateFunc: &UsersStoreUpdateFunc{
  3262. defaultHook: i.Update,
  3263. },
  3264. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  3265. defaultHook: i.UseCustomAvatar,
  3266. },
  3267. }
  3268. }
  3269. // UsersStoreAddEmailFunc describes the behavior when the AddEmail method of
  3270. // the parent MockUsersStore instance is invoked.
  3271. type UsersStoreAddEmailFunc struct {
  3272. defaultHook func(context.Context, int64, string, bool) error
  3273. hooks []func(context.Context, int64, string, bool) error
  3274. history []UsersStoreAddEmailFuncCall
  3275. mutex sync.Mutex
  3276. }
  3277. // AddEmail delegates to the next hook function in the queue and stores the
  3278. // parameter and result values of this invocation.
  3279. func (m *MockUsersStore) AddEmail(v0 context.Context, v1 int64, v2 string, v3 bool) error {
  3280. r0 := m.AddEmailFunc.nextHook()(v0, v1, v2, v3)
  3281. m.AddEmailFunc.appendCall(UsersStoreAddEmailFuncCall{v0, v1, v2, v3, r0})
  3282. return r0
  3283. }
  3284. // SetDefaultHook sets function that is called when the AddEmail method of
  3285. // the parent MockUsersStore instance is invoked and the hook queue is
  3286. // empty.
  3287. func (f *UsersStoreAddEmailFunc) SetDefaultHook(hook func(context.Context, int64, string, bool) error) {
  3288. f.defaultHook = hook
  3289. }
  3290. // PushHook adds a function to the end of hook queue. Each invocation of the
  3291. // AddEmail method of the parent MockUsersStore instance invokes the hook at
  3292. // the front of the queue and discards it. After the queue is empty, the
  3293. // default hook function is invoked for any future action.
  3294. func (f *UsersStoreAddEmailFunc) PushHook(hook func(context.Context, int64, string, bool) error) {
  3295. f.mutex.Lock()
  3296. f.hooks = append(f.hooks, hook)
  3297. f.mutex.Unlock()
  3298. }
  3299. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3300. // given values.
  3301. func (f *UsersStoreAddEmailFunc) SetDefaultReturn(r0 error) {
  3302. f.SetDefaultHook(func(context.Context, int64, string, bool) error {
  3303. return r0
  3304. })
  3305. }
  3306. // PushReturn calls PushHook with a function that returns the given values.
  3307. func (f *UsersStoreAddEmailFunc) PushReturn(r0 error) {
  3308. f.PushHook(func(context.Context, int64, string, bool) error {
  3309. return r0
  3310. })
  3311. }
  3312. func (f *UsersStoreAddEmailFunc) nextHook() func(context.Context, int64, string, bool) error {
  3313. f.mutex.Lock()
  3314. defer f.mutex.Unlock()
  3315. if len(f.hooks) == 0 {
  3316. return f.defaultHook
  3317. }
  3318. hook := f.hooks[0]
  3319. f.hooks = f.hooks[1:]
  3320. return hook
  3321. }
  3322. func (f *UsersStoreAddEmailFunc) appendCall(r0 UsersStoreAddEmailFuncCall) {
  3323. f.mutex.Lock()
  3324. f.history = append(f.history, r0)
  3325. f.mutex.Unlock()
  3326. }
  3327. // History returns a sequence of UsersStoreAddEmailFuncCall objects
  3328. // describing the invocations of this function.
  3329. func (f *UsersStoreAddEmailFunc) History() []UsersStoreAddEmailFuncCall {
  3330. f.mutex.Lock()
  3331. history := make([]UsersStoreAddEmailFuncCall, len(f.history))
  3332. copy(history, f.history)
  3333. f.mutex.Unlock()
  3334. return history
  3335. }
  3336. // UsersStoreAddEmailFuncCall is an object that describes an invocation of
  3337. // method AddEmail on an instance of MockUsersStore.
  3338. type UsersStoreAddEmailFuncCall struct {
  3339. // Arg0 is the value of the 1st argument passed to this method
  3340. // invocation.
  3341. Arg0 context.Context
  3342. // Arg1 is the value of the 2nd argument passed to this method
  3343. // invocation.
  3344. Arg1 int64
  3345. // Arg2 is the value of the 3rd argument passed to this method
  3346. // invocation.
  3347. Arg2 string
  3348. // Arg3 is the value of the 4th argument passed to this method
  3349. // invocation.
  3350. Arg3 bool
  3351. // Result0 is the value of the 1st result returned from this method
  3352. // invocation.
  3353. Result0 error
  3354. }
  3355. // Args returns an interface slice containing the arguments of this
  3356. // invocation.
  3357. func (c UsersStoreAddEmailFuncCall) Args() []interface{} {
  3358. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3359. }
  3360. // Results returns an interface slice containing the results of this
  3361. // invocation.
  3362. func (c UsersStoreAddEmailFuncCall) Results() []interface{} {
  3363. return []interface{}{c.Result0}
  3364. }
  3365. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  3366. // method of the parent MockUsersStore instance is invoked.
  3367. type UsersStoreAuthenticateFunc struct {
  3368. defaultHook func(context.Context, string, string, int64) (*db.User, error)
  3369. hooks []func(context.Context, string, string, int64) (*db.User, error)
  3370. history []UsersStoreAuthenticateFuncCall
  3371. mutex sync.Mutex
  3372. }
  3373. // Authenticate delegates to the next hook function in the queue and stores
  3374. // the parameter and result values of this invocation.
  3375. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*db.User, error) {
  3376. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  3377. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  3378. return r0, r1
  3379. }
  3380. // SetDefaultHook sets function that is called when the Authenticate method
  3381. // of the parent MockUsersStore instance is invoked and the hook queue is
  3382. // empty.
  3383. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  3384. f.defaultHook = hook
  3385. }
  3386. // PushHook adds a function to the end of hook queue. Each invocation of the
  3387. // Authenticate method of the parent MockUsersStore instance invokes the
  3388. // hook at the front of the queue and discards it. After the queue is empty,
  3389. // the default hook function is invoked for any future action.
  3390. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  3391. f.mutex.Lock()
  3392. f.hooks = append(f.hooks, hook)
  3393. f.mutex.Unlock()
  3394. }
  3395. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3396. // given values.
  3397. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3398. f.SetDefaultHook(func(context.Context, string, string, int64) (*db.User, error) {
  3399. return r0, r1
  3400. })
  3401. }
  3402. // PushReturn calls PushHook with a function that returns the given values.
  3403. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *db.User, r1 error) {
  3404. f.PushHook(func(context.Context, string, string, int64) (*db.User, error) {
  3405. return r0, r1
  3406. })
  3407. }
  3408. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*db.User, error) {
  3409. f.mutex.Lock()
  3410. defer f.mutex.Unlock()
  3411. if len(f.hooks) == 0 {
  3412. return f.defaultHook
  3413. }
  3414. hook := f.hooks[0]
  3415. f.hooks = f.hooks[1:]
  3416. return hook
  3417. }
  3418. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  3419. f.mutex.Lock()
  3420. f.history = append(f.history, r0)
  3421. f.mutex.Unlock()
  3422. }
  3423. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  3424. // describing the invocations of this function.
  3425. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  3426. f.mutex.Lock()
  3427. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  3428. copy(history, f.history)
  3429. f.mutex.Unlock()
  3430. return history
  3431. }
  3432. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  3433. // of method Authenticate on an instance of MockUsersStore.
  3434. type UsersStoreAuthenticateFuncCall struct {
  3435. // Arg0 is the value of the 1st argument passed to this method
  3436. // invocation.
  3437. Arg0 context.Context
  3438. // Arg1 is the value of the 2nd argument passed to this method
  3439. // invocation.
  3440. Arg1 string
  3441. // Arg2 is the value of the 3rd argument passed to this method
  3442. // invocation.
  3443. Arg2 string
  3444. // Arg3 is the value of the 4th argument passed to this method
  3445. // invocation.
  3446. Arg3 int64
  3447. // Result0 is the value of the 1st result returned from this method
  3448. // invocation.
  3449. Result0 *db.User
  3450. // Result1 is the value of the 2nd result returned from this method
  3451. // invocation.
  3452. Result1 error
  3453. }
  3454. // Args returns an interface slice containing the arguments of this
  3455. // invocation.
  3456. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  3457. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3458. }
  3459. // Results returns an interface slice containing the results of this
  3460. // invocation.
  3461. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  3462. return []interface{}{c.Result0, c.Result1}
  3463. }
  3464. // UsersStoreChangeUsernameFunc describes the behavior when the
  3465. // ChangeUsername method of the parent MockUsersStore instance is invoked.
  3466. type UsersStoreChangeUsernameFunc struct {
  3467. defaultHook func(context.Context, int64, string) error
  3468. hooks []func(context.Context, int64, string) error
  3469. history []UsersStoreChangeUsernameFuncCall
  3470. mutex sync.Mutex
  3471. }
  3472. // ChangeUsername delegates to the next hook function in the queue and
  3473. // stores the parameter and result values of this invocation.
  3474. func (m *MockUsersStore) ChangeUsername(v0 context.Context, v1 int64, v2 string) error {
  3475. r0 := m.ChangeUsernameFunc.nextHook()(v0, v1, v2)
  3476. m.ChangeUsernameFunc.appendCall(UsersStoreChangeUsernameFuncCall{v0, v1, v2, r0})
  3477. return r0
  3478. }
  3479. // SetDefaultHook sets function that is called when the ChangeUsername
  3480. // method of the parent MockUsersStore instance is invoked and the hook
  3481. // queue is empty.
  3482. func (f *UsersStoreChangeUsernameFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  3483. f.defaultHook = hook
  3484. }
  3485. // PushHook adds a function to the end of hook queue. Each invocation of the
  3486. // ChangeUsername method of the parent MockUsersStore instance invokes the
  3487. // hook at the front of the queue and discards it. After the queue is empty,
  3488. // the default hook function is invoked for any future action.
  3489. func (f *UsersStoreChangeUsernameFunc) PushHook(hook func(context.Context, int64, string) error) {
  3490. f.mutex.Lock()
  3491. f.hooks = append(f.hooks, hook)
  3492. f.mutex.Unlock()
  3493. }
  3494. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3495. // given values.
  3496. func (f *UsersStoreChangeUsernameFunc) SetDefaultReturn(r0 error) {
  3497. f.SetDefaultHook(func(context.Context, int64, string) error {
  3498. return r0
  3499. })
  3500. }
  3501. // PushReturn calls PushHook with a function that returns the given values.
  3502. func (f *UsersStoreChangeUsernameFunc) PushReturn(r0 error) {
  3503. f.PushHook(func(context.Context, int64, string) error {
  3504. return r0
  3505. })
  3506. }
  3507. func (f *UsersStoreChangeUsernameFunc) nextHook() func(context.Context, int64, string) error {
  3508. f.mutex.Lock()
  3509. defer f.mutex.Unlock()
  3510. if len(f.hooks) == 0 {
  3511. return f.defaultHook
  3512. }
  3513. hook := f.hooks[0]
  3514. f.hooks = f.hooks[1:]
  3515. return hook
  3516. }
  3517. func (f *UsersStoreChangeUsernameFunc) appendCall(r0 UsersStoreChangeUsernameFuncCall) {
  3518. f.mutex.Lock()
  3519. f.history = append(f.history, r0)
  3520. f.mutex.Unlock()
  3521. }
  3522. // History returns a sequence of UsersStoreChangeUsernameFuncCall objects
  3523. // describing the invocations of this function.
  3524. func (f *UsersStoreChangeUsernameFunc) History() []UsersStoreChangeUsernameFuncCall {
  3525. f.mutex.Lock()
  3526. history := make([]UsersStoreChangeUsernameFuncCall, len(f.history))
  3527. copy(history, f.history)
  3528. f.mutex.Unlock()
  3529. return history
  3530. }
  3531. // UsersStoreChangeUsernameFuncCall is an object that describes an
  3532. // invocation of method ChangeUsername on an instance of MockUsersStore.
  3533. type UsersStoreChangeUsernameFuncCall struct {
  3534. // Arg0 is the value of the 1st argument passed to this method
  3535. // invocation.
  3536. Arg0 context.Context
  3537. // Arg1 is the value of the 2nd argument passed to this method
  3538. // invocation.
  3539. Arg1 int64
  3540. // Arg2 is the value of the 3rd argument passed to this method
  3541. // invocation.
  3542. Arg2 string
  3543. // Result0 is the value of the 1st result returned from this method
  3544. // invocation.
  3545. Result0 error
  3546. }
  3547. // Args returns an interface slice containing the arguments of this
  3548. // invocation.
  3549. func (c UsersStoreChangeUsernameFuncCall) Args() []interface{} {
  3550. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3551. }
  3552. // Results returns an interface slice containing the results of this
  3553. // invocation.
  3554. func (c UsersStoreChangeUsernameFuncCall) Results() []interface{} {
  3555. return []interface{}{c.Result0}
  3556. }
  3557. // UsersStoreCountFunc describes the behavior when the Count method of the
  3558. // parent MockUsersStore instance is invoked.
  3559. type UsersStoreCountFunc struct {
  3560. defaultHook func(context.Context) int64
  3561. hooks []func(context.Context) int64
  3562. history []UsersStoreCountFuncCall
  3563. mutex sync.Mutex
  3564. }
  3565. // Count delegates to the next hook function in the queue and stores the
  3566. // parameter and result values of this invocation.
  3567. func (m *MockUsersStore) Count(v0 context.Context) int64 {
  3568. r0 := m.CountFunc.nextHook()(v0)
  3569. m.CountFunc.appendCall(UsersStoreCountFuncCall{v0, r0})
  3570. return r0
  3571. }
  3572. // SetDefaultHook sets function that is called when the Count method of the
  3573. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3574. func (f *UsersStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  3575. f.defaultHook = hook
  3576. }
  3577. // PushHook adds a function to the end of hook queue. Each invocation of the
  3578. // Count method of the parent MockUsersStore instance invokes the hook at
  3579. // the front of the queue and discards it. After the queue is empty, the
  3580. // default hook function is invoked for any future action.
  3581. func (f *UsersStoreCountFunc) PushHook(hook func(context.Context) int64) {
  3582. f.mutex.Lock()
  3583. f.hooks = append(f.hooks, hook)
  3584. f.mutex.Unlock()
  3585. }
  3586. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3587. // given values.
  3588. func (f *UsersStoreCountFunc) SetDefaultReturn(r0 int64) {
  3589. f.SetDefaultHook(func(context.Context) int64 {
  3590. return r0
  3591. })
  3592. }
  3593. // PushReturn calls PushHook with a function that returns the given values.
  3594. func (f *UsersStoreCountFunc) PushReturn(r0 int64) {
  3595. f.PushHook(func(context.Context) int64 {
  3596. return r0
  3597. })
  3598. }
  3599. func (f *UsersStoreCountFunc) nextHook() func(context.Context) int64 {
  3600. f.mutex.Lock()
  3601. defer f.mutex.Unlock()
  3602. if len(f.hooks) == 0 {
  3603. return f.defaultHook
  3604. }
  3605. hook := f.hooks[0]
  3606. f.hooks = f.hooks[1:]
  3607. return hook
  3608. }
  3609. func (f *UsersStoreCountFunc) appendCall(r0 UsersStoreCountFuncCall) {
  3610. f.mutex.Lock()
  3611. f.history = append(f.history, r0)
  3612. f.mutex.Unlock()
  3613. }
  3614. // History returns a sequence of UsersStoreCountFuncCall objects describing
  3615. // the invocations of this function.
  3616. func (f *UsersStoreCountFunc) History() []UsersStoreCountFuncCall {
  3617. f.mutex.Lock()
  3618. history := make([]UsersStoreCountFuncCall, len(f.history))
  3619. copy(history, f.history)
  3620. f.mutex.Unlock()
  3621. return history
  3622. }
  3623. // UsersStoreCountFuncCall is an object that describes an invocation of
  3624. // method Count on an instance of MockUsersStore.
  3625. type UsersStoreCountFuncCall struct {
  3626. // Arg0 is the value of the 1st argument passed to this method
  3627. // invocation.
  3628. Arg0 context.Context
  3629. // Result0 is the value of the 1st result returned from this method
  3630. // invocation.
  3631. Result0 int64
  3632. }
  3633. // Args returns an interface slice containing the arguments of this
  3634. // invocation.
  3635. func (c UsersStoreCountFuncCall) Args() []interface{} {
  3636. return []interface{}{c.Arg0}
  3637. }
  3638. // Results returns an interface slice containing the results of this
  3639. // invocation.
  3640. func (c UsersStoreCountFuncCall) Results() []interface{} {
  3641. return []interface{}{c.Result0}
  3642. }
  3643. // UsersStoreCreateFunc describes the behavior when the Create method of the
  3644. // parent MockUsersStore instance is invoked.
  3645. type UsersStoreCreateFunc struct {
  3646. defaultHook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  3647. hooks []func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  3648. history []UsersStoreCreateFuncCall
  3649. mutex sync.Mutex
  3650. }
  3651. // Create delegates to the next hook function in the queue and stores the
  3652. // parameter and result values of this invocation.
  3653. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.CreateUserOptions) (*db.User, error) {
  3654. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  3655. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  3656. return r0, r1
  3657. }
  3658. // SetDefaultHook sets function that is called when the Create method of the
  3659. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3660. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  3661. f.defaultHook = hook
  3662. }
  3663. // PushHook adds a function to the end of hook queue. Each invocation of the
  3664. // Create method of the parent MockUsersStore instance invokes the hook at
  3665. // the front of the queue and discards it. After the queue is empty, the
  3666. // default hook function is invoked for any future action.
  3667. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  3668. f.mutex.Lock()
  3669. f.hooks = append(f.hooks, hook)
  3670. f.mutex.Unlock()
  3671. }
  3672. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3673. // given values.
  3674. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3675. f.SetDefaultHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3676. return r0, r1
  3677. })
  3678. }
  3679. // PushReturn calls PushHook with a function that returns the given values.
  3680. func (f *UsersStoreCreateFunc) PushReturn(r0 *db.User, r1 error) {
  3681. f.PushHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3682. return r0, r1
  3683. })
  3684. }
  3685. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3686. f.mutex.Lock()
  3687. defer f.mutex.Unlock()
  3688. if len(f.hooks) == 0 {
  3689. return f.defaultHook
  3690. }
  3691. hook := f.hooks[0]
  3692. f.hooks = f.hooks[1:]
  3693. return hook
  3694. }
  3695. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  3696. f.mutex.Lock()
  3697. f.history = append(f.history, r0)
  3698. f.mutex.Unlock()
  3699. }
  3700. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  3701. // the invocations of this function.
  3702. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  3703. f.mutex.Lock()
  3704. history := make([]UsersStoreCreateFuncCall, len(f.history))
  3705. copy(history, f.history)
  3706. f.mutex.Unlock()
  3707. return history
  3708. }
  3709. // UsersStoreCreateFuncCall is an object that describes an invocation of
  3710. // method Create on an instance of MockUsersStore.
  3711. type UsersStoreCreateFuncCall struct {
  3712. // Arg0 is the value of the 1st argument passed to this method
  3713. // invocation.
  3714. Arg0 context.Context
  3715. // Arg1 is the value of the 2nd argument passed to this method
  3716. // invocation.
  3717. Arg1 string
  3718. // Arg2 is the value of the 3rd argument passed to this method
  3719. // invocation.
  3720. Arg2 string
  3721. // Arg3 is the value of the 4th argument passed to this method
  3722. // invocation.
  3723. Arg3 db.CreateUserOptions
  3724. // Result0 is the value of the 1st result returned from this method
  3725. // invocation.
  3726. Result0 *db.User
  3727. // Result1 is the value of the 2nd result returned from this method
  3728. // invocation.
  3729. Result1 error
  3730. }
  3731. // Args returns an interface slice containing the arguments of this
  3732. // invocation.
  3733. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  3734. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3735. }
  3736. // Results returns an interface slice containing the results of this
  3737. // invocation.
  3738. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  3739. return []interface{}{c.Result0, c.Result1}
  3740. }
  3741. // UsersStoreDeleteByIDFunc describes the behavior when the DeleteByID
  3742. // method of the parent MockUsersStore instance is invoked.
  3743. type UsersStoreDeleteByIDFunc struct {
  3744. defaultHook func(context.Context, int64, bool) error
  3745. hooks []func(context.Context, int64, bool) error
  3746. history []UsersStoreDeleteByIDFuncCall
  3747. mutex sync.Mutex
  3748. }
  3749. // DeleteByID delegates to the next hook function in the queue and stores
  3750. // the parameter and result values of this invocation.
  3751. func (m *MockUsersStore) DeleteByID(v0 context.Context, v1 int64, v2 bool) error {
  3752. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  3753. m.DeleteByIDFunc.appendCall(UsersStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  3754. return r0
  3755. }
  3756. // SetDefaultHook sets function that is called when the DeleteByID method of
  3757. // the parent MockUsersStore instance is invoked and the hook queue is
  3758. // empty.
  3759. func (f *UsersStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, bool) error) {
  3760. f.defaultHook = hook
  3761. }
  3762. // PushHook adds a function to the end of hook queue. Each invocation of the
  3763. // DeleteByID method of the parent MockUsersStore instance invokes the hook
  3764. // at the front of the queue and discards it. After the queue is empty, the
  3765. // default hook function is invoked for any future action.
  3766. func (f *UsersStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, bool) error) {
  3767. f.mutex.Lock()
  3768. f.hooks = append(f.hooks, hook)
  3769. f.mutex.Unlock()
  3770. }
  3771. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3772. // given values.
  3773. func (f *UsersStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  3774. f.SetDefaultHook(func(context.Context, int64, bool) error {
  3775. return r0
  3776. })
  3777. }
  3778. // PushReturn calls PushHook with a function that returns the given values.
  3779. func (f *UsersStoreDeleteByIDFunc) PushReturn(r0 error) {
  3780. f.PushHook(func(context.Context, int64, bool) error {
  3781. return r0
  3782. })
  3783. }
  3784. func (f *UsersStoreDeleteByIDFunc) nextHook() func(context.Context, int64, bool) error {
  3785. f.mutex.Lock()
  3786. defer f.mutex.Unlock()
  3787. if len(f.hooks) == 0 {
  3788. return f.defaultHook
  3789. }
  3790. hook := f.hooks[0]
  3791. f.hooks = f.hooks[1:]
  3792. return hook
  3793. }
  3794. func (f *UsersStoreDeleteByIDFunc) appendCall(r0 UsersStoreDeleteByIDFuncCall) {
  3795. f.mutex.Lock()
  3796. f.history = append(f.history, r0)
  3797. f.mutex.Unlock()
  3798. }
  3799. // History returns a sequence of UsersStoreDeleteByIDFuncCall objects
  3800. // describing the invocations of this function.
  3801. func (f *UsersStoreDeleteByIDFunc) History() []UsersStoreDeleteByIDFuncCall {
  3802. f.mutex.Lock()
  3803. history := make([]UsersStoreDeleteByIDFuncCall, len(f.history))
  3804. copy(history, f.history)
  3805. f.mutex.Unlock()
  3806. return history
  3807. }
  3808. // UsersStoreDeleteByIDFuncCall is an object that describes an invocation of
  3809. // method DeleteByID on an instance of MockUsersStore.
  3810. type UsersStoreDeleteByIDFuncCall struct {
  3811. // Arg0 is the value of the 1st argument passed to this method
  3812. // invocation.
  3813. Arg0 context.Context
  3814. // Arg1 is the value of the 2nd argument passed to this method
  3815. // invocation.
  3816. Arg1 int64
  3817. // Arg2 is the value of the 3rd argument passed to this method
  3818. // invocation.
  3819. Arg2 bool
  3820. // Result0 is the value of the 1st result returned from this method
  3821. // invocation.
  3822. Result0 error
  3823. }
  3824. // Args returns an interface slice containing the arguments of this
  3825. // invocation.
  3826. func (c UsersStoreDeleteByIDFuncCall) Args() []interface{} {
  3827. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3828. }
  3829. // Results returns an interface slice containing the results of this
  3830. // invocation.
  3831. func (c UsersStoreDeleteByIDFuncCall) Results() []interface{} {
  3832. return []interface{}{c.Result0}
  3833. }
  3834. // UsersStoreDeleteCustomAvatarFunc describes the behavior when the
  3835. // DeleteCustomAvatar method of the parent MockUsersStore instance is
  3836. // invoked.
  3837. type UsersStoreDeleteCustomAvatarFunc struct {
  3838. defaultHook func(context.Context, int64) error
  3839. hooks []func(context.Context, int64) error
  3840. history []UsersStoreDeleteCustomAvatarFuncCall
  3841. mutex sync.Mutex
  3842. }
  3843. // DeleteCustomAvatar delegates to the next hook function in the queue and
  3844. // stores the parameter and result values of this invocation.
  3845. func (m *MockUsersStore) DeleteCustomAvatar(v0 context.Context, v1 int64) error {
  3846. r0 := m.DeleteCustomAvatarFunc.nextHook()(v0, v1)
  3847. m.DeleteCustomAvatarFunc.appendCall(UsersStoreDeleteCustomAvatarFuncCall{v0, v1, r0})
  3848. return r0
  3849. }
  3850. // SetDefaultHook sets function that is called when the DeleteCustomAvatar
  3851. // method of the parent MockUsersStore instance is invoked and the hook
  3852. // queue is empty.
  3853. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  3854. f.defaultHook = hook
  3855. }
  3856. // PushHook adds a function to the end of hook queue. Each invocation of the
  3857. // DeleteCustomAvatar method of the parent MockUsersStore instance invokes
  3858. // the hook at the front of the queue and discards it. After the queue is
  3859. // empty, the default hook function is invoked for any future action.
  3860. func (f *UsersStoreDeleteCustomAvatarFunc) PushHook(hook func(context.Context, int64) error) {
  3861. f.mutex.Lock()
  3862. f.hooks = append(f.hooks, hook)
  3863. f.mutex.Unlock()
  3864. }
  3865. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3866. // given values.
  3867. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultReturn(r0 error) {
  3868. f.SetDefaultHook(func(context.Context, int64) error {
  3869. return r0
  3870. })
  3871. }
  3872. // PushReturn calls PushHook with a function that returns the given values.
  3873. func (f *UsersStoreDeleteCustomAvatarFunc) PushReturn(r0 error) {
  3874. f.PushHook(func(context.Context, int64) error {
  3875. return r0
  3876. })
  3877. }
  3878. func (f *UsersStoreDeleteCustomAvatarFunc) nextHook() func(context.Context, int64) error {
  3879. f.mutex.Lock()
  3880. defer f.mutex.Unlock()
  3881. if len(f.hooks) == 0 {
  3882. return f.defaultHook
  3883. }
  3884. hook := f.hooks[0]
  3885. f.hooks = f.hooks[1:]
  3886. return hook
  3887. }
  3888. func (f *UsersStoreDeleteCustomAvatarFunc) appendCall(r0 UsersStoreDeleteCustomAvatarFuncCall) {
  3889. f.mutex.Lock()
  3890. f.history = append(f.history, r0)
  3891. f.mutex.Unlock()
  3892. }
  3893. // History returns a sequence of UsersStoreDeleteCustomAvatarFuncCall
  3894. // objects describing the invocations of this function.
  3895. func (f *UsersStoreDeleteCustomAvatarFunc) History() []UsersStoreDeleteCustomAvatarFuncCall {
  3896. f.mutex.Lock()
  3897. history := make([]UsersStoreDeleteCustomAvatarFuncCall, len(f.history))
  3898. copy(history, f.history)
  3899. f.mutex.Unlock()
  3900. return history
  3901. }
  3902. // UsersStoreDeleteCustomAvatarFuncCall is an object that describes an
  3903. // invocation of method DeleteCustomAvatar on an instance of MockUsersStore.
  3904. type UsersStoreDeleteCustomAvatarFuncCall struct {
  3905. // Arg0 is the value of the 1st argument passed to this method
  3906. // invocation.
  3907. Arg0 context.Context
  3908. // Arg1 is the value of the 2nd argument passed to this method
  3909. // invocation.
  3910. Arg1 int64
  3911. // Result0 is the value of the 1st result returned from this method
  3912. // invocation.
  3913. Result0 error
  3914. }
  3915. // Args returns an interface slice containing the arguments of this
  3916. // invocation.
  3917. func (c UsersStoreDeleteCustomAvatarFuncCall) Args() []interface{} {
  3918. return []interface{}{c.Arg0, c.Arg1}
  3919. }
  3920. // Results returns an interface slice containing the results of this
  3921. // invocation.
  3922. func (c UsersStoreDeleteCustomAvatarFuncCall) Results() []interface{} {
  3923. return []interface{}{c.Result0}
  3924. }
  3925. // UsersStoreDeleteEmailFunc describes the behavior when the DeleteEmail
  3926. // method of the parent MockUsersStore instance is invoked.
  3927. type UsersStoreDeleteEmailFunc struct {
  3928. defaultHook func(context.Context, int64, string) error
  3929. hooks []func(context.Context, int64, string) error
  3930. history []UsersStoreDeleteEmailFuncCall
  3931. mutex sync.Mutex
  3932. }
  3933. // DeleteEmail delegates to the next hook function in the queue and stores
  3934. // the parameter and result values of this invocation.
  3935. func (m *MockUsersStore) DeleteEmail(v0 context.Context, v1 int64, v2 string) error {
  3936. r0 := m.DeleteEmailFunc.nextHook()(v0, v1, v2)
  3937. m.DeleteEmailFunc.appendCall(UsersStoreDeleteEmailFuncCall{v0, v1, v2, r0})
  3938. return r0
  3939. }
  3940. // SetDefaultHook sets function that is called when the DeleteEmail method
  3941. // of the parent MockUsersStore instance is invoked and the hook queue is
  3942. // empty.
  3943. func (f *UsersStoreDeleteEmailFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  3944. f.defaultHook = hook
  3945. }
  3946. // PushHook adds a function to the end of hook queue. Each invocation of the
  3947. // DeleteEmail method of the parent MockUsersStore instance invokes the hook
  3948. // at the front of the queue and discards it. After the queue is empty, the
  3949. // default hook function is invoked for any future action.
  3950. func (f *UsersStoreDeleteEmailFunc) PushHook(hook func(context.Context, int64, string) error) {
  3951. f.mutex.Lock()
  3952. f.hooks = append(f.hooks, hook)
  3953. f.mutex.Unlock()
  3954. }
  3955. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3956. // given values.
  3957. func (f *UsersStoreDeleteEmailFunc) SetDefaultReturn(r0 error) {
  3958. f.SetDefaultHook(func(context.Context, int64, string) error {
  3959. return r0
  3960. })
  3961. }
  3962. // PushReturn calls PushHook with a function that returns the given values.
  3963. func (f *UsersStoreDeleteEmailFunc) PushReturn(r0 error) {
  3964. f.PushHook(func(context.Context, int64, string) error {
  3965. return r0
  3966. })
  3967. }
  3968. func (f *UsersStoreDeleteEmailFunc) nextHook() func(context.Context, int64, string) error {
  3969. f.mutex.Lock()
  3970. defer f.mutex.Unlock()
  3971. if len(f.hooks) == 0 {
  3972. return f.defaultHook
  3973. }
  3974. hook := f.hooks[0]
  3975. f.hooks = f.hooks[1:]
  3976. return hook
  3977. }
  3978. func (f *UsersStoreDeleteEmailFunc) appendCall(r0 UsersStoreDeleteEmailFuncCall) {
  3979. f.mutex.Lock()
  3980. f.history = append(f.history, r0)
  3981. f.mutex.Unlock()
  3982. }
  3983. // History returns a sequence of UsersStoreDeleteEmailFuncCall objects
  3984. // describing the invocations of this function.
  3985. func (f *UsersStoreDeleteEmailFunc) History() []UsersStoreDeleteEmailFuncCall {
  3986. f.mutex.Lock()
  3987. history := make([]UsersStoreDeleteEmailFuncCall, len(f.history))
  3988. copy(history, f.history)
  3989. f.mutex.Unlock()
  3990. return history
  3991. }
  3992. // UsersStoreDeleteEmailFuncCall is an object that describes an invocation
  3993. // of method DeleteEmail on an instance of MockUsersStore.
  3994. type UsersStoreDeleteEmailFuncCall struct {
  3995. // Arg0 is the value of the 1st argument passed to this method
  3996. // invocation.
  3997. Arg0 context.Context
  3998. // Arg1 is the value of the 2nd argument passed to this method
  3999. // invocation.
  4000. Arg1 int64
  4001. // Arg2 is the value of the 3rd argument passed to this method
  4002. // invocation.
  4003. Arg2 string
  4004. // Result0 is the value of the 1st result returned from this method
  4005. // invocation.
  4006. Result0 error
  4007. }
  4008. // Args returns an interface slice containing the arguments of this
  4009. // invocation.
  4010. func (c UsersStoreDeleteEmailFuncCall) Args() []interface{} {
  4011. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4012. }
  4013. // Results returns an interface slice containing the results of this
  4014. // invocation.
  4015. func (c UsersStoreDeleteEmailFuncCall) Results() []interface{} {
  4016. return []interface{}{c.Result0}
  4017. }
  4018. // UsersStoreDeleteInactivatedFunc describes the behavior when the
  4019. // DeleteInactivated method of the parent MockUsersStore instance is
  4020. // invoked.
  4021. type UsersStoreDeleteInactivatedFunc struct {
  4022. defaultHook func() error
  4023. hooks []func() error
  4024. history []UsersStoreDeleteInactivatedFuncCall
  4025. mutex sync.Mutex
  4026. }
  4027. // DeleteInactivated delegates to the next hook function in the queue and
  4028. // stores the parameter and result values of this invocation.
  4029. func (m *MockUsersStore) DeleteInactivated() error {
  4030. r0 := m.DeleteInactivatedFunc.nextHook()()
  4031. m.DeleteInactivatedFunc.appendCall(UsersStoreDeleteInactivatedFuncCall{r0})
  4032. return r0
  4033. }
  4034. // SetDefaultHook sets function that is called when the DeleteInactivated
  4035. // method of the parent MockUsersStore instance is invoked and the hook
  4036. // queue is empty.
  4037. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultHook(hook func() error) {
  4038. f.defaultHook = hook
  4039. }
  4040. // PushHook adds a function to the end of hook queue. Each invocation of the
  4041. // DeleteInactivated method of the parent MockUsersStore instance invokes
  4042. // the hook at the front of the queue and discards it. After the queue is
  4043. // empty, the default hook function is invoked for any future action.
  4044. func (f *UsersStoreDeleteInactivatedFunc) PushHook(hook func() error) {
  4045. f.mutex.Lock()
  4046. f.hooks = append(f.hooks, hook)
  4047. f.mutex.Unlock()
  4048. }
  4049. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4050. // given values.
  4051. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultReturn(r0 error) {
  4052. f.SetDefaultHook(func() error {
  4053. return r0
  4054. })
  4055. }
  4056. // PushReturn calls PushHook with a function that returns the given values.
  4057. func (f *UsersStoreDeleteInactivatedFunc) PushReturn(r0 error) {
  4058. f.PushHook(func() error {
  4059. return r0
  4060. })
  4061. }
  4062. func (f *UsersStoreDeleteInactivatedFunc) nextHook() func() error {
  4063. f.mutex.Lock()
  4064. defer f.mutex.Unlock()
  4065. if len(f.hooks) == 0 {
  4066. return f.defaultHook
  4067. }
  4068. hook := f.hooks[0]
  4069. f.hooks = f.hooks[1:]
  4070. return hook
  4071. }
  4072. func (f *UsersStoreDeleteInactivatedFunc) appendCall(r0 UsersStoreDeleteInactivatedFuncCall) {
  4073. f.mutex.Lock()
  4074. f.history = append(f.history, r0)
  4075. f.mutex.Unlock()
  4076. }
  4077. // History returns a sequence of UsersStoreDeleteInactivatedFuncCall objects
  4078. // describing the invocations of this function.
  4079. func (f *UsersStoreDeleteInactivatedFunc) History() []UsersStoreDeleteInactivatedFuncCall {
  4080. f.mutex.Lock()
  4081. history := make([]UsersStoreDeleteInactivatedFuncCall, len(f.history))
  4082. copy(history, f.history)
  4083. f.mutex.Unlock()
  4084. return history
  4085. }
  4086. // UsersStoreDeleteInactivatedFuncCall is an object that describes an
  4087. // invocation of method DeleteInactivated on an instance of MockUsersStore.
  4088. type UsersStoreDeleteInactivatedFuncCall struct {
  4089. // Result0 is the value of the 1st result returned from this method
  4090. // invocation.
  4091. Result0 error
  4092. }
  4093. // Args returns an interface slice containing the arguments of this
  4094. // invocation.
  4095. func (c UsersStoreDeleteInactivatedFuncCall) Args() []interface{} {
  4096. return []interface{}{}
  4097. }
  4098. // Results returns an interface slice containing the results of this
  4099. // invocation.
  4100. func (c UsersStoreDeleteInactivatedFuncCall) Results() []interface{} {
  4101. return []interface{}{c.Result0}
  4102. }
  4103. // UsersStoreFollowFunc describes the behavior when the Follow method of the
  4104. // parent MockUsersStore instance is invoked.
  4105. type UsersStoreFollowFunc struct {
  4106. defaultHook func(context.Context, int64, int64) error
  4107. hooks []func(context.Context, int64, int64) error
  4108. history []UsersStoreFollowFuncCall
  4109. mutex sync.Mutex
  4110. }
  4111. // Follow delegates to the next hook function in the queue and stores the
  4112. // parameter and result values of this invocation.
  4113. func (m *MockUsersStore) Follow(v0 context.Context, v1 int64, v2 int64) error {
  4114. r0 := m.FollowFunc.nextHook()(v0, v1, v2)
  4115. m.FollowFunc.appendCall(UsersStoreFollowFuncCall{v0, v1, v2, r0})
  4116. return r0
  4117. }
  4118. // SetDefaultHook sets function that is called when the Follow method of the
  4119. // parent MockUsersStore instance is invoked and the hook queue is empty.
  4120. func (f *UsersStoreFollowFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  4121. f.defaultHook = hook
  4122. }
  4123. // PushHook adds a function to the end of hook queue. Each invocation of the
  4124. // Follow method of the parent MockUsersStore instance invokes the hook at
  4125. // the front of the queue and discards it. After the queue is empty, the
  4126. // default hook function is invoked for any future action.
  4127. func (f *UsersStoreFollowFunc) PushHook(hook func(context.Context, int64, int64) error) {
  4128. f.mutex.Lock()
  4129. f.hooks = append(f.hooks, hook)
  4130. f.mutex.Unlock()
  4131. }
  4132. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4133. // given values.
  4134. func (f *UsersStoreFollowFunc) SetDefaultReturn(r0 error) {
  4135. f.SetDefaultHook(func(context.Context, int64, int64) error {
  4136. return r0
  4137. })
  4138. }
  4139. // PushReturn calls PushHook with a function that returns the given values.
  4140. func (f *UsersStoreFollowFunc) PushReturn(r0 error) {
  4141. f.PushHook(func(context.Context, int64, int64) error {
  4142. return r0
  4143. })
  4144. }
  4145. func (f *UsersStoreFollowFunc) nextHook() func(context.Context, int64, int64) error {
  4146. f.mutex.Lock()
  4147. defer f.mutex.Unlock()
  4148. if len(f.hooks) == 0 {
  4149. return f.defaultHook
  4150. }
  4151. hook := f.hooks[0]
  4152. f.hooks = f.hooks[1:]
  4153. return hook
  4154. }
  4155. func (f *UsersStoreFollowFunc) appendCall(r0 UsersStoreFollowFuncCall) {
  4156. f.mutex.Lock()
  4157. f.history = append(f.history, r0)
  4158. f.mutex.Unlock()
  4159. }
  4160. // History returns a sequence of UsersStoreFollowFuncCall objects describing
  4161. // the invocations of this function.
  4162. func (f *UsersStoreFollowFunc) History() []UsersStoreFollowFuncCall {
  4163. f.mutex.Lock()
  4164. history := make([]UsersStoreFollowFuncCall, len(f.history))
  4165. copy(history, f.history)
  4166. f.mutex.Unlock()
  4167. return history
  4168. }
  4169. // UsersStoreFollowFuncCall is an object that describes an invocation of
  4170. // method Follow on an instance of MockUsersStore.
  4171. type UsersStoreFollowFuncCall struct {
  4172. // Arg0 is the value of the 1st argument passed to this method
  4173. // invocation.
  4174. Arg0 context.Context
  4175. // Arg1 is the value of the 2nd argument passed to this method
  4176. // invocation.
  4177. Arg1 int64
  4178. // Arg2 is the value of the 3rd argument passed to this method
  4179. // invocation.
  4180. Arg2 int64
  4181. // Result0 is the value of the 1st result returned from this method
  4182. // invocation.
  4183. Result0 error
  4184. }
  4185. // Args returns an interface slice containing the arguments of this
  4186. // invocation.
  4187. func (c UsersStoreFollowFuncCall) Args() []interface{} {
  4188. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4189. }
  4190. // Results returns an interface slice containing the results of this
  4191. // invocation.
  4192. func (c UsersStoreFollowFuncCall) Results() []interface{} {
  4193. return []interface{}{c.Result0}
  4194. }
  4195. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  4196. // method of the parent MockUsersStore instance is invoked.
  4197. type UsersStoreGetByEmailFunc struct {
  4198. defaultHook func(context.Context, string) (*db.User, error)
  4199. hooks []func(context.Context, string) (*db.User, error)
  4200. history []UsersStoreGetByEmailFuncCall
  4201. mutex sync.Mutex
  4202. }
  4203. // GetByEmail delegates to the next hook function in the queue and stores
  4204. // the parameter and result values of this invocation.
  4205. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*db.User, error) {
  4206. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  4207. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  4208. return r0, r1
  4209. }
  4210. // SetDefaultHook sets function that is called when the GetByEmail method of
  4211. // the parent MockUsersStore instance is invoked and the hook queue is
  4212. // empty.
  4213. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  4214. f.defaultHook = hook
  4215. }
  4216. // PushHook adds a function to the end of hook queue. Each invocation of the
  4217. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  4218. // at the front of the queue and discards it. After the queue is empty, the
  4219. // default hook function is invoked for any future action.
  4220. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  4221. f.mutex.Lock()
  4222. f.hooks = append(f.hooks, hook)
  4223. f.mutex.Unlock()
  4224. }
  4225. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4226. // given values.
  4227. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4228. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  4229. return r0, r1
  4230. })
  4231. }
  4232. // PushReturn calls PushHook with a function that returns the given values.
  4233. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *db.User, r1 error) {
  4234. f.PushHook(func(context.Context, string) (*db.User, error) {
  4235. return r0, r1
  4236. })
  4237. }
  4238. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*db.User, error) {
  4239. f.mutex.Lock()
  4240. defer f.mutex.Unlock()
  4241. if len(f.hooks) == 0 {
  4242. return f.defaultHook
  4243. }
  4244. hook := f.hooks[0]
  4245. f.hooks = f.hooks[1:]
  4246. return hook
  4247. }
  4248. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  4249. f.mutex.Lock()
  4250. f.history = append(f.history, r0)
  4251. f.mutex.Unlock()
  4252. }
  4253. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  4254. // describing the invocations of this function.
  4255. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  4256. f.mutex.Lock()
  4257. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  4258. copy(history, f.history)
  4259. f.mutex.Unlock()
  4260. return history
  4261. }
  4262. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  4263. // method GetByEmail on an instance of MockUsersStore.
  4264. type UsersStoreGetByEmailFuncCall struct {
  4265. // Arg0 is the value of the 1st argument passed to this method
  4266. // invocation.
  4267. Arg0 context.Context
  4268. // Arg1 is the value of the 2nd argument passed to this method
  4269. // invocation.
  4270. Arg1 string
  4271. // Result0 is the value of the 1st result returned from this method
  4272. // invocation.
  4273. Result0 *db.User
  4274. // Result1 is the value of the 2nd result returned from this method
  4275. // invocation.
  4276. Result1 error
  4277. }
  4278. // Args returns an interface slice containing the arguments of this
  4279. // invocation.
  4280. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  4281. return []interface{}{c.Arg0, c.Arg1}
  4282. }
  4283. // Results returns an interface slice containing the results of this
  4284. // invocation.
  4285. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  4286. return []interface{}{c.Result0, c.Result1}
  4287. }
  4288. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  4289. // the parent MockUsersStore instance is invoked.
  4290. type UsersStoreGetByIDFunc struct {
  4291. defaultHook func(context.Context, int64) (*db.User, error)
  4292. hooks []func(context.Context, int64) (*db.User, error)
  4293. history []UsersStoreGetByIDFuncCall
  4294. mutex sync.Mutex
  4295. }
  4296. // GetByID delegates to the next hook function in the queue and stores the
  4297. // parameter and result values of this invocation.
  4298. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*db.User, error) {
  4299. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  4300. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  4301. return r0, r1
  4302. }
  4303. // SetDefaultHook sets function that is called when the GetByID method of
  4304. // the parent MockUsersStore instance is invoked and the hook queue is
  4305. // empty.
  4306. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  4307. f.defaultHook = hook
  4308. }
  4309. // PushHook adds a function to the end of hook queue. Each invocation of the
  4310. // GetByID method of the parent MockUsersStore instance invokes the hook at
  4311. // the front of the queue and discards it. After the queue is empty, the
  4312. // default hook function is invoked for any future action.
  4313. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  4314. f.mutex.Lock()
  4315. f.hooks = append(f.hooks, hook)
  4316. f.mutex.Unlock()
  4317. }
  4318. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4319. // given values.
  4320. func (f *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4321. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  4322. return r0, r1
  4323. })
  4324. }
  4325. // PushReturn calls PushHook with a function that returns the given values.
  4326. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *db.User, r1 error) {
  4327. f.PushHook(func(context.Context, int64) (*db.User, error) {
  4328. return r0, r1
  4329. })
  4330. }
  4331. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  4332. f.mutex.Lock()
  4333. defer f.mutex.Unlock()
  4334. if len(f.hooks) == 0 {
  4335. return f.defaultHook
  4336. }
  4337. hook := f.hooks[0]
  4338. f.hooks = f.hooks[1:]
  4339. return hook
  4340. }
  4341. func (f *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  4342. f.mutex.Lock()
  4343. f.history = append(f.history, r0)
  4344. f.mutex.Unlock()
  4345. }
  4346. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  4347. // describing the invocations of this function.
  4348. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  4349. f.mutex.Lock()
  4350. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  4351. copy(history, f.history)
  4352. f.mutex.Unlock()
  4353. return history
  4354. }
  4355. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  4356. // method GetByID on an instance of MockUsersStore.
  4357. type UsersStoreGetByIDFuncCall struct {
  4358. // Arg0 is the value of the 1st argument passed to this method
  4359. // invocation.
  4360. Arg0 context.Context
  4361. // Arg1 is the value of the 2nd argument passed to this method
  4362. // invocation.
  4363. Arg1 int64
  4364. // Result0 is the value of the 1st result returned from this method
  4365. // invocation.
  4366. Result0 *db.User
  4367. // Result1 is the value of the 2nd result returned from this method
  4368. // invocation.
  4369. Result1 error
  4370. }
  4371. // Args returns an interface slice containing the arguments of this
  4372. // invocation.
  4373. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  4374. return []interface{}{c.Arg0, c.Arg1}
  4375. }
  4376. // Results returns an interface slice containing the results of this
  4377. // invocation.
  4378. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  4379. return []interface{}{c.Result0, c.Result1}
  4380. }
  4381. // UsersStoreGetByKeyIDFunc describes the behavior when the GetByKeyID
  4382. // method of the parent MockUsersStore instance is invoked.
  4383. type UsersStoreGetByKeyIDFunc struct {
  4384. defaultHook func(context.Context, int64) (*db.User, error)
  4385. hooks []func(context.Context, int64) (*db.User, error)
  4386. history []UsersStoreGetByKeyIDFuncCall
  4387. mutex sync.Mutex
  4388. }
  4389. // GetByKeyID delegates to the next hook function in the queue and stores
  4390. // the parameter and result values of this invocation.
  4391. func (m *MockUsersStore) GetByKeyID(v0 context.Context, v1 int64) (*db.User, error) {
  4392. r0, r1 := m.GetByKeyIDFunc.nextHook()(v0, v1)
  4393. m.GetByKeyIDFunc.appendCall(UsersStoreGetByKeyIDFuncCall{v0, v1, r0, r1})
  4394. return r0, r1
  4395. }
  4396. // SetDefaultHook sets function that is called when the GetByKeyID method of
  4397. // the parent MockUsersStore instance is invoked and the hook queue is
  4398. // empty.
  4399. func (f *UsersStoreGetByKeyIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  4400. f.defaultHook = hook
  4401. }
  4402. // PushHook adds a function to the end of hook queue. Each invocation of the
  4403. // GetByKeyID method of the parent MockUsersStore instance invokes the hook
  4404. // at the front of the queue and discards it. After the queue is empty, the
  4405. // default hook function is invoked for any future action.
  4406. func (f *UsersStoreGetByKeyIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  4407. f.mutex.Lock()
  4408. f.hooks = append(f.hooks, hook)
  4409. f.mutex.Unlock()
  4410. }
  4411. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4412. // given values.
  4413. func (f *UsersStoreGetByKeyIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4414. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  4415. return r0, r1
  4416. })
  4417. }
  4418. // PushReturn calls PushHook with a function that returns the given values.
  4419. func (f *UsersStoreGetByKeyIDFunc) PushReturn(r0 *db.User, r1 error) {
  4420. f.PushHook(func(context.Context, int64) (*db.User, error) {
  4421. return r0, r1
  4422. })
  4423. }
  4424. func (f *UsersStoreGetByKeyIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  4425. f.mutex.Lock()
  4426. defer f.mutex.Unlock()
  4427. if len(f.hooks) == 0 {
  4428. return f.defaultHook
  4429. }
  4430. hook := f.hooks[0]
  4431. f.hooks = f.hooks[1:]
  4432. return hook
  4433. }
  4434. func (f *UsersStoreGetByKeyIDFunc) appendCall(r0 UsersStoreGetByKeyIDFuncCall) {
  4435. f.mutex.Lock()
  4436. f.history = append(f.history, r0)
  4437. f.mutex.Unlock()
  4438. }
  4439. // History returns a sequence of UsersStoreGetByKeyIDFuncCall objects
  4440. // describing the invocations of this function.
  4441. func (f *UsersStoreGetByKeyIDFunc) History() []UsersStoreGetByKeyIDFuncCall {
  4442. f.mutex.Lock()
  4443. history := make([]UsersStoreGetByKeyIDFuncCall, len(f.history))
  4444. copy(history, f.history)
  4445. f.mutex.Unlock()
  4446. return history
  4447. }
  4448. // UsersStoreGetByKeyIDFuncCall is an object that describes an invocation of
  4449. // method GetByKeyID on an instance of MockUsersStore.
  4450. type UsersStoreGetByKeyIDFuncCall struct {
  4451. // Arg0 is the value of the 1st argument passed to this method
  4452. // invocation.
  4453. Arg0 context.Context
  4454. // Arg1 is the value of the 2nd argument passed to this method
  4455. // invocation.
  4456. Arg1 int64
  4457. // Result0 is the value of the 1st result returned from this method
  4458. // invocation.
  4459. Result0 *db.User
  4460. // Result1 is the value of the 2nd result returned from this method
  4461. // invocation.
  4462. Result1 error
  4463. }
  4464. // Args returns an interface slice containing the arguments of this
  4465. // invocation.
  4466. func (c UsersStoreGetByKeyIDFuncCall) Args() []interface{} {
  4467. return []interface{}{c.Arg0, c.Arg1}
  4468. }
  4469. // Results returns an interface slice containing the results of this
  4470. // invocation.
  4471. func (c UsersStoreGetByKeyIDFuncCall) Results() []interface{} {
  4472. return []interface{}{c.Result0, c.Result1}
  4473. }
  4474. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  4475. // method of the parent MockUsersStore instance is invoked.
  4476. type UsersStoreGetByUsernameFunc struct {
  4477. defaultHook func(context.Context, string) (*db.User, error)
  4478. hooks []func(context.Context, string) (*db.User, error)
  4479. history []UsersStoreGetByUsernameFuncCall
  4480. mutex sync.Mutex
  4481. }
  4482. // GetByUsername delegates to the next hook function in the queue and stores
  4483. // the parameter and result values of this invocation.
  4484. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*db.User, error) {
  4485. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  4486. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  4487. return r0, r1
  4488. }
  4489. // SetDefaultHook sets function that is called when the GetByUsername method
  4490. // of the parent MockUsersStore instance is invoked and the hook queue is
  4491. // empty.
  4492. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  4493. f.defaultHook = hook
  4494. }
  4495. // PushHook adds a function to the end of hook queue. Each invocation of the
  4496. // GetByUsername method of the parent MockUsersStore instance invokes the
  4497. // hook at the front of the queue and discards it. After the queue is empty,
  4498. // the default hook function is invoked for any future action.
  4499. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  4500. f.mutex.Lock()
  4501. f.hooks = append(f.hooks, hook)
  4502. f.mutex.Unlock()
  4503. }
  4504. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4505. // given values.
  4506. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  4507. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  4508. return r0, r1
  4509. })
  4510. }
  4511. // PushReturn calls PushHook with a function that returns the given values.
  4512. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *db.User, r1 error) {
  4513. f.PushHook(func(context.Context, string) (*db.User, error) {
  4514. return r0, r1
  4515. })
  4516. }
  4517. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*db.User, error) {
  4518. f.mutex.Lock()
  4519. defer f.mutex.Unlock()
  4520. if len(f.hooks) == 0 {
  4521. return f.defaultHook
  4522. }
  4523. hook := f.hooks[0]
  4524. f.hooks = f.hooks[1:]
  4525. return hook
  4526. }
  4527. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  4528. f.mutex.Lock()
  4529. f.history = append(f.history, r0)
  4530. f.mutex.Unlock()
  4531. }
  4532. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  4533. // describing the invocations of this function.
  4534. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  4535. f.mutex.Lock()
  4536. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  4537. copy(history, f.history)
  4538. f.mutex.Unlock()
  4539. return history
  4540. }
  4541. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  4542. // of method GetByUsername on an instance of MockUsersStore.
  4543. type UsersStoreGetByUsernameFuncCall struct {
  4544. // Arg0 is the value of the 1st argument passed to this method
  4545. // invocation.
  4546. Arg0 context.Context
  4547. // Arg1 is the value of the 2nd argument passed to this method
  4548. // invocation.
  4549. Arg1 string
  4550. // Result0 is the value of the 1st result returned from this method
  4551. // invocation.
  4552. Result0 *db.User
  4553. // Result1 is the value of the 2nd result returned from this method
  4554. // invocation.
  4555. Result1 error
  4556. }
  4557. // Args returns an interface slice containing the arguments of this
  4558. // invocation.
  4559. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  4560. return []interface{}{c.Arg0, c.Arg1}
  4561. }
  4562. // Results returns an interface slice containing the results of this
  4563. // invocation.
  4564. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  4565. return []interface{}{c.Result0, c.Result1}
  4566. }
  4567. // UsersStoreGetEmailFunc describes the behavior when the GetEmail method of
  4568. // the parent MockUsersStore instance is invoked.
  4569. type UsersStoreGetEmailFunc struct {
  4570. defaultHook func(context.Context, int64, string, bool) (*db.EmailAddress, error)
  4571. hooks []func(context.Context, int64, string, bool) (*db.EmailAddress, error)
  4572. history []UsersStoreGetEmailFuncCall
  4573. mutex sync.Mutex
  4574. }
  4575. // GetEmail delegates to the next hook function in the queue and stores the
  4576. // parameter and result values of this invocation.
  4577. func (m *MockUsersStore) GetEmail(v0 context.Context, v1 int64, v2 string, v3 bool) (*db.EmailAddress, error) {
  4578. r0, r1 := m.GetEmailFunc.nextHook()(v0, v1, v2, v3)
  4579. m.GetEmailFunc.appendCall(UsersStoreGetEmailFuncCall{v0, v1, v2, v3, r0, r1})
  4580. return r0, r1
  4581. }
  4582. // SetDefaultHook sets function that is called when the GetEmail method of
  4583. // the parent MockUsersStore instance is invoked and the hook queue is
  4584. // empty.
  4585. func (f *UsersStoreGetEmailFunc) SetDefaultHook(hook func(context.Context, int64, string, bool) (*db.EmailAddress, error)) {
  4586. f.defaultHook = hook
  4587. }
  4588. // PushHook adds a function to the end of hook queue. Each invocation of the
  4589. // GetEmail method of the parent MockUsersStore instance invokes the hook at
  4590. // the front of the queue and discards it. After the queue is empty, the
  4591. // default hook function is invoked for any future action.
  4592. func (f *UsersStoreGetEmailFunc) PushHook(hook func(context.Context, int64, string, bool) (*db.EmailAddress, error)) {
  4593. f.mutex.Lock()
  4594. f.hooks = append(f.hooks, hook)
  4595. f.mutex.Unlock()
  4596. }
  4597. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4598. // given values.
  4599. func (f *UsersStoreGetEmailFunc) SetDefaultReturn(r0 *db.EmailAddress, r1 error) {
  4600. f.SetDefaultHook(func(context.Context, int64, string, bool) (*db.EmailAddress, error) {
  4601. return r0, r1
  4602. })
  4603. }
  4604. // PushReturn calls PushHook with a function that returns the given values.
  4605. func (f *UsersStoreGetEmailFunc) PushReturn(r0 *db.EmailAddress, r1 error) {
  4606. f.PushHook(func(context.Context, int64, string, bool) (*db.EmailAddress, error) {
  4607. return r0, r1
  4608. })
  4609. }
  4610. func (f *UsersStoreGetEmailFunc) nextHook() func(context.Context, int64, string, bool) (*db.EmailAddress, error) {
  4611. f.mutex.Lock()
  4612. defer f.mutex.Unlock()
  4613. if len(f.hooks) == 0 {
  4614. return f.defaultHook
  4615. }
  4616. hook := f.hooks[0]
  4617. f.hooks = f.hooks[1:]
  4618. return hook
  4619. }
  4620. func (f *UsersStoreGetEmailFunc) appendCall(r0 UsersStoreGetEmailFuncCall) {
  4621. f.mutex.Lock()
  4622. f.history = append(f.history, r0)
  4623. f.mutex.Unlock()
  4624. }
  4625. // History returns a sequence of UsersStoreGetEmailFuncCall objects
  4626. // describing the invocations of this function.
  4627. func (f *UsersStoreGetEmailFunc) History() []UsersStoreGetEmailFuncCall {
  4628. f.mutex.Lock()
  4629. history := make([]UsersStoreGetEmailFuncCall, len(f.history))
  4630. copy(history, f.history)
  4631. f.mutex.Unlock()
  4632. return history
  4633. }
  4634. // UsersStoreGetEmailFuncCall is an object that describes an invocation of
  4635. // method GetEmail on an instance of MockUsersStore.
  4636. type UsersStoreGetEmailFuncCall struct {
  4637. // Arg0 is the value of the 1st argument passed to this method
  4638. // invocation.
  4639. Arg0 context.Context
  4640. // Arg1 is the value of the 2nd argument passed to this method
  4641. // invocation.
  4642. Arg1 int64
  4643. // Arg2 is the value of the 3rd argument passed to this method
  4644. // invocation.
  4645. Arg2 string
  4646. // Arg3 is the value of the 4th argument passed to this method
  4647. // invocation.
  4648. Arg3 bool
  4649. // Result0 is the value of the 1st result returned from this method
  4650. // invocation.
  4651. Result0 *db.EmailAddress
  4652. // Result1 is the value of the 2nd result returned from this method
  4653. // invocation.
  4654. Result1 error
  4655. }
  4656. // Args returns an interface slice containing the arguments of this
  4657. // invocation.
  4658. func (c UsersStoreGetEmailFuncCall) Args() []interface{} {
  4659. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  4660. }
  4661. // Results returns an interface slice containing the results of this
  4662. // invocation.
  4663. func (c UsersStoreGetEmailFuncCall) Results() []interface{} {
  4664. return []interface{}{c.Result0, c.Result1}
  4665. }
  4666. // UsersStoreGetMailableEmailsByUsernamesFunc describes the behavior when
  4667. // the GetMailableEmailsByUsernames method of the parent MockUsersStore
  4668. // instance is invoked.
  4669. type UsersStoreGetMailableEmailsByUsernamesFunc struct {
  4670. defaultHook func(context.Context, []string) ([]string, error)
  4671. hooks []func(context.Context, []string) ([]string, error)
  4672. history []UsersStoreGetMailableEmailsByUsernamesFuncCall
  4673. mutex sync.Mutex
  4674. }
  4675. // GetMailableEmailsByUsernames delegates to the next hook function in the
  4676. // queue and stores the parameter and result values of this invocation.
  4677. func (m *MockUsersStore) GetMailableEmailsByUsernames(v0 context.Context, v1 []string) ([]string, error) {
  4678. r0, r1 := m.GetMailableEmailsByUsernamesFunc.nextHook()(v0, v1)
  4679. m.GetMailableEmailsByUsernamesFunc.appendCall(UsersStoreGetMailableEmailsByUsernamesFuncCall{v0, v1, r0, r1})
  4680. return r0, r1
  4681. }
  4682. // SetDefaultHook sets function that is called when the
  4683. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  4684. // is invoked and the hook queue is empty.
  4685. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultHook(hook func(context.Context, []string) ([]string, error)) {
  4686. f.defaultHook = hook
  4687. }
  4688. // PushHook adds a function to the end of hook queue. Each invocation of the
  4689. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  4690. // invokes the hook at the front of the queue and discards it. After the
  4691. // queue is empty, the default hook function is invoked for any future
  4692. // action.
  4693. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushHook(hook func(context.Context, []string) ([]string, error)) {
  4694. f.mutex.Lock()
  4695. f.hooks = append(f.hooks, hook)
  4696. f.mutex.Unlock()
  4697. }
  4698. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4699. // given values.
  4700. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultReturn(r0 []string, r1 error) {
  4701. f.SetDefaultHook(func(context.Context, []string) ([]string, error) {
  4702. return r0, r1
  4703. })
  4704. }
  4705. // PushReturn calls PushHook with a function that returns the given values.
  4706. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushReturn(r0 []string, r1 error) {
  4707. f.PushHook(func(context.Context, []string) ([]string, error) {
  4708. return r0, r1
  4709. })
  4710. }
  4711. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) nextHook() func(context.Context, []string) ([]string, error) {
  4712. f.mutex.Lock()
  4713. defer f.mutex.Unlock()
  4714. if len(f.hooks) == 0 {
  4715. return f.defaultHook
  4716. }
  4717. hook := f.hooks[0]
  4718. f.hooks = f.hooks[1:]
  4719. return hook
  4720. }
  4721. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) appendCall(r0 UsersStoreGetMailableEmailsByUsernamesFuncCall) {
  4722. f.mutex.Lock()
  4723. f.history = append(f.history, r0)
  4724. f.mutex.Unlock()
  4725. }
  4726. // History returns a sequence of
  4727. // UsersStoreGetMailableEmailsByUsernamesFuncCall objects describing the
  4728. // invocations of this function.
  4729. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) History() []UsersStoreGetMailableEmailsByUsernamesFuncCall {
  4730. f.mutex.Lock()
  4731. history := make([]UsersStoreGetMailableEmailsByUsernamesFuncCall, len(f.history))
  4732. copy(history, f.history)
  4733. f.mutex.Unlock()
  4734. return history
  4735. }
  4736. // UsersStoreGetMailableEmailsByUsernamesFuncCall is an object that
  4737. // describes an invocation of method GetMailableEmailsByUsernames on an
  4738. // instance of MockUsersStore.
  4739. type UsersStoreGetMailableEmailsByUsernamesFuncCall struct {
  4740. // Arg0 is the value of the 1st argument passed to this method
  4741. // invocation.
  4742. Arg0 context.Context
  4743. // Arg1 is the value of the 2nd argument passed to this method
  4744. // invocation.
  4745. Arg1 []string
  4746. // Result0 is the value of the 1st result returned from this method
  4747. // invocation.
  4748. Result0 []string
  4749. // Result1 is the value of the 2nd result returned from this method
  4750. // invocation.
  4751. Result1 error
  4752. }
  4753. // Args returns an interface slice containing the arguments of this
  4754. // invocation.
  4755. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Args() []interface{} {
  4756. return []interface{}{c.Arg0, c.Arg1}
  4757. }
  4758. // Results returns an interface slice containing the results of this
  4759. // invocation.
  4760. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Results() []interface{} {
  4761. return []interface{}{c.Result0, c.Result1}
  4762. }
  4763. // UsersStoreIsFollowingFunc describes the behavior when the IsFollowing
  4764. // method of the parent MockUsersStore instance is invoked.
  4765. type UsersStoreIsFollowingFunc struct {
  4766. defaultHook func(context.Context, int64, int64) bool
  4767. hooks []func(context.Context, int64, int64) bool
  4768. history []UsersStoreIsFollowingFuncCall
  4769. mutex sync.Mutex
  4770. }
  4771. // IsFollowing delegates to the next hook function in the queue and stores
  4772. // the parameter and result values of this invocation.
  4773. func (m *MockUsersStore) IsFollowing(v0 context.Context, v1 int64, v2 int64) bool {
  4774. r0 := m.IsFollowingFunc.nextHook()(v0, v1, v2)
  4775. m.IsFollowingFunc.appendCall(UsersStoreIsFollowingFuncCall{v0, v1, v2, r0})
  4776. return r0
  4777. }
  4778. // SetDefaultHook sets function that is called when the IsFollowing method
  4779. // of the parent MockUsersStore instance is invoked and the hook queue is
  4780. // empty.
  4781. func (f *UsersStoreIsFollowingFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  4782. f.defaultHook = hook
  4783. }
  4784. // PushHook adds a function to the end of hook queue. Each invocation of the
  4785. // IsFollowing method of the parent MockUsersStore instance invokes the hook
  4786. // at the front of the queue and discards it. After the queue is empty, the
  4787. // default hook function is invoked for any future action.
  4788. func (f *UsersStoreIsFollowingFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  4789. f.mutex.Lock()
  4790. f.hooks = append(f.hooks, hook)
  4791. f.mutex.Unlock()
  4792. }
  4793. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4794. // given values.
  4795. func (f *UsersStoreIsFollowingFunc) SetDefaultReturn(r0 bool) {
  4796. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  4797. return r0
  4798. })
  4799. }
  4800. // PushReturn calls PushHook with a function that returns the given values.
  4801. func (f *UsersStoreIsFollowingFunc) PushReturn(r0 bool) {
  4802. f.PushHook(func(context.Context, int64, int64) bool {
  4803. return r0
  4804. })
  4805. }
  4806. func (f *UsersStoreIsFollowingFunc) nextHook() func(context.Context, int64, int64) bool {
  4807. f.mutex.Lock()
  4808. defer f.mutex.Unlock()
  4809. if len(f.hooks) == 0 {
  4810. return f.defaultHook
  4811. }
  4812. hook := f.hooks[0]
  4813. f.hooks = f.hooks[1:]
  4814. return hook
  4815. }
  4816. func (f *UsersStoreIsFollowingFunc) appendCall(r0 UsersStoreIsFollowingFuncCall) {
  4817. f.mutex.Lock()
  4818. f.history = append(f.history, r0)
  4819. f.mutex.Unlock()
  4820. }
  4821. // History returns a sequence of UsersStoreIsFollowingFuncCall objects
  4822. // describing the invocations of this function.
  4823. func (f *UsersStoreIsFollowingFunc) History() []UsersStoreIsFollowingFuncCall {
  4824. f.mutex.Lock()
  4825. history := make([]UsersStoreIsFollowingFuncCall, len(f.history))
  4826. copy(history, f.history)
  4827. f.mutex.Unlock()
  4828. return history
  4829. }
  4830. // UsersStoreIsFollowingFuncCall is an object that describes an invocation
  4831. // of method IsFollowing on an instance of MockUsersStore.
  4832. type UsersStoreIsFollowingFuncCall struct {
  4833. // Arg0 is the value of the 1st argument passed to this method
  4834. // invocation.
  4835. Arg0 context.Context
  4836. // Arg1 is the value of the 2nd argument passed to this method
  4837. // invocation.
  4838. Arg1 int64
  4839. // Arg2 is the value of the 3rd argument passed to this method
  4840. // invocation.
  4841. Arg2 int64
  4842. // Result0 is the value of the 1st result returned from this method
  4843. // invocation.
  4844. Result0 bool
  4845. }
  4846. // Args returns an interface slice containing the arguments of this
  4847. // invocation.
  4848. func (c UsersStoreIsFollowingFuncCall) Args() []interface{} {
  4849. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4850. }
  4851. // Results returns an interface slice containing the results of this
  4852. // invocation.
  4853. func (c UsersStoreIsFollowingFuncCall) Results() []interface{} {
  4854. return []interface{}{c.Result0}
  4855. }
  4856. // UsersStoreIsUsernameUsedFunc describes the behavior when the
  4857. // IsUsernameUsed method of the parent MockUsersStore instance is invoked.
  4858. type UsersStoreIsUsernameUsedFunc struct {
  4859. defaultHook func(context.Context, string, int64) bool
  4860. hooks []func(context.Context, string, int64) bool
  4861. history []UsersStoreIsUsernameUsedFuncCall
  4862. mutex sync.Mutex
  4863. }
  4864. // IsUsernameUsed delegates to the next hook function in the queue and
  4865. // stores the parameter and result values of this invocation.
  4866. func (m *MockUsersStore) IsUsernameUsed(v0 context.Context, v1 string, v2 int64) bool {
  4867. r0 := m.IsUsernameUsedFunc.nextHook()(v0, v1, v2)
  4868. m.IsUsernameUsedFunc.appendCall(UsersStoreIsUsernameUsedFuncCall{v0, v1, v2, r0})
  4869. return r0
  4870. }
  4871. // SetDefaultHook sets function that is called when the IsUsernameUsed
  4872. // method of the parent MockUsersStore instance is invoked and the hook
  4873. // queue is empty.
  4874. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultHook(hook func(context.Context, string, int64) bool) {
  4875. f.defaultHook = hook
  4876. }
  4877. // PushHook adds a function to the end of hook queue. Each invocation of the
  4878. // IsUsernameUsed method of the parent MockUsersStore instance invokes the
  4879. // hook at the front of the queue and discards it. After the queue is empty,
  4880. // the default hook function is invoked for any future action.
  4881. func (f *UsersStoreIsUsernameUsedFunc) PushHook(hook func(context.Context, string, int64) bool) {
  4882. f.mutex.Lock()
  4883. f.hooks = append(f.hooks, hook)
  4884. f.mutex.Unlock()
  4885. }
  4886. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4887. // given values.
  4888. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultReturn(r0 bool) {
  4889. f.SetDefaultHook(func(context.Context, string, int64) bool {
  4890. return r0
  4891. })
  4892. }
  4893. // PushReturn calls PushHook with a function that returns the given values.
  4894. func (f *UsersStoreIsUsernameUsedFunc) PushReturn(r0 bool) {
  4895. f.PushHook(func(context.Context, string, int64) bool {
  4896. return r0
  4897. })
  4898. }
  4899. func (f *UsersStoreIsUsernameUsedFunc) nextHook() func(context.Context, string, int64) bool {
  4900. f.mutex.Lock()
  4901. defer f.mutex.Unlock()
  4902. if len(f.hooks) == 0 {
  4903. return f.defaultHook
  4904. }
  4905. hook := f.hooks[0]
  4906. f.hooks = f.hooks[1:]
  4907. return hook
  4908. }
  4909. func (f *UsersStoreIsUsernameUsedFunc) appendCall(r0 UsersStoreIsUsernameUsedFuncCall) {
  4910. f.mutex.Lock()
  4911. f.history = append(f.history, r0)
  4912. f.mutex.Unlock()
  4913. }
  4914. // History returns a sequence of UsersStoreIsUsernameUsedFuncCall objects
  4915. // describing the invocations of this function.
  4916. func (f *UsersStoreIsUsernameUsedFunc) History() []UsersStoreIsUsernameUsedFuncCall {
  4917. f.mutex.Lock()
  4918. history := make([]UsersStoreIsUsernameUsedFuncCall, len(f.history))
  4919. copy(history, f.history)
  4920. f.mutex.Unlock()
  4921. return history
  4922. }
  4923. // UsersStoreIsUsernameUsedFuncCall is an object that describes an
  4924. // invocation of method IsUsernameUsed on an instance of MockUsersStore.
  4925. type UsersStoreIsUsernameUsedFuncCall struct {
  4926. // Arg0 is the value of the 1st argument passed to this method
  4927. // invocation.
  4928. Arg0 context.Context
  4929. // Arg1 is the value of the 2nd argument passed to this method
  4930. // invocation.
  4931. Arg1 string
  4932. // Arg2 is the value of the 3rd argument passed to this method
  4933. // invocation.
  4934. Arg2 int64
  4935. // Result0 is the value of the 1st result returned from this method
  4936. // invocation.
  4937. Result0 bool
  4938. }
  4939. // Args returns an interface slice containing the arguments of this
  4940. // invocation.
  4941. func (c UsersStoreIsUsernameUsedFuncCall) Args() []interface{} {
  4942. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4943. }
  4944. // Results returns an interface slice containing the results of this
  4945. // invocation.
  4946. func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
  4947. return []interface{}{c.Result0}
  4948. }
  4949. // UsersStoreListFunc describes the behavior when the List method of the
  4950. // parent MockUsersStore instance is invoked.
  4951. type UsersStoreListFunc struct {
  4952. defaultHook func(context.Context, int, int) ([]*db.User, error)
  4953. hooks []func(context.Context, int, int) ([]*db.User, error)
  4954. history []UsersStoreListFuncCall
  4955. mutex sync.Mutex
  4956. }
  4957. // List delegates to the next hook function in the queue and stores the
  4958. // parameter and result values of this invocation.
  4959. func (m *MockUsersStore) List(v0 context.Context, v1 int, v2 int) ([]*db.User, error) {
  4960. r0, r1 := m.ListFunc.nextHook()(v0, v1, v2)
  4961. m.ListFunc.appendCall(UsersStoreListFuncCall{v0, v1, v2, r0, r1})
  4962. return r0, r1
  4963. }
  4964. // SetDefaultHook sets function that is called when the List method of the
  4965. // parent MockUsersStore instance is invoked and the hook queue is empty.
  4966. func (f *UsersStoreListFunc) SetDefaultHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  4967. f.defaultHook = hook
  4968. }
  4969. // PushHook adds a function to the end of hook queue. Each invocation of the
  4970. // List method of the parent MockUsersStore instance invokes the hook at the
  4971. // front of the queue and discards it. After the queue is empty, the default
  4972. // hook function is invoked for any future action.
  4973. func (f *UsersStoreListFunc) PushHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  4974. f.mutex.Lock()
  4975. f.hooks = append(f.hooks, hook)
  4976. f.mutex.Unlock()
  4977. }
  4978. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4979. // given values.
  4980. func (f *UsersStoreListFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4981. f.SetDefaultHook(func(context.Context, int, int) ([]*db.User, error) {
  4982. return r0, r1
  4983. })
  4984. }
  4985. // PushReturn calls PushHook with a function that returns the given values.
  4986. func (f *UsersStoreListFunc) PushReturn(r0 []*db.User, r1 error) {
  4987. f.PushHook(func(context.Context, int, int) ([]*db.User, error) {
  4988. return r0, r1
  4989. })
  4990. }
  4991. func (f *UsersStoreListFunc) nextHook() func(context.Context, int, int) ([]*db.User, error) {
  4992. f.mutex.Lock()
  4993. defer f.mutex.Unlock()
  4994. if len(f.hooks) == 0 {
  4995. return f.defaultHook
  4996. }
  4997. hook := f.hooks[0]
  4998. f.hooks = f.hooks[1:]
  4999. return hook
  5000. }
  5001. func (f *UsersStoreListFunc) appendCall(r0 UsersStoreListFuncCall) {
  5002. f.mutex.Lock()
  5003. f.history = append(f.history, r0)
  5004. f.mutex.Unlock()
  5005. }
  5006. // History returns a sequence of UsersStoreListFuncCall objects describing
  5007. // the invocations of this function.
  5008. func (f *UsersStoreListFunc) History() []UsersStoreListFuncCall {
  5009. f.mutex.Lock()
  5010. history := make([]UsersStoreListFuncCall, len(f.history))
  5011. copy(history, f.history)
  5012. f.mutex.Unlock()
  5013. return history
  5014. }
  5015. // UsersStoreListFuncCall is an object that describes an invocation of
  5016. // method List on an instance of MockUsersStore.
  5017. type UsersStoreListFuncCall struct {
  5018. // Arg0 is the value of the 1st argument passed to this method
  5019. // invocation.
  5020. Arg0 context.Context
  5021. // Arg1 is the value of the 2nd argument passed to this method
  5022. // invocation.
  5023. Arg1 int
  5024. // Arg2 is the value of the 3rd argument passed to this method
  5025. // invocation.
  5026. Arg2 int
  5027. // Result0 is the value of the 1st result returned from this method
  5028. // invocation.
  5029. Result0 []*db.User
  5030. // Result1 is the value of the 2nd result returned from this method
  5031. // invocation.
  5032. Result1 error
  5033. }
  5034. // Args returns an interface slice containing the arguments of this
  5035. // invocation.
  5036. func (c UsersStoreListFuncCall) 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 UsersStoreListFuncCall) Results() []interface{} {
  5042. return []interface{}{c.Result0, c.Result1}
  5043. }
  5044. // UsersStoreListEmailsFunc describes the behavior when the ListEmails
  5045. // method of the parent MockUsersStore instance is invoked.
  5046. type UsersStoreListEmailsFunc struct {
  5047. defaultHook func(context.Context, int64) ([]*db.EmailAddress, error)
  5048. hooks []func(context.Context, int64) ([]*db.EmailAddress, error)
  5049. history []UsersStoreListEmailsFuncCall
  5050. mutex sync.Mutex
  5051. }
  5052. // ListEmails delegates to the next hook function in the queue and stores
  5053. // the parameter and result values of this invocation.
  5054. func (m *MockUsersStore) ListEmails(v0 context.Context, v1 int64) ([]*db.EmailAddress, error) {
  5055. r0, r1 := m.ListEmailsFunc.nextHook()(v0, v1)
  5056. m.ListEmailsFunc.appendCall(UsersStoreListEmailsFuncCall{v0, v1, r0, r1})
  5057. return r0, r1
  5058. }
  5059. // SetDefaultHook sets function that is called when the ListEmails method of
  5060. // the parent MockUsersStore instance is invoked and the hook queue is
  5061. // empty.
  5062. func (f *UsersStoreListEmailsFunc) SetDefaultHook(hook func(context.Context, int64) ([]*db.EmailAddress, error)) {
  5063. f.defaultHook = hook
  5064. }
  5065. // PushHook adds a function to the end of hook queue. Each invocation of the
  5066. // ListEmails method of the parent MockUsersStore instance invokes the hook
  5067. // at the front of the queue and discards it. After the queue is empty, the
  5068. // default hook function is invoked for any future action.
  5069. func (f *UsersStoreListEmailsFunc) PushHook(hook func(context.Context, int64) ([]*db.EmailAddress, error)) {
  5070. f.mutex.Lock()
  5071. f.hooks = append(f.hooks, hook)
  5072. f.mutex.Unlock()
  5073. }
  5074. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5075. // given values.
  5076. func (f *UsersStoreListEmailsFunc) SetDefaultReturn(r0 []*db.EmailAddress, r1 error) {
  5077. f.SetDefaultHook(func(context.Context, int64) ([]*db.EmailAddress, error) {
  5078. return r0, r1
  5079. })
  5080. }
  5081. // PushReturn calls PushHook with a function that returns the given values.
  5082. func (f *UsersStoreListEmailsFunc) PushReturn(r0 []*db.EmailAddress, r1 error) {
  5083. f.PushHook(func(context.Context, int64) ([]*db.EmailAddress, error) {
  5084. return r0, r1
  5085. })
  5086. }
  5087. func (f *UsersStoreListEmailsFunc) nextHook() func(context.Context, int64) ([]*db.EmailAddress, error) {
  5088. f.mutex.Lock()
  5089. defer f.mutex.Unlock()
  5090. if len(f.hooks) == 0 {
  5091. return f.defaultHook
  5092. }
  5093. hook := f.hooks[0]
  5094. f.hooks = f.hooks[1:]
  5095. return hook
  5096. }
  5097. func (f *UsersStoreListEmailsFunc) appendCall(r0 UsersStoreListEmailsFuncCall) {
  5098. f.mutex.Lock()
  5099. f.history = append(f.history, r0)
  5100. f.mutex.Unlock()
  5101. }
  5102. // History returns a sequence of UsersStoreListEmailsFuncCall objects
  5103. // describing the invocations of this function.
  5104. func (f *UsersStoreListEmailsFunc) History() []UsersStoreListEmailsFuncCall {
  5105. f.mutex.Lock()
  5106. history := make([]UsersStoreListEmailsFuncCall, len(f.history))
  5107. copy(history, f.history)
  5108. f.mutex.Unlock()
  5109. return history
  5110. }
  5111. // UsersStoreListEmailsFuncCall is an object that describes an invocation of
  5112. // method ListEmails on an instance of MockUsersStore.
  5113. type UsersStoreListEmailsFuncCall struct {
  5114. // Arg0 is the value of the 1st argument passed to this method
  5115. // invocation.
  5116. Arg0 context.Context
  5117. // Arg1 is the value of the 2nd argument passed to this method
  5118. // invocation.
  5119. Arg1 int64
  5120. // Result0 is the value of the 1st result returned from this method
  5121. // invocation.
  5122. Result0 []*db.EmailAddress
  5123. // Result1 is the value of the 2nd result returned from this method
  5124. // invocation.
  5125. Result1 error
  5126. }
  5127. // Args returns an interface slice containing the arguments of this
  5128. // invocation.
  5129. func (c UsersStoreListEmailsFuncCall) Args() []interface{} {
  5130. return []interface{}{c.Arg0, c.Arg1}
  5131. }
  5132. // Results returns an interface slice containing the results of this
  5133. // invocation.
  5134. func (c UsersStoreListEmailsFuncCall) Results() []interface{} {
  5135. return []interface{}{c.Result0, c.Result1}
  5136. }
  5137. // UsersStoreListFollowersFunc describes the behavior when the ListFollowers
  5138. // method of the parent MockUsersStore instance is invoked.
  5139. type UsersStoreListFollowersFunc struct {
  5140. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  5141. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  5142. history []UsersStoreListFollowersFuncCall
  5143. mutex sync.Mutex
  5144. }
  5145. // ListFollowers delegates to the next hook function in the queue and stores
  5146. // the parameter and result values of this invocation.
  5147. func (m *MockUsersStore) ListFollowers(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  5148. r0, r1 := m.ListFollowersFunc.nextHook()(v0, v1, v2, v3)
  5149. m.ListFollowersFunc.appendCall(UsersStoreListFollowersFuncCall{v0, v1, v2, v3, r0, r1})
  5150. return r0, r1
  5151. }
  5152. // SetDefaultHook sets function that is called when the ListFollowers method
  5153. // of the parent MockUsersStore instance is invoked and the hook queue is
  5154. // empty.
  5155. func (f *UsersStoreListFollowersFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  5156. f.defaultHook = hook
  5157. }
  5158. // PushHook adds a function to the end of hook queue. Each invocation of the
  5159. // ListFollowers method of the parent MockUsersStore instance invokes the
  5160. // hook at the front of the queue and discards it. After the queue is empty,
  5161. // the default hook function is invoked for any future action.
  5162. func (f *UsersStoreListFollowersFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  5163. f.mutex.Lock()
  5164. f.hooks = append(f.hooks, hook)
  5165. f.mutex.Unlock()
  5166. }
  5167. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5168. // given values.
  5169. func (f *UsersStoreListFollowersFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  5170. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  5171. return r0, r1
  5172. })
  5173. }
  5174. // PushReturn calls PushHook with a function that returns the given values.
  5175. func (f *UsersStoreListFollowersFunc) PushReturn(r0 []*db.User, r1 error) {
  5176. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  5177. return r0, r1
  5178. })
  5179. }
  5180. func (f *UsersStoreListFollowersFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  5181. f.mutex.Lock()
  5182. defer f.mutex.Unlock()
  5183. if len(f.hooks) == 0 {
  5184. return f.defaultHook
  5185. }
  5186. hook := f.hooks[0]
  5187. f.hooks = f.hooks[1:]
  5188. return hook
  5189. }
  5190. func (f *UsersStoreListFollowersFunc) appendCall(r0 UsersStoreListFollowersFuncCall) {
  5191. f.mutex.Lock()
  5192. f.history = append(f.history, r0)
  5193. f.mutex.Unlock()
  5194. }
  5195. // History returns a sequence of UsersStoreListFollowersFuncCall objects
  5196. // describing the invocations of this function.
  5197. func (f *UsersStoreListFollowersFunc) History() []UsersStoreListFollowersFuncCall {
  5198. f.mutex.Lock()
  5199. history := make([]UsersStoreListFollowersFuncCall, len(f.history))
  5200. copy(history, f.history)
  5201. f.mutex.Unlock()
  5202. return history
  5203. }
  5204. // UsersStoreListFollowersFuncCall is an object that describes an invocation
  5205. // of method ListFollowers on an instance of MockUsersStore.
  5206. type UsersStoreListFollowersFuncCall struct {
  5207. // Arg0 is the value of the 1st argument passed to this method
  5208. // invocation.
  5209. Arg0 context.Context
  5210. // Arg1 is the value of the 2nd argument passed to this method
  5211. // invocation.
  5212. Arg1 int64
  5213. // Arg2 is the value of the 3rd argument passed to this method
  5214. // invocation.
  5215. Arg2 int
  5216. // Arg3 is the value of the 4th argument passed to this method
  5217. // invocation.
  5218. Arg3 int
  5219. // Result0 is the value of the 1st result returned from this method
  5220. // invocation.
  5221. Result0 []*db.User
  5222. // Result1 is the value of the 2nd result returned from this method
  5223. // invocation.
  5224. Result1 error
  5225. }
  5226. // Args returns an interface slice containing the arguments of this
  5227. // invocation.
  5228. func (c UsersStoreListFollowersFuncCall) Args() []interface{} {
  5229. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  5230. }
  5231. // Results returns an interface slice containing the results of this
  5232. // invocation.
  5233. func (c UsersStoreListFollowersFuncCall) Results() []interface{} {
  5234. return []interface{}{c.Result0, c.Result1}
  5235. }
  5236. // UsersStoreListFollowingsFunc describes the behavior when the
  5237. // ListFollowings method of the parent MockUsersStore instance is invoked.
  5238. type UsersStoreListFollowingsFunc struct {
  5239. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  5240. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  5241. history []UsersStoreListFollowingsFuncCall
  5242. mutex sync.Mutex
  5243. }
  5244. // ListFollowings delegates to the next hook function in the queue and
  5245. // stores the parameter and result values of this invocation.
  5246. func (m *MockUsersStore) ListFollowings(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  5247. r0, r1 := m.ListFollowingsFunc.nextHook()(v0, v1, v2, v3)
  5248. m.ListFollowingsFunc.appendCall(UsersStoreListFollowingsFuncCall{v0, v1, v2, v3, r0, r1})
  5249. return r0, r1
  5250. }
  5251. // SetDefaultHook sets function that is called when the ListFollowings
  5252. // method of the parent MockUsersStore instance is invoked and the hook
  5253. // queue is empty.
  5254. func (f *UsersStoreListFollowingsFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  5255. f.defaultHook = hook
  5256. }
  5257. // PushHook adds a function to the end of hook queue. Each invocation of the
  5258. // ListFollowings method of the parent MockUsersStore instance invokes the
  5259. // hook at the front of the queue and discards it. After the queue is empty,
  5260. // the default hook function is invoked for any future action.
  5261. func (f *UsersStoreListFollowingsFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  5262. f.mutex.Lock()
  5263. f.hooks = append(f.hooks, hook)
  5264. f.mutex.Unlock()
  5265. }
  5266. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5267. // given values.
  5268. func (f *UsersStoreListFollowingsFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  5269. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  5270. return r0, r1
  5271. })
  5272. }
  5273. // PushReturn calls PushHook with a function that returns the given values.
  5274. func (f *UsersStoreListFollowingsFunc) PushReturn(r0 []*db.User, r1 error) {
  5275. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  5276. return r0, r1
  5277. })
  5278. }
  5279. func (f *UsersStoreListFollowingsFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  5280. f.mutex.Lock()
  5281. defer f.mutex.Unlock()
  5282. if len(f.hooks) == 0 {
  5283. return f.defaultHook
  5284. }
  5285. hook := f.hooks[0]
  5286. f.hooks = f.hooks[1:]
  5287. return hook
  5288. }
  5289. func (f *UsersStoreListFollowingsFunc) appendCall(r0 UsersStoreListFollowingsFuncCall) {
  5290. f.mutex.Lock()
  5291. f.history = append(f.history, r0)
  5292. f.mutex.Unlock()
  5293. }
  5294. // History returns a sequence of UsersStoreListFollowingsFuncCall objects
  5295. // describing the invocations of this function.
  5296. func (f *UsersStoreListFollowingsFunc) History() []UsersStoreListFollowingsFuncCall {
  5297. f.mutex.Lock()
  5298. history := make([]UsersStoreListFollowingsFuncCall, len(f.history))
  5299. copy(history, f.history)
  5300. f.mutex.Unlock()
  5301. return history
  5302. }
  5303. // UsersStoreListFollowingsFuncCall is an object that describes an
  5304. // invocation of method ListFollowings on an instance of MockUsersStore.
  5305. type UsersStoreListFollowingsFuncCall struct {
  5306. // Arg0 is the value of the 1st argument passed to this method
  5307. // invocation.
  5308. Arg0 context.Context
  5309. // Arg1 is the value of the 2nd argument passed to this method
  5310. // invocation.
  5311. Arg1 int64
  5312. // Arg2 is the value of the 3rd argument passed to this method
  5313. // invocation.
  5314. Arg2 int
  5315. // Arg3 is the value of the 4th argument passed to this method
  5316. // invocation.
  5317. Arg3 int
  5318. // Result0 is the value of the 1st result returned from this method
  5319. // invocation.
  5320. Result0 []*db.User
  5321. // Result1 is the value of the 2nd result returned from this method
  5322. // invocation.
  5323. Result1 error
  5324. }
  5325. // Args returns an interface slice containing the arguments of this
  5326. // invocation.
  5327. func (c UsersStoreListFollowingsFuncCall) Args() []interface{} {
  5328. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  5329. }
  5330. // Results returns an interface slice containing the results of this
  5331. // invocation.
  5332. func (c UsersStoreListFollowingsFuncCall) Results() []interface{} {
  5333. return []interface{}{c.Result0, c.Result1}
  5334. }
  5335. // UsersStoreMarkEmailActivatedFunc describes the behavior when the
  5336. // MarkEmailActivated method of the parent MockUsersStore instance is
  5337. // invoked.
  5338. type UsersStoreMarkEmailActivatedFunc struct {
  5339. defaultHook func(context.Context, int64, string) error
  5340. hooks []func(context.Context, int64, string) error
  5341. history []UsersStoreMarkEmailActivatedFuncCall
  5342. mutex sync.Mutex
  5343. }
  5344. // MarkEmailActivated delegates to the next hook function in the queue and
  5345. // stores the parameter and result values of this invocation.
  5346. func (m *MockUsersStore) MarkEmailActivated(v0 context.Context, v1 int64, v2 string) error {
  5347. r0 := m.MarkEmailActivatedFunc.nextHook()(v0, v1, v2)
  5348. m.MarkEmailActivatedFunc.appendCall(UsersStoreMarkEmailActivatedFuncCall{v0, v1, v2, r0})
  5349. return r0
  5350. }
  5351. // SetDefaultHook sets function that is called when the MarkEmailActivated
  5352. // method of the parent MockUsersStore instance is invoked and the hook
  5353. // queue is empty.
  5354. func (f *UsersStoreMarkEmailActivatedFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  5355. f.defaultHook = hook
  5356. }
  5357. // PushHook adds a function to the end of hook queue. Each invocation of the
  5358. // MarkEmailActivated method of the parent MockUsersStore instance invokes
  5359. // the hook at the front of the queue and discards it. After the queue is
  5360. // empty, the default hook function is invoked for any future action.
  5361. func (f *UsersStoreMarkEmailActivatedFunc) PushHook(hook func(context.Context, int64, string) error) {
  5362. f.mutex.Lock()
  5363. f.hooks = append(f.hooks, hook)
  5364. f.mutex.Unlock()
  5365. }
  5366. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5367. // given values.
  5368. func (f *UsersStoreMarkEmailActivatedFunc) SetDefaultReturn(r0 error) {
  5369. f.SetDefaultHook(func(context.Context, int64, string) error {
  5370. return r0
  5371. })
  5372. }
  5373. // PushReturn calls PushHook with a function that returns the given values.
  5374. func (f *UsersStoreMarkEmailActivatedFunc) PushReturn(r0 error) {
  5375. f.PushHook(func(context.Context, int64, string) error {
  5376. return r0
  5377. })
  5378. }
  5379. func (f *UsersStoreMarkEmailActivatedFunc) nextHook() func(context.Context, int64, string) error {
  5380. f.mutex.Lock()
  5381. defer f.mutex.Unlock()
  5382. if len(f.hooks) == 0 {
  5383. return f.defaultHook
  5384. }
  5385. hook := f.hooks[0]
  5386. f.hooks = f.hooks[1:]
  5387. return hook
  5388. }
  5389. func (f *UsersStoreMarkEmailActivatedFunc) appendCall(r0 UsersStoreMarkEmailActivatedFuncCall) {
  5390. f.mutex.Lock()
  5391. f.history = append(f.history, r0)
  5392. f.mutex.Unlock()
  5393. }
  5394. // History returns a sequence of UsersStoreMarkEmailActivatedFuncCall
  5395. // objects describing the invocations of this function.
  5396. func (f *UsersStoreMarkEmailActivatedFunc) History() []UsersStoreMarkEmailActivatedFuncCall {
  5397. f.mutex.Lock()
  5398. history := make([]UsersStoreMarkEmailActivatedFuncCall, len(f.history))
  5399. copy(history, f.history)
  5400. f.mutex.Unlock()
  5401. return history
  5402. }
  5403. // UsersStoreMarkEmailActivatedFuncCall is an object that describes an
  5404. // invocation of method MarkEmailActivated on an instance of MockUsersStore.
  5405. type UsersStoreMarkEmailActivatedFuncCall struct {
  5406. // Arg0 is the value of the 1st argument passed to this method
  5407. // invocation.
  5408. Arg0 context.Context
  5409. // Arg1 is the value of the 2nd argument passed to this method
  5410. // invocation.
  5411. Arg1 int64
  5412. // Arg2 is the value of the 3rd argument passed to this method
  5413. // invocation.
  5414. Arg2 string
  5415. // Result0 is the value of the 1st result returned from this method
  5416. // invocation.
  5417. Result0 error
  5418. }
  5419. // Args returns an interface slice containing the arguments of this
  5420. // invocation.
  5421. func (c UsersStoreMarkEmailActivatedFuncCall) Args() []interface{} {
  5422. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5423. }
  5424. // Results returns an interface slice containing the results of this
  5425. // invocation.
  5426. func (c UsersStoreMarkEmailActivatedFuncCall) Results() []interface{} {
  5427. return []interface{}{c.Result0}
  5428. }
  5429. // UsersStoreMarkEmailPrimaryFunc describes the behavior when the
  5430. // MarkEmailPrimary method of the parent MockUsersStore instance is invoked.
  5431. type UsersStoreMarkEmailPrimaryFunc struct {
  5432. defaultHook func(context.Context, int64, string) error
  5433. hooks []func(context.Context, int64, string) error
  5434. history []UsersStoreMarkEmailPrimaryFuncCall
  5435. mutex sync.Mutex
  5436. }
  5437. // MarkEmailPrimary delegates to the next hook function in the queue and
  5438. // stores the parameter and result values of this invocation.
  5439. func (m *MockUsersStore) MarkEmailPrimary(v0 context.Context, v1 int64, v2 string) error {
  5440. r0 := m.MarkEmailPrimaryFunc.nextHook()(v0, v1, v2)
  5441. m.MarkEmailPrimaryFunc.appendCall(UsersStoreMarkEmailPrimaryFuncCall{v0, v1, v2, r0})
  5442. return r0
  5443. }
  5444. // SetDefaultHook sets function that is called when the MarkEmailPrimary
  5445. // method of the parent MockUsersStore instance is invoked and the hook
  5446. // queue is empty.
  5447. func (f *UsersStoreMarkEmailPrimaryFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  5448. f.defaultHook = hook
  5449. }
  5450. // PushHook adds a function to the end of hook queue. Each invocation of the
  5451. // MarkEmailPrimary method of the parent MockUsersStore instance invokes the
  5452. // hook at the front of the queue and discards it. After the queue is empty,
  5453. // the default hook function is invoked for any future action.
  5454. func (f *UsersStoreMarkEmailPrimaryFunc) PushHook(hook func(context.Context, int64, string) error) {
  5455. f.mutex.Lock()
  5456. f.hooks = append(f.hooks, hook)
  5457. f.mutex.Unlock()
  5458. }
  5459. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5460. // given values.
  5461. func (f *UsersStoreMarkEmailPrimaryFunc) SetDefaultReturn(r0 error) {
  5462. f.SetDefaultHook(func(context.Context, int64, string) error {
  5463. return r0
  5464. })
  5465. }
  5466. // PushReturn calls PushHook with a function that returns the given values.
  5467. func (f *UsersStoreMarkEmailPrimaryFunc) PushReturn(r0 error) {
  5468. f.PushHook(func(context.Context, int64, string) error {
  5469. return r0
  5470. })
  5471. }
  5472. func (f *UsersStoreMarkEmailPrimaryFunc) nextHook() func(context.Context, int64, string) error {
  5473. f.mutex.Lock()
  5474. defer f.mutex.Unlock()
  5475. if len(f.hooks) == 0 {
  5476. return f.defaultHook
  5477. }
  5478. hook := f.hooks[0]
  5479. f.hooks = f.hooks[1:]
  5480. return hook
  5481. }
  5482. func (f *UsersStoreMarkEmailPrimaryFunc) appendCall(r0 UsersStoreMarkEmailPrimaryFuncCall) {
  5483. f.mutex.Lock()
  5484. f.history = append(f.history, r0)
  5485. f.mutex.Unlock()
  5486. }
  5487. // History returns a sequence of UsersStoreMarkEmailPrimaryFuncCall objects
  5488. // describing the invocations of this function.
  5489. func (f *UsersStoreMarkEmailPrimaryFunc) History() []UsersStoreMarkEmailPrimaryFuncCall {
  5490. f.mutex.Lock()
  5491. history := make([]UsersStoreMarkEmailPrimaryFuncCall, len(f.history))
  5492. copy(history, f.history)
  5493. f.mutex.Unlock()
  5494. return history
  5495. }
  5496. // UsersStoreMarkEmailPrimaryFuncCall is an object that describes an
  5497. // invocation of method MarkEmailPrimary on an instance of MockUsersStore.
  5498. type UsersStoreMarkEmailPrimaryFuncCall struct {
  5499. // Arg0 is the value of the 1st argument passed to this method
  5500. // invocation.
  5501. Arg0 context.Context
  5502. // Arg1 is the value of the 2nd argument passed to this method
  5503. // invocation.
  5504. Arg1 int64
  5505. // Arg2 is the value of the 3rd argument passed to this method
  5506. // invocation.
  5507. Arg2 string
  5508. // Result0 is the value of the 1st result returned from this method
  5509. // invocation.
  5510. Result0 error
  5511. }
  5512. // Args returns an interface slice containing the arguments of this
  5513. // invocation.
  5514. func (c UsersStoreMarkEmailPrimaryFuncCall) Args() []interface{} {
  5515. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5516. }
  5517. // Results returns an interface slice containing the results of this
  5518. // invocation.
  5519. func (c UsersStoreMarkEmailPrimaryFuncCall) Results() []interface{} {
  5520. return []interface{}{c.Result0}
  5521. }
  5522. // UsersStoreSearchByNameFunc describes the behavior when the SearchByName
  5523. // method of the parent MockUsersStore instance is invoked.
  5524. type UsersStoreSearchByNameFunc struct {
  5525. defaultHook func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  5526. hooks []func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  5527. history []UsersStoreSearchByNameFuncCall
  5528. mutex sync.Mutex
  5529. }
  5530. // SearchByName delegates to the next hook function in the queue and stores
  5531. // the parameter and result values of this invocation.
  5532. func (m *MockUsersStore) SearchByName(v0 context.Context, v1 string, v2 int, v3 int, v4 string) ([]*db.User, int64, error) {
  5533. r0, r1, r2 := m.SearchByNameFunc.nextHook()(v0, v1, v2, v3, v4)
  5534. m.SearchByNameFunc.appendCall(UsersStoreSearchByNameFuncCall{v0, v1, v2, v3, v4, r0, r1, r2})
  5535. return r0, r1, r2
  5536. }
  5537. // SetDefaultHook sets function that is called when the SearchByName method
  5538. // of the parent MockUsersStore instance is invoked and the hook queue is
  5539. // empty.
  5540. func (f *UsersStoreSearchByNameFunc) SetDefaultHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  5541. f.defaultHook = hook
  5542. }
  5543. // PushHook adds a function to the end of hook queue. Each invocation of the
  5544. // SearchByName method of the parent MockUsersStore instance invokes the
  5545. // hook at the front of the queue and discards it. After the queue is empty,
  5546. // the default hook function is invoked for any future action.
  5547. func (f *UsersStoreSearchByNameFunc) PushHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  5548. f.mutex.Lock()
  5549. f.hooks = append(f.hooks, hook)
  5550. f.mutex.Unlock()
  5551. }
  5552. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5553. // given values.
  5554. func (f *UsersStoreSearchByNameFunc) SetDefaultReturn(r0 []*db.User, r1 int64, r2 error) {
  5555. f.SetDefaultHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  5556. return r0, r1, r2
  5557. })
  5558. }
  5559. // PushReturn calls PushHook with a function that returns the given values.
  5560. func (f *UsersStoreSearchByNameFunc) PushReturn(r0 []*db.User, r1 int64, r2 error) {
  5561. f.PushHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  5562. return r0, r1, r2
  5563. })
  5564. }
  5565. func (f *UsersStoreSearchByNameFunc) nextHook() func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  5566. f.mutex.Lock()
  5567. defer f.mutex.Unlock()
  5568. if len(f.hooks) == 0 {
  5569. return f.defaultHook
  5570. }
  5571. hook := f.hooks[0]
  5572. f.hooks = f.hooks[1:]
  5573. return hook
  5574. }
  5575. func (f *UsersStoreSearchByNameFunc) appendCall(r0 UsersStoreSearchByNameFuncCall) {
  5576. f.mutex.Lock()
  5577. f.history = append(f.history, r0)
  5578. f.mutex.Unlock()
  5579. }
  5580. // History returns a sequence of UsersStoreSearchByNameFuncCall objects
  5581. // describing the invocations of this function.
  5582. func (f *UsersStoreSearchByNameFunc) History() []UsersStoreSearchByNameFuncCall {
  5583. f.mutex.Lock()
  5584. history := make([]UsersStoreSearchByNameFuncCall, len(f.history))
  5585. copy(history, f.history)
  5586. f.mutex.Unlock()
  5587. return history
  5588. }
  5589. // UsersStoreSearchByNameFuncCall is an object that describes an invocation
  5590. // of method SearchByName on an instance of MockUsersStore.
  5591. type UsersStoreSearchByNameFuncCall struct {
  5592. // Arg0 is the value of the 1st argument passed to this method
  5593. // invocation.
  5594. Arg0 context.Context
  5595. // Arg1 is the value of the 2nd argument passed to this method
  5596. // invocation.
  5597. Arg1 string
  5598. // Arg2 is the value of the 3rd argument passed to this method
  5599. // invocation.
  5600. Arg2 int
  5601. // Arg3 is the value of the 4th argument passed to this method
  5602. // invocation.
  5603. Arg3 int
  5604. // Arg4 is the value of the 5th argument passed to this method
  5605. // invocation.
  5606. Arg4 string
  5607. // Result0 is the value of the 1st result returned from this method
  5608. // invocation.
  5609. Result0 []*db.User
  5610. // Result1 is the value of the 2nd result returned from this method
  5611. // invocation.
  5612. Result1 int64
  5613. // Result2 is the value of the 3rd result returned from this method
  5614. // invocation.
  5615. Result2 error
  5616. }
  5617. // Args returns an interface slice containing the arguments of this
  5618. // invocation.
  5619. func (c UsersStoreSearchByNameFuncCall) Args() []interface{} {
  5620. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  5621. }
  5622. // Results returns an interface slice containing the results of this
  5623. // invocation.
  5624. func (c UsersStoreSearchByNameFuncCall) Results() []interface{} {
  5625. return []interface{}{c.Result0, c.Result1, c.Result2}
  5626. }
  5627. // UsersStoreUnfollowFunc describes the behavior when the Unfollow method of
  5628. // the parent MockUsersStore instance is invoked.
  5629. type UsersStoreUnfollowFunc struct {
  5630. defaultHook func(context.Context, int64, int64) error
  5631. hooks []func(context.Context, int64, int64) error
  5632. history []UsersStoreUnfollowFuncCall
  5633. mutex sync.Mutex
  5634. }
  5635. // Unfollow delegates to the next hook function in the queue and stores the
  5636. // parameter and result values of this invocation.
  5637. func (m *MockUsersStore) Unfollow(v0 context.Context, v1 int64, v2 int64) error {
  5638. r0 := m.UnfollowFunc.nextHook()(v0, v1, v2)
  5639. m.UnfollowFunc.appendCall(UsersStoreUnfollowFuncCall{v0, v1, v2, r0})
  5640. return r0
  5641. }
  5642. // SetDefaultHook sets function that is called when the Unfollow method of
  5643. // the parent MockUsersStore instance is invoked and the hook queue is
  5644. // empty.
  5645. func (f *UsersStoreUnfollowFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  5646. f.defaultHook = hook
  5647. }
  5648. // PushHook adds a function to the end of hook queue. Each invocation of the
  5649. // Unfollow method of the parent MockUsersStore instance invokes the hook at
  5650. // the front of the queue and discards it. After the queue is empty, the
  5651. // default hook function is invoked for any future action.
  5652. func (f *UsersStoreUnfollowFunc) PushHook(hook func(context.Context, int64, int64) error) {
  5653. f.mutex.Lock()
  5654. f.hooks = append(f.hooks, hook)
  5655. f.mutex.Unlock()
  5656. }
  5657. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5658. // given values.
  5659. func (f *UsersStoreUnfollowFunc) SetDefaultReturn(r0 error) {
  5660. f.SetDefaultHook(func(context.Context, int64, int64) error {
  5661. return r0
  5662. })
  5663. }
  5664. // PushReturn calls PushHook with a function that returns the given values.
  5665. func (f *UsersStoreUnfollowFunc) PushReturn(r0 error) {
  5666. f.PushHook(func(context.Context, int64, int64) error {
  5667. return r0
  5668. })
  5669. }
  5670. func (f *UsersStoreUnfollowFunc) nextHook() func(context.Context, int64, int64) error {
  5671. f.mutex.Lock()
  5672. defer f.mutex.Unlock()
  5673. if len(f.hooks) == 0 {
  5674. return f.defaultHook
  5675. }
  5676. hook := f.hooks[0]
  5677. f.hooks = f.hooks[1:]
  5678. return hook
  5679. }
  5680. func (f *UsersStoreUnfollowFunc) appendCall(r0 UsersStoreUnfollowFuncCall) {
  5681. f.mutex.Lock()
  5682. f.history = append(f.history, r0)
  5683. f.mutex.Unlock()
  5684. }
  5685. // History returns a sequence of UsersStoreUnfollowFuncCall objects
  5686. // describing the invocations of this function.
  5687. func (f *UsersStoreUnfollowFunc) History() []UsersStoreUnfollowFuncCall {
  5688. f.mutex.Lock()
  5689. history := make([]UsersStoreUnfollowFuncCall, len(f.history))
  5690. copy(history, f.history)
  5691. f.mutex.Unlock()
  5692. return history
  5693. }
  5694. // UsersStoreUnfollowFuncCall is an object that describes an invocation of
  5695. // method Unfollow on an instance of MockUsersStore.
  5696. type UsersStoreUnfollowFuncCall struct {
  5697. // Arg0 is the value of the 1st argument passed to this method
  5698. // invocation.
  5699. Arg0 context.Context
  5700. // Arg1 is the value of the 2nd argument passed to this method
  5701. // invocation.
  5702. Arg1 int64
  5703. // Arg2 is the value of the 3rd argument passed to this method
  5704. // invocation.
  5705. Arg2 int64
  5706. // Result0 is the value of the 1st result returned from this method
  5707. // invocation.
  5708. Result0 error
  5709. }
  5710. // Args returns an interface slice containing the arguments of this
  5711. // invocation.
  5712. func (c UsersStoreUnfollowFuncCall) Args() []interface{} {
  5713. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5714. }
  5715. // Results returns an interface slice containing the results of this
  5716. // invocation.
  5717. func (c UsersStoreUnfollowFuncCall) Results() []interface{} {
  5718. return []interface{}{c.Result0}
  5719. }
  5720. // UsersStoreUpdateFunc describes the behavior when the Update method of the
  5721. // parent MockUsersStore instance is invoked.
  5722. type UsersStoreUpdateFunc struct {
  5723. defaultHook func(context.Context, int64, db.UpdateUserOptions) error
  5724. hooks []func(context.Context, int64, db.UpdateUserOptions) error
  5725. history []UsersStoreUpdateFuncCall
  5726. mutex sync.Mutex
  5727. }
  5728. // Update delegates to the next hook function in the queue and stores the
  5729. // parameter and result values of this invocation.
  5730. func (m *MockUsersStore) Update(v0 context.Context, v1 int64, v2 db.UpdateUserOptions) error {
  5731. r0 := m.UpdateFunc.nextHook()(v0, v1, v2)
  5732. m.UpdateFunc.appendCall(UsersStoreUpdateFuncCall{v0, v1, v2, r0})
  5733. return r0
  5734. }
  5735. // SetDefaultHook sets function that is called when the Update method of the
  5736. // parent MockUsersStore instance is invoked and the hook queue is empty.
  5737. func (f *UsersStoreUpdateFunc) SetDefaultHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  5738. f.defaultHook = hook
  5739. }
  5740. // PushHook adds a function to the end of hook queue. Each invocation of the
  5741. // Update method of the parent MockUsersStore instance invokes the hook at
  5742. // the front of the queue and discards it. After the queue is empty, the
  5743. // default hook function is invoked for any future action.
  5744. func (f *UsersStoreUpdateFunc) PushHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  5745. f.mutex.Lock()
  5746. f.hooks = append(f.hooks, hook)
  5747. f.mutex.Unlock()
  5748. }
  5749. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5750. // given values.
  5751. func (f *UsersStoreUpdateFunc) SetDefaultReturn(r0 error) {
  5752. f.SetDefaultHook(func(context.Context, int64, db.UpdateUserOptions) error {
  5753. return r0
  5754. })
  5755. }
  5756. // PushReturn calls PushHook with a function that returns the given values.
  5757. func (f *UsersStoreUpdateFunc) PushReturn(r0 error) {
  5758. f.PushHook(func(context.Context, int64, db.UpdateUserOptions) error {
  5759. return r0
  5760. })
  5761. }
  5762. func (f *UsersStoreUpdateFunc) nextHook() func(context.Context, int64, db.UpdateUserOptions) error {
  5763. f.mutex.Lock()
  5764. defer f.mutex.Unlock()
  5765. if len(f.hooks) == 0 {
  5766. return f.defaultHook
  5767. }
  5768. hook := f.hooks[0]
  5769. f.hooks = f.hooks[1:]
  5770. return hook
  5771. }
  5772. func (f *UsersStoreUpdateFunc) appendCall(r0 UsersStoreUpdateFuncCall) {
  5773. f.mutex.Lock()
  5774. f.history = append(f.history, r0)
  5775. f.mutex.Unlock()
  5776. }
  5777. // History returns a sequence of UsersStoreUpdateFuncCall objects describing
  5778. // the invocations of this function.
  5779. func (f *UsersStoreUpdateFunc) History() []UsersStoreUpdateFuncCall {
  5780. f.mutex.Lock()
  5781. history := make([]UsersStoreUpdateFuncCall, len(f.history))
  5782. copy(history, f.history)
  5783. f.mutex.Unlock()
  5784. return history
  5785. }
  5786. // UsersStoreUpdateFuncCall is an object that describes an invocation of
  5787. // method Update on an instance of MockUsersStore.
  5788. type UsersStoreUpdateFuncCall struct {
  5789. // Arg0 is the value of the 1st argument passed to this method
  5790. // invocation.
  5791. Arg0 context.Context
  5792. // Arg1 is the value of the 2nd argument passed to this method
  5793. // invocation.
  5794. Arg1 int64
  5795. // Arg2 is the value of the 3rd argument passed to this method
  5796. // invocation.
  5797. Arg2 db.UpdateUserOptions
  5798. // Result0 is the value of the 1st result returned from this method
  5799. // invocation.
  5800. Result0 error
  5801. }
  5802. // Args returns an interface slice containing the arguments of this
  5803. // invocation.
  5804. func (c UsersStoreUpdateFuncCall) Args() []interface{} {
  5805. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5806. }
  5807. // Results returns an interface slice containing the results of this
  5808. // invocation.
  5809. func (c UsersStoreUpdateFuncCall) Results() []interface{} {
  5810. return []interface{}{c.Result0}
  5811. }
  5812. // UsersStoreUseCustomAvatarFunc describes the behavior when the
  5813. // UseCustomAvatar method of the parent MockUsersStore instance is invoked.
  5814. type UsersStoreUseCustomAvatarFunc struct {
  5815. defaultHook func(context.Context, int64, []byte) error
  5816. hooks []func(context.Context, int64, []byte) error
  5817. history []UsersStoreUseCustomAvatarFuncCall
  5818. mutex sync.Mutex
  5819. }
  5820. // UseCustomAvatar delegates to the next hook function in the queue and
  5821. // stores the parameter and result values of this invocation.
  5822. func (m *MockUsersStore) UseCustomAvatar(v0 context.Context, v1 int64, v2 []byte) error {
  5823. r0 := m.UseCustomAvatarFunc.nextHook()(v0, v1, v2)
  5824. m.UseCustomAvatarFunc.appendCall(UsersStoreUseCustomAvatarFuncCall{v0, v1, v2, r0})
  5825. return r0
  5826. }
  5827. // SetDefaultHook sets function that is called when the UseCustomAvatar
  5828. // method of the parent MockUsersStore instance is invoked and the hook
  5829. // queue is empty.
  5830. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64, []byte) error) {
  5831. f.defaultHook = hook
  5832. }
  5833. // PushHook adds a function to the end of hook queue. Each invocation of the
  5834. // UseCustomAvatar method of the parent MockUsersStore instance invokes the
  5835. // hook at the front of the queue and discards it. After the queue is empty,
  5836. // the default hook function is invoked for any future action.
  5837. func (f *UsersStoreUseCustomAvatarFunc) PushHook(hook func(context.Context, int64, []byte) error) {
  5838. f.mutex.Lock()
  5839. f.hooks = append(f.hooks, hook)
  5840. f.mutex.Unlock()
  5841. }
  5842. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  5843. // given values.
  5844. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultReturn(r0 error) {
  5845. f.SetDefaultHook(func(context.Context, int64, []byte) error {
  5846. return r0
  5847. })
  5848. }
  5849. // PushReturn calls PushHook with a function that returns the given values.
  5850. func (f *UsersStoreUseCustomAvatarFunc) PushReturn(r0 error) {
  5851. f.PushHook(func(context.Context, int64, []byte) error {
  5852. return r0
  5853. })
  5854. }
  5855. func (f *UsersStoreUseCustomAvatarFunc) nextHook() func(context.Context, int64, []byte) error {
  5856. f.mutex.Lock()
  5857. defer f.mutex.Unlock()
  5858. if len(f.hooks) == 0 {
  5859. return f.defaultHook
  5860. }
  5861. hook := f.hooks[0]
  5862. f.hooks = f.hooks[1:]
  5863. return hook
  5864. }
  5865. func (f *UsersStoreUseCustomAvatarFunc) appendCall(r0 UsersStoreUseCustomAvatarFuncCall) {
  5866. f.mutex.Lock()
  5867. f.history = append(f.history, r0)
  5868. f.mutex.Unlock()
  5869. }
  5870. // History returns a sequence of UsersStoreUseCustomAvatarFuncCall objects
  5871. // describing the invocations of this function.
  5872. func (f *UsersStoreUseCustomAvatarFunc) History() []UsersStoreUseCustomAvatarFuncCall {
  5873. f.mutex.Lock()
  5874. history := make([]UsersStoreUseCustomAvatarFuncCall, len(f.history))
  5875. copy(history, f.history)
  5876. f.mutex.Unlock()
  5877. return history
  5878. }
  5879. // UsersStoreUseCustomAvatarFuncCall is an object that describes an
  5880. // invocation of method UseCustomAvatar on an instance of MockUsersStore.
  5881. type UsersStoreUseCustomAvatarFuncCall struct {
  5882. // Arg0 is the value of the 1st argument passed to this method
  5883. // invocation.
  5884. Arg0 context.Context
  5885. // Arg1 is the value of the 2nd argument passed to this method
  5886. // invocation.
  5887. Arg1 int64
  5888. // Arg2 is the value of the 3rd argument passed to this method
  5889. // invocation.
  5890. Arg2 []byte
  5891. // Result0 is the value of the 1st result returned from this method
  5892. // invocation.
  5893. Result0 error
  5894. }
  5895. // Args returns an interface slice containing the arguments of this
  5896. // invocation.
  5897. func (c UsersStoreUseCustomAvatarFuncCall) Args() []interface{} {
  5898. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  5899. }
  5900. // Results returns an interface slice containing the results of this
  5901. // invocation.
  5902. func (c UsersStoreUseCustomAvatarFuncCall) Results() []interface{} {
  5903. return []interface{}{c.Result0}
  5904. }