mocks_test.go 166 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843
  1. // Code generated by go-mockgen 1.3.3; DO NOT EDIT.
  2. //
  3. // This file was generated by running `go-mockgen` at the root of this repository.
  4. // To add additional mocks to this or another package, add a new entry to the
  5. // mockgen.yaml file in the root of this repository.
  6. package lfs
  7. import (
  8. "context"
  9. "sync"
  10. db "gogs.io/gogs/internal/db"
  11. lfsutil "gogs.io/gogs/internal/lfsutil"
  12. )
  13. // MockAccessTokensStore is a mock implementation of the AccessTokensStore
  14. // interface (from the package gogs.io/gogs/internal/db) used for unit
  15. // testing.
  16. type MockAccessTokensStore struct {
  17. // CreateFunc is an instance of a mock function object controlling the
  18. // behavior of the method Create.
  19. CreateFunc *AccessTokensStoreCreateFunc
  20. // DeleteByIDFunc is an instance of a mock function object controlling
  21. // the behavior of the method DeleteByID.
  22. DeleteByIDFunc *AccessTokensStoreDeleteByIDFunc
  23. // GetBySHA1Func is an instance of a mock function object controlling
  24. // the behavior of the method GetBySHA1.
  25. GetBySHA1Func *AccessTokensStoreGetBySHA1Func
  26. // ListFunc is an instance of a mock function object controlling the
  27. // behavior of the method List.
  28. ListFunc *AccessTokensStoreListFunc
  29. // TouchFunc is an instance of a mock function object controlling the
  30. // behavior of the method Touch.
  31. TouchFunc *AccessTokensStoreTouchFunc
  32. }
  33. // NewMockAccessTokensStore creates a new mock of the AccessTokensStore
  34. // interface. All methods return zero values for all results, unless
  35. // overwritten.
  36. func NewMockAccessTokensStore() *MockAccessTokensStore {
  37. return &MockAccessTokensStore{
  38. CreateFunc: &AccessTokensStoreCreateFunc{
  39. defaultHook: func(context.Context, int64, string) (r0 *db.AccessToken, r1 error) {
  40. return
  41. },
  42. },
  43. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  44. defaultHook: func(context.Context, int64, int64) (r0 error) {
  45. return
  46. },
  47. },
  48. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  49. defaultHook: func(context.Context, string) (r0 *db.AccessToken, r1 error) {
  50. return
  51. },
  52. },
  53. ListFunc: &AccessTokensStoreListFunc{
  54. defaultHook: func(context.Context, int64) (r0 []*db.AccessToken, r1 error) {
  55. return
  56. },
  57. },
  58. TouchFunc: &AccessTokensStoreTouchFunc{
  59. defaultHook: func(context.Context, int64) (r0 error) {
  60. return
  61. },
  62. },
  63. }
  64. }
  65. // NewStrictMockAccessTokensStore creates a new mock of the
  66. // AccessTokensStore interface. All methods panic on invocation, unless
  67. // overwritten.
  68. func NewStrictMockAccessTokensStore() *MockAccessTokensStore {
  69. return &MockAccessTokensStore{
  70. CreateFunc: &AccessTokensStoreCreateFunc{
  71. defaultHook: func(context.Context, int64, string) (*db.AccessToken, error) {
  72. panic("unexpected invocation of MockAccessTokensStore.Create")
  73. },
  74. },
  75. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  76. defaultHook: func(context.Context, int64, int64) error {
  77. panic("unexpected invocation of MockAccessTokensStore.DeleteByID")
  78. },
  79. },
  80. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  81. defaultHook: func(context.Context, string) (*db.AccessToken, error) {
  82. panic("unexpected invocation of MockAccessTokensStore.GetBySHA1")
  83. },
  84. },
  85. ListFunc: &AccessTokensStoreListFunc{
  86. defaultHook: func(context.Context, int64) ([]*db.AccessToken, error) {
  87. panic("unexpected invocation of MockAccessTokensStore.List")
  88. },
  89. },
  90. TouchFunc: &AccessTokensStoreTouchFunc{
  91. defaultHook: func(context.Context, int64) error {
  92. panic("unexpected invocation of MockAccessTokensStore.Touch")
  93. },
  94. },
  95. }
  96. }
  97. // NewMockAccessTokensStoreFrom creates a new mock of the
  98. // MockAccessTokensStore interface. All methods delegate to the given
  99. // implementation, unless overwritten.
  100. func NewMockAccessTokensStoreFrom(i db.AccessTokensStore) *MockAccessTokensStore {
  101. return &MockAccessTokensStore{
  102. CreateFunc: &AccessTokensStoreCreateFunc{
  103. defaultHook: i.Create,
  104. },
  105. DeleteByIDFunc: &AccessTokensStoreDeleteByIDFunc{
  106. defaultHook: i.DeleteByID,
  107. },
  108. GetBySHA1Func: &AccessTokensStoreGetBySHA1Func{
  109. defaultHook: i.GetBySHA1,
  110. },
  111. ListFunc: &AccessTokensStoreListFunc{
  112. defaultHook: i.List,
  113. },
  114. TouchFunc: &AccessTokensStoreTouchFunc{
  115. defaultHook: i.Touch,
  116. },
  117. }
  118. }
  119. // AccessTokensStoreCreateFunc describes the behavior when the Create method
  120. // of the parent MockAccessTokensStore instance is invoked.
  121. type AccessTokensStoreCreateFunc struct {
  122. defaultHook func(context.Context, int64, string) (*db.AccessToken, error)
  123. hooks []func(context.Context, int64, string) (*db.AccessToken, error)
  124. history []AccessTokensStoreCreateFuncCall
  125. mutex sync.Mutex
  126. }
  127. // Create delegates to the next hook function in the queue and stores the
  128. // parameter and result values of this invocation.
  129. func (m *MockAccessTokensStore) Create(v0 context.Context, v1 int64, v2 string) (*db.AccessToken, error) {
  130. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  131. m.CreateFunc.appendCall(AccessTokensStoreCreateFuncCall{v0, v1, v2, r0, r1})
  132. return r0, r1
  133. }
  134. // SetDefaultHook sets function that is called when the Create method of the
  135. // parent MockAccessTokensStore instance is invoked and the hook queue is
  136. // empty.
  137. func (f *AccessTokensStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string) (*db.AccessToken, error)) {
  138. f.defaultHook = hook
  139. }
  140. // PushHook adds a function to the end of hook queue. Each invocation of the
  141. // Create method of the parent MockAccessTokensStore instance invokes the
  142. // hook at the front of the queue and discards it. After the queue is empty,
  143. // the default hook function is invoked for any future action.
  144. func (f *AccessTokensStoreCreateFunc) PushHook(hook func(context.Context, int64, string) (*db.AccessToken, error)) {
  145. f.mutex.Lock()
  146. f.hooks = append(f.hooks, hook)
  147. f.mutex.Unlock()
  148. }
  149. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  150. // given values.
  151. func (f *AccessTokensStoreCreateFunc) SetDefaultReturn(r0 *db.AccessToken, r1 error) {
  152. f.SetDefaultHook(func(context.Context, int64, string) (*db.AccessToken, error) {
  153. return r0, r1
  154. })
  155. }
  156. // PushReturn calls PushHook with a function that returns the given values.
  157. func (f *AccessTokensStoreCreateFunc) PushReturn(r0 *db.AccessToken, r1 error) {
  158. f.PushHook(func(context.Context, int64, string) (*db.AccessToken, error) {
  159. return r0, r1
  160. })
  161. }
  162. func (f *AccessTokensStoreCreateFunc) nextHook() func(context.Context, int64, string) (*db.AccessToken, error) {
  163. f.mutex.Lock()
  164. defer f.mutex.Unlock()
  165. if len(f.hooks) == 0 {
  166. return f.defaultHook
  167. }
  168. hook := f.hooks[0]
  169. f.hooks = f.hooks[1:]
  170. return hook
  171. }
  172. func (f *AccessTokensStoreCreateFunc) appendCall(r0 AccessTokensStoreCreateFuncCall) {
  173. f.mutex.Lock()
  174. f.history = append(f.history, r0)
  175. f.mutex.Unlock()
  176. }
  177. // History returns a sequence of AccessTokensStoreCreateFuncCall objects
  178. // describing the invocations of this function.
  179. func (f *AccessTokensStoreCreateFunc) History() []AccessTokensStoreCreateFuncCall {
  180. f.mutex.Lock()
  181. history := make([]AccessTokensStoreCreateFuncCall, len(f.history))
  182. copy(history, f.history)
  183. f.mutex.Unlock()
  184. return history
  185. }
  186. // AccessTokensStoreCreateFuncCall is an object that describes an invocation
  187. // of method Create on an instance of MockAccessTokensStore.
  188. type AccessTokensStoreCreateFuncCall struct {
  189. // Arg0 is the value of the 1st argument passed to this method
  190. // invocation.
  191. Arg0 context.Context
  192. // Arg1 is the value of the 2nd argument passed to this method
  193. // invocation.
  194. Arg1 int64
  195. // Arg2 is the value of the 3rd argument passed to this method
  196. // invocation.
  197. Arg2 string
  198. // Result0 is the value of the 1st result returned from this method
  199. // invocation.
  200. Result0 *db.AccessToken
  201. // Result1 is the value of the 2nd result returned from this method
  202. // invocation.
  203. Result1 error
  204. }
  205. // Args returns an interface slice containing the arguments of this
  206. // invocation.
  207. func (c AccessTokensStoreCreateFuncCall) Args() []interface{} {
  208. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  209. }
  210. // Results returns an interface slice containing the results of this
  211. // invocation.
  212. func (c AccessTokensStoreCreateFuncCall) Results() []interface{} {
  213. return []interface{}{c.Result0, c.Result1}
  214. }
  215. // AccessTokensStoreDeleteByIDFunc describes the behavior when the
  216. // DeleteByID method of the parent MockAccessTokensStore instance is
  217. // invoked.
  218. type AccessTokensStoreDeleteByIDFunc struct {
  219. defaultHook func(context.Context, int64, int64) error
  220. hooks []func(context.Context, int64, int64) error
  221. history []AccessTokensStoreDeleteByIDFuncCall
  222. mutex sync.Mutex
  223. }
  224. // DeleteByID delegates to the next hook function in the queue and stores
  225. // the parameter and result values of this invocation.
  226. func (m *MockAccessTokensStore) DeleteByID(v0 context.Context, v1 int64, v2 int64) error {
  227. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  228. m.DeleteByIDFunc.appendCall(AccessTokensStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  229. return r0
  230. }
  231. // SetDefaultHook sets function that is called when the DeleteByID method of
  232. // the parent MockAccessTokensStore instance is invoked and the hook queue
  233. // is empty.
  234. func (f *AccessTokensStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  235. f.defaultHook = hook
  236. }
  237. // PushHook adds a function to the end of hook queue. Each invocation of the
  238. // DeleteByID method of the parent MockAccessTokensStore instance invokes
  239. // the hook at the front of the queue and discards it. After the queue is
  240. // empty, the default hook function is invoked for any future action.
  241. func (f *AccessTokensStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, int64) error) {
  242. f.mutex.Lock()
  243. f.hooks = append(f.hooks, hook)
  244. f.mutex.Unlock()
  245. }
  246. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  247. // given values.
  248. func (f *AccessTokensStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  249. f.SetDefaultHook(func(context.Context, int64, int64) error {
  250. return r0
  251. })
  252. }
  253. // PushReturn calls PushHook with a function that returns the given values.
  254. func (f *AccessTokensStoreDeleteByIDFunc) PushReturn(r0 error) {
  255. f.PushHook(func(context.Context, int64, int64) error {
  256. return r0
  257. })
  258. }
  259. func (f *AccessTokensStoreDeleteByIDFunc) nextHook() func(context.Context, int64, int64) error {
  260. f.mutex.Lock()
  261. defer f.mutex.Unlock()
  262. if len(f.hooks) == 0 {
  263. return f.defaultHook
  264. }
  265. hook := f.hooks[0]
  266. f.hooks = f.hooks[1:]
  267. return hook
  268. }
  269. func (f *AccessTokensStoreDeleteByIDFunc) appendCall(r0 AccessTokensStoreDeleteByIDFuncCall) {
  270. f.mutex.Lock()
  271. f.history = append(f.history, r0)
  272. f.mutex.Unlock()
  273. }
  274. // History returns a sequence of AccessTokensStoreDeleteByIDFuncCall objects
  275. // describing the invocations of this function.
  276. func (f *AccessTokensStoreDeleteByIDFunc) History() []AccessTokensStoreDeleteByIDFuncCall {
  277. f.mutex.Lock()
  278. history := make([]AccessTokensStoreDeleteByIDFuncCall, len(f.history))
  279. copy(history, f.history)
  280. f.mutex.Unlock()
  281. return history
  282. }
  283. // AccessTokensStoreDeleteByIDFuncCall is an object that describes an
  284. // invocation of method DeleteByID on an instance of MockAccessTokensStore.
  285. type AccessTokensStoreDeleteByIDFuncCall struct {
  286. // Arg0 is the value of the 1st argument passed to this method
  287. // invocation.
  288. Arg0 context.Context
  289. // Arg1 is the value of the 2nd argument passed to this method
  290. // invocation.
  291. Arg1 int64
  292. // Arg2 is the value of the 3rd argument passed to this method
  293. // invocation.
  294. Arg2 int64
  295. // Result0 is the value of the 1st result returned from this method
  296. // invocation.
  297. Result0 error
  298. }
  299. // Args returns an interface slice containing the arguments of this
  300. // invocation.
  301. func (c AccessTokensStoreDeleteByIDFuncCall) Args() []interface{} {
  302. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  303. }
  304. // Results returns an interface slice containing the results of this
  305. // invocation.
  306. func (c AccessTokensStoreDeleteByIDFuncCall) Results() []interface{} {
  307. return []interface{}{c.Result0}
  308. }
  309. // AccessTokensStoreGetBySHA1Func describes the behavior when the GetBySHA1
  310. // method of the parent MockAccessTokensStore instance is invoked.
  311. type AccessTokensStoreGetBySHA1Func struct {
  312. defaultHook func(context.Context, string) (*db.AccessToken, error)
  313. hooks []func(context.Context, string) (*db.AccessToken, error)
  314. history []AccessTokensStoreGetBySHA1FuncCall
  315. mutex sync.Mutex
  316. }
  317. // GetBySHA1 delegates to the next hook function in the queue and stores the
  318. // parameter and result values of this invocation.
  319. func (m *MockAccessTokensStore) GetBySHA1(v0 context.Context, v1 string) (*db.AccessToken, error) {
  320. r0, r1 := m.GetBySHA1Func.nextHook()(v0, v1)
  321. m.GetBySHA1Func.appendCall(AccessTokensStoreGetBySHA1FuncCall{v0, v1, r0, r1})
  322. return r0, r1
  323. }
  324. // SetDefaultHook sets function that is called when the GetBySHA1 method of
  325. // the parent MockAccessTokensStore instance is invoked and the hook queue
  326. // is empty.
  327. func (f *AccessTokensStoreGetBySHA1Func) SetDefaultHook(hook func(context.Context, string) (*db.AccessToken, error)) {
  328. f.defaultHook = hook
  329. }
  330. // PushHook adds a function to the end of hook queue. Each invocation of the
  331. // GetBySHA1 method of the parent MockAccessTokensStore instance invokes the
  332. // hook at the front of the queue and discards it. After the queue is empty,
  333. // the default hook function is invoked for any future action.
  334. func (f *AccessTokensStoreGetBySHA1Func) PushHook(hook func(context.Context, string) (*db.AccessToken, error)) {
  335. f.mutex.Lock()
  336. f.hooks = append(f.hooks, hook)
  337. f.mutex.Unlock()
  338. }
  339. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  340. // given values.
  341. func (f *AccessTokensStoreGetBySHA1Func) SetDefaultReturn(r0 *db.AccessToken, r1 error) {
  342. f.SetDefaultHook(func(context.Context, string) (*db.AccessToken, error) {
  343. return r0, r1
  344. })
  345. }
  346. // PushReturn calls PushHook with a function that returns the given values.
  347. func (f *AccessTokensStoreGetBySHA1Func) PushReturn(r0 *db.AccessToken, r1 error) {
  348. f.PushHook(func(context.Context, string) (*db.AccessToken, error) {
  349. return r0, r1
  350. })
  351. }
  352. func (f *AccessTokensStoreGetBySHA1Func) nextHook() func(context.Context, string) (*db.AccessToken, error) {
  353. f.mutex.Lock()
  354. defer f.mutex.Unlock()
  355. if len(f.hooks) == 0 {
  356. return f.defaultHook
  357. }
  358. hook := f.hooks[0]
  359. f.hooks = f.hooks[1:]
  360. return hook
  361. }
  362. func (f *AccessTokensStoreGetBySHA1Func) appendCall(r0 AccessTokensStoreGetBySHA1FuncCall) {
  363. f.mutex.Lock()
  364. f.history = append(f.history, r0)
  365. f.mutex.Unlock()
  366. }
  367. // History returns a sequence of AccessTokensStoreGetBySHA1FuncCall objects
  368. // describing the invocations of this function.
  369. func (f *AccessTokensStoreGetBySHA1Func) History() []AccessTokensStoreGetBySHA1FuncCall {
  370. f.mutex.Lock()
  371. history := make([]AccessTokensStoreGetBySHA1FuncCall, len(f.history))
  372. copy(history, f.history)
  373. f.mutex.Unlock()
  374. return history
  375. }
  376. // AccessTokensStoreGetBySHA1FuncCall is an object that describes an
  377. // invocation of method GetBySHA1 on an instance of MockAccessTokensStore.
  378. type AccessTokensStoreGetBySHA1FuncCall struct {
  379. // Arg0 is the value of the 1st argument passed to this method
  380. // invocation.
  381. Arg0 context.Context
  382. // Arg1 is the value of the 2nd argument passed to this method
  383. // invocation.
  384. Arg1 string
  385. // Result0 is the value of the 1st result returned from this method
  386. // invocation.
  387. Result0 *db.AccessToken
  388. // Result1 is the value of the 2nd result returned from this method
  389. // invocation.
  390. Result1 error
  391. }
  392. // Args returns an interface slice containing the arguments of this
  393. // invocation.
  394. func (c AccessTokensStoreGetBySHA1FuncCall) Args() []interface{} {
  395. return []interface{}{c.Arg0, c.Arg1}
  396. }
  397. // Results returns an interface slice containing the results of this
  398. // invocation.
  399. func (c AccessTokensStoreGetBySHA1FuncCall) Results() []interface{} {
  400. return []interface{}{c.Result0, c.Result1}
  401. }
  402. // AccessTokensStoreListFunc describes the behavior when the List method of
  403. // the parent MockAccessTokensStore instance is invoked.
  404. type AccessTokensStoreListFunc struct {
  405. defaultHook func(context.Context, int64) ([]*db.AccessToken, error)
  406. hooks []func(context.Context, int64) ([]*db.AccessToken, error)
  407. history []AccessTokensStoreListFuncCall
  408. mutex sync.Mutex
  409. }
  410. // List delegates to the next hook function in the queue and stores the
  411. // parameter and result values of this invocation.
  412. func (m *MockAccessTokensStore) List(v0 context.Context, v1 int64) ([]*db.AccessToken, error) {
  413. r0, r1 := m.ListFunc.nextHook()(v0, v1)
  414. m.ListFunc.appendCall(AccessTokensStoreListFuncCall{v0, v1, r0, r1})
  415. return r0, r1
  416. }
  417. // SetDefaultHook sets function that is called when the List method of the
  418. // parent MockAccessTokensStore instance is invoked and the hook queue is
  419. // empty.
  420. func (f *AccessTokensStoreListFunc) SetDefaultHook(hook func(context.Context, int64) ([]*db.AccessToken, error)) {
  421. f.defaultHook = hook
  422. }
  423. // PushHook adds a function to the end of hook queue. Each invocation of the
  424. // List method of the parent MockAccessTokensStore instance invokes the hook
  425. // at the front of the queue and discards it. After the queue is empty, the
  426. // default hook function is invoked for any future action.
  427. func (f *AccessTokensStoreListFunc) PushHook(hook func(context.Context, int64) ([]*db.AccessToken, error)) {
  428. f.mutex.Lock()
  429. f.hooks = append(f.hooks, hook)
  430. f.mutex.Unlock()
  431. }
  432. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  433. // given values.
  434. func (f *AccessTokensStoreListFunc) SetDefaultReturn(r0 []*db.AccessToken, r1 error) {
  435. f.SetDefaultHook(func(context.Context, int64) ([]*db.AccessToken, error) {
  436. return r0, r1
  437. })
  438. }
  439. // PushReturn calls PushHook with a function that returns the given values.
  440. func (f *AccessTokensStoreListFunc) PushReturn(r0 []*db.AccessToken, r1 error) {
  441. f.PushHook(func(context.Context, int64) ([]*db.AccessToken, error) {
  442. return r0, r1
  443. })
  444. }
  445. func (f *AccessTokensStoreListFunc) nextHook() func(context.Context, int64) ([]*db.AccessToken, error) {
  446. f.mutex.Lock()
  447. defer f.mutex.Unlock()
  448. if len(f.hooks) == 0 {
  449. return f.defaultHook
  450. }
  451. hook := f.hooks[0]
  452. f.hooks = f.hooks[1:]
  453. return hook
  454. }
  455. func (f *AccessTokensStoreListFunc) appendCall(r0 AccessTokensStoreListFuncCall) {
  456. f.mutex.Lock()
  457. f.history = append(f.history, r0)
  458. f.mutex.Unlock()
  459. }
  460. // History returns a sequence of AccessTokensStoreListFuncCall objects
  461. // describing the invocations of this function.
  462. func (f *AccessTokensStoreListFunc) History() []AccessTokensStoreListFuncCall {
  463. f.mutex.Lock()
  464. history := make([]AccessTokensStoreListFuncCall, len(f.history))
  465. copy(history, f.history)
  466. f.mutex.Unlock()
  467. return history
  468. }
  469. // AccessTokensStoreListFuncCall is an object that describes an invocation
  470. // of method List on an instance of MockAccessTokensStore.
  471. type AccessTokensStoreListFuncCall struct {
  472. // Arg0 is the value of the 1st argument passed to this method
  473. // invocation.
  474. Arg0 context.Context
  475. // Arg1 is the value of the 2nd argument passed to this method
  476. // invocation.
  477. Arg1 int64
  478. // Result0 is the value of the 1st result returned from this method
  479. // invocation.
  480. Result0 []*db.AccessToken
  481. // Result1 is the value of the 2nd result returned from this method
  482. // invocation.
  483. Result1 error
  484. }
  485. // Args returns an interface slice containing the arguments of this
  486. // invocation.
  487. func (c AccessTokensStoreListFuncCall) Args() []interface{} {
  488. return []interface{}{c.Arg0, c.Arg1}
  489. }
  490. // Results returns an interface slice containing the results of this
  491. // invocation.
  492. func (c AccessTokensStoreListFuncCall) Results() []interface{} {
  493. return []interface{}{c.Result0, c.Result1}
  494. }
  495. // AccessTokensStoreTouchFunc describes the behavior when the Touch method
  496. // of the parent MockAccessTokensStore instance is invoked.
  497. type AccessTokensStoreTouchFunc struct {
  498. defaultHook func(context.Context, int64) error
  499. hooks []func(context.Context, int64) error
  500. history []AccessTokensStoreTouchFuncCall
  501. mutex sync.Mutex
  502. }
  503. // Touch delegates to the next hook function in the queue and stores the
  504. // parameter and result values of this invocation.
  505. func (m *MockAccessTokensStore) Touch(v0 context.Context, v1 int64) error {
  506. r0 := m.TouchFunc.nextHook()(v0, v1)
  507. m.TouchFunc.appendCall(AccessTokensStoreTouchFuncCall{v0, v1, r0})
  508. return r0
  509. }
  510. // SetDefaultHook sets function that is called when the Touch method of the
  511. // parent MockAccessTokensStore instance is invoked and the hook queue is
  512. // empty.
  513. func (f *AccessTokensStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  514. f.defaultHook = hook
  515. }
  516. // PushHook adds a function to the end of hook queue. Each invocation of the
  517. // Touch method of the parent MockAccessTokensStore instance invokes the
  518. // hook at the front of the queue and discards it. After the queue is empty,
  519. // the default hook function is invoked for any future action.
  520. func (f *AccessTokensStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  521. f.mutex.Lock()
  522. f.hooks = append(f.hooks, hook)
  523. f.mutex.Unlock()
  524. }
  525. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  526. // given values.
  527. func (f *AccessTokensStoreTouchFunc) SetDefaultReturn(r0 error) {
  528. f.SetDefaultHook(func(context.Context, int64) error {
  529. return r0
  530. })
  531. }
  532. // PushReturn calls PushHook with a function that returns the given values.
  533. func (f *AccessTokensStoreTouchFunc) PushReturn(r0 error) {
  534. f.PushHook(func(context.Context, int64) error {
  535. return r0
  536. })
  537. }
  538. func (f *AccessTokensStoreTouchFunc) nextHook() func(context.Context, int64) error {
  539. f.mutex.Lock()
  540. defer f.mutex.Unlock()
  541. if len(f.hooks) == 0 {
  542. return f.defaultHook
  543. }
  544. hook := f.hooks[0]
  545. f.hooks = f.hooks[1:]
  546. return hook
  547. }
  548. func (f *AccessTokensStoreTouchFunc) appendCall(r0 AccessTokensStoreTouchFuncCall) {
  549. f.mutex.Lock()
  550. f.history = append(f.history, r0)
  551. f.mutex.Unlock()
  552. }
  553. // History returns a sequence of AccessTokensStoreTouchFuncCall objects
  554. // describing the invocations of this function.
  555. func (f *AccessTokensStoreTouchFunc) History() []AccessTokensStoreTouchFuncCall {
  556. f.mutex.Lock()
  557. history := make([]AccessTokensStoreTouchFuncCall, len(f.history))
  558. copy(history, f.history)
  559. f.mutex.Unlock()
  560. return history
  561. }
  562. // AccessTokensStoreTouchFuncCall is an object that describes an invocation
  563. // of method Touch on an instance of MockAccessTokensStore.
  564. type AccessTokensStoreTouchFuncCall struct {
  565. // Arg0 is the value of the 1st argument passed to this method
  566. // invocation.
  567. Arg0 context.Context
  568. // Arg1 is the value of the 2nd argument passed to this method
  569. // invocation.
  570. Arg1 int64
  571. // Result0 is the value of the 1st result returned from this method
  572. // invocation.
  573. Result0 error
  574. }
  575. // Args returns an interface slice containing the arguments of this
  576. // invocation.
  577. func (c AccessTokensStoreTouchFuncCall) Args() []interface{} {
  578. return []interface{}{c.Arg0, c.Arg1}
  579. }
  580. // Results returns an interface slice containing the results of this
  581. // invocation.
  582. func (c AccessTokensStoreTouchFuncCall) Results() []interface{} {
  583. return []interface{}{c.Result0}
  584. }
  585. // MockLFSStore is a mock implementation of the LFSStore interface (from the
  586. // package gogs.io/gogs/internal/db) used for unit testing.
  587. type MockLFSStore struct {
  588. // CreateObjectFunc is an instance of a mock function object controlling
  589. // the behavior of the method CreateObject.
  590. CreateObjectFunc *LFSStoreCreateObjectFunc
  591. // GetObjectByOIDFunc is an instance of a mock function object
  592. // controlling the behavior of the method GetObjectByOID.
  593. GetObjectByOIDFunc *LFSStoreGetObjectByOIDFunc
  594. // GetObjectsByOIDsFunc is an instance of a mock function object
  595. // controlling the behavior of the method GetObjectsByOIDs.
  596. GetObjectsByOIDsFunc *LFSStoreGetObjectsByOIDsFunc
  597. }
  598. // NewMockLFSStore creates a new mock of the LFSStore interface. All methods
  599. // return zero values for all results, unless overwritten.
  600. func NewMockLFSStore() *MockLFSStore {
  601. return &MockLFSStore{
  602. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  603. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) (r0 error) {
  604. return
  605. },
  606. },
  607. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  608. defaultHook: func(context.Context, int64, lfsutil.OID) (r0 *db.LFSObject, r1 error) {
  609. return
  610. },
  611. },
  612. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  613. defaultHook: func(context.Context, int64, ...lfsutil.OID) (r0 []*db.LFSObject, r1 error) {
  614. return
  615. },
  616. },
  617. }
  618. }
  619. // NewStrictMockLFSStore creates a new mock of the LFSStore interface. All
  620. // methods panic on invocation, unless overwritten.
  621. func NewStrictMockLFSStore() *MockLFSStore {
  622. return &MockLFSStore{
  623. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  624. defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  625. panic("unexpected invocation of MockLFSStore.CreateObject")
  626. },
  627. },
  628. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  629. defaultHook: func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  630. panic("unexpected invocation of MockLFSStore.GetObjectByOID")
  631. },
  632. },
  633. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  634. defaultHook: func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  635. panic("unexpected invocation of MockLFSStore.GetObjectsByOIDs")
  636. },
  637. },
  638. }
  639. }
  640. // NewMockLFSStoreFrom creates a new mock of the MockLFSStore interface. All
  641. // methods delegate to the given implementation, unless overwritten.
  642. func NewMockLFSStoreFrom(i db.LFSStore) *MockLFSStore {
  643. return &MockLFSStore{
  644. CreateObjectFunc: &LFSStoreCreateObjectFunc{
  645. defaultHook: i.CreateObject,
  646. },
  647. GetObjectByOIDFunc: &LFSStoreGetObjectByOIDFunc{
  648. defaultHook: i.GetObjectByOID,
  649. },
  650. GetObjectsByOIDsFunc: &LFSStoreGetObjectsByOIDsFunc{
  651. defaultHook: i.GetObjectsByOIDs,
  652. },
  653. }
  654. }
  655. // LFSStoreCreateObjectFunc describes the behavior when the CreateObject
  656. // method of the parent MockLFSStore instance is invoked.
  657. type LFSStoreCreateObjectFunc struct {
  658. defaultHook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  659. hooks []func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
  660. history []LFSStoreCreateObjectFuncCall
  661. mutex sync.Mutex
  662. }
  663. // CreateObject delegates to the next hook function in the queue and stores
  664. // the parameter and result values of this invocation.
  665. func (m *MockLFSStore) CreateObject(v0 context.Context, v1 int64, v2 lfsutil.OID, v3 int64, v4 lfsutil.Storage) error {
  666. r0 := m.CreateObjectFunc.nextHook()(v0, v1, v2, v3, v4)
  667. m.CreateObjectFunc.appendCall(LFSStoreCreateObjectFuncCall{v0, v1, v2, v3, v4, r0})
  668. return r0
  669. }
  670. // SetDefaultHook sets function that is called when the CreateObject method
  671. // of the parent MockLFSStore instance is invoked and the hook queue is
  672. // empty.
  673. func (f *LFSStoreCreateObjectFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  674. f.defaultHook = hook
  675. }
  676. // PushHook adds a function to the end of hook queue. Each invocation of the
  677. // CreateObject method of the parent MockLFSStore instance invokes the hook
  678. // at the front of the queue and discards it. After the queue is empty, the
  679. // default hook function is invoked for any future action.
  680. func (f *LFSStoreCreateObjectFunc) PushHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
  681. f.mutex.Lock()
  682. f.hooks = append(f.hooks, hook)
  683. f.mutex.Unlock()
  684. }
  685. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  686. // given values.
  687. func (f *LFSStoreCreateObjectFunc) SetDefaultReturn(r0 error) {
  688. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  689. return r0
  690. })
  691. }
  692. // PushReturn calls PushHook with a function that returns the given values.
  693. func (f *LFSStoreCreateObjectFunc) PushReturn(r0 error) {
  694. f.PushHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  695. return r0
  696. })
  697. }
  698. func (f *LFSStoreCreateObjectFunc) nextHook() func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
  699. f.mutex.Lock()
  700. defer f.mutex.Unlock()
  701. if len(f.hooks) == 0 {
  702. return f.defaultHook
  703. }
  704. hook := f.hooks[0]
  705. f.hooks = f.hooks[1:]
  706. return hook
  707. }
  708. func (f *LFSStoreCreateObjectFunc) appendCall(r0 LFSStoreCreateObjectFuncCall) {
  709. f.mutex.Lock()
  710. f.history = append(f.history, r0)
  711. f.mutex.Unlock()
  712. }
  713. // History returns a sequence of LFSStoreCreateObjectFuncCall objects
  714. // describing the invocations of this function.
  715. func (f *LFSStoreCreateObjectFunc) History() []LFSStoreCreateObjectFuncCall {
  716. f.mutex.Lock()
  717. history := make([]LFSStoreCreateObjectFuncCall, len(f.history))
  718. copy(history, f.history)
  719. f.mutex.Unlock()
  720. return history
  721. }
  722. // LFSStoreCreateObjectFuncCall is an object that describes an invocation of
  723. // method CreateObject on an instance of MockLFSStore.
  724. type LFSStoreCreateObjectFuncCall struct {
  725. // Arg0 is the value of the 1st argument passed to this method
  726. // invocation.
  727. Arg0 context.Context
  728. // Arg1 is the value of the 2nd argument passed to this method
  729. // invocation.
  730. Arg1 int64
  731. // Arg2 is the value of the 3rd argument passed to this method
  732. // invocation.
  733. Arg2 lfsutil.OID
  734. // Arg3 is the value of the 4th argument passed to this method
  735. // invocation.
  736. Arg3 int64
  737. // Arg4 is the value of the 5th argument passed to this method
  738. // invocation.
  739. Arg4 lfsutil.Storage
  740. // Result0 is the value of the 1st result returned from this method
  741. // invocation.
  742. Result0 error
  743. }
  744. // Args returns an interface slice containing the arguments of this
  745. // invocation.
  746. func (c LFSStoreCreateObjectFuncCall) Args() []interface{} {
  747. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  748. }
  749. // Results returns an interface slice containing the results of this
  750. // invocation.
  751. func (c LFSStoreCreateObjectFuncCall) Results() []interface{} {
  752. return []interface{}{c.Result0}
  753. }
  754. // LFSStoreGetObjectByOIDFunc describes the behavior when the GetObjectByOID
  755. // method of the parent MockLFSStore instance is invoked.
  756. type LFSStoreGetObjectByOIDFunc struct {
  757. defaultHook func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)
  758. hooks []func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)
  759. history []LFSStoreGetObjectByOIDFuncCall
  760. mutex sync.Mutex
  761. }
  762. // GetObjectByOID delegates to the next hook function in the queue and
  763. // stores the parameter and result values of this invocation.
  764. func (m *MockLFSStore) GetObjectByOID(v0 context.Context, v1 int64, v2 lfsutil.OID) (*db.LFSObject, error) {
  765. r0, r1 := m.GetObjectByOIDFunc.nextHook()(v0, v1, v2)
  766. m.GetObjectByOIDFunc.appendCall(LFSStoreGetObjectByOIDFuncCall{v0, v1, v2, r0, r1})
  767. return r0, r1
  768. }
  769. // SetDefaultHook sets function that is called when the GetObjectByOID
  770. // method of the parent MockLFSStore instance is invoked and the hook queue
  771. // is empty.
  772. func (f *LFSStoreGetObjectByOIDFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)) {
  773. f.defaultHook = hook
  774. }
  775. // PushHook adds a function to the end of hook queue. Each invocation of the
  776. // GetObjectByOID method of the parent MockLFSStore instance invokes the
  777. // hook at the front of the queue and discards it. After the queue is empty,
  778. // the default hook function is invoked for any future action.
  779. func (f *LFSStoreGetObjectByOIDFunc) PushHook(hook func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error)) {
  780. f.mutex.Lock()
  781. f.hooks = append(f.hooks, hook)
  782. f.mutex.Unlock()
  783. }
  784. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  785. // given values.
  786. func (f *LFSStoreGetObjectByOIDFunc) SetDefaultReturn(r0 *db.LFSObject, r1 error) {
  787. f.SetDefaultHook(func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  788. return r0, r1
  789. })
  790. }
  791. // PushReturn calls PushHook with a function that returns the given values.
  792. func (f *LFSStoreGetObjectByOIDFunc) PushReturn(r0 *db.LFSObject, r1 error) {
  793. f.PushHook(func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  794. return r0, r1
  795. })
  796. }
  797. func (f *LFSStoreGetObjectByOIDFunc) nextHook() func(context.Context, int64, lfsutil.OID) (*db.LFSObject, error) {
  798. f.mutex.Lock()
  799. defer f.mutex.Unlock()
  800. if len(f.hooks) == 0 {
  801. return f.defaultHook
  802. }
  803. hook := f.hooks[0]
  804. f.hooks = f.hooks[1:]
  805. return hook
  806. }
  807. func (f *LFSStoreGetObjectByOIDFunc) appendCall(r0 LFSStoreGetObjectByOIDFuncCall) {
  808. f.mutex.Lock()
  809. f.history = append(f.history, r0)
  810. f.mutex.Unlock()
  811. }
  812. // History returns a sequence of LFSStoreGetObjectByOIDFuncCall objects
  813. // describing the invocations of this function.
  814. func (f *LFSStoreGetObjectByOIDFunc) History() []LFSStoreGetObjectByOIDFuncCall {
  815. f.mutex.Lock()
  816. history := make([]LFSStoreGetObjectByOIDFuncCall, len(f.history))
  817. copy(history, f.history)
  818. f.mutex.Unlock()
  819. return history
  820. }
  821. // LFSStoreGetObjectByOIDFuncCall is an object that describes an invocation
  822. // of method GetObjectByOID on an instance of MockLFSStore.
  823. type LFSStoreGetObjectByOIDFuncCall struct {
  824. // Arg0 is the value of the 1st argument passed to this method
  825. // invocation.
  826. Arg0 context.Context
  827. // Arg1 is the value of the 2nd argument passed to this method
  828. // invocation.
  829. Arg1 int64
  830. // Arg2 is the value of the 3rd argument passed to this method
  831. // invocation.
  832. Arg2 lfsutil.OID
  833. // Result0 is the value of the 1st result returned from this method
  834. // invocation.
  835. Result0 *db.LFSObject
  836. // Result1 is the value of the 2nd result returned from this method
  837. // invocation.
  838. Result1 error
  839. }
  840. // Args returns an interface slice containing the arguments of this
  841. // invocation.
  842. func (c LFSStoreGetObjectByOIDFuncCall) Args() []interface{} {
  843. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  844. }
  845. // Results returns an interface slice containing the results of this
  846. // invocation.
  847. func (c LFSStoreGetObjectByOIDFuncCall) Results() []interface{} {
  848. return []interface{}{c.Result0, c.Result1}
  849. }
  850. // LFSStoreGetObjectsByOIDsFunc describes the behavior when the
  851. // GetObjectsByOIDs method of the parent MockLFSStore instance is invoked.
  852. type LFSStoreGetObjectsByOIDsFunc struct {
  853. defaultHook func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)
  854. hooks []func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)
  855. history []LFSStoreGetObjectsByOIDsFuncCall
  856. mutex sync.Mutex
  857. }
  858. // GetObjectsByOIDs delegates to the next hook function in the queue and
  859. // stores the parameter and result values of this invocation.
  860. func (m *MockLFSStore) GetObjectsByOIDs(v0 context.Context, v1 int64, v2 ...lfsutil.OID) ([]*db.LFSObject, error) {
  861. r0, r1 := m.GetObjectsByOIDsFunc.nextHook()(v0, v1, v2...)
  862. m.GetObjectsByOIDsFunc.appendCall(LFSStoreGetObjectsByOIDsFuncCall{v0, v1, v2, r0, r1})
  863. return r0, r1
  864. }
  865. // SetDefaultHook sets function that is called when the GetObjectsByOIDs
  866. // method of the parent MockLFSStore instance is invoked and the hook queue
  867. // is empty.
  868. func (f *LFSStoreGetObjectsByOIDsFunc) SetDefaultHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)) {
  869. f.defaultHook = hook
  870. }
  871. // PushHook adds a function to the end of hook queue. Each invocation of the
  872. // GetObjectsByOIDs method of the parent MockLFSStore instance invokes the
  873. // hook at the front of the queue and discards it. After the queue is empty,
  874. // the default hook function is invoked for any future action.
  875. func (f *LFSStoreGetObjectsByOIDsFunc) PushHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error)) {
  876. f.mutex.Lock()
  877. f.hooks = append(f.hooks, hook)
  878. f.mutex.Unlock()
  879. }
  880. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  881. // given values.
  882. func (f *LFSStoreGetObjectsByOIDsFunc) SetDefaultReturn(r0 []*db.LFSObject, r1 error) {
  883. f.SetDefaultHook(func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  884. return r0, r1
  885. })
  886. }
  887. // PushReturn calls PushHook with a function that returns the given values.
  888. func (f *LFSStoreGetObjectsByOIDsFunc) PushReturn(r0 []*db.LFSObject, r1 error) {
  889. f.PushHook(func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  890. return r0, r1
  891. })
  892. }
  893. func (f *LFSStoreGetObjectsByOIDsFunc) nextHook() func(context.Context, int64, ...lfsutil.OID) ([]*db.LFSObject, error) {
  894. f.mutex.Lock()
  895. defer f.mutex.Unlock()
  896. if len(f.hooks) == 0 {
  897. return f.defaultHook
  898. }
  899. hook := f.hooks[0]
  900. f.hooks = f.hooks[1:]
  901. return hook
  902. }
  903. func (f *LFSStoreGetObjectsByOIDsFunc) appendCall(r0 LFSStoreGetObjectsByOIDsFuncCall) {
  904. f.mutex.Lock()
  905. f.history = append(f.history, r0)
  906. f.mutex.Unlock()
  907. }
  908. // History returns a sequence of LFSStoreGetObjectsByOIDsFuncCall objects
  909. // describing the invocations of this function.
  910. func (f *LFSStoreGetObjectsByOIDsFunc) History() []LFSStoreGetObjectsByOIDsFuncCall {
  911. f.mutex.Lock()
  912. history := make([]LFSStoreGetObjectsByOIDsFuncCall, len(f.history))
  913. copy(history, f.history)
  914. f.mutex.Unlock()
  915. return history
  916. }
  917. // LFSStoreGetObjectsByOIDsFuncCall is an object that describes an
  918. // invocation of method GetObjectsByOIDs on an instance of MockLFSStore.
  919. type LFSStoreGetObjectsByOIDsFuncCall struct {
  920. // Arg0 is the value of the 1st argument passed to this method
  921. // invocation.
  922. Arg0 context.Context
  923. // Arg1 is the value of the 2nd argument passed to this method
  924. // invocation.
  925. Arg1 int64
  926. // Arg2 is a slice containing the values of the variadic arguments
  927. // passed to this method invocation.
  928. Arg2 []lfsutil.OID
  929. // Result0 is the value of the 1st result returned from this method
  930. // invocation.
  931. Result0 []*db.LFSObject
  932. // Result1 is the value of the 2nd result returned from this method
  933. // invocation.
  934. Result1 error
  935. }
  936. // Args returns an interface slice containing the arguments of this
  937. // invocation. The variadic slice argument is flattened in this array such
  938. // that one positional argument and three variadic arguments would result in
  939. // a slice of four, not two.
  940. func (c LFSStoreGetObjectsByOIDsFuncCall) Args() []interface{} {
  941. trailing := []interface{}{}
  942. for _, val := range c.Arg2 {
  943. trailing = append(trailing, val)
  944. }
  945. return append([]interface{}{c.Arg0, c.Arg1}, trailing...)
  946. }
  947. // Results returns an interface slice containing the results of this
  948. // invocation.
  949. func (c LFSStoreGetObjectsByOIDsFuncCall) Results() []interface{} {
  950. return []interface{}{c.Result0, c.Result1}
  951. }
  952. // MockPermsStore is a mock implementation of the PermsStore interface (from
  953. // the package gogs.io/gogs/internal/db) used for unit testing.
  954. type MockPermsStore struct {
  955. // AccessModeFunc is an instance of a mock function object controlling
  956. // the behavior of the method AccessMode.
  957. AccessModeFunc *PermsStoreAccessModeFunc
  958. // AuthorizeFunc is an instance of a mock function object controlling
  959. // the behavior of the method Authorize.
  960. AuthorizeFunc *PermsStoreAuthorizeFunc
  961. // SetRepoPermsFunc is an instance of a mock function object controlling
  962. // the behavior of the method SetRepoPerms.
  963. SetRepoPermsFunc *PermsStoreSetRepoPermsFunc
  964. }
  965. // NewMockPermsStore creates a new mock of the PermsStore interface. All
  966. // methods return zero values for all results, unless overwritten.
  967. func NewMockPermsStore() *MockPermsStore {
  968. return &MockPermsStore{
  969. AccessModeFunc: &PermsStoreAccessModeFunc{
  970. defaultHook: func(context.Context, int64, int64, db.AccessModeOptions) (r0 db.AccessMode) {
  971. return
  972. },
  973. },
  974. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  975. defaultHook: func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) (r0 bool) {
  976. return
  977. },
  978. },
  979. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  980. defaultHook: func(context.Context, int64, map[int64]db.AccessMode) (r0 error) {
  981. return
  982. },
  983. },
  984. }
  985. }
  986. // NewStrictMockPermsStore creates a new mock of the PermsStore interface.
  987. // All methods panic on invocation, unless overwritten.
  988. func NewStrictMockPermsStore() *MockPermsStore {
  989. return &MockPermsStore{
  990. AccessModeFunc: &PermsStoreAccessModeFunc{
  991. defaultHook: func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  992. panic("unexpected invocation of MockPermsStore.AccessMode")
  993. },
  994. },
  995. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  996. defaultHook: func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  997. panic("unexpected invocation of MockPermsStore.Authorize")
  998. },
  999. },
  1000. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1001. defaultHook: func(context.Context, int64, map[int64]db.AccessMode) error {
  1002. panic("unexpected invocation of MockPermsStore.SetRepoPerms")
  1003. },
  1004. },
  1005. }
  1006. }
  1007. // NewMockPermsStoreFrom creates a new mock of the MockPermsStore interface.
  1008. // All methods delegate to the given implementation, unless overwritten.
  1009. func NewMockPermsStoreFrom(i db.PermsStore) *MockPermsStore {
  1010. return &MockPermsStore{
  1011. AccessModeFunc: &PermsStoreAccessModeFunc{
  1012. defaultHook: i.AccessMode,
  1013. },
  1014. AuthorizeFunc: &PermsStoreAuthorizeFunc{
  1015. defaultHook: i.Authorize,
  1016. },
  1017. SetRepoPermsFunc: &PermsStoreSetRepoPermsFunc{
  1018. defaultHook: i.SetRepoPerms,
  1019. },
  1020. }
  1021. }
  1022. // PermsStoreAccessModeFunc describes the behavior when the AccessMode
  1023. // method of the parent MockPermsStore instance is invoked.
  1024. type PermsStoreAccessModeFunc struct {
  1025. defaultHook func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode
  1026. hooks []func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode
  1027. history []PermsStoreAccessModeFuncCall
  1028. mutex sync.Mutex
  1029. }
  1030. // AccessMode delegates to the next hook function in the queue and stores
  1031. // the parameter and result values of this invocation.
  1032. func (m *MockPermsStore) AccessMode(v0 context.Context, v1 int64, v2 int64, v3 db.AccessModeOptions) db.AccessMode {
  1033. r0 := m.AccessModeFunc.nextHook()(v0, v1, v2, v3)
  1034. m.AccessModeFunc.appendCall(PermsStoreAccessModeFuncCall{v0, v1, v2, v3, r0})
  1035. return r0
  1036. }
  1037. // SetDefaultHook sets function that is called when the AccessMode method of
  1038. // the parent MockPermsStore instance is invoked and the hook queue is
  1039. // empty.
  1040. func (f *PermsStoreAccessModeFunc) SetDefaultHook(hook func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode) {
  1041. f.defaultHook = hook
  1042. }
  1043. // PushHook adds a function to the end of hook queue. Each invocation of the
  1044. // AccessMode method of the parent MockPermsStore instance invokes the hook
  1045. // at the front of the queue and discards it. After the queue is empty, the
  1046. // default hook function is invoked for any future action.
  1047. func (f *PermsStoreAccessModeFunc) PushHook(hook func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode) {
  1048. f.mutex.Lock()
  1049. f.hooks = append(f.hooks, hook)
  1050. f.mutex.Unlock()
  1051. }
  1052. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1053. // given values.
  1054. func (f *PermsStoreAccessModeFunc) SetDefaultReturn(r0 db.AccessMode) {
  1055. f.SetDefaultHook(func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  1056. return r0
  1057. })
  1058. }
  1059. // PushReturn calls PushHook with a function that returns the given values.
  1060. func (f *PermsStoreAccessModeFunc) PushReturn(r0 db.AccessMode) {
  1061. f.PushHook(func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  1062. return r0
  1063. })
  1064. }
  1065. func (f *PermsStoreAccessModeFunc) nextHook() func(context.Context, int64, int64, db.AccessModeOptions) db.AccessMode {
  1066. f.mutex.Lock()
  1067. defer f.mutex.Unlock()
  1068. if len(f.hooks) == 0 {
  1069. return f.defaultHook
  1070. }
  1071. hook := f.hooks[0]
  1072. f.hooks = f.hooks[1:]
  1073. return hook
  1074. }
  1075. func (f *PermsStoreAccessModeFunc) appendCall(r0 PermsStoreAccessModeFuncCall) {
  1076. f.mutex.Lock()
  1077. f.history = append(f.history, r0)
  1078. f.mutex.Unlock()
  1079. }
  1080. // History returns a sequence of PermsStoreAccessModeFuncCall objects
  1081. // describing the invocations of this function.
  1082. func (f *PermsStoreAccessModeFunc) History() []PermsStoreAccessModeFuncCall {
  1083. f.mutex.Lock()
  1084. history := make([]PermsStoreAccessModeFuncCall, len(f.history))
  1085. copy(history, f.history)
  1086. f.mutex.Unlock()
  1087. return history
  1088. }
  1089. // PermsStoreAccessModeFuncCall is an object that describes an invocation of
  1090. // method AccessMode on an instance of MockPermsStore.
  1091. type PermsStoreAccessModeFuncCall struct {
  1092. // Arg0 is the value of the 1st argument passed to this method
  1093. // invocation.
  1094. Arg0 context.Context
  1095. // Arg1 is the value of the 2nd argument passed to this method
  1096. // invocation.
  1097. Arg1 int64
  1098. // Arg2 is the value of the 3rd argument passed to this method
  1099. // invocation.
  1100. Arg2 int64
  1101. // Arg3 is the value of the 4th argument passed to this method
  1102. // invocation.
  1103. Arg3 db.AccessModeOptions
  1104. // Result0 is the value of the 1st result returned from this method
  1105. // invocation.
  1106. Result0 db.AccessMode
  1107. }
  1108. // Args returns an interface slice containing the arguments of this
  1109. // invocation.
  1110. func (c PermsStoreAccessModeFuncCall) Args() []interface{} {
  1111. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1112. }
  1113. // Results returns an interface slice containing the results of this
  1114. // invocation.
  1115. func (c PermsStoreAccessModeFuncCall) Results() []interface{} {
  1116. return []interface{}{c.Result0}
  1117. }
  1118. // PermsStoreAuthorizeFunc describes the behavior when the Authorize method
  1119. // of the parent MockPermsStore instance is invoked.
  1120. type PermsStoreAuthorizeFunc struct {
  1121. defaultHook func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool
  1122. hooks []func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool
  1123. history []PermsStoreAuthorizeFuncCall
  1124. mutex sync.Mutex
  1125. }
  1126. // Authorize delegates to the next hook function in the queue and stores the
  1127. // parameter and result values of this invocation.
  1128. func (m *MockPermsStore) Authorize(v0 context.Context, v1 int64, v2 int64, v3 db.AccessMode, v4 db.AccessModeOptions) bool {
  1129. r0 := m.AuthorizeFunc.nextHook()(v0, v1, v2, v3, v4)
  1130. m.AuthorizeFunc.appendCall(PermsStoreAuthorizeFuncCall{v0, v1, v2, v3, v4, r0})
  1131. return r0
  1132. }
  1133. // SetDefaultHook sets function that is called when the Authorize method of
  1134. // the parent MockPermsStore instance is invoked and the hook queue is
  1135. // empty.
  1136. func (f *PermsStoreAuthorizeFunc) SetDefaultHook(hook func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool) {
  1137. f.defaultHook = hook
  1138. }
  1139. // PushHook adds a function to the end of hook queue. Each invocation of the
  1140. // Authorize method of the parent MockPermsStore instance invokes the hook
  1141. // at the front of the queue and discards it. After the queue is empty, the
  1142. // default hook function is invoked for any future action.
  1143. func (f *PermsStoreAuthorizeFunc) PushHook(hook func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool) {
  1144. f.mutex.Lock()
  1145. f.hooks = append(f.hooks, hook)
  1146. f.mutex.Unlock()
  1147. }
  1148. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1149. // given values.
  1150. func (f *PermsStoreAuthorizeFunc) SetDefaultReturn(r0 bool) {
  1151. f.SetDefaultHook(func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  1152. return r0
  1153. })
  1154. }
  1155. // PushReturn calls PushHook with a function that returns the given values.
  1156. func (f *PermsStoreAuthorizeFunc) PushReturn(r0 bool) {
  1157. f.PushHook(func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  1158. return r0
  1159. })
  1160. }
  1161. func (f *PermsStoreAuthorizeFunc) nextHook() func(context.Context, int64, int64, db.AccessMode, db.AccessModeOptions) bool {
  1162. f.mutex.Lock()
  1163. defer f.mutex.Unlock()
  1164. if len(f.hooks) == 0 {
  1165. return f.defaultHook
  1166. }
  1167. hook := f.hooks[0]
  1168. f.hooks = f.hooks[1:]
  1169. return hook
  1170. }
  1171. func (f *PermsStoreAuthorizeFunc) appendCall(r0 PermsStoreAuthorizeFuncCall) {
  1172. f.mutex.Lock()
  1173. f.history = append(f.history, r0)
  1174. f.mutex.Unlock()
  1175. }
  1176. // History returns a sequence of PermsStoreAuthorizeFuncCall objects
  1177. // describing the invocations of this function.
  1178. func (f *PermsStoreAuthorizeFunc) History() []PermsStoreAuthorizeFuncCall {
  1179. f.mutex.Lock()
  1180. history := make([]PermsStoreAuthorizeFuncCall, len(f.history))
  1181. copy(history, f.history)
  1182. f.mutex.Unlock()
  1183. return history
  1184. }
  1185. // PermsStoreAuthorizeFuncCall is an object that describes an invocation of
  1186. // method Authorize on an instance of MockPermsStore.
  1187. type PermsStoreAuthorizeFuncCall struct {
  1188. // Arg0 is the value of the 1st argument passed to this method
  1189. // invocation.
  1190. Arg0 context.Context
  1191. // Arg1 is the value of the 2nd argument passed to this method
  1192. // invocation.
  1193. Arg1 int64
  1194. // Arg2 is the value of the 3rd argument passed to this method
  1195. // invocation.
  1196. Arg2 int64
  1197. // Arg3 is the value of the 4th argument passed to this method
  1198. // invocation.
  1199. Arg3 db.AccessMode
  1200. // Arg4 is the value of the 5th argument passed to this method
  1201. // invocation.
  1202. Arg4 db.AccessModeOptions
  1203. // Result0 is the value of the 1st result returned from this method
  1204. // invocation.
  1205. Result0 bool
  1206. }
  1207. // Args returns an interface slice containing the arguments of this
  1208. // invocation.
  1209. func (c PermsStoreAuthorizeFuncCall) Args() []interface{} {
  1210. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  1211. }
  1212. // Results returns an interface slice containing the results of this
  1213. // invocation.
  1214. func (c PermsStoreAuthorizeFuncCall) Results() []interface{} {
  1215. return []interface{}{c.Result0}
  1216. }
  1217. // PermsStoreSetRepoPermsFunc describes the behavior when the SetRepoPerms
  1218. // method of the parent MockPermsStore instance is invoked.
  1219. type PermsStoreSetRepoPermsFunc struct {
  1220. defaultHook func(context.Context, int64, map[int64]db.AccessMode) error
  1221. hooks []func(context.Context, int64, map[int64]db.AccessMode) error
  1222. history []PermsStoreSetRepoPermsFuncCall
  1223. mutex sync.Mutex
  1224. }
  1225. // SetRepoPerms delegates to the next hook function in the queue and stores
  1226. // the parameter and result values of this invocation.
  1227. func (m *MockPermsStore) SetRepoPerms(v0 context.Context, v1 int64, v2 map[int64]db.AccessMode) error {
  1228. r0 := m.SetRepoPermsFunc.nextHook()(v0, v1, v2)
  1229. m.SetRepoPermsFunc.appendCall(PermsStoreSetRepoPermsFuncCall{v0, v1, v2, r0})
  1230. return r0
  1231. }
  1232. // SetDefaultHook sets function that is called when the SetRepoPerms method
  1233. // of the parent MockPermsStore instance is invoked and the hook queue is
  1234. // empty.
  1235. func (f *PermsStoreSetRepoPermsFunc) SetDefaultHook(hook func(context.Context, int64, map[int64]db.AccessMode) error) {
  1236. f.defaultHook = hook
  1237. }
  1238. // PushHook adds a function to the end of hook queue. Each invocation of the
  1239. // SetRepoPerms method of the parent MockPermsStore instance invokes the
  1240. // hook at the front of the queue and discards it. After the queue is empty,
  1241. // the default hook function is invoked for any future action.
  1242. func (f *PermsStoreSetRepoPermsFunc) PushHook(hook func(context.Context, int64, map[int64]db.AccessMode) error) {
  1243. f.mutex.Lock()
  1244. f.hooks = append(f.hooks, hook)
  1245. f.mutex.Unlock()
  1246. }
  1247. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1248. // given values.
  1249. func (f *PermsStoreSetRepoPermsFunc) SetDefaultReturn(r0 error) {
  1250. f.SetDefaultHook(func(context.Context, int64, map[int64]db.AccessMode) error {
  1251. return r0
  1252. })
  1253. }
  1254. // PushReturn calls PushHook with a function that returns the given values.
  1255. func (f *PermsStoreSetRepoPermsFunc) PushReturn(r0 error) {
  1256. f.PushHook(func(context.Context, int64, map[int64]db.AccessMode) error {
  1257. return r0
  1258. })
  1259. }
  1260. func (f *PermsStoreSetRepoPermsFunc) nextHook() func(context.Context, int64, map[int64]db.AccessMode) error {
  1261. f.mutex.Lock()
  1262. defer f.mutex.Unlock()
  1263. if len(f.hooks) == 0 {
  1264. return f.defaultHook
  1265. }
  1266. hook := f.hooks[0]
  1267. f.hooks = f.hooks[1:]
  1268. return hook
  1269. }
  1270. func (f *PermsStoreSetRepoPermsFunc) appendCall(r0 PermsStoreSetRepoPermsFuncCall) {
  1271. f.mutex.Lock()
  1272. f.history = append(f.history, r0)
  1273. f.mutex.Unlock()
  1274. }
  1275. // History returns a sequence of PermsStoreSetRepoPermsFuncCall objects
  1276. // describing the invocations of this function.
  1277. func (f *PermsStoreSetRepoPermsFunc) History() []PermsStoreSetRepoPermsFuncCall {
  1278. f.mutex.Lock()
  1279. history := make([]PermsStoreSetRepoPermsFuncCall, len(f.history))
  1280. copy(history, f.history)
  1281. f.mutex.Unlock()
  1282. return history
  1283. }
  1284. // PermsStoreSetRepoPermsFuncCall is an object that describes an invocation
  1285. // of method SetRepoPerms on an instance of MockPermsStore.
  1286. type PermsStoreSetRepoPermsFuncCall struct {
  1287. // Arg0 is the value of the 1st argument passed to this method
  1288. // invocation.
  1289. Arg0 context.Context
  1290. // Arg1 is the value of the 2nd argument passed to this method
  1291. // invocation.
  1292. Arg1 int64
  1293. // Arg2 is the value of the 3rd argument passed to this method
  1294. // invocation.
  1295. Arg2 map[int64]db.AccessMode
  1296. // Result0 is the value of the 1st result returned from this method
  1297. // invocation.
  1298. Result0 error
  1299. }
  1300. // Args returns an interface slice containing the arguments of this
  1301. // invocation.
  1302. func (c PermsStoreSetRepoPermsFuncCall) Args() []interface{} {
  1303. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1304. }
  1305. // Results returns an interface slice containing the results of this
  1306. // invocation.
  1307. func (c PermsStoreSetRepoPermsFuncCall) Results() []interface{} {
  1308. return []interface{}{c.Result0}
  1309. }
  1310. // MockReposStore is a mock implementation of the ReposStore interface (from
  1311. // the package gogs.io/gogs/internal/db) used for unit testing.
  1312. type MockReposStore struct {
  1313. // CreateFunc is an instance of a mock function object controlling the
  1314. // behavior of the method Create.
  1315. CreateFunc *ReposStoreCreateFunc
  1316. // GetByCollaboratorIDFunc is an instance of a mock function object
  1317. // controlling the behavior of the method GetByCollaboratorID.
  1318. GetByCollaboratorIDFunc *ReposStoreGetByCollaboratorIDFunc
  1319. // GetByCollaboratorIDWithAccessModeFunc is an instance of a mock
  1320. // function object controlling the behavior of the method
  1321. // GetByCollaboratorIDWithAccessMode.
  1322. GetByCollaboratorIDWithAccessModeFunc *ReposStoreGetByCollaboratorIDWithAccessModeFunc
  1323. // GetByNameFunc is an instance of a mock function object controlling
  1324. // the behavior of the method GetByName.
  1325. GetByNameFunc *ReposStoreGetByNameFunc
  1326. // TouchFunc is an instance of a mock function object controlling the
  1327. // behavior of the method Touch.
  1328. TouchFunc *ReposStoreTouchFunc
  1329. }
  1330. // NewMockReposStore creates a new mock of the ReposStore interface. All
  1331. // methods return zero values for all results, unless overwritten.
  1332. func NewMockReposStore() *MockReposStore {
  1333. return &MockReposStore{
  1334. CreateFunc: &ReposStoreCreateFunc{
  1335. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (r0 *db.Repository, r1 error) {
  1336. return
  1337. },
  1338. },
  1339. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1340. defaultHook: func(context.Context, int64, int, string) (r0 []*db.Repository, r1 error) {
  1341. return
  1342. },
  1343. },
  1344. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1345. defaultHook: func(context.Context, int64) (r0 map[*db.Repository]db.AccessMode, r1 error) {
  1346. return
  1347. },
  1348. },
  1349. GetByNameFunc: &ReposStoreGetByNameFunc{
  1350. defaultHook: func(context.Context, int64, string) (r0 *db.Repository, r1 error) {
  1351. return
  1352. },
  1353. },
  1354. TouchFunc: &ReposStoreTouchFunc{
  1355. defaultHook: func(context.Context, int64) (r0 error) {
  1356. return
  1357. },
  1358. },
  1359. }
  1360. }
  1361. // NewStrictMockReposStore creates a new mock of the ReposStore interface.
  1362. // All methods panic on invocation, unless overwritten.
  1363. func NewStrictMockReposStore() *MockReposStore {
  1364. return &MockReposStore{
  1365. CreateFunc: &ReposStoreCreateFunc{
  1366. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1367. panic("unexpected invocation of MockReposStore.Create")
  1368. },
  1369. },
  1370. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1371. defaultHook: func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1372. panic("unexpected invocation of MockReposStore.GetByCollaboratorID")
  1373. },
  1374. },
  1375. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1376. defaultHook: func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1377. panic("unexpected invocation of MockReposStore.GetByCollaboratorIDWithAccessMode")
  1378. },
  1379. },
  1380. GetByNameFunc: &ReposStoreGetByNameFunc{
  1381. defaultHook: func(context.Context, int64, string) (*db.Repository, error) {
  1382. panic("unexpected invocation of MockReposStore.GetByName")
  1383. },
  1384. },
  1385. TouchFunc: &ReposStoreTouchFunc{
  1386. defaultHook: func(context.Context, int64) error {
  1387. panic("unexpected invocation of MockReposStore.Touch")
  1388. },
  1389. },
  1390. }
  1391. }
  1392. // NewMockReposStoreFrom creates a new mock of the MockReposStore interface.
  1393. // All methods delegate to the given implementation, unless overwritten.
  1394. func NewMockReposStoreFrom(i db.ReposStore) *MockReposStore {
  1395. return &MockReposStore{
  1396. CreateFunc: &ReposStoreCreateFunc{
  1397. defaultHook: i.Create,
  1398. },
  1399. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1400. defaultHook: i.GetByCollaboratorID,
  1401. },
  1402. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1403. defaultHook: i.GetByCollaboratorIDWithAccessMode,
  1404. },
  1405. GetByNameFunc: &ReposStoreGetByNameFunc{
  1406. defaultHook: i.GetByName,
  1407. },
  1408. TouchFunc: &ReposStoreTouchFunc{
  1409. defaultHook: i.Touch,
  1410. },
  1411. }
  1412. }
  1413. // ReposStoreCreateFunc describes the behavior when the Create method of the
  1414. // parent MockReposStore instance is invoked.
  1415. type ReposStoreCreateFunc struct {
  1416. defaultHook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1417. hooks []func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1418. history []ReposStoreCreateFuncCall
  1419. mutex sync.Mutex
  1420. }
  1421. // Create delegates to the next hook function in the queue and stores the
  1422. // parameter and result values of this invocation.
  1423. func (m *MockReposStore) Create(v0 context.Context, v1 int64, v2 db.CreateRepoOptions) (*db.Repository, error) {
  1424. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  1425. m.CreateFunc.appendCall(ReposStoreCreateFuncCall{v0, v1, v2, r0, r1})
  1426. return r0, r1
  1427. }
  1428. // SetDefaultHook sets function that is called when the Create method of the
  1429. // parent MockReposStore instance is invoked and the hook queue is empty.
  1430. func (f *ReposStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1431. f.defaultHook = hook
  1432. }
  1433. // PushHook adds a function to the end of hook queue. Each invocation of the
  1434. // Create method of the parent MockReposStore instance invokes the hook at
  1435. // the front of the queue and discards it. After the queue is empty, the
  1436. // default hook function is invoked for any future action.
  1437. func (f *ReposStoreCreateFunc) PushHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1438. f.mutex.Lock()
  1439. f.hooks = append(f.hooks, hook)
  1440. f.mutex.Unlock()
  1441. }
  1442. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1443. // given values.
  1444. func (f *ReposStoreCreateFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1445. f.SetDefaultHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1446. return r0, r1
  1447. })
  1448. }
  1449. // PushReturn calls PushHook with a function that returns the given values.
  1450. func (f *ReposStoreCreateFunc) PushReturn(r0 *db.Repository, r1 error) {
  1451. f.PushHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1452. return r0, r1
  1453. })
  1454. }
  1455. func (f *ReposStoreCreateFunc) nextHook() func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1456. f.mutex.Lock()
  1457. defer f.mutex.Unlock()
  1458. if len(f.hooks) == 0 {
  1459. return f.defaultHook
  1460. }
  1461. hook := f.hooks[0]
  1462. f.hooks = f.hooks[1:]
  1463. return hook
  1464. }
  1465. func (f *ReposStoreCreateFunc) appendCall(r0 ReposStoreCreateFuncCall) {
  1466. f.mutex.Lock()
  1467. f.history = append(f.history, r0)
  1468. f.mutex.Unlock()
  1469. }
  1470. // History returns a sequence of ReposStoreCreateFuncCall objects describing
  1471. // the invocations of this function.
  1472. func (f *ReposStoreCreateFunc) History() []ReposStoreCreateFuncCall {
  1473. f.mutex.Lock()
  1474. history := make([]ReposStoreCreateFuncCall, len(f.history))
  1475. copy(history, f.history)
  1476. f.mutex.Unlock()
  1477. return history
  1478. }
  1479. // ReposStoreCreateFuncCall is an object that describes an invocation of
  1480. // method Create on an instance of MockReposStore.
  1481. type ReposStoreCreateFuncCall struct {
  1482. // Arg0 is the value of the 1st argument passed to this method
  1483. // invocation.
  1484. Arg0 context.Context
  1485. // Arg1 is the value of the 2nd argument passed to this method
  1486. // invocation.
  1487. Arg1 int64
  1488. // Arg2 is the value of the 3rd argument passed to this method
  1489. // invocation.
  1490. Arg2 db.CreateRepoOptions
  1491. // Result0 is the value of the 1st result returned from this method
  1492. // invocation.
  1493. Result0 *db.Repository
  1494. // Result1 is the value of the 2nd result returned from this method
  1495. // invocation.
  1496. Result1 error
  1497. }
  1498. // Args returns an interface slice containing the arguments of this
  1499. // invocation.
  1500. func (c ReposStoreCreateFuncCall) Args() []interface{} {
  1501. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1502. }
  1503. // Results returns an interface slice containing the results of this
  1504. // invocation.
  1505. func (c ReposStoreCreateFuncCall) Results() []interface{} {
  1506. return []interface{}{c.Result0, c.Result1}
  1507. }
  1508. // ReposStoreGetByCollaboratorIDFunc describes the behavior when the
  1509. // GetByCollaboratorID method of the parent MockReposStore instance is
  1510. // invoked.
  1511. type ReposStoreGetByCollaboratorIDFunc struct {
  1512. defaultHook func(context.Context, int64, int, string) ([]*db.Repository, error)
  1513. hooks []func(context.Context, int64, int, string) ([]*db.Repository, error)
  1514. history []ReposStoreGetByCollaboratorIDFuncCall
  1515. mutex sync.Mutex
  1516. }
  1517. // GetByCollaboratorID delegates to the next hook function in the queue and
  1518. // stores the parameter and result values of this invocation.
  1519. func (m *MockReposStore) GetByCollaboratorID(v0 context.Context, v1 int64, v2 int, v3 string) ([]*db.Repository, error) {
  1520. r0, r1 := m.GetByCollaboratorIDFunc.nextHook()(v0, v1, v2, v3)
  1521. m.GetByCollaboratorIDFunc.appendCall(ReposStoreGetByCollaboratorIDFuncCall{v0, v1, v2, v3, r0, r1})
  1522. return r0, r1
  1523. }
  1524. // SetDefaultHook sets function that is called when the GetByCollaboratorID
  1525. // method of the parent MockReposStore instance is invoked and the hook
  1526. // queue is empty.
  1527. func (f *ReposStoreGetByCollaboratorIDFunc) SetDefaultHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1528. f.defaultHook = hook
  1529. }
  1530. // PushHook adds a function to the end of hook queue. Each invocation of the
  1531. // GetByCollaboratorID method of the parent MockReposStore instance invokes
  1532. // the hook at the front of the queue and discards it. After the queue is
  1533. // empty, the default hook function is invoked for any future action.
  1534. func (f *ReposStoreGetByCollaboratorIDFunc) PushHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1535. f.mutex.Lock()
  1536. f.hooks = append(f.hooks, hook)
  1537. f.mutex.Unlock()
  1538. }
  1539. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1540. // given values.
  1541. func (f *ReposStoreGetByCollaboratorIDFunc) SetDefaultReturn(r0 []*db.Repository, r1 error) {
  1542. f.SetDefaultHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1543. return r0, r1
  1544. })
  1545. }
  1546. // PushReturn calls PushHook with a function that returns the given values.
  1547. func (f *ReposStoreGetByCollaboratorIDFunc) PushReturn(r0 []*db.Repository, r1 error) {
  1548. f.PushHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1549. return r0, r1
  1550. })
  1551. }
  1552. func (f *ReposStoreGetByCollaboratorIDFunc) nextHook() func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1553. f.mutex.Lock()
  1554. defer f.mutex.Unlock()
  1555. if len(f.hooks) == 0 {
  1556. return f.defaultHook
  1557. }
  1558. hook := f.hooks[0]
  1559. f.hooks = f.hooks[1:]
  1560. return hook
  1561. }
  1562. func (f *ReposStoreGetByCollaboratorIDFunc) appendCall(r0 ReposStoreGetByCollaboratorIDFuncCall) {
  1563. f.mutex.Lock()
  1564. f.history = append(f.history, r0)
  1565. f.mutex.Unlock()
  1566. }
  1567. // History returns a sequence of ReposStoreGetByCollaboratorIDFuncCall
  1568. // objects describing the invocations of this function.
  1569. func (f *ReposStoreGetByCollaboratorIDFunc) History() []ReposStoreGetByCollaboratorIDFuncCall {
  1570. f.mutex.Lock()
  1571. history := make([]ReposStoreGetByCollaboratorIDFuncCall, len(f.history))
  1572. copy(history, f.history)
  1573. f.mutex.Unlock()
  1574. return history
  1575. }
  1576. // ReposStoreGetByCollaboratorIDFuncCall is an object that describes an
  1577. // invocation of method GetByCollaboratorID on an instance of
  1578. // MockReposStore.
  1579. type ReposStoreGetByCollaboratorIDFuncCall struct {
  1580. // Arg0 is the value of the 1st argument passed to this method
  1581. // invocation.
  1582. Arg0 context.Context
  1583. // Arg1 is the value of the 2nd argument passed to this method
  1584. // invocation.
  1585. Arg1 int64
  1586. // Arg2 is the value of the 3rd argument passed to this method
  1587. // invocation.
  1588. Arg2 int
  1589. // Arg3 is the value of the 4th argument passed to this method
  1590. // invocation.
  1591. Arg3 string
  1592. // Result0 is the value of the 1st result returned from this method
  1593. // invocation.
  1594. Result0 []*db.Repository
  1595. // Result1 is the value of the 2nd result returned from this method
  1596. // invocation.
  1597. Result1 error
  1598. }
  1599. // Args returns an interface slice containing the arguments of this
  1600. // invocation.
  1601. func (c ReposStoreGetByCollaboratorIDFuncCall) Args() []interface{} {
  1602. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1603. }
  1604. // Results returns an interface slice containing the results of this
  1605. // invocation.
  1606. func (c ReposStoreGetByCollaboratorIDFuncCall) Results() []interface{} {
  1607. return []interface{}{c.Result0, c.Result1}
  1608. }
  1609. // ReposStoreGetByCollaboratorIDWithAccessModeFunc describes the behavior
  1610. // when the GetByCollaboratorIDWithAccessMode method of the parent
  1611. // MockReposStore instance is invoked.
  1612. type ReposStoreGetByCollaboratorIDWithAccessModeFunc struct {
  1613. defaultHook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1614. hooks []func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1615. history []ReposStoreGetByCollaboratorIDWithAccessModeFuncCall
  1616. mutex sync.Mutex
  1617. }
  1618. // GetByCollaboratorIDWithAccessMode delegates to the next hook function in
  1619. // the queue and stores the parameter and result values of this invocation.
  1620. func (m *MockReposStore) GetByCollaboratorIDWithAccessMode(v0 context.Context, v1 int64) (map[*db.Repository]db.AccessMode, error) {
  1621. r0, r1 := m.GetByCollaboratorIDWithAccessModeFunc.nextHook()(v0, v1)
  1622. m.GetByCollaboratorIDWithAccessModeFunc.appendCall(ReposStoreGetByCollaboratorIDWithAccessModeFuncCall{v0, v1, r0, r1})
  1623. return r0, r1
  1624. }
  1625. // SetDefaultHook sets function that is called when the
  1626. // GetByCollaboratorIDWithAccessMode method of the parent MockReposStore
  1627. // instance is invoked and the hook queue is empty.
  1628. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1629. f.defaultHook = hook
  1630. }
  1631. // PushHook adds a function to the end of hook queue. Each invocation of the
  1632. // GetByCollaboratorIDWithAccessMode method of the parent MockReposStore
  1633. // instance invokes the hook at the front of the queue and discards it.
  1634. // After the queue is empty, the default hook function is invoked for any
  1635. // future action.
  1636. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) PushHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1637. f.mutex.Lock()
  1638. f.hooks = append(f.hooks, hook)
  1639. f.mutex.Unlock()
  1640. }
  1641. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1642. // given values.
  1643. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1644. f.SetDefaultHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1645. return r0, r1
  1646. })
  1647. }
  1648. // PushReturn calls PushHook with a function that returns the given values.
  1649. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) PushReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1650. f.PushHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1651. return r0, r1
  1652. })
  1653. }
  1654. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) nextHook() func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1655. f.mutex.Lock()
  1656. defer f.mutex.Unlock()
  1657. if len(f.hooks) == 0 {
  1658. return f.defaultHook
  1659. }
  1660. hook := f.hooks[0]
  1661. f.hooks = f.hooks[1:]
  1662. return hook
  1663. }
  1664. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) appendCall(r0 ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) {
  1665. f.mutex.Lock()
  1666. f.history = append(f.history, r0)
  1667. f.mutex.Unlock()
  1668. }
  1669. // History returns a sequence of
  1670. // ReposStoreGetByCollaboratorIDWithAccessModeFuncCall objects describing
  1671. // the invocations of this function.
  1672. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) History() []ReposStoreGetByCollaboratorIDWithAccessModeFuncCall {
  1673. f.mutex.Lock()
  1674. history := make([]ReposStoreGetByCollaboratorIDWithAccessModeFuncCall, len(f.history))
  1675. copy(history, f.history)
  1676. f.mutex.Unlock()
  1677. return history
  1678. }
  1679. // ReposStoreGetByCollaboratorIDWithAccessModeFuncCall is an object that
  1680. // describes an invocation of method GetByCollaboratorIDWithAccessMode on an
  1681. // instance of MockReposStore.
  1682. type ReposStoreGetByCollaboratorIDWithAccessModeFuncCall struct {
  1683. // Arg0 is the value of the 1st argument passed to this method
  1684. // invocation.
  1685. Arg0 context.Context
  1686. // Arg1 is the value of the 2nd argument passed to this method
  1687. // invocation.
  1688. Arg1 int64
  1689. // Result0 is the value of the 1st result returned from this method
  1690. // invocation.
  1691. Result0 map[*db.Repository]db.AccessMode
  1692. // Result1 is the value of the 2nd result returned from this method
  1693. // invocation.
  1694. Result1 error
  1695. }
  1696. // Args returns an interface slice containing the arguments of this
  1697. // invocation.
  1698. func (c ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) Args() []interface{} {
  1699. return []interface{}{c.Arg0, c.Arg1}
  1700. }
  1701. // Results returns an interface slice containing the results of this
  1702. // invocation.
  1703. func (c ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) Results() []interface{} {
  1704. return []interface{}{c.Result0, c.Result1}
  1705. }
  1706. // ReposStoreGetByNameFunc describes the behavior when the GetByName method
  1707. // of the parent MockReposStore instance is invoked.
  1708. type ReposStoreGetByNameFunc struct {
  1709. defaultHook func(context.Context, int64, string) (*db.Repository, error)
  1710. hooks []func(context.Context, int64, string) (*db.Repository, error)
  1711. history []ReposStoreGetByNameFuncCall
  1712. mutex sync.Mutex
  1713. }
  1714. // GetByName delegates to the next hook function in the queue and stores the
  1715. // parameter and result values of this invocation.
  1716. func (m *MockReposStore) GetByName(v0 context.Context, v1 int64, v2 string) (*db.Repository, error) {
  1717. r0, r1 := m.GetByNameFunc.nextHook()(v0, v1, v2)
  1718. m.GetByNameFunc.appendCall(ReposStoreGetByNameFuncCall{v0, v1, v2, r0, r1})
  1719. return r0, r1
  1720. }
  1721. // SetDefaultHook sets function that is called when the GetByName method of
  1722. // the parent MockReposStore instance is invoked and the hook queue is
  1723. // empty.
  1724. func (f *ReposStoreGetByNameFunc) SetDefaultHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1725. f.defaultHook = hook
  1726. }
  1727. // PushHook adds a function to the end of hook queue. Each invocation of the
  1728. // GetByName method of the parent MockReposStore instance invokes the hook
  1729. // at the front of the queue and discards it. After the queue is empty, the
  1730. // default hook function is invoked for any future action.
  1731. func (f *ReposStoreGetByNameFunc) PushHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1732. f.mutex.Lock()
  1733. f.hooks = append(f.hooks, hook)
  1734. f.mutex.Unlock()
  1735. }
  1736. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1737. // given values.
  1738. func (f *ReposStoreGetByNameFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1739. f.SetDefaultHook(func(context.Context, int64, string) (*db.Repository, error) {
  1740. return r0, r1
  1741. })
  1742. }
  1743. // PushReturn calls PushHook with a function that returns the given values.
  1744. func (f *ReposStoreGetByNameFunc) PushReturn(r0 *db.Repository, r1 error) {
  1745. f.PushHook(func(context.Context, int64, string) (*db.Repository, error) {
  1746. return r0, r1
  1747. })
  1748. }
  1749. func (f *ReposStoreGetByNameFunc) nextHook() func(context.Context, int64, string) (*db.Repository, error) {
  1750. f.mutex.Lock()
  1751. defer f.mutex.Unlock()
  1752. if len(f.hooks) == 0 {
  1753. return f.defaultHook
  1754. }
  1755. hook := f.hooks[0]
  1756. f.hooks = f.hooks[1:]
  1757. return hook
  1758. }
  1759. func (f *ReposStoreGetByNameFunc) appendCall(r0 ReposStoreGetByNameFuncCall) {
  1760. f.mutex.Lock()
  1761. f.history = append(f.history, r0)
  1762. f.mutex.Unlock()
  1763. }
  1764. // History returns a sequence of ReposStoreGetByNameFuncCall objects
  1765. // describing the invocations of this function.
  1766. func (f *ReposStoreGetByNameFunc) History() []ReposStoreGetByNameFuncCall {
  1767. f.mutex.Lock()
  1768. history := make([]ReposStoreGetByNameFuncCall, len(f.history))
  1769. copy(history, f.history)
  1770. f.mutex.Unlock()
  1771. return history
  1772. }
  1773. // ReposStoreGetByNameFuncCall is an object that describes an invocation of
  1774. // method GetByName on an instance of MockReposStore.
  1775. type ReposStoreGetByNameFuncCall struct {
  1776. // Arg0 is the value of the 1st argument passed to this method
  1777. // invocation.
  1778. Arg0 context.Context
  1779. // Arg1 is the value of the 2nd argument passed to this method
  1780. // invocation.
  1781. Arg1 int64
  1782. // Arg2 is the value of the 3rd argument passed to this method
  1783. // invocation.
  1784. Arg2 string
  1785. // Result0 is the value of the 1st result returned from this method
  1786. // invocation.
  1787. Result0 *db.Repository
  1788. // Result1 is the value of the 2nd result returned from this method
  1789. // invocation.
  1790. Result1 error
  1791. }
  1792. // Args returns an interface slice containing the arguments of this
  1793. // invocation.
  1794. func (c ReposStoreGetByNameFuncCall) Args() []interface{} {
  1795. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1796. }
  1797. // Results returns an interface slice containing the results of this
  1798. // invocation.
  1799. func (c ReposStoreGetByNameFuncCall) Results() []interface{} {
  1800. return []interface{}{c.Result0, c.Result1}
  1801. }
  1802. // ReposStoreTouchFunc describes the behavior when the Touch method of the
  1803. // parent MockReposStore instance is invoked.
  1804. type ReposStoreTouchFunc struct {
  1805. defaultHook func(context.Context, int64) error
  1806. hooks []func(context.Context, int64) error
  1807. history []ReposStoreTouchFuncCall
  1808. mutex sync.Mutex
  1809. }
  1810. // Touch delegates to the next hook function in the queue and stores the
  1811. // parameter and result values of this invocation.
  1812. func (m *MockReposStore) Touch(v0 context.Context, v1 int64) error {
  1813. r0 := m.TouchFunc.nextHook()(v0, v1)
  1814. m.TouchFunc.appendCall(ReposStoreTouchFuncCall{v0, v1, r0})
  1815. return r0
  1816. }
  1817. // SetDefaultHook sets function that is called when the Touch method of the
  1818. // parent MockReposStore instance is invoked and the hook queue is empty.
  1819. func (f *ReposStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  1820. f.defaultHook = hook
  1821. }
  1822. // PushHook adds a function to the end of hook queue. Each invocation of the
  1823. // Touch method of the parent MockReposStore instance invokes the hook at
  1824. // the front of the queue and discards it. After the queue is empty, the
  1825. // default hook function is invoked for any future action.
  1826. func (f *ReposStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  1827. f.mutex.Lock()
  1828. f.hooks = append(f.hooks, hook)
  1829. f.mutex.Unlock()
  1830. }
  1831. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1832. // given values.
  1833. func (f *ReposStoreTouchFunc) SetDefaultReturn(r0 error) {
  1834. f.SetDefaultHook(func(context.Context, int64) error {
  1835. return r0
  1836. })
  1837. }
  1838. // PushReturn calls PushHook with a function that returns the given values.
  1839. func (f *ReposStoreTouchFunc) PushReturn(r0 error) {
  1840. f.PushHook(func(context.Context, int64) error {
  1841. return r0
  1842. })
  1843. }
  1844. func (f *ReposStoreTouchFunc) nextHook() func(context.Context, int64) error {
  1845. f.mutex.Lock()
  1846. defer f.mutex.Unlock()
  1847. if len(f.hooks) == 0 {
  1848. return f.defaultHook
  1849. }
  1850. hook := f.hooks[0]
  1851. f.hooks = f.hooks[1:]
  1852. return hook
  1853. }
  1854. func (f *ReposStoreTouchFunc) appendCall(r0 ReposStoreTouchFuncCall) {
  1855. f.mutex.Lock()
  1856. f.history = append(f.history, r0)
  1857. f.mutex.Unlock()
  1858. }
  1859. // History returns a sequence of ReposStoreTouchFuncCall objects describing
  1860. // the invocations of this function.
  1861. func (f *ReposStoreTouchFunc) History() []ReposStoreTouchFuncCall {
  1862. f.mutex.Lock()
  1863. history := make([]ReposStoreTouchFuncCall, len(f.history))
  1864. copy(history, f.history)
  1865. f.mutex.Unlock()
  1866. return history
  1867. }
  1868. // ReposStoreTouchFuncCall is an object that describes an invocation of
  1869. // method Touch on an instance of MockReposStore.
  1870. type ReposStoreTouchFuncCall struct {
  1871. // Arg0 is the value of the 1st argument passed to this method
  1872. // invocation.
  1873. Arg0 context.Context
  1874. // Arg1 is the value of the 2nd argument passed to this method
  1875. // invocation.
  1876. Arg1 int64
  1877. // Result0 is the value of the 1st result returned from this method
  1878. // invocation.
  1879. Result0 error
  1880. }
  1881. // Args returns an interface slice containing the arguments of this
  1882. // invocation.
  1883. func (c ReposStoreTouchFuncCall) Args() []interface{} {
  1884. return []interface{}{c.Arg0, c.Arg1}
  1885. }
  1886. // Results returns an interface slice containing the results of this
  1887. // invocation.
  1888. func (c ReposStoreTouchFuncCall) Results() []interface{} {
  1889. return []interface{}{c.Result0}
  1890. }
  1891. // MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
  1892. // interface (from the package gogs.io/gogs/internal/db) used for unit
  1893. // testing.
  1894. type MockTwoFactorsStore struct {
  1895. // CreateFunc is an instance of a mock function object controlling the
  1896. // behavior of the method Create.
  1897. CreateFunc *TwoFactorsStoreCreateFunc
  1898. // GetByUserIDFunc is an instance of a mock function object controlling
  1899. // the behavior of the method GetByUserID.
  1900. GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
  1901. // IsEnabledFunc is an instance of a mock function object controlling
  1902. // the behavior of the method IsEnabled.
  1903. IsEnabledFunc *TwoFactorsStoreIsEnabledFunc
  1904. }
  1905. // NewMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  1906. // interface. All methods return zero values for all results, unless
  1907. // overwritten.
  1908. func NewMockTwoFactorsStore() *MockTwoFactorsStore {
  1909. return &MockTwoFactorsStore{
  1910. CreateFunc: &TwoFactorsStoreCreateFunc{
  1911. defaultHook: func(context.Context, int64, string, string) (r0 error) {
  1912. return
  1913. },
  1914. },
  1915. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  1916. defaultHook: func(context.Context, int64) (r0 *db.TwoFactor, r1 error) {
  1917. return
  1918. },
  1919. },
  1920. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  1921. defaultHook: func(context.Context, int64) (r0 bool) {
  1922. return
  1923. },
  1924. },
  1925. }
  1926. }
  1927. // NewStrictMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  1928. // interface. All methods panic on invocation, unless overwritten.
  1929. func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
  1930. return &MockTwoFactorsStore{
  1931. CreateFunc: &TwoFactorsStoreCreateFunc{
  1932. defaultHook: func(context.Context, int64, string, string) error {
  1933. panic("unexpected invocation of MockTwoFactorsStore.Create")
  1934. },
  1935. },
  1936. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  1937. defaultHook: func(context.Context, int64) (*db.TwoFactor, error) {
  1938. panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
  1939. },
  1940. },
  1941. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  1942. defaultHook: func(context.Context, int64) bool {
  1943. panic("unexpected invocation of MockTwoFactorsStore.IsEnabled")
  1944. },
  1945. },
  1946. }
  1947. }
  1948. // NewMockTwoFactorsStoreFrom creates a new mock of the MockTwoFactorsStore
  1949. // interface. All methods delegate to the given implementation, unless
  1950. // overwritten.
  1951. func NewMockTwoFactorsStoreFrom(i db.TwoFactorsStore) *MockTwoFactorsStore {
  1952. return &MockTwoFactorsStore{
  1953. CreateFunc: &TwoFactorsStoreCreateFunc{
  1954. defaultHook: i.Create,
  1955. },
  1956. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  1957. defaultHook: i.GetByUserID,
  1958. },
  1959. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  1960. defaultHook: i.IsEnabled,
  1961. },
  1962. }
  1963. }
  1964. // TwoFactorsStoreCreateFunc describes the behavior when the Create method
  1965. // of the parent MockTwoFactorsStore instance is invoked.
  1966. type TwoFactorsStoreCreateFunc struct {
  1967. defaultHook func(context.Context, int64, string, string) error
  1968. hooks []func(context.Context, int64, string, string) error
  1969. history []TwoFactorsStoreCreateFuncCall
  1970. mutex sync.Mutex
  1971. }
  1972. // Create delegates to the next hook function in the queue and stores the
  1973. // parameter and result values of this invocation.
  1974. func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
  1975. r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  1976. m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
  1977. return r0
  1978. }
  1979. // SetDefaultHook sets function that is called when the Create method of the
  1980. // parent MockTwoFactorsStore instance is invoked and the hook queue is
  1981. // empty.
  1982. func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
  1983. f.defaultHook = hook
  1984. }
  1985. // PushHook adds a function to the end of hook queue. Each invocation of the
  1986. // Create method of the parent MockTwoFactorsStore instance invokes the hook
  1987. // at the front of the queue and discards it. After the queue is empty, the
  1988. // default hook function is invoked for any future action.
  1989. func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
  1990. f.mutex.Lock()
  1991. f.hooks = append(f.hooks, hook)
  1992. f.mutex.Unlock()
  1993. }
  1994. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1995. // given values.
  1996. func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
  1997. f.SetDefaultHook(func(context.Context, int64, string, string) error {
  1998. return r0
  1999. })
  2000. }
  2001. // PushReturn calls PushHook with a function that returns the given values.
  2002. func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
  2003. f.PushHook(func(context.Context, int64, string, string) error {
  2004. return r0
  2005. })
  2006. }
  2007. func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
  2008. f.mutex.Lock()
  2009. defer f.mutex.Unlock()
  2010. if len(f.hooks) == 0 {
  2011. return f.defaultHook
  2012. }
  2013. hook := f.hooks[0]
  2014. f.hooks = f.hooks[1:]
  2015. return hook
  2016. }
  2017. func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
  2018. f.mutex.Lock()
  2019. f.history = append(f.history, r0)
  2020. f.mutex.Unlock()
  2021. }
  2022. // History returns a sequence of TwoFactorsStoreCreateFuncCall objects
  2023. // describing the invocations of this function.
  2024. func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
  2025. f.mutex.Lock()
  2026. history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
  2027. copy(history, f.history)
  2028. f.mutex.Unlock()
  2029. return history
  2030. }
  2031. // TwoFactorsStoreCreateFuncCall is an object that describes an invocation
  2032. // of method Create on an instance of MockTwoFactorsStore.
  2033. type TwoFactorsStoreCreateFuncCall struct {
  2034. // Arg0 is the value of the 1st argument passed to this method
  2035. // invocation.
  2036. Arg0 context.Context
  2037. // Arg1 is the value of the 2nd argument passed to this method
  2038. // invocation.
  2039. Arg1 int64
  2040. // Arg2 is the value of the 3rd argument passed to this method
  2041. // invocation.
  2042. Arg2 string
  2043. // Arg3 is the value of the 4th argument passed to this method
  2044. // invocation.
  2045. Arg3 string
  2046. // Result0 is the value of the 1st result returned from this method
  2047. // invocation.
  2048. Result0 error
  2049. }
  2050. // Args returns an interface slice containing the arguments of this
  2051. // invocation.
  2052. func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
  2053. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2054. }
  2055. // Results returns an interface slice containing the results of this
  2056. // invocation.
  2057. func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
  2058. return []interface{}{c.Result0}
  2059. }
  2060. // TwoFactorsStoreGetByUserIDFunc describes the behavior when the
  2061. // GetByUserID method of the parent MockTwoFactorsStore instance is invoked.
  2062. type TwoFactorsStoreGetByUserIDFunc struct {
  2063. defaultHook func(context.Context, int64) (*db.TwoFactor, error)
  2064. hooks []func(context.Context, int64) (*db.TwoFactor, error)
  2065. history []TwoFactorsStoreGetByUserIDFuncCall
  2066. mutex sync.Mutex
  2067. }
  2068. // GetByUserID delegates to the next hook function in the queue and stores
  2069. // the parameter and result values of this invocation.
  2070. func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*db.TwoFactor, error) {
  2071. r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
  2072. m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
  2073. return r0, r1
  2074. }
  2075. // SetDefaultHook sets function that is called when the GetByUserID method
  2076. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  2077. // is empty.
  2078. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2079. f.defaultHook = hook
  2080. }
  2081. // PushHook adds a function to the end of hook queue. Each invocation of the
  2082. // GetByUserID method of the parent MockTwoFactorsStore instance invokes the
  2083. // hook at the front of the queue and discards it. After the queue is empty,
  2084. // the default hook function is invoked for any future action.
  2085. func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2086. f.mutex.Lock()
  2087. f.hooks = append(f.hooks, hook)
  2088. f.mutex.Unlock()
  2089. }
  2090. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2091. // given values.
  2092. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *db.TwoFactor, r1 error) {
  2093. f.SetDefaultHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2094. return r0, r1
  2095. })
  2096. }
  2097. // PushReturn calls PushHook with a function that returns the given values.
  2098. func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *db.TwoFactor, r1 error) {
  2099. f.PushHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2100. return r0, r1
  2101. })
  2102. }
  2103. func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*db.TwoFactor, error) {
  2104. f.mutex.Lock()
  2105. defer f.mutex.Unlock()
  2106. if len(f.hooks) == 0 {
  2107. return f.defaultHook
  2108. }
  2109. hook := f.hooks[0]
  2110. f.hooks = f.hooks[1:]
  2111. return hook
  2112. }
  2113. func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
  2114. f.mutex.Lock()
  2115. f.history = append(f.history, r0)
  2116. f.mutex.Unlock()
  2117. }
  2118. // History returns a sequence of TwoFactorsStoreGetByUserIDFuncCall objects
  2119. // describing the invocations of this function.
  2120. func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
  2121. f.mutex.Lock()
  2122. history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
  2123. copy(history, f.history)
  2124. f.mutex.Unlock()
  2125. return history
  2126. }
  2127. // TwoFactorsStoreGetByUserIDFuncCall is an object that describes an
  2128. // invocation of method GetByUserID on an instance of MockTwoFactorsStore.
  2129. type TwoFactorsStoreGetByUserIDFuncCall struct {
  2130. // Arg0 is the value of the 1st argument passed to this method
  2131. // invocation.
  2132. Arg0 context.Context
  2133. // Arg1 is the value of the 2nd argument passed to this method
  2134. // invocation.
  2135. Arg1 int64
  2136. // Result0 is the value of the 1st result returned from this method
  2137. // invocation.
  2138. Result0 *db.TwoFactor
  2139. // Result1 is the value of the 2nd result returned from this method
  2140. // invocation.
  2141. Result1 error
  2142. }
  2143. // Args returns an interface slice containing the arguments of this
  2144. // invocation.
  2145. func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
  2146. return []interface{}{c.Arg0, c.Arg1}
  2147. }
  2148. // Results returns an interface slice containing the results of this
  2149. // invocation.
  2150. func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
  2151. return []interface{}{c.Result0, c.Result1}
  2152. }
  2153. // TwoFactorsStoreIsEnabledFunc describes the behavior when the IsEnabled
  2154. // method of the parent MockTwoFactorsStore instance is invoked.
  2155. type TwoFactorsStoreIsEnabledFunc struct {
  2156. defaultHook func(context.Context, int64) bool
  2157. hooks []func(context.Context, int64) bool
  2158. history []TwoFactorsStoreIsEnabledFuncCall
  2159. mutex sync.Mutex
  2160. }
  2161. // IsEnabled delegates to the next hook function in the queue and stores the
  2162. // parameter and result values of this invocation.
  2163. func (m *MockTwoFactorsStore) IsEnabled(v0 context.Context, v1 int64) bool {
  2164. r0 := m.IsEnabledFunc.nextHook()(v0, v1)
  2165. m.IsEnabledFunc.appendCall(TwoFactorsStoreIsEnabledFuncCall{v0, v1, r0})
  2166. return r0
  2167. }
  2168. // SetDefaultHook sets function that is called when the IsEnabled method of
  2169. // the parent MockTwoFactorsStore instance is invoked and the hook queue is
  2170. // empty.
  2171. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
  2172. f.defaultHook = hook
  2173. }
  2174. // PushHook adds a function to the end of hook queue. Each invocation of the
  2175. // IsEnabled method of the parent MockTwoFactorsStore instance invokes the
  2176. // hook at the front of the queue and discards it. After the queue is empty,
  2177. // the default hook function is invoked for any future action.
  2178. func (f *TwoFactorsStoreIsEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
  2179. f.mutex.Lock()
  2180. f.hooks = append(f.hooks, hook)
  2181. f.mutex.Unlock()
  2182. }
  2183. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2184. // given values.
  2185. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultReturn(r0 bool) {
  2186. f.SetDefaultHook(func(context.Context, int64) bool {
  2187. return r0
  2188. })
  2189. }
  2190. // PushReturn calls PushHook with a function that returns the given values.
  2191. func (f *TwoFactorsStoreIsEnabledFunc) PushReturn(r0 bool) {
  2192. f.PushHook(func(context.Context, int64) bool {
  2193. return r0
  2194. })
  2195. }
  2196. func (f *TwoFactorsStoreIsEnabledFunc) nextHook() func(context.Context, int64) bool {
  2197. f.mutex.Lock()
  2198. defer f.mutex.Unlock()
  2199. if len(f.hooks) == 0 {
  2200. return f.defaultHook
  2201. }
  2202. hook := f.hooks[0]
  2203. f.hooks = f.hooks[1:]
  2204. return hook
  2205. }
  2206. func (f *TwoFactorsStoreIsEnabledFunc) appendCall(r0 TwoFactorsStoreIsEnabledFuncCall) {
  2207. f.mutex.Lock()
  2208. f.history = append(f.history, r0)
  2209. f.mutex.Unlock()
  2210. }
  2211. // History returns a sequence of TwoFactorsStoreIsEnabledFuncCall objects
  2212. // describing the invocations of this function.
  2213. func (f *TwoFactorsStoreIsEnabledFunc) History() []TwoFactorsStoreIsEnabledFuncCall {
  2214. f.mutex.Lock()
  2215. history := make([]TwoFactorsStoreIsEnabledFuncCall, len(f.history))
  2216. copy(history, f.history)
  2217. f.mutex.Unlock()
  2218. return history
  2219. }
  2220. // TwoFactorsStoreIsEnabledFuncCall is an object that describes an
  2221. // invocation of method IsEnabled on an instance of MockTwoFactorsStore.
  2222. type TwoFactorsStoreIsEnabledFuncCall struct {
  2223. // Arg0 is the value of the 1st argument passed to this method
  2224. // invocation.
  2225. Arg0 context.Context
  2226. // Arg1 is the value of the 2nd argument passed to this method
  2227. // invocation.
  2228. Arg1 int64
  2229. // Result0 is the value of the 1st result returned from this method
  2230. // invocation.
  2231. Result0 bool
  2232. }
  2233. // Args returns an interface slice containing the arguments of this
  2234. // invocation.
  2235. func (c TwoFactorsStoreIsEnabledFuncCall) Args() []interface{} {
  2236. return []interface{}{c.Arg0, c.Arg1}
  2237. }
  2238. // Results returns an interface slice containing the results of this
  2239. // invocation.
  2240. func (c TwoFactorsStoreIsEnabledFuncCall) Results() []interface{} {
  2241. return []interface{}{c.Result0}
  2242. }
  2243. // MockUsersStore is a mock implementation of the UsersStore interface (from
  2244. // the package gogs.io/gogs/internal/db) used for unit testing.
  2245. type MockUsersStore struct {
  2246. // AuthenticateFunc is an instance of a mock function object controlling
  2247. // the behavior of the method Authenticate.
  2248. AuthenticateFunc *UsersStoreAuthenticateFunc
  2249. // ChangeUsernameFunc is an instance of a mock function object
  2250. // controlling the behavior of the method ChangeUsername.
  2251. ChangeUsernameFunc *UsersStoreChangeUsernameFunc
  2252. // CountFunc is an instance of a mock function object controlling the
  2253. // behavior of the method Count.
  2254. CountFunc *UsersStoreCountFunc
  2255. // CreateFunc is an instance of a mock function object controlling the
  2256. // behavior of the method Create.
  2257. CreateFunc *UsersStoreCreateFunc
  2258. // DeleteCustomAvatarFunc is an instance of a mock function object
  2259. // controlling the behavior of the method DeleteCustomAvatar.
  2260. DeleteCustomAvatarFunc *UsersStoreDeleteCustomAvatarFunc
  2261. // GetByEmailFunc is an instance of a mock function object controlling
  2262. // the behavior of the method GetByEmail.
  2263. GetByEmailFunc *UsersStoreGetByEmailFunc
  2264. // GetByIDFunc is an instance of a mock function object controlling the
  2265. // behavior of the method GetByID.
  2266. GetByIDFunc *UsersStoreGetByIDFunc
  2267. // GetByKeyIDFunc is an instance of a mock function object controlling
  2268. // the behavior of the method GetByKeyID.
  2269. GetByKeyIDFunc *UsersStoreGetByKeyIDFunc
  2270. // GetByUsernameFunc is an instance of a mock function object
  2271. // controlling the behavior of the method GetByUsername.
  2272. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  2273. // GetMailableEmailsByUsernamesFunc is an instance of a mock function
  2274. // object controlling the behavior of the method
  2275. // GetMailableEmailsByUsernames.
  2276. GetMailableEmailsByUsernamesFunc *UsersStoreGetMailableEmailsByUsernamesFunc
  2277. // HasForkedRepositoryFunc is an instance of a mock function object
  2278. // controlling the behavior of the method HasForkedRepository.
  2279. HasForkedRepositoryFunc *UsersStoreHasForkedRepositoryFunc
  2280. // IsUsernameUsedFunc is an instance of a mock function object
  2281. // controlling the behavior of the method IsUsernameUsed.
  2282. IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
  2283. // ListFunc is an instance of a mock function object controlling the
  2284. // behavior of the method List.
  2285. ListFunc *UsersStoreListFunc
  2286. // ListFollowersFunc is an instance of a mock function object
  2287. // controlling the behavior of the method ListFollowers.
  2288. ListFollowersFunc *UsersStoreListFollowersFunc
  2289. // ListFollowingsFunc is an instance of a mock function object
  2290. // controlling the behavior of the method ListFollowings.
  2291. ListFollowingsFunc *UsersStoreListFollowingsFunc
  2292. // SearchByNameFunc is an instance of a mock function object controlling
  2293. // the behavior of the method SearchByName.
  2294. SearchByNameFunc *UsersStoreSearchByNameFunc
  2295. // UpdateFunc is an instance of a mock function object controlling the
  2296. // behavior of the method Update.
  2297. UpdateFunc *UsersStoreUpdateFunc
  2298. // UseCustomAvatarFunc is an instance of a mock function object
  2299. // controlling the behavior of the method UseCustomAvatar.
  2300. UseCustomAvatarFunc *UsersStoreUseCustomAvatarFunc
  2301. }
  2302. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  2303. // methods return zero values for all results, unless overwritten.
  2304. func NewMockUsersStore() *MockUsersStore {
  2305. return &MockUsersStore{
  2306. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2307. defaultHook: func(context.Context, string, string, int64) (r0 *db.User, r1 error) {
  2308. return
  2309. },
  2310. },
  2311. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2312. defaultHook: func(context.Context, int64, string) (r0 error) {
  2313. return
  2314. },
  2315. },
  2316. CountFunc: &UsersStoreCountFunc{
  2317. defaultHook: func(context.Context) (r0 int64) {
  2318. return
  2319. },
  2320. },
  2321. CreateFunc: &UsersStoreCreateFunc{
  2322. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (r0 *db.User, r1 error) {
  2323. return
  2324. },
  2325. },
  2326. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2327. defaultHook: func(context.Context, int64) (r0 error) {
  2328. return
  2329. },
  2330. },
  2331. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2332. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  2333. return
  2334. },
  2335. },
  2336. GetByIDFunc: &UsersStoreGetByIDFunc{
  2337. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  2338. return
  2339. },
  2340. },
  2341. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2342. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  2343. return
  2344. },
  2345. },
  2346. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2347. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  2348. return
  2349. },
  2350. },
  2351. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2352. defaultHook: func(context.Context, []string) (r0 []string, r1 error) {
  2353. return
  2354. },
  2355. },
  2356. HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
  2357. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  2358. return
  2359. },
  2360. },
  2361. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2362. defaultHook: func(context.Context, string, int64) (r0 bool) {
  2363. return
  2364. },
  2365. },
  2366. ListFunc: &UsersStoreListFunc{
  2367. defaultHook: func(context.Context, int, int) (r0 []*db.User, r1 error) {
  2368. return
  2369. },
  2370. },
  2371. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2372. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  2373. return
  2374. },
  2375. },
  2376. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2377. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  2378. return
  2379. },
  2380. },
  2381. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  2382. defaultHook: func(context.Context, string, int, int, string) (r0 []*db.User, r1 int64, r2 error) {
  2383. return
  2384. },
  2385. },
  2386. UpdateFunc: &UsersStoreUpdateFunc{
  2387. defaultHook: func(context.Context, int64, db.UpdateUserOptions) (r0 error) {
  2388. return
  2389. },
  2390. },
  2391. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  2392. defaultHook: func(context.Context, int64, []byte) (r0 error) {
  2393. return
  2394. },
  2395. },
  2396. }
  2397. }
  2398. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  2399. // All methods panic on invocation, unless overwritten.
  2400. func NewStrictMockUsersStore() *MockUsersStore {
  2401. return &MockUsersStore{
  2402. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2403. defaultHook: func(context.Context, string, string, int64) (*db.User, error) {
  2404. panic("unexpected invocation of MockUsersStore.Authenticate")
  2405. },
  2406. },
  2407. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2408. defaultHook: func(context.Context, int64, string) error {
  2409. panic("unexpected invocation of MockUsersStore.ChangeUsername")
  2410. },
  2411. },
  2412. CountFunc: &UsersStoreCountFunc{
  2413. defaultHook: func(context.Context) int64 {
  2414. panic("unexpected invocation of MockUsersStore.Count")
  2415. },
  2416. },
  2417. CreateFunc: &UsersStoreCreateFunc{
  2418. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  2419. panic("unexpected invocation of MockUsersStore.Create")
  2420. },
  2421. },
  2422. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2423. defaultHook: func(context.Context, int64) error {
  2424. panic("unexpected invocation of MockUsersStore.DeleteCustomAvatar")
  2425. },
  2426. },
  2427. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2428. defaultHook: func(context.Context, string) (*db.User, error) {
  2429. panic("unexpected invocation of MockUsersStore.GetByEmail")
  2430. },
  2431. },
  2432. GetByIDFunc: &UsersStoreGetByIDFunc{
  2433. defaultHook: func(context.Context, int64) (*db.User, error) {
  2434. panic("unexpected invocation of MockUsersStore.GetByID")
  2435. },
  2436. },
  2437. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2438. defaultHook: func(context.Context, int64) (*db.User, error) {
  2439. panic("unexpected invocation of MockUsersStore.GetByKeyID")
  2440. },
  2441. },
  2442. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2443. defaultHook: func(context.Context, string) (*db.User, error) {
  2444. panic("unexpected invocation of MockUsersStore.GetByUsername")
  2445. },
  2446. },
  2447. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2448. defaultHook: func(context.Context, []string) ([]string, error) {
  2449. panic("unexpected invocation of MockUsersStore.GetMailableEmailsByUsernames")
  2450. },
  2451. },
  2452. HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
  2453. defaultHook: func(context.Context, int64, int64) bool {
  2454. panic("unexpected invocation of MockUsersStore.HasForkedRepository")
  2455. },
  2456. },
  2457. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2458. defaultHook: func(context.Context, string, int64) bool {
  2459. panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
  2460. },
  2461. },
  2462. ListFunc: &UsersStoreListFunc{
  2463. defaultHook: func(context.Context, int, int) ([]*db.User, error) {
  2464. panic("unexpected invocation of MockUsersStore.List")
  2465. },
  2466. },
  2467. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2468. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  2469. panic("unexpected invocation of MockUsersStore.ListFollowers")
  2470. },
  2471. },
  2472. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2473. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  2474. panic("unexpected invocation of MockUsersStore.ListFollowings")
  2475. },
  2476. },
  2477. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  2478. defaultHook: func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  2479. panic("unexpected invocation of MockUsersStore.SearchByName")
  2480. },
  2481. },
  2482. UpdateFunc: &UsersStoreUpdateFunc{
  2483. defaultHook: func(context.Context, int64, db.UpdateUserOptions) error {
  2484. panic("unexpected invocation of MockUsersStore.Update")
  2485. },
  2486. },
  2487. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  2488. defaultHook: func(context.Context, int64, []byte) error {
  2489. panic("unexpected invocation of MockUsersStore.UseCustomAvatar")
  2490. },
  2491. },
  2492. }
  2493. }
  2494. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  2495. // All methods delegate to the given implementation, unless overwritten.
  2496. func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
  2497. return &MockUsersStore{
  2498. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2499. defaultHook: i.Authenticate,
  2500. },
  2501. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2502. defaultHook: i.ChangeUsername,
  2503. },
  2504. CountFunc: &UsersStoreCountFunc{
  2505. defaultHook: i.Count,
  2506. },
  2507. CreateFunc: &UsersStoreCreateFunc{
  2508. defaultHook: i.Create,
  2509. },
  2510. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2511. defaultHook: i.DeleteCustomAvatar,
  2512. },
  2513. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2514. defaultHook: i.GetByEmail,
  2515. },
  2516. GetByIDFunc: &UsersStoreGetByIDFunc{
  2517. defaultHook: i.GetByID,
  2518. },
  2519. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2520. defaultHook: i.GetByKeyID,
  2521. },
  2522. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2523. defaultHook: i.GetByUsername,
  2524. },
  2525. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2526. defaultHook: i.GetMailableEmailsByUsernames,
  2527. },
  2528. HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
  2529. defaultHook: i.HasForkedRepository,
  2530. },
  2531. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2532. defaultHook: i.IsUsernameUsed,
  2533. },
  2534. ListFunc: &UsersStoreListFunc{
  2535. defaultHook: i.List,
  2536. },
  2537. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2538. defaultHook: i.ListFollowers,
  2539. },
  2540. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2541. defaultHook: i.ListFollowings,
  2542. },
  2543. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  2544. defaultHook: i.SearchByName,
  2545. },
  2546. UpdateFunc: &UsersStoreUpdateFunc{
  2547. defaultHook: i.Update,
  2548. },
  2549. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  2550. defaultHook: i.UseCustomAvatar,
  2551. },
  2552. }
  2553. }
  2554. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  2555. // method of the parent MockUsersStore instance is invoked.
  2556. type UsersStoreAuthenticateFunc struct {
  2557. defaultHook func(context.Context, string, string, int64) (*db.User, error)
  2558. hooks []func(context.Context, string, string, int64) (*db.User, error)
  2559. history []UsersStoreAuthenticateFuncCall
  2560. mutex sync.Mutex
  2561. }
  2562. // Authenticate delegates to the next hook function in the queue and stores
  2563. // the parameter and result values of this invocation.
  2564. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*db.User, error) {
  2565. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  2566. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  2567. return r0, r1
  2568. }
  2569. // SetDefaultHook sets function that is called when the Authenticate method
  2570. // of the parent MockUsersStore instance is invoked and the hook queue is
  2571. // empty.
  2572. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  2573. f.defaultHook = hook
  2574. }
  2575. // PushHook adds a function to the end of hook queue. Each invocation of the
  2576. // Authenticate method of the parent MockUsersStore instance invokes the
  2577. // hook at the front of the queue and discards it. After the queue is empty,
  2578. // the default hook function is invoked for any future action.
  2579. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  2580. f.mutex.Lock()
  2581. f.hooks = append(f.hooks, hook)
  2582. f.mutex.Unlock()
  2583. }
  2584. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2585. // given values.
  2586. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  2587. f.SetDefaultHook(func(context.Context, string, string, int64) (*db.User, error) {
  2588. return r0, r1
  2589. })
  2590. }
  2591. // PushReturn calls PushHook with a function that returns the given values.
  2592. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *db.User, r1 error) {
  2593. f.PushHook(func(context.Context, string, string, int64) (*db.User, error) {
  2594. return r0, r1
  2595. })
  2596. }
  2597. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*db.User, error) {
  2598. f.mutex.Lock()
  2599. defer f.mutex.Unlock()
  2600. if len(f.hooks) == 0 {
  2601. return f.defaultHook
  2602. }
  2603. hook := f.hooks[0]
  2604. f.hooks = f.hooks[1:]
  2605. return hook
  2606. }
  2607. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  2608. f.mutex.Lock()
  2609. f.history = append(f.history, r0)
  2610. f.mutex.Unlock()
  2611. }
  2612. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  2613. // describing the invocations of this function.
  2614. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  2615. f.mutex.Lock()
  2616. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  2617. copy(history, f.history)
  2618. f.mutex.Unlock()
  2619. return history
  2620. }
  2621. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  2622. // of method Authenticate on an instance of MockUsersStore.
  2623. type UsersStoreAuthenticateFuncCall struct {
  2624. // Arg0 is the value of the 1st argument passed to this method
  2625. // invocation.
  2626. Arg0 context.Context
  2627. // Arg1 is the value of the 2nd argument passed to this method
  2628. // invocation.
  2629. Arg1 string
  2630. // Arg2 is the value of the 3rd argument passed to this method
  2631. // invocation.
  2632. Arg2 string
  2633. // Arg3 is the value of the 4th argument passed to this method
  2634. // invocation.
  2635. Arg3 int64
  2636. // Result0 is the value of the 1st result returned from this method
  2637. // invocation.
  2638. Result0 *db.User
  2639. // Result1 is the value of the 2nd result returned from this method
  2640. // invocation.
  2641. Result1 error
  2642. }
  2643. // Args returns an interface slice containing the arguments of this
  2644. // invocation.
  2645. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  2646. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2647. }
  2648. // Results returns an interface slice containing the results of this
  2649. // invocation.
  2650. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  2651. return []interface{}{c.Result0, c.Result1}
  2652. }
  2653. // UsersStoreChangeUsernameFunc describes the behavior when the
  2654. // ChangeUsername method of the parent MockUsersStore instance is invoked.
  2655. type UsersStoreChangeUsernameFunc struct {
  2656. defaultHook func(context.Context, int64, string) error
  2657. hooks []func(context.Context, int64, string) error
  2658. history []UsersStoreChangeUsernameFuncCall
  2659. mutex sync.Mutex
  2660. }
  2661. // ChangeUsername delegates to the next hook function in the queue and
  2662. // stores the parameter and result values of this invocation.
  2663. func (m *MockUsersStore) ChangeUsername(v0 context.Context, v1 int64, v2 string) error {
  2664. r0 := m.ChangeUsernameFunc.nextHook()(v0, v1, v2)
  2665. m.ChangeUsernameFunc.appendCall(UsersStoreChangeUsernameFuncCall{v0, v1, v2, r0})
  2666. return r0
  2667. }
  2668. // SetDefaultHook sets function that is called when the ChangeUsername
  2669. // method of the parent MockUsersStore instance is invoked and the hook
  2670. // queue is empty.
  2671. func (f *UsersStoreChangeUsernameFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  2672. f.defaultHook = hook
  2673. }
  2674. // PushHook adds a function to the end of hook queue. Each invocation of the
  2675. // ChangeUsername method of the parent MockUsersStore instance invokes the
  2676. // hook at the front of the queue and discards it. After the queue is empty,
  2677. // the default hook function is invoked for any future action.
  2678. func (f *UsersStoreChangeUsernameFunc) PushHook(hook func(context.Context, int64, string) error) {
  2679. f.mutex.Lock()
  2680. f.hooks = append(f.hooks, hook)
  2681. f.mutex.Unlock()
  2682. }
  2683. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2684. // given values.
  2685. func (f *UsersStoreChangeUsernameFunc) SetDefaultReturn(r0 error) {
  2686. f.SetDefaultHook(func(context.Context, int64, string) error {
  2687. return r0
  2688. })
  2689. }
  2690. // PushReturn calls PushHook with a function that returns the given values.
  2691. func (f *UsersStoreChangeUsernameFunc) PushReturn(r0 error) {
  2692. f.PushHook(func(context.Context, int64, string) error {
  2693. return r0
  2694. })
  2695. }
  2696. func (f *UsersStoreChangeUsernameFunc) nextHook() func(context.Context, int64, string) error {
  2697. f.mutex.Lock()
  2698. defer f.mutex.Unlock()
  2699. if len(f.hooks) == 0 {
  2700. return f.defaultHook
  2701. }
  2702. hook := f.hooks[0]
  2703. f.hooks = f.hooks[1:]
  2704. return hook
  2705. }
  2706. func (f *UsersStoreChangeUsernameFunc) appendCall(r0 UsersStoreChangeUsernameFuncCall) {
  2707. f.mutex.Lock()
  2708. f.history = append(f.history, r0)
  2709. f.mutex.Unlock()
  2710. }
  2711. // History returns a sequence of UsersStoreChangeUsernameFuncCall objects
  2712. // describing the invocations of this function.
  2713. func (f *UsersStoreChangeUsernameFunc) History() []UsersStoreChangeUsernameFuncCall {
  2714. f.mutex.Lock()
  2715. history := make([]UsersStoreChangeUsernameFuncCall, len(f.history))
  2716. copy(history, f.history)
  2717. f.mutex.Unlock()
  2718. return history
  2719. }
  2720. // UsersStoreChangeUsernameFuncCall is an object that describes an
  2721. // invocation of method ChangeUsername on an instance of MockUsersStore.
  2722. type UsersStoreChangeUsernameFuncCall struct {
  2723. // Arg0 is the value of the 1st argument passed to this method
  2724. // invocation.
  2725. Arg0 context.Context
  2726. // Arg1 is the value of the 2nd argument passed to this method
  2727. // invocation.
  2728. Arg1 int64
  2729. // Arg2 is the value of the 3rd argument passed to this method
  2730. // invocation.
  2731. Arg2 string
  2732. // Result0 is the value of the 1st result returned from this method
  2733. // invocation.
  2734. Result0 error
  2735. }
  2736. // Args returns an interface slice containing the arguments of this
  2737. // invocation.
  2738. func (c UsersStoreChangeUsernameFuncCall) Args() []interface{} {
  2739. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2740. }
  2741. // Results returns an interface slice containing the results of this
  2742. // invocation.
  2743. func (c UsersStoreChangeUsernameFuncCall) Results() []interface{} {
  2744. return []interface{}{c.Result0}
  2745. }
  2746. // UsersStoreCountFunc describes the behavior when the Count method of the
  2747. // parent MockUsersStore instance is invoked.
  2748. type UsersStoreCountFunc struct {
  2749. defaultHook func(context.Context) int64
  2750. hooks []func(context.Context) int64
  2751. history []UsersStoreCountFuncCall
  2752. mutex sync.Mutex
  2753. }
  2754. // Count delegates to the next hook function in the queue and stores the
  2755. // parameter and result values of this invocation.
  2756. func (m *MockUsersStore) Count(v0 context.Context) int64 {
  2757. r0 := m.CountFunc.nextHook()(v0)
  2758. m.CountFunc.appendCall(UsersStoreCountFuncCall{v0, r0})
  2759. return r0
  2760. }
  2761. // SetDefaultHook sets function that is called when the Count method of the
  2762. // parent MockUsersStore instance is invoked and the hook queue is empty.
  2763. func (f *UsersStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  2764. f.defaultHook = hook
  2765. }
  2766. // PushHook adds a function to the end of hook queue. Each invocation of the
  2767. // Count method of the parent MockUsersStore instance invokes the hook at
  2768. // the front of the queue and discards it. After the queue is empty, the
  2769. // default hook function is invoked for any future action.
  2770. func (f *UsersStoreCountFunc) PushHook(hook func(context.Context) int64) {
  2771. f.mutex.Lock()
  2772. f.hooks = append(f.hooks, hook)
  2773. f.mutex.Unlock()
  2774. }
  2775. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2776. // given values.
  2777. func (f *UsersStoreCountFunc) SetDefaultReturn(r0 int64) {
  2778. f.SetDefaultHook(func(context.Context) int64 {
  2779. return r0
  2780. })
  2781. }
  2782. // PushReturn calls PushHook with a function that returns the given values.
  2783. func (f *UsersStoreCountFunc) PushReturn(r0 int64) {
  2784. f.PushHook(func(context.Context) int64 {
  2785. return r0
  2786. })
  2787. }
  2788. func (f *UsersStoreCountFunc) nextHook() func(context.Context) int64 {
  2789. f.mutex.Lock()
  2790. defer f.mutex.Unlock()
  2791. if len(f.hooks) == 0 {
  2792. return f.defaultHook
  2793. }
  2794. hook := f.hooks[0]
  2795. f.hooks = f.hooks[1:]
  2796. return hook
  2797. }
  2798. func (f *UsersStoreCountFunc) appendCall(r0 UsersStoreCountFuncCall) {
  2799. f.mutex.Lock()
  2800. f.history = append(f.history, r0)
  2801. f.mutex.Unlock()
  2802. }
  2803. // History returns a sequence of UsersStoreCountFuncCall objects describing
  2804. // the invocations of this function.
  2805. func (f *UsersStoreCountFunc) History() []UsersStoreCountFuncCall {
  2806. f.mutex.Lock()
  2807. history := make([]UsersStoreCountFuncCall, len(f.history))
  2808. copy(history, f.history)
  2809. f.mutex.Unlock()
  2810. return history
  2811. }
  2812. // UsersStoreCountFuncCall is an object that describes an invocation of
  2813. // method Count on an instance of MockUsersStore.
  2814. type UsersStoreCountFuncCall struct {
  2815. // Arg0 is the value of the 1st argument passed to this method
  2816. // invocation.
  2817. Arg0 context.Context
  2818. // Result0 is the value of the 1st result returned from this method
  2819. // invocation.
  2820. Result0 int64
  2821. }
  2822. // Args returns an interface slice containing the arguments of this
  2823. // invocation.
  2824. func (c UsersStoreCountFuncCall) Args() []interface{} {
  2825. return []interface{}{c.Arg0}
  2826. }
  2827. // Results returns an interface slice containing the results of this
  2828. // invocation.
  2829. func (c UsersStoreCountFuncCall) Results() []interface{} {
  2830. return []interface{}{c.Result0}
  2831. }
  2832. // UsersStoreCreateFunc describes the behavior when the Create method of the
  2833. // parent MockUsersStore instance is invoked.
  2834. type UsersStoreCreateFunc struct {
  2835. defaultHook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  2836. hooks []func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  2837. history []UsersStoreCreateFuncCall
  2838. mutex sync.Mutex
  2839. }
  2840. // Create delegates to the next hook function in the queue and stores the
  2841. // parameter and result values of this invocation.
  2842. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.CreateUserOptions) (*db.User, error) {
  2843. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2844. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  2845. return r0, r1
  2846. }
  2847. // SetDefaultHook sets function that is called when the Create method of the
  2848. // parent MockUsersStore instance is invoked and the hook queue is empty.
  2849. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  2850. f.defaultHook = hook
  2851. }
  2852. // PushHook adds a function to the end of hook queue. Each invocation of the
  2853. // Create method of the parent MockUsersStore instance invokes the hook at
  2854. // the front of the queue and discards it. After the queue is empty, the
  2855. // default hook function is invoked for any future action.
  2856. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  2857. f.mutex.Lock()
  2858. f.hooks = append(f.hooks, hook)
  2859. f.mutex.Unlock()
  2860. }
  2861. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2862. // given values.
  2863. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  2864. f.SetDefaultHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  2865. return r0, r1
  2866. })
  2867. }
  2868. // PushReturn calls PushHook with a function that returns the given values.
  2869. func (f *UsersStoreCreateFunc) PushReturn(r0 *db.User, r1 error) {
  2870. f.PushHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  2871. return r0, r1
  2872. })
  2873. }
  2874. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  2875. f.mutex.Lock()
  2876. defer f.mutex.Unlock()
  2877. if len(f.hooks) == 0 {
  2878. return f.defaultHook
  2879. }
  2880. hook := f.hooks[0]
  2881. f.hooks = f.hooks[1:]
  2882. return hook
  2883. }
  2884. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  2885. f.mutex.Lock()
  2886. f.history = append(f.history, r0)
  2887. f.mutex.Unlock()
  2888. }
  2889. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  2890. // the invocations of this function.
  2891. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  2892. f.mutex.Lock()
  2893. history := make([]UsersStoreCreateFuncCall, len(f.history))
  2894. copy(history, f.history)
  2895. f.mutex.Unlock()
  2896. return history
  2897. }
  2898. // UsersStoreCreateFuncCall is an object that describes an invocation of
  2899. // method Create on an instance of MockUsersStore.
  2900. type UsersStoreCreateFuncCall struct {
  2901. // Arg0 is the value of the 1st argument passed to this method
  2902. // invocation.
  2903. Arg0 context.Context
  2904. // Arg1 is the value of the 2nd argument passed to this method
  2905. // invocation.
  2906. Arg1 string
  2907. // Arg2 is the value of the 3rd argument passed to this method
  2908. // invocation.
  2909. Arg2 string
  2910. // Arg3 is the value of the 4th argument passed to this method
  2911. // invocation.
  2912. Arg3 db.CreateUserOptions
  2913. // Result0 is the value of the 1st result returned from this method
  2914. // invocation.
  2915. Result0 *db.User
  2916. // Result1 is the value of the 2nd result returned from this method
  2917. // invocation.
  2918. Result1 error
  2919. }
  2920. // Args returns an interface slice containing the arguments of this
  2921. // invocation.
  2922. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  2923. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2924. }
  2925. // Results returns an interface slice containing the results of this
  2926. // invocation.
  2927. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  2928. return []interface{}{c.Result0, c.Result1}
  2929. }
  2930. // UsersStoreDeleteCustomAvatarFunc describes the behavior when the
  2931. // DeleteCustomAvatar method of the parent MockUsersStore instance is
  2932. // invoked.
  2933. type UsersStoreDeleteCustomAvatarFunc struct {
  2934. defaultHook func(context.Context, int64) error
  2935. hooks []func(context.Context, int64) error
  2936. history []UsersStoreDeleteCustomAvatarFuncCall
  2937. mutex sync.Mutex
  2938. }
  2939. // DeleteCustomAvatar delegates to the next hook function in the queue and
  2940. // stores the parameter and result values of this invocation.
  2941. func (m *MockUsersStore) DeleteCustomAvatar(v0 context.Context, v1 int64) error {
  2942. r0 := m.DeleteCustomAvatarFunc.nextHook()(v0, v1)
  2943. m.DeleteCustomAvatarFunc.appendCall(UsersStoreDeleteCustomAvatarFuncCall{v0, v1, r0})
  2944. return r0
  2945. }
  2946. // SetDefaultHook sets function that is called when the DeleteCustomAvatar
  2947. // method of the parent MockUsersStore instance is invoked and the hook
  2948. // queue is empty.
  2949. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  2950. f.defaultHook = hook
  2951. }
  2952. // PushHook adds a function to the end of hook queue. Each invocation of the
  2953. // DeleteCustomAvatar method of the parent MockUsersStore instance invokes
  2954. // the hook at the front of the queue and discards it. After the queue is
  2955. // empty, the default hook function is invoked for any future action.
  2956. func (f *UsersStoreDeleteCustomAvatarFunc) PushHook(hook func(context.Context, int64) error) {
  2957. f.mutex.Lock()
  2958. f.hooks = append(f.hooks, hook)
  2959. f.mutex.Unlock()
  2960. }
  2961. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2962. // given values.
  2963. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultReturn(r0 error) {
  2964. f.SetDefaultHook(func(context.Context, int64) error {
  2965. return r0
  2966. })
  2967. }
  2968. // PushReturn calls PushHook with a function that returns the given values.
  2969. func (f *UsersStoreDeleteCustomAvatarFunc) PushReturn(r0 error) {
  2970. f.PushHook(func(context.Context, int64) error {
  2971. return r0
  2972. })
  2973. }
  2974. func (f *UsersStoreDeleteCustomAvatarFunc) nextHook() func(context.Context, int64) error {
  2975. f.mutex.Lock()
  2976. defer f.mutex.Unlock()
  2977. if len(f.hooks) == 0 {
  2978. return f.defaultHook
  2979. }
  2980. hook := f.hooks[0]
  2981. f.hooks = f.hooks[1:]
  2982. return hook
  2983. }
  2984. func (f *UsersStoreDeleteCustomAvatarFunc) appendCall(r0 UsersStoreDeleteCustomAvatarFuncCall) {
  2985. f.mutex.Lock()
  2986. f.history = append(f.history, r0)
  2987. f.mutex.Unlock()
  2988. }
  2989. // History returns a sequence of UsersStoreDeleteCustomAvatarFuncCall
  2990. // objects describing the invocations of this function.
  2991. func (f *UsersStoreDeleteCustomAvatarFunc) History() []UsersStoreDeleteCustomAvatarFuncCall {
  2992. f.mutex.Lock()
  2993. history := make([]UsersStoreDeleteCustomAvatarFuncCall, len(f.history))
  2994. copy(history, f.history)
  2995. f.mutex.Unlock()
  2996. return history
  2997. }
  2998. // UsersStoreDeleteCustomAvatarFuncCall is an object that describes an
  2999. // invocation of method DeleteCustomAvatar on an instance of MockUsersStore.
  3000. type UsersStoreDeleteCustomAvatarFuncCall struct {
  3001. // Arg0 is the value of the 1st argument passed to this method
  3002. // invocation.
  3003. Arg0 context.Context
  3004. // Arg1 is the value of the 2nd argument passed to this method
  3005. // invocation.
  3006. Arg1 int64
  3007. // Result0 is the value of the 1st result returned from this method
  3008. // invocation.
  3009. Result0 error
  3010. }
  3011. // Args returns an interface slice containing the arguments of this
  3012. // invocation.
  3013. func (c UsersStoreDeleteCustomAvatarFuncCall) Args() []interface{} {
  3014. return []interface{}{c.Arg0, c.Arg1}
  3015. }
  3016. // Results returns an interface slice containing the results of this
  3017. // invocation.
  3018. func (c UsersStoreDeleteCustomAvatarFuncCall) Results() []interface{} {
  3019. return []interface{}{c.Result0}
  3020. }
  3021. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  3022. // method of the parent MockUsersStore instance is invoked.
  3023. type UsersStoreGetByEmailFunc struct {
  3024. defaultHook func(context.Context, string) (*db.User, error)
  3025. hooks []func(context.Context, string) (*db.User, error)
  3026. history []UsersStoreGetByEmailFuncCall
  3027. mutex sync.Mutex
  3028. }
  3029. // GetByEmail delegates to the next hook function in the queue and stores
  3030. // the parameter and result values of this invocation.
  3031. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*db.User, error) {
  3032. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  3033. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  3034. return r0, r1
  3035. }
  3036. // SetDefaultHook sets function that is called when the GetByEmail method of
  3037. // the parent MockUsersStore instance is invoked and the hook queue is
  3038. // empty.
  3039. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  3040. f.defaultHook = hook
  3041. }
  3042. // PushHook adds a function to the end of hook queue. Each invocation of the
  3043. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  3044. // at the front of the queue and discards it. After the queue is empty, the
  3045. // default hook function is invoked for any future action.
  3046. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  3047. f.mutex.Lock()
  3048. f.hooks = append(f.hooks, hook)
  3049. f.mutex.Unlock()
  3050. }
  3051. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3052. // given values.
  3053. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3054. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  3055. return r0, r1
  3056. })
  3057. }
  3058. // PushReturn calls PushHook with a function that returns the given values.
  3059. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *db.User, r1 error) {
  3060. f.PushHook(func(context.Context, string) (*db.User, error) {
  3061. return r0, r1
  3062. })
  3063. }
  3064. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*db.User, error) {
  3065. f.mutex.Lock()
  3066. defer f.mutex.Unlock()
  3067. if len(f.hooks) == 0 {
  3068. return f.defaultHook
  3069. }
  3070. hook := f.hooks[0]
  3071. f.hooks = f.hooks[1:]
  3072. return hook
  3073. }
  3074. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  3075. f.mutex.Lock()
  3076. f.history = append(f.history, r0)
  3077. f.mutex.Unlock()
  3078. }
  3079. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  3080. // describing the invocations of this function.
  3081. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  3082. f.mutex.Lock()
  3083. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  3084. copy(history, f.history)
  3085. f.mutex.Unlock()
  3086. return history
  3087. }
  3088. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  3089. // method GetByEmail on an instance of MockUsersStore.
  3090. type UsersStoreGetByEmailFuncCall struct {
  3091. // Arg0 is the value of the 1st argument passed to this method
  3092. // invocation.
  3093. Arg0 context.Context
  3094. // Arg1 is the value of the 2nd argument passed to this method
  3095. // invocation.
  3096. Arg1 string
  3097. // Result0 is the value of the 1st result returned from this method
  3098. // invocation.
  3099. Result0 *db.User
  3100. // Result1 is the value of the 2nd result returned from this method
  3101. // invocation.
  3102. Result1 error
  3103. }
  3104. // Args returns an interface slice containing the arguments of this
  3105. // invocation.
  3106. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  3107. return []interface{}{c.Arg0, c.Arg1}
  3108. }
  3109. // Results returns an interface slice containing the results of this
  3110. // invocation.
  3111. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  3112. return []interface{}{c.Result0, c.Result1}
  3113. }
  3114. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  3115. // the parent MockUsersStore instance is invoked.
  3116. type UsersStoreGetByIDFunc struct {
  3117. defaultHook func(context.Context, int64) (*db.User, error)
  3118. hooks []func(context.Context, int64) (*db.User, error)
  3119. history []UsersStoreGetByIDFuncCall
  3120. mutex sync.Mutex
  3121. }
  3122. // GetByID delegates to the next hook function in the queue and stores the
  3123. // parameter and result values of this invocation.
  3124. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*db.User, error) {
  3125. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  3126. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  3127. return r0, r1
  3128. }
  3129. // SetDefaultHook sets function that is called when the GetByID method of
  3130. // the parent MockUsersStore instance is invoked and the hook queue is
  3131. // empty.
  3132. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  3133. f.defaultHook = hook
  3134. }
  3135. // PushHook adds a function to the end of hook queue. Each invocation of the
  3136. // GetByID method of the parent MockUsersStore instance invokes the hook at
  3137. // the front of the queue and discards it. After the queue is empty, the
  3138. // default hook function is invoked for any future action.
  3139. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  3140. f.mutex.Lock()
  3141. f.hooks = append(f.hooks, hook)
  3142. f.mutex.Unlock()
  3143. }
  3144. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3145. // given values.
  3146. func (f *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3147. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  3148. return r0, r1
  3149. })
  3150. }
  3151. // PushReturn calls PushHook with a function that returns the given values.
  3152. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *db.User, r1 error) {
  3153. f.PushHook(func(context.Context, int64) (*db.User, error) {
  3154. return r0, r1
  3155. })
  3156. }
  3157. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  3158. f.mutex.Lock()
  3159. defer f.mutex.Unlock()
  3160. if len(f.hooks) == 0 {
  3161. return f.defaultHook
  3162. }
  3163. hook := f.hooks[0]
  3164. f.hooks = f.hooks[1:]
  3165. return hook
  3166. }
  3167. func (f *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  3168. f.mutex.Lock()
  3169. f.history = append(f.history, r0)
  3170. f.mutex.Unlock()
  3171. }
  3172. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  3173. // describing the invocations of this function.
  3174. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  3175. f.mutex.Lock()
  3176. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  3177. copy(history, f.history)
  3178. f.mutex.Unlock()
  3179. return history
  3180. }
  3181. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  3182. // method GetByID on an instance of MockUsersStore.
  3183. type UsersStoreGetByIDFuncCall struct {
  3184. // Arg0 is the value of the 1st argument passed to this method
  3185. // invocation.
  3186. Arg0 context.Context
  3187. // Arg1 is the value of the 2nd argument passed to this method
  3188. // invocation.
  3189. Arg1 int64
  3190. // Result0 is the value of the 1st result returned from this method
  3191. // invocation.
  3192. Result0 *db.User
  3193. // Result1 is the value of the 2nd result returned from this method
  3194. // invocation.
  3195. Result1 error
  3196. }
  3197. // Args returns an interface slice containing the arguments of this
  3198. // invocation.
  3199. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  3200. return []interface{}{c.Arg0, c.Arg1}
  3201. }
  3202. // Results returns an interface slice containing the results of this
  3203. // invocation.
  3204. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  3205. return []interface{}{c.Result0, c.Result1}
  3206. }
  3207. // UsersStoreGetByKeyIDFunc describes the behavior when the GetByKeyID
  3208. // method of the parent MockUsersStore instance is invoked.
  3209. type UsersStoreGetByKeyIDFunc struct {
  3210. defaultHook func(context.Context, int64) (*db.User, error)
  3211. hooks []func(context.Context, int64) (*db.User, error)
  3212. history []UsersStoreGetByKeyIDFuncCall
  3213. mutex sync.Mutex
  3214. }
  3215. // GetByKeyID delegates to the next hook function in the queue and stores
  3216. // the parameter and result values of this invocation.
  3217. func (m *MockUsersStore) GetByKeyID(v0 context.Context, v1 int64) (*db.User, error) {
  3218. r0, r1 := m.GetByKeyIDFunc.nextHook()(v0, v1)
  3219. m.GetByKeyIDFunc.appendCall(UsersStoreGetByKeyIDFuncCall{v0, v1, r0, r1})
  3220. return r0, r1
  3221. }
  3222. // SetDefaultHook sets function that is called when the GetByKeyID method of
  3223. // the parent MockUsersStore instance is invoked and the hook queue is
  3224. // empty.
  3225. func (f *UsersStoreGetByKeyIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  3226. f.defaultHook = hook
  3227. }
  3228. // PushHook adds a function to the end of hook queue. Each invocation of the
  3229. // GetByKeyID method of the parent MockUsersStore instance invokes the hook
  3230. // at the front of the queue and discards it. After the queue is empty, the
  3231. // default hook function is invoked for any future action.
  3232. func (f *UsersStoreGetByKeyIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  3233. f.mutex.Lock()
  3234. f.hooks = append(f.hooks, hook)
  3235. f.mutex.Unlock()
  3236. }
  3237. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3238. // given values.
  3239. func (f *UsersStoreGetByKeyIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3240. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  3241. return r0, r1
  3242. })
  3243. }
  3244. // PushReturn calls PushHook with a function that returns the given values.
  3245. func (f *UsersStoreGetByKeyIDFunc) PushReturn(r0 *db.User, r1 error) {
  3246. f.PushHook(func(context.Context, int64) (*db.User, error) {
  3247. return r0, r1
  3248. })
  3249. }
  3250. func (f *UsersStoreGetByKeyIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  3251. f.mutex.Lock()
  3252. defer f.mutex.Unlock()
  3253. if len(f.hooks) == 0 {
  3254. return f.defaultHook
  3255. }
  3256. hook := f.hooks[0]
  3257. f.hooks = f.hooks[1:]
  3258. return hook
  3259. }
  3260. func (f *UsersStoreGetByKeyIDFunc) appendCall(r0 UsersStoreGetByKeyIDFuncCall) {
  3261. f.mutex.Lock()
  3262. f.history = append(f.history, r0)
  3263. f.mutex.Unlock()
  3264. }
  3265. // History returns a sequence of UsersStoreGetByKeyIDFuncCall objects
  3266. // describing the invocations of this function.
  3267. func (f *UsersStoreGetByKeyIDFunc) History() []UsersStoreGetByKeyIDFuncCall {
  3268. f.mutex.Lock()
  3269. history := make([]UsersStoreGetByKeyIDFuncCall, len(f.history))
  3270. copy(history, f.history)
  3271. f.mutex.Unlock()
  3272. return history
  3273. }
  3274. // UsersStoreGetByKeyIDFuncCall is an object that describes an invocation of
  3275. // method GetByKeyID on an instance of MockUsersStore.
  3276. type UsersStoreGetByKeyIDFuncCall struct {
  3277. // Arg0 is the value of the 1st argument passed to this method
  3278. // invocation.
  3279. Arg0 context.Context
  3280. // Arg1 is the value of the 2nd argument passed to this method
  3281. // invocation.
  3282. Arg1 int64
  3283. // Result0 is the value of the 1st result returned from this method
  3284. // invocation.
  3285. Result0 *db.User
  3286. // Result1 is the value of the 2nd result returned from this method
  3287. // invocation.
  3288. Result1 error
  3289. }
  3290. // Args returns an interface slice containing the arguments of this
  3291. // invocation.
  3292. func (c UsersStoreGetByKeyIDFuncCall) Args() []interface{} {
  3293. return []interface{}{c.Arg0, c.Arg1}
  3294. }
  3295. // Results returns an interface slice containing the results of this
  3296. // invocation.
  3297. func (c UsersStoreGetByKeyIDFuncCall) Results() []interface{} {
  3298. return []interface{}{c.Result0, c.Result1}
  3299. }
  3300. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  3301. // method of the parent MockUsersStore instance is invoked.
  3302. type UsersStoreGetByUsernameFunc struct {
  3303. defaultHook func(context.Context, string) (*db.User, error)
  3304. hooks []func(context.Context, string) (*db.User, error)
  3305. history []UsersStoreGetByUsernameFuncCall
  3306. mutex sync.Mutex
  3307. }
  3308. // GetByUsername delegates to the next hook function in the queue and stores
  3309. // the parameter and result values of this invocation.
  3310. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*db.User, error) {
  3311. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  3312. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  3313. return r0, r1
  3314. }
  3315. // SetDefaultHook sets function that is called when the GetByUsername method
  3316. // of the parent MockUsersStore instance is invoked and the hook queue is
  3317. // empty.
  3318. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  3319. f.defaultHook = hook
  3320. }
  3321. // PushHook adds a function to the end of hook queue. Each invocation of the
  3322. // GetByUsername method of the parent MockUsersStore instance invokes the
  3323. // hook at the front of the queue and discards it. After the queue is empty,
  3324. // the default hook function is invoked for any future action.
  3325. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  3326. f.mutex.Lock()
  3327. f.hooks = append(f.hooks, hook)
  3328. f.mutex.Unlock()
  3329. }
  3330. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3331. // given values.
  3332. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3333. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  3334. return r0, r1
  3335. })
  3336. }
  3337. // PushReturn calls PushHook with a function that returns the given values.
  3338. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *db.User, r1 error) {
  3339. f.PushHook(func(context.Context, string) (*db.User, error) {
  3340. return r0, r1
  3341. })
  3342. }
  3343. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*db.User, error) {
  3344. f.mutex.Lock()
  3345. defer f.mutex.Unlock()
  3346. if len(f.hooks) == 0 {
  3347. return f.defaultHook
  3348. }
  3349. hook := f.hooks[0]
  3350. f.hooks = f.hooks[1:]
  3351. return hook
  3352. }
  3353. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  3354. f.mutex.Lock()
  3355. f.history = append(f.history, r0)
  3356. f.mutex.Unlock()
  3357. }
  3358. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  3359. // describing the invocations of this function.
  3360. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  3361. f.mutex.Lock()
  3362. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  3363. copy(history, f.history)
  3364. f.mutex.Unlock()
  3365. return history
  3366. }
  3367. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  3368. // of method GetByUsername on an instance of MockUsersStore.
  3369. type UsersStoreGetByUsernameFuncCall struct {
  3370. // Arg0 is the value of the 1st argument passed to this method
  3371. // invocation.
  3372. Arg0 context.Context
  3373. // Arg1 is the value of the 2nd argument passed to this method
  3374. // invocation.
  3375. Arg1 string
  3376. // Result0 is the value of the 1st result returned from this method
  3377. // invocation.
  3378. Result0 *db.User
  3379. // Result1 is the value of the 2nd result returned from this method
  3380. // invocation.
  3381. Result1 error
  3382. }
  3383. // Args returns an interface slice containing the arguments of this
  3384. // invocation.
  3385. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  3386. return []interface{}{c.Arg0, c.Arg1}
  3387. }
  3388. // Results returns an interface slice containing the results of this
  3389. // invocation.
  3390. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  3391. return []interface{}{c.Result0, c.Result1}
  3392. }
  3393. // UsersStoreGetMailableEmailsByUsernamesFunc describes the behavior when
  3394. // the GetMailableEmailsByUsernames method of the parent MockUsersStore
  3395. // instance is invoked.
  3396. type UsersStoreGetMailableEmailsByUsernamesFunc struct {
  3397. defaultHook func(context.Context, []string) ([]string, error)
  3398. hooks []func(context.Context, []string) ([]string, error)
  3399. history []UsersStoreGetMailableEmailsByUsernamesFuncCall
  3400. mutex sync.Mutex
  3401. }
  3402. // GetMailableEmailsByUsernames delegates to the next hook function in the
  3403. // queue and stores the parameter and result values of this invocation.
  3404. func (m *MockUsersStore) GetMailableEmailsByUsernames(v0 context.Context, v1 []string) ([]string, error) {
  3405. r0, r1 := m.GetMailableEmailsByUsernamesFunc.nextHook()(v0, v1)
  3406. m.GetMailableEmailsByUsernamesFunc.appendCall(UsersStoreGetMailableEmailsByUsernamesFuncCall{v0, v1, r0, r1})
  3407. return r0, r1
  3408. }
  3409. // SetDefaultHook sets function that is called when the
  3410. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  3411. // is invoked and the hook queue is empty.
  3412. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultHook(hook func(context.Context, []string) ([]string, error)) {
  3413. f.defaultHook = hook
  3414. }
  3415. // PushHook adds a function to the end of hook queue. Each invocation of the
  3416. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  3417. // invokes the hook at the front of the queue and discards it. After the
  3418. // queue is empty, the default hook function is invoked for any future
  3419. // action.
  3420. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushHook(hook func(context.Context, []string) ([]string, error)) {
  3421. f.mutex.Lock()
  3422. f.hooks = append(f.hooks, hook)
  3423. f.mutex.Unlock()
  3424. }
  3425. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3426. // given values.
  3427. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultReturn(r0 []string, r1 error) {
  3428. f.SetDefaultHook(func(context.Context, []string) ([]string, error) {
  3429. return r0, r1
  3430. })
  3431. }
  3432. // PushReturn calls PushHook with a function that returns the given values.
  3433. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushReturn(r0 []string, r1 error) {
  3434. f.PushHook(func(context.Context, []string) ([]string, error) {
  3435. return r0, r1
  3436. })
  3437. }
  3438. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) nextHook() func(context.Context, []string) ([]string, error) {
  3439. f.mutex.Lock()
  3440. defer f.mutex.Unlock()
  3441. if len(f.hooks) == 0 {
  3442. return f.defaultHook
  3443. }
  3444. hook := f.hooks[0]
  3445. f.hooks = f.hooks[1:]
  3446. return hook
  3447. }
  3448. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) appendCall(r0 UsersStoreGetMailableEmailsByUsernamesFuncCall) {
  3449. f.mutex.Lock()
  3450. f.history = append(f.history, r0)
  3451. f.mutex.Unlock()
  3452. }
  3453. // History returns a sequence of
  3454. // UsersStoreGetMailableEmailsByUsernamesFuncCall objects describing the
  3455. // invocations of this function.
  3456. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) History() []UsersStoreGetMailableEmailsByUsernamesFuncCall {
  3457. f.mutex.Lock()
  3458. history := make([]UsersStoreGetMailableEmailsByUsernamesFuncCall, len(f.history))
  3459. copy(history, f.history)
  3460. f.mutex.Unlock()
  3461. return history
  3462. }
  3463. // UsersStoreGetMailableEmailsByUsernamesFuncCall is an object that
  3464. // describes an invocation of method GetMailableEmailsByUsernames on an
  3465. // instance of MockUsersStore.
  3466. type UsersStoreGetMailableEmailsByUsernamesFuncCall struct {
  3467. // Arg0 is the value of the 1st argument passed to this method
  3468. // invocation.
  3469. Arg0 context.Context
  3470. // Arg1 is the value of the 2nd argument passed to this method
  3471. // invocation.
  3472. Arg1 []string
  3473. // Result0 is the value of the 1st result returned from this method
  3474. // invocation.
  3475. Result0 []string
  3476. // Result1 is the value of the 2nd result returned from this method
  3477. // invocation.
  3478. Result1 error
  3479. }
  3480. // Args returns an interface slice containing the arguments of this
  3481. // invocation.
  3482. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Args() []interface{} {
  3483. return []interface{}{c.Arg0, c.Arg1}
  3484. }
  3485. // Results returns an interface slice containing the results of this
  3486. // invocation.
  3487. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Results() []interface{} {
  3488. return []interface{}{c.Result0, c.Result1}
  3489. }
  3490. // UsersStoreHasForkedRepositoryFunc describes the behavior when the
  3491. // HasForkedRepository method of the parent MockUsersStore instance is
  3492. // invoked.
  3493. type UsersStoreHasForkedRepositoryFunc struct {
  3494. defaultHook func(context.Context, int64, int64) bool
  3495. hooks []func(context.Context, int64, int64) bool
  3496. history []UsersStoreHasForkedRepositoryFuncCall
  3497. mutex sync.Mutex
  3498. }
  3499. // HasForkedRepository delegates to the next hook function in the queue and
  3500. // stores the parameter and result values of this invocation.
  3501. func (m *MockUsersStore) HasForkedRepository(v0 context.Context, v1 int64, v2 int64) bool {
  3502. r0 := m.HasForkedRepositoryFunc.nextHook()(v0, v1, v2)
  3503. m.HasForkedRepositoryFunc.appendCall(UsersStoreHasForkedRepositoryFuncCall{v0, v1, v2, r0})
  3504. return r0
  3505. }
  3506. // SetDefaultHook sets function that is called when the HasForkedRepository
  3507. // method of the parent MockUsersStore instance is invoked and the hook
  3508. // queue is empty.
  3509. func (f *UsersStoreHasForkedRepositoryFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  3510. f.defaultHook = hook
  3511. }
  3512. // PushHook adds a function to the end of hook queue. Each invocation of the
  3513. // HasForkedRepository method of the parent MockUsersStore instance invokes
  3514. // the hook at the front of the queue and discards it. After the queue is
  3515. // empty, the default hook function is invoked for any future action.
  3516. func (f *UsersStoreHasForkedRepositoryFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  3517. f.mutex.Lock()
  3518. f.hooks = append(f.hooks, hook)
  3519. f.mutex.Unlock()
  3520. }
  3521. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3522. // given values.
  3523. func (f *UsersStoreHasForkedRepositoryFunc) SetDefaultReturn(r0 bool) {
  3524. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  3525. return r0
  3526. })
  3527. }
  3528. // PushReturn calls PushHook with a function that returns the given values.
  3529. func (f *UsersStoreHasForkedRepositoryFunc) PushReturn(r0 bool) {
  3530. f.PushHook(func(context.Context, int64, int64) bool {
  3531. return r0
  3532. })
  3533. }
  3534. func (f *UsersStoreHasForkedRepositoryFunc) nextHook() func(context.Context, int64, int64) bool {
  3535. f.mutex.Lock()
  3536. defer f.mutex.Unlock()
  3537. if len(f.hooks) == 0 {
  3538. return f.defaultHook
  3539. }
  3540. hook := f.hooks[0]
  3541. f.hooks = f.hooks[1:]
  3542. return hook
  3543. }
  3544. func (f *UsersStoreHasForkedRepositoryFunc) appendCall(r0 UsersStoreHasForkedRepositoryFuncCall) {
  3545. f.mutex.Lock()
  3546. f.history = append(f.history, r0)
  3547. f.mutex.Unlock()
  3548. }
  3549. // History returns a sequence of UsersStoreHasForkedRepositoryFuncCall
  3550. // objects describing the invocations of this function.
  3551. func (f *UsersStoreHasForkedRepositoryFunc) History() []UsersStoreHasForkedRepositoryFuncCall {
  3552. f.mutex.Lock()
  3553. history := make([]UsersStoreHasForkedRepositoryFuncCall, len(f.history))
  3554. copy(history, f.history)
  3555. f.mutex.Unlock()
  3556. return history
  3557. }
  3558. // UsersStoreHasForkedRepositoryFuncCall is an object that describes an
  3559. // invocation of method HasForkedRepository on an instance of
  3560. // MockUsersStore.
  3561. type UsersStoreHasForkedRepositoryFuncCall struct {
  3562. // Arg0 is the value of the 1st argument passed to this method
  3563. // invocation.
  3564. Arg0 context.Context
  3565. // Arg1 is the value of the 2nd argument passed to this method
  3566. // invocation.
  3567. Arg1 int64
  3568. // Arg2 is the value of the 3rd argument passed to this method
  3569. // invocation.
  3570. Arg2 int64
  3571. // Result0 is the value of the 1st result returned from this method
  3572. // invocation.
  3573. Result0 bool
  3574. }
  3575. // Args returns an interface slice containing the arguments of this
  3576. // invocation.
  3577. func (c UsersStoreHasForkedRepositoryFuncCall) Args() []interface{} {
  3578. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3579. }
  3580. // Results returns an interface slice containing the results of this
  3581. // invocation.
  3582. func (c UsersStoreHasForkedRepositoryFuncCall) Results() []interface{} {
  3583. return []interface{}{c.Result0}
  3584. }
  3585. // UsersStoreIsUsernameUsedFunc describes the behavior when the
  3586. // IsUsernameUsed method of the parent MockUsersStore instance is invoked.
  3587. type UsersStoreIsUsernameUsedFunc struct {
  3588. defaultHook func(context.Context, string, int64) bool
  3589. hooks []func(context.Context, string, int64) bool
  3590. history []UsersStoreIsUsernameUsedFuncCall
  3591. mutex sync.Mutex
  3592. }
  3593. // IsUsernameUsed delegates to the next hook function in the queue and
  3594. // stores the parameter and result values of this invocation.
  3595. func (m *MockUsersStore) IsUsernameUsed(v0 context.Context, v1 string, v2 int64) bool {
  3596. r0 := m.IsUsernameUsedFunc.nextHook()(v0, v1, v2)
  3597. m.IsUsernameUsedFunc.appendCall(UsersStoreIsUsernameUsedFuncCall{v0, v1, v2, r0})
  3598. return r0
  3599. }
  3600. // SetDefaultHook sets function that is called when the IsUsernameUsed
  3601. // method of the parent MockUsersStore instance is invoked and the hook
  3602. // queue is empty.
  3603. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultHook(hook func(context.Context, string, int64) bool) {
  3604. f.defaultHook = hook
  3605. }
  3606. // PushHook adds a function to the end of hook queue. Each invocation of the
  3607. // IsUsernameUsed method of the parent MockUsersStore instance invokes the
  3608. // hook at the front of the queue and discards it. After the queue is empty,
  3609. // the default hook function is invoked for any future action.
  3610. func (f *UsersStoreIsUsernameUsedFunc) PushHook(hook func(context.Context, string, int64) bool) {
  3611. f.mutex.Lock()
  3612. f.hooks = append(f.hooks, hook)
  3613. f.mutex.Unlock()
  3614. }
  3615. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3616. // given values.
  3617. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultReturn(r0 bool) {
  3618. f.SetDefaultHook(func(context.Context, string, int64) bool {
  3619. return r0
  3620. })
  3621. }
  3622. // PushReturn calls PushHook with a function that returns the given values.
  3623. func (f *UsersStoreIsUsernameUsedFunc) PushReturn(r0 bool) {
  3624. f.PushHook(func(context.Context, string, int64) bool {
  3625. return r0
  3626. })
  3627. }
  3628. func (f *UsersStoreIsUsernameUsedFunc) nextHook() func(context.Context, string, int64) bool {
  3629. f.mutex.Lock()
  3630. defer f.mutex.Unlock()
  3631. if len(f.hooks) == 0 {
  3632. return f.defaultHook
  3633. }
  3634. hook := f.hooks[0]
  3635. f.hooks = f.hooks[1:]
  3636. return hook
  3637. }
  3638. func (f *UsersStoreIsUsernameUsedFunc) appendCall(r0 UsersStoreIsUsernameUsedFuncCall) {
  3639. f.mutex.Lock()
  3640. f.history = append(f.history, r0)
  3641. f.mutex.Unlock()
  3642. }
  3643. // History returns a sequence of UsersStoreIsUsernameUsedFuncCall objects
  3644. // describing the invocations of this function.
  3645. func (f *UsersStoreIsUsernameUsedFunc) History() []UsersStoreIsUsernameUsedFuncCall {
  3646. f.mutex.Lock()
  3647. history := make([]UsersStoreIsUsernameUsedFuncCall, len(f.history))
  3648. copy(history, f.history)
  3649. f.mutex.Unlock()
  3650. return history
  3651. }
  3652. // UsersStoreIsUsernameUsedFuncCall is an object that describes an
  3653. // invocation of method IsUsernameUsed on an instance of MockUsersStore.
  3654. type UsersStoreIsUsernameUsedFuncCall struct {
  3655. // Arg0 is the value of the 1st argument passed to this method
  3656. // invocation.
  3657. Arg0 context.Context
  3658. // Arg1 is the value of the 2nd argument passed to this method
  3659. // invocation.
  3660. Arg1 string
  3661. // Arg2 is the value of the 3rd argument passed to this method
  3662. // invocation.
  3663. Arg2 int64
  3664. // Result0 is the value of the 1st result returned from this method
  3665. // invocation.
  3666. Result0 bool
  3667. }
  3668. // Args returns an interface slice containing the arguments of this
  3669. // invocation.
  3670. func (c UsersStoreIsUsernameUsedFuncCall) Args() []interface{} {
  3671. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3672. }
  3673. // Results returns an interface slice containing the results of this
  3674. // invocation.
  3675. func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
  3676. return []interface{}{c.Result0}
  3677. }
  3678. // UsersStoreListFunc describes the behavior when the List method of the
  3679. // parent MockUsersStore instance is invoked.
  3680. type UsersStoreListFunc struct {
  3681. defaultHook func(context.Context, int, int) ([]*db.User, error)
  3682. hooks []func(context.Context, int, int) ([]*db.User, error)
  3683. history []UsersStoreListFuncCall
  3684. mutex sync.Mutex
  3685. }
  3686. // List delegates to the next hook function in the queue and stores the
  3687. // parameter and result values of this invocation.
  3688. func (m *MockUsersStore) List(v0 context.Context, v1 int, v2 int) ([]*db.User, error) {
  3689. r0, r1 := m.ListFunc.nextHook()(v0, v1, v2)
  3690. m.ListFunc.appendCall(UsersStoreListFuncCall{v0, v1, v2, r0, r1})
  3691. return r0, r1
  3692. }
  3693. // SetDefaultHook sets function that is called when the List method of the
  3694. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3695. func (f *UsersStoreListFunc) SetDefaultHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  3696. f.defaultHook = hook
  3697. }
  3698. // PushHook adds a function to the end of hook queue. Each invocation of the
  3699. // List method of the parent MockUsersStore instance invokes the hook at the
  3700. // front of the queue and discards it. After the queue is empty, the default
  3701. // hook function is invoked for any future action.
  3702. func (f *UsersStoreListFunc) PushHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  3703. f.mutex.Lock()
  3704. f.hooks = append(f.hooks, hook)
  3705. f.mutex.Unlock()
  3706. }
  3707. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3708. // given values.
  3709. func (f *UsersStoreListFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  3710. f.SetDefaultHook(func(context.Context, int, int) ([]*db.User, error) {
  3711. return r0, r1
  3712. })
  3713. }
  3714. // PushReturn calls PushHook with a function that returns the given values.
  3715. func (f *UsersStoreListFunc) PushReturn(r0 []*db.User, r1 error) {
  3716. f.PushHook(func(context.Context, int, int) ([]*db.User, error) {
  3717. return r0, r1
  3718. })
  3719. }
  3720. func (f *UsersStoreListFunc) nextHook() func(context.Context, int, int) ([]*db.User, error) {
  3721. f.mutex.Lock()
  3722. defer f.mutex.Unlock()
  3723. if len(f.hooks) == 0 {
  3724. return f.defaultHook
  3725. }
  3726. hook := f.hooks[0]
  3727. f.hooks = f.hooks[1:]
  3728. return hook
  3729. }
  3730. func (f *UsersStoreListFunc) appendCall(r0 UsersStoreListFuncCall) {
  3731. f.mutex.Lock()
  3732. f.history = append(f.history, r0)
  3733. f.mutex.Unlock()
  3734. }
  3735. // History returns a sequence of UsersStoreListFuncCall objects describing
  3736. // the invocations of this function.
  3737. func (f *UsersStoreListFunc) History() []UsersStoreListFuncCall {
  3738. f.mutex.Lock()
  3739. history := make([]UsersStoreListFuncCall, len(f.history))
  3740. copy(history, f.history)
  3741. f.mutex.Unlock()
  3742. return history
  3743. }
  3744. // UsersStoreListFuncCall is an object that describes an invocation of
  3745. // method List on an instance of MockUsersStore.
  3746. type UsersStoreListFuncCall struct {
  3747. // Arg0 is the value of the 1st argument passed to this method
  3748. // invocation.
  3749. Arg0 context.Context
  3750. // Arg1 is the value of the 2nd argument passed to this method
  3751. // invocation.
  3752. Arg1 int
  3753. // Arg2 is the value of the 3rd argument passed to this method
  3754. // invocation.
  3755. Arg2 int
  3756. // Result0 is the value of the 1st result returned from this method
  3757. // invocation.
  3758. Result0 []*db.User
  3759. // Result1 is the value of the 2nd result returned from this method
  3760. // invocation.
  3761. Result1 error
  3762. }
  3763. // Args returns an interface slice containing the arguments of this
  3764. // invocation.
  3765. func (c UsersStoreListFuncCall) Args() []interface{} {
  3766. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3767. }
  3768. // Results returns an interface slice containing the results of this
  3769. // invocation.
  3770. func (c UsersStoreListFuncCall) Results() []interface{} {
  3771. return []interface{}{c.Result0, c.Result1}
  3772. }
  3773. // UsersStoreListFollowersFunc describes the behavior when the ListFollowers
  3774. // method of the parent MockUsersStore instance is invoked.
  3775. type UsersStoreListFollowersFunc struct {
  3776. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  3777. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  3778. history []UsersStoreListFollowersFuncCall
  3779. mutex sync.Mutex
  3780. }
  3781. // ListFollowers delegates to the next hook function in the queue and stores
  3782. // the parameter and result values of this invocation.
  3783. func (m *MockUsersStore) ListFollowers(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  3784. r0, r1 := m.ListFollowersFunc.nextHook()(v0, v1, v2, v3)
  3785. m.ListFollowersFunc.appendCall(UsersStoreListFollowersFuncCall{v0, v1, v2, v3, r0, r1})
  3786. return r0, r1
  3787. }
  3788. // SetDefaultHook sets function that is called when the ListFollowers method
  3789. // of the parent MockUsersStore instance is invoked and the hook queue is
  3790. // empty.
  3791. func (f *UsersStoreListFollowersFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  3792. f.defaultHook = hook
  3793. }
  3794. // PushHook adds a function to the end of hook queue. Each invocation of the
  3795. // ListFollowers method of the parent MockUsersStore instance invokes the
  3796. // hook at the front of the queue and discards it. After the queue is empty,
  3797. // the default hook function is invoked for any future action.
  3798. func (f *UsersStoreListFollowersFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  3799. f.mutex.Lock()
  3800. f.hooks = append(f.hooks, hook)
  3801. f.mutex.Unlock()
  3802. }
  3803. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3804. // given values.
  3805. func (f *UsersStoreListFollowersFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  3806. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  3807. return r0, r1
  3808. })
  3809. }
  3810. // PushReturn calls PushHook with a function that returns the given values.
  3811. func (f *UsersStoreListFollowersFunc) PushReturn(r0 []*db.User, r1 error) {
  3812. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  3813. return r0, r1
  3814. })
  3815. }
  3816. func (f *UsersStoreListFollowersFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  3817. f.mutex.Lock()
  3818. defer f.mutex.Unlock()
  3819. if len(f.hooks) == 0 {
  3820. return f.defaultHook
  3821. }
  3822. hook := f.hooks[0]
  3823. f.hooks = f.hooks[1:]
  3824. return hook
  3825. }
  3826. func (f *UsersStoreListFollowersFunc) appendCall(r0 UsersStoreListFollowersFuncCall) {
  3827. f.mutex.Lock()
  3828. f.history = append(f.history, r0)
  3829. f.mutex.Unlock()
  3830. }
  3831. // History returns a sequence of UsersStoreListFollowersFuncCall objects
  3832. // describing the invocations of this function.
  3833. func (f *UsersStoreListFollowersFunc) History() []UsersStoreListFollowersFuncCall {
  3834. f.mutex.Lock()
  3835. history := make([]UsersStoreListFollowersFuncCall, len(f.history))
  3836. copy(history, f.history)
  3837. f.mutex.Unlock()
  3838. return history
  3839. }
  3840. // UsersStoreListFollowersFuncCall is an object that describes an invocation
  3841. // of method ListFollowers on an instance of MockUsersStore.
  3842. type UsersStoreListFollowersFuncCall struct {
  3843. // Arg0 is the value of the 1st argument passed to this method
  3844. // invocation.
  3845. Arg0 context.Context
  3846. // Arg1 is the value of the 2nd argument passed to this method
  3847. // invocation.
  3848. Arg1 int64
  3849. // Arg2 is the value of the 3rd argument passed to this method
  3850. // invocation.
  3851. Arg2 int
  3852. // Arg3 is the value of the 4th argument passed to this method
  3853. // invocation.
  3854. Arg3 int
  3855. // Result0 is the value of the 1st result returned from this method
  3856. // invocation.
  3857. Result0 []*db.User
  3858. // Result1 is the value of the 2nd result returned from this method
  3859. // invocation.
  3860. Result1 error
  3861. }
  3862. // Args returns an interface slice containing the arguments of this
  3863. // invocation.
  3864. func (c UsersStoreListFollowersFuncCall) Args() []interface{} {
  3865. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3866. }
  3867. // Results returns an interface slice containing the results of this
  3868. // invocation.
  3869. func (c UsersStoreListFollowersFuncCall) Results() []interface{} {
  3870. return []interface{}{c.Result0, c.Result1}
  3871. }
  3872. // UsersStoreListFollowingsFunc describes the behavior when the
  3873. // ListFollowings method of the parent MockUsersStore instance is invoked.
  3874. type UsersStoreListFollowingsFunc struct {
  3875. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  3876. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  3877. history []UsersStoreListFollowingsFuncCall
  3878. mutex sync.Mutex
  3879. }
  3880. // ListFollowings delegates to the next hook function in the queue and
  3881. // stores the parameter and result values of this invocation.
  3882. func (m *MockUsersStore) ListFollowings(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  3883. r0, r1 := m.ListFollowingsFunc.nextHook()(v0, v1, v2, v3)
  3884. m.ListFollowingsFunc.appendCall(UsersStoreListFollowingsFuncCall{v0, v1, v2, v3, r0, r1})
  3885. return r0, r1
  3886. }
  3887. // SetDefaultHook sets function that is called when the ListFollowings
  3888. // method of the parent MockUsersStore instance is invoked and the hook
  3889. // queue is empty.
  3890. func (f *UsersStoreListFollowingsFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  3891. f.defaultHook = hook
  3892. }
  3893. // PushHook adds a function to the end of hook queue. Each invocation of the
  3894. // ListFollowings method of the parent MockUsersStore instance invokes the
  3895. // hook at the front of the queue and discards it. After the queue is empty,
  3896. // the default hook function is invoked for any future action.
  3897. func (f *UsersStoreListFollowingsFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  3898. f.mutex.Lock()
  3899. f.hooks = append(f.hooks, hook)
  3900. f.mutex.Unlock()
  3901. }
  3902. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3903. // given values.
  3904. func (f *UsersStoreListFollowingsFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  3905. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  3906. return r0, r1
  3907. })
  3908. }
  3909. // PushReturn calls PushHook with a function that returns the given values.
  3910. func (f *UsersStoreListFollowingsFunc) PushReturn(r0 []*db.User, r1 error) {
  3911. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  3912. return r0, r1
  3913. })
  3914. }
  3915. func (f *UsersStoreListFollowingsFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  3916. f.mutex.Lock()
  3917. defer f.mutex.Unlock()
  3918. if len(f.hooks) == 0 {
  3919. return f.defaultHook
  3920. }
  3921. hook := f.hooks[0]
  3922. f.hooks = f.hooks[1:]
  3923. return hook
  3924. }
  3925. func (f *UsersStoreListFollowingsFunc) appendCall(r0 UsersStoreListFollowingsFuncCall) {
  3926. f.mutex.Lock()
  3927. f.history = append(f.history, r0)
  3928. f.mutex.Unlock()
  3929. }
  3930. // History returns a sequence of UsersStoreListFollowingsFuncCall objects
  3931. // describing the invocations of this function.
  3932. func (f *UsersStoreListFollowingsFunc) History() []UsersStoreListFollowingsFuncCall {
  3933. f.mutex.Lock()
  3934. history := make([]UsersStoreListFollowingsFuncCall, len(f.history))
  3935. copy(history, f.history)
  3936. f.mutex.Unlock()
  3937. return history
  3938. }
  3939. // UsersStoreListFollowingsFuncCall is an object that describes an
  3940. // invocation of method ListFollowings on an instance of MockUsersStore.
  3941. type UsersStoreListFollowingsFuncCall struct {
  3942. // Arg0 is the value of the 1st argument passed to this method
  3943. // invocation.
  3944. Arg0 context.Context
  3945. // Arg1 is the value of the 2nd argument passed to this method
  3946. // invocation.
  3947. Arg1 int64
  3948. // Arg2 is the value of the 3rd argument passed to this method
  3949. // invocation.
  3950. Arg2 int
  3951. // Arg3 is the value of the 4th argument passed to this method
  3952. // invocation.
  3953. Arg3 int
  3954. // Result0 is the value of the 1st result returned from this method
  3955. // invocation.
  3956. Result0 []*db.User
  3957. // Result1 is the value of the 2nd result returned from this method
  3958. // invocation.
  3959. Result1 error
  3960. }
  3961. // Args returns an interface slice containing the arguments of this
  3962. // invocation.
  3963. func (c UsersStoreListFollowingsFuncCall) Args() []interface{} {
  3964. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3965. }
  3966. // Results returns an interface slice containing the results of this
  3967. // invocation.
  3968. func (c UsersStoreListFollowingsFuncCall) Results() []interface{} {
  3969. return []interface{}{c.Result0, c.Result1}
  3970. }
  3971. // UsersStoreSearchByNameFunc describes the behavior when the SearchByName
  3972. // method of the parent MockUsersStore instance is invoked.
  3973. type UsersStoreSearchByNameFunc struct {
  3974. defaultHook func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  3975. hooks []func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  3976. history []UsersStoreSearchByNameFuncCall
  3977. mutex sync.Mutex
  3978. }
  3979. // SearchByName delegates to the next hook function in the queue and stores
  3980. // the parameter and result values of this invocation.
  3981. func (m *MockUsersStore) SearchByName(v0 context.Context, v1 string, v2 int, v3 int, v4 string) ([]*db.User, int64, error) {
  3982. r0, r1, r2 := m.SearchByNameFunc.nextHook()(v0, v1, v2, v3, v4)
  3983. m.SearchByNameFunc.appendCall(UsersStoreSearchByNameFuncCall{v0, v1, v2, v3, v4, r0, r1, r2})
  3984. return r0, r1, r2
  3985. }
  3986. // SetDefaultHook sets function that is called when the SearchByName method
  3987. // of the parent MockUsersStore instance is invoked and the hook queue is
  3988. // empty.
  3989. func (f *UsersStoreSearchByNameFunc) SetDefaultHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  3990. f.defaultHook = hook
  3991. }
  3992. // PushHook adds a function to the end of hook queue. Each invocation of the
  3993. // SearchByName method of the parent MockUsersStore instance invokes the
  3994. // hook at the front of the queue and discards it. After the queue is empty,
  3995. // the default hook function is invoked for any future action.
  3996. func (f *UsersStoreSearchByNameFunc) PushHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  3997. f.mutex.Lock()
  3998. f.hooks = append(f.hooks, hook)
  3999. f.mutex.Unlock()
  4000. }
  4001. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4002. // given values.
  4003. func (f *UsersStoreSearchByNameFunc) SetDefaultReturn(r0 []*db.User, r1 int64, r2 error) {
  4004. f.SetDefaultHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4005. return r0, r1, r2
  4006. })
  4007. }
  4008. // PushReturn calls PushHook with a function that returns the given values.
  4009. func (f *UsersStoreSearchByNameFunc) PushReturn(r0 []*db.User, r1 int64, r2 error) {
  4010. f.PushHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4011. return r0, r1, r2
  4012. })
  4013. }
  4014. func (f *UsersStoreSearchByNameFunc) nextHook() func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4015. f.mutex.Lock()
  4016. defer f.mutex.Unlock()
  4017. if len(f.hooks) == 0 {
  4018. return f.defaultHook
  4019. }
  4020. hook := f.hooks[0]
  4021. f.hooks = f.hooks[1:]
  4022. return hook
  4023. }
  4024. func (f *UsersStoreSearchByNameFunc) appendCall(r0 UsersStoreSearchByNameFuncCall) {
  4025. f.mutex.Lock()
  4026. f.history = append(f.history, r0)
  4027. f.mutex.Unlock()
  4028. }
  4029. // History returns a sequence of UsersStoreSearchByNameFuncCall objects
  4030. // describing the invocations of this function.
  4031. func (f *UsersStoreSearchByNameFunc) History() []UsersStoreSearchByNameFuncCall {
  4032. f.mutex.Lock()
  4033. history := make([]UsersStoreSearchByNameFuncCall, len(f.history))
  4034. copy(history, f.history)
  4035. f.mutex.Unlock()
  4036. return history
  4037. }
  4038. // UsersStoreSearchByNameFuncCall is an object that describes an invocation
  4039. // of method SearchByName on an instance of MockUsersStore.
  4040. type UsersStoreSearchByNameFuncCall struct {
  4041. // Arg0 is the value of the 1st argument passed to this method
  4042. // invocation.
  4043. Arg0 context.Context
  4044. // Arg1 is the value of the 2nd argument passed to this method
  4045. // invocation.
  4046. Arg1 string
  4047. // Arg2 is the value of the 3rd argument passed to this method
  4048. // invocation.
  4049. Arg2 int
  4050. // Arg3 is the value of the 4th argument passed to this method
  4051. // invocation.
  4052. Arg3 int
  4053. // Arg4 is the value of the 5th argument passed to this method
  4054. // invocation.
  4055. Arg4 string
  4056. // Result0 is the value of the 1st result returned from this method
  4057. // invocation.
  4058. Result0 []*db.User
  4059. // Result1 is the value of the 2nd result returned from this method
  4060. // invocation.
  4061. Result1 int64
  4062. // Result2 is the value of the 3rd result returned from this method
  4063. // invocation.
  4064. Result2 error
  4065. }
  4066. // Args returns an interface slice containing the arguments of this
  4067. // invocation.
  4068. func (c UsersStoreSearchByNameFuncCall) Args() []interface{} {
  4069. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  4070. }
  4071. // Results returns an interface slice containing the results of this
  4072. // invocation.
  4073. func (c UsersStoreSearchByNameFuncCall) Results() []interface{} {
  4074. return []interface{}{c.Result0, c.Result1, c.Result2}
  4075. }
  4076. // UsersStoreUpdateFunc describes the behavior when the Update method of the
  4077. // parent MockUsersStore instance is invoked.
  4078. type UsersStoreUpdateFunc struct {
  4079. defaultHook func(context.Context, int64, db.UpdateUserOptions) error
  4080. hooks []func(context.Context, int64, db.UpdateUserOptions) error
  4081. history []UsersStoreUpdateFuncCall
  4082. mutex sync.Mutex
  4083. }
  4084. // Update delegates to the next hook function in the queue and stores the
  4085. // parameter and result values of this invocation.
  4086. func (m *MockUsersStore) Update(v0 context.Context, v1 int64, v2 db.UpdateUserOptions) error {
  4087. r0 := m.UpdateFunc.nextHook()(v0, v1, v2)
  4088. m.UpdateFunc.appendCall(UsersStoreUpdateFuncCall{v0, v1, v2, r0})
  4089. return r0
  4090. }
  4091. // SetDefaultHook sets function that is called when the Update method of the
  4092. // parent MockUsersStore instance is invoked and the hook queue is empty.
  4093. func (f *UsersStoreUpdateFunc) SetDefaultHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  4094. f.defaultHook = hook
  4095. }
  4096. // PushHook adds a function to the end of hook queue. Each invocation of the
  4097. // Update method of the parent MockUsersStore instance invokes the hook at
  4098. // the front of the queue and discards it. After the queue is empty, the
  4099. // default hook function is invoked for any future action.
  4100. func (f *UsersStoreUpdateFunc) PushHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  4101. f.mutex.Lock()
  4102. f.hooks = append(f.hooks, hook)
  4103. f.mutex.Unlock()
  4104. }
  4105. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4106. // given values.
  4107. func (f *UsersStoreUpdateFunc) SetDefaultReturn(r0 error) {
  4108. f.SetDefaultHook(func(context.Context, int64, db.UpdateUserOptions) error {
  4109. return r0
  4110. })
  4111. }
  4112. // PushReturn calls PushHook with a function that returns the given values.
  4113. func (f *UsersStoreUpdateFunc) PushReturn(r0 error) {
  4114. f.PushHook(func(context.Context, int64, db.UpdateUserOptions) error {
  4115. return r0
  4116. })
  4117. }
  4118. func (f *UsersStoreUpdateFunc) nextHook() func(context.Context, int64, db.UpdateUserOptions) error {
  4119. f.mutex.Lock()
  4120. defer f.mutex.Unlock()
  4121. if len(f.hooks) == 0 {
  4122. return f.defaultHook
  4123. }
  4124. hook := f.hooks[0]
  4125. f.hooks = f.hooks[1:]
  4126. return hook
  4127. }
  4128. func (f *UsersStoreUpdateFunc) appendCall(r0 UsersStoreUpdateFuncCall) {
  4129. f.mutex.Lock()
  4130. f.history = append(f.history, r0)
  4131. f.mutex.Unlock()
  4132. }
  4133. // History returns a sequence of UsersStoreUpdateFuncCall objects describing
  4134. // the invocations of this function.
  4135. func (f *UsersStoreUpdateFunc) History() []UsersStoreUpdateFuncCall {
  4136. f.mutex.Lock()
  4137. history := make([]UsersStoreUpdateFuncCall, len(f.history))
  4138. copy(history, f.history)
  4139. f.mutex.Unlock()
  4140. return history
  4141. }
  4142. // UsersStoreUpdateFuncCall is an object that describes an invocation of
  4143. // method Update on an instance of MockUsersStore.
  4144. type UsersStoreUpdateFuncCall struct {
  4145. // Arg0 is the value of the 1st argument passed to this method
  4146. // invocation.
  4147. Arg0 context.Context
  4148. // Arg1 is the value of the 2nd argument passed to this method
  4149. // invocation.
  4150. Arg1 int64
  4151. // Arg2 is the value of the 3rd argument passed to this method
  4152. // invocation.
  4153. Arg2 db.UpdateUserOptions
  4154. // Result0 is the value of the 1st result returned from this method
  4155. // invocation.
  4156. Result0 error
  4157. }
  4158. // Args returns an interface slice containing the arguments of this
  4159. // invocation.
  4160. func (c UsersStoreUpdateFuncCall) Args() []interface{} {
  4161. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4162. }
  4163. // Results returns an interface slice containing the results of this
  4164. // invocation.
  4165. func (c UsersStoreUpdateFuncCall) Results() []interface{} {
  4166. return []interface{}{c.Result0}
  4167. }
  4168. // UsersStoreUseCustomAvatarFunc describes the behavior when the
  4169. // UseCustomAvatar method of the parent MockUsersStore instance is invoked.
  4170. type UsersStoreUseCustomAvatarFunc struct {
  4171. defaultHook func(context.Context, int64, []byte) error
  4172. hooks []func(context.Context, int64, []byte) error
  4173. history []UsersStoreUseCustomAvatarFuncCall
  4174. mutex sync.Mutex
  4175. }
  4176. // UseCustomAvatar delegates to the next hook function in the queue and
  4177. // stores the parameter and result values of this invocation.
  4178. func (m *MockUsersStore) UseCustomAvatar(v0 context.Context, v1 int64, v2 []byte) error {
  4179. r0 := m.UseCustomAvatarFunc.nextHook()(v0, v1, v2)
  4180. m.UseCustomAvatarFunc.appendCall(UsersStoreUseCustomAvatarFuncCall{v0, v1, v2, r0})
  4181. return r0
  4182. }
  4183. // SetDefaultHook sets function that is called when the UseCustomAvatar
  4184. // method of the parent MockUsersStore instance is invoked and the hook
  4185. // queue is empty.
  4186. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64, []byte) error) {
  4187. f.defaultHook = hook
  4188. }
  4189. // PushHook adds a function to the end of hook queue. Each invocation of the
  4190. // UseCustomAvatar method of the parent MockUsersStore instance invokes the
  4191. // hook at the front of the queue and discards it. After the queue is empty,
  4192. // the default hook function is invoked for any future action.
  4193. func (f *UsersStoreUseCustomAvatarFunc) PushHook(hook func(context.Context, int64, []byte) error) {
  4194. f.mutex.Lock()
  4195. f.hooks = append(f.hooks, hook)
  4196. f.mutex.Unlock()
  4197. }
  4198. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4199. // given values.
  4200. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultReturn(r0 error) {
  4201. f.SetDefaultHook(func(context.Context, int64, []byte) error {
  4202. return r0
  4203. })
  4204. }
  4205. // PushReturn calls PushHook with a function that returns the given values.
  4206. func (f *UsersStoreUseCustomAvatarFunc) PushReturn(r0 error) {
  4207. f.PushHook(func(context.Context, int64, []byte) error {
  4208. return r0
  4209. })
  4210. }
  4211. func (f *UsersStoreUseCustomAvatarFunc) nextHook() func(context.Context, int64, []byte) error {
  4212. f.mutex.Lock()
  4213. defer f.mutex.Unlock()
  4214. if len(f.hooks) == 0 {
  4215. return f.defaultHook
  4216. }
  4217. hook := f.hooks[0]
  4218. f.hooks = f.hooks[1:]
  4219. return hook
  4220. }
  4221. func (f *UsersStoreUseCustomAvatarFunc) appendCall(r0 UsersStoreUseCustomAvatarFuncCall) {
  4222. f.mutex.Lock()
  4223. f.history = append(f.history, r0)
  4224. f.mutex.Unlock()
  4225. }
  4226. // History returns a sequence of UsersStoreUseCustomAvatarFuncCall objects
  4227. // describing the invocations of this function.
  4228. func (f *UsersStoreUseCustomAvatarFunc) History() []UsersStoreUseCustomAvatarFuncCall {
  4229. f.mutex.Lock()
  4230. history := make([]UsersStoreUseCustomAvatarFuncCall, len(f.history))
  4231. copy(history, f.history)
  4232. f.mutex.Unlock()
  4233. return history
  4234. }
  4235. // UsersStoreUseCustomAvatarFuncCall is an object that describes an
  4236. // invocation of method UseCustomAvatar on an instance of MockUsersStore.
  4237. type UsersStoreUseCustomAvatarFuncCall struct {
  4238. // Arg0 is the value of the 1st argument passed to this method
  4239. // invocation.
  4240. Arg0 context.Context
  4241. // Arg1 is the value of the 2nd argument passed to this method
  4242. // invocation.
  4243. Arg1 int64
  4244. // Arg2 is the value of the 3rd argument passed to this method
  4245. // invocation.
  4246. Arg2 []byte
  4247. // Result0 is the value of the 1st result returned from this method
  4248. // invocation.
  4249. Result0 error
  4250. }
  4251. // Args returns an interface slice containing the arguments of this
  4252. // invocation.
  4253. func (c UsersStoreUseCustomAvatarFuncCall) Args() []interface{} {
  4254. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4255. }
  4256. // Results returns an interface slice containing the results of this
  4257. // invocation.
  4258. func (c UsersStoreUseCustomAvatarFuncCall) Results() []interface{} {
  4259. return []interface{}{c.Result0}
  4260. }