1
0

mocks_test.go 229 KB

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