mocks_test.go 226 KB

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