mocks_test.go 206 KB

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