mocks_test.go 216 KB

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