mocks_test.go 181 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330
  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. // GetByIDFunc is an instance of a mock function object controlling the
  1324. // behavior of the method GetByID.
  1325. GetByIDFunc *ReposStoreGetByIDFunc
  1326. // GetByNameFunc is an instance of a mock function object controlling
  1327. // the behavior of the method GetByName.
  1328. GetByNameFunc *ReposStoreGetByNameFunc
  1329. // StarFunc is an instance of a mock function object controlling the
  1330. // behavior of the method Star.
  1331. StarFunc *ReposStoreStarFunc
  1332. // TouchFunc is an instance of a mock function object controlling the
  1333. // behavior of the method Touch.
  1334. TouchFunc *ReposStoreTouchFunc
  1335. }
  1336. // NewMockReposStore creates a new mock of the ReposStore interface. All
  1337. // methods return zero values for all results, unless overwritten.
  1338. func NewMockReposStore() *MockReposStore {
  1339. return &MockReposStore{
  1340. CreateFunc: &ReposStoreCreateFunc{
  1341. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (r0 *db.Repository, r1 error) {
  1342. return
  1343. },
  1344. },
  1345. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1346. defaultHook: func(context.Context, int64, int, string) (r0 []*db.Repository, r1 error) {
  1347. return
  1348. },
  1349. },
  1350. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1351. defaultHook: func(context.Context, int64) (r0 map[*db.Repository]db.AccessMode, r1 error) {
  1352. return
  1353. },
  1354. },
  1355. GetByIDFunc: &ReposStoreGetByIDFunc{
  1356. defaultHook: func(context.Context, int64) (r0 *db.Repository, r1 error) {
  1357. return
  1358. },
  1359. },
  1360. GetByNameFunc: &ReposStoreGetByNameFunc{
  1361. defaultHook: func(context.Context, int64, string) (r0 *db.Repository, r1 error) {
  1362. return
  1363. },
  1364. },
  1365. StarFunc: &ReposStoreStarFunc{
  1366. defaultHook: func(context.Context, int64, int64) (r0 error) {
  1367. return
  1368. },
  1369. },
  1370. TouchFunc: &ReposStoreTouchFunc{
  1371. defaultHook: func(context.Context, int64) (r0 error) {
  1372. return
  1373. },
  1374. },
  1375. }
  1376. }
  1377. // NewStrictMockReposStore creates a new mock of the ReposStore interface.
  1378. // All methods panic on invocation, unless overwritten.
  1379. func NewStrictMockReposStore() *MockReposStore {
  1380. return &MockReposStore{
  1381. CreateFunc: &ReposStoreCreateFunc{
  1382. defaultHook: func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1383. panic("unexpected invocation of MockReposStore.Create")
  1384. },
  1385. },
  1386. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1387. defaultHook: func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1388. panic("unexpected invocation of MockReposStore.GetByCollaboratorID")
  1389. },
  1390. },
  1391. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1392. defaultHook: func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1393. panic("unexpected invocation of MockReposStore.GetByCollaboratorIDWithAccessMode")
  1394. },
  1395. },
  1396. GetByIDFunc: &ReposStoreGetByIDFunc{
  1397. defaultHook: func(context.Context, int64) (*db.Repository, error) {
  1398. panic("unexpected invocation of MockReposStore.GetByID")
  1399. },
  1400. },
  1401. GetByNameFunc: &ReposStoreGetByNameFunc{
  1402. defaultHook: func(context.Context, int64, string) (*db.Repository, error) {
  1403. panic("unexpected invocation of MockReposStore.GetByName")
  1404. },
  1405. },
  1406. StarFunc: &ReposStoreStarFunc{
  1407. defaultHook: func(context.Context, int64, int64) error {
  1408. panic("unexpected invocation of MockReposStore.Star")
  1409. },
  1410. },
  1411. TouchFunc: &ReposStoreTouchFunc{
  1412. defaultHook: func(context.Context, int64) error {
  1413. panic("unexpected invocation of MockReposStore.Touch")
  1414. },
  1415. },
  1416. }
  1417. }
  1418. // NewMockReposStoreFrom creates a new mock of the MockReposStore interface.
  1419. // All methods delegate to the given implementation, unless overwritten.
  1420. func NewMockReposStoreFrom(i db.ReposStore) *MockReposStore {
  1421. return &MockReposStore{
  1422. CreateFunc: &ReposStoreCreateFunc{
  1423. defaultHook: i.Create,
  1424. },
  1425. GetByCollaboratorIDFunc: &ReposStoreGetByCollaboratorIDFunc{
  1426. defaultHook: i.GetByCollaboratorID,
  1427. },
  1428. GetByCollaboratorIDWithAccessModeFunc: &ReposStoreGetByCollaboratorIDWithAccessModeFunc{
  1429. defaultHook: i.GetByCollaboratorIDWithAccessMode,
  1430. },
  1431. GetByIDFunc: &ReposStoreGetByIDFunc{
  1432. defaultHook: i.GetByID,
  1433. },
  1434. GetByNameFunc: &ReposStoreGetByNameFunc{
  1435. defaultHook: i.GetByName,
  1436. },
  1437. StarFunc: &ReposStoreStarFunc{
  1438. defaultHook: i.Star,
  1439. },
  1440. TouchFunc: &ReposStoreTouchFunc{
  1441. defaultHook: i.Touch,
  1442. },
  1443. }
  1444. }
  1445. // ReposStoreCreateFunc describes the behavior when the Create method of the
  1446. // parent MockReposStore instance is invoked.
  1447. type ReposStoreCreateFunc struct {
  1448. defaultHook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1449. hooks []func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)
  1450. history []ReposStoreCreateFuncCall
  1451. mutex sync.Mutex
  1452. }
  1453. // Create delegates to the next hook function in the queue and stores the
  1454. // parameter and result values of this invocation.
  1455. func (m *MockReposStore) Create(v0 context.Context, v1 int64, v2 db.CreateRepoOptions) (*db.Repository, error) {
  1456. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2)
  1457. m.CreateFunc.appendCall(ReposStoreCreateFuncCall{v0, v1, v2, r0, r1})
  1458. return r0, r1
  1459. }
  1460. // SetDefaultHook sets function that is called when the Create method of the
  1461. // parent MockReposStore instance is invoked and the hook queue is empty.
  1462. func (f *ReposStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1463. f.defaultHook = hook
  1464. }
  1465. // PushHook adds a function to the end of hook queue. Each invocation of the
  1466. // Create method of the parent MockReposStore instance invokes the hook at
  1467. // the front of the queue and discards it. After the queue is empty, the
  1468. // default hook function is invoked for any future action.
  1469. func (f *ReposStoreCreateFunc) PushHook(hook func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error)) {
  1470. f.mutex.Lock()
  1471. f.hooks = append(f.hooks, hook)
  1472. f.mutex.Unlock()
  1473. }
  1474. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1475. // given values.
  1476. func (f *ReposStoreCreateFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1477. f.SetDefaultHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1478. return r0, r1
  1479. })
  1480. }
  1481. // PushReturn calls PushHook with a function that returns the given values.
  1482. func (f *ReposStoreCreateFunc) PushReturn(r0 *db.Repository, r1 error) {
  1483. f.PushHook(func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1484. return r0, r1
  1485. })
  1486. }
  1487. func (f *ReposStoreCreateFunc) nextHook() func(context.Context, int64, db.CreateRepoOptions) (*db.Repository, error) {
  1488. f.mutex.Lock()
  1489. defer f.mutex.Unlock()
  1490. if len(f.hooks) == 0 {
  1491. return f.defaultHook
  1492. }
  1493. hook := f.hooks[0]
  1494. f.hooks = f.hooks[1:]
  1495. return hook
  1496. }
  1497. func (f *ReposStoreCreateFunc) appendCall(r0 ReposStoreCreateFuncCall) {
  1498. f.mutex.Lock()
  1499. f.history = append(f.history, r0)
  1500. f.mutex.Unlock()
  1501. }
  1502. // History returns a sequence of ReposStoreCreateFuncCall objects describing
  1503. // the invocations of this function.
  1504. func (f *ReposStoreCreateFunc) History() []ReposStoreCreateFuncCall {
  1505. f.mutex.Lock()
  1506. history := make([]ReposStoreCreateFuncCall, len(f.history))
  1507. copy(history, f.history)
  1508. f.mutex.Unlock()
  1509. return history
  1510. }
  1511. // ReposStoreCreateFuncCall is an object that describes an invocation of
  1512. // method Create on an instance of MockReposStore.
  1513. type ReposStoreCreateFuncCall struct {
  1514. // Arg0 is the value of the 1st argument passed to this method
  1515. // invocation.
  1516. Arg0 context.Context
  1517. // Arg1 is the value of the 2nd argument passed to this method
  1518. // invocation.
  1519. Arg1 int64
  1520. // Arg2 is the value of the 3rd argument passed to this method
  1521. // invocation.
  1522. Arg2 db.CreateRepoOptions
  1523. // Result0 is the value of the 1st result returned from this method
  1524. // invocation.
  1525. Result0 *db.Repository
  1526. // Result1 is the value of the 2nd result returned from this method
  1527. // invocation.
  1528. Result1 error
  1529. }
  1530. // Args returns an interface slice containing the arguments of this
  1531. // invocation.
  1532. func (c ReposStoreCreateFuncCall) Args() []interface{} {
  1533. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1534. }
  1535. // Results returns an interface slice containing the results of this
  1536. // invocation.
  1537. func (c ReposStoreCreateFuncCall) Results() []interface{} {
  1538. return []interface{}{c.Result0, c.Result1}
  1539. }
  1540. // ReposStoreGetByCollaboratorIDFunc describes the behavior when the
  1541. // GetByCollaboratorID method of the parent MockReposStore instance is
  1542. // invoked.
  1543. type ReposStoreGetByCollaboratorIDFunc struct {
  1544. defaultHook func(context.Context, int64, int, string) ([]*db.Repository, error)
  1545. hooks []func(context.Context, int64, int, string) ([]*db.Repository, error)
  1546. history []ReposStoreGetByCollaboratorIDFuncCall
  1547. mutex sync.Mutex
  1548. }
  1549. // GetByCollaboratorID delegates to the next hook function in the queue and
  1550. // stores the parameter and result values of this invocation.
  1551. func (m *MockReposStore) GetByCollaboratorID(v0 context.Context, v1 int64, v2 int, v3 string) ([]*db.Repository, error) {
  1552. r0, r1 := m.GetByCollaboratorIDFunc.nextHook()(v0, v1, v2, v3)
  1553. m.GetByCollaboratorIDFunc.appendCall(ReposStoreGetByCollaboratorIDFuncCall{v0, v1, v2, v3, r0, r1})
  1554. return r0, r1
  1555. }
  1556. // SetDefaultHook sets function that is called when the GetByCollaboratorID
  1557. // method of the parent MockReposStore instance is invoked and the hook
  1558. // queue is empty.
  1559. func (f *ReposStoreGetByCollaboratorIDFunc) SetDefaultHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1560. f.defaultHook = hook
  1561. }
  1562. // PushHook adds a function to the end of hook queue. Each invocation of the
  1563. // GetByCollaboratorID method of the parent MockReposStore instance invokes
  1564. // the hook at the front of the queue and discards it. After the queue is
  1565. // empty, the default hook function is invoked for any future action.
  1566. func (f *ReposStoreGetByCollaboratorIDFunc) PushHook(hook func(context.Context, int64, int, string) ([]*db.Repository, error)) {
  1567. f.mutex.Lock()
  1568. f.hooks = append(f.hooks, hook)
  1569. f.mutex.Unlock()
  1570. }
  1571. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1572. // given values.
  1573. func (f *ReposStoreGetByCollaboratorIDFunc) SetDefaultReturn(r0 []*db.Repository, r1 error) {
  1574. f.SetDefaultHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1575. return r0, r1
  1576. })
  1577. }
  1578. // PushReturn calls PushHook with a function that returns the given values.
  1579. func (f *ReposStoreGetByCollaboratorIDFunc) PushReturn(r0 []*db.Repository, r1 error) {
  1580. f.PushHook(func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1581. return r0, r1
  1582. })
  1583. }
  1584. func (f *ReposStoreGetByCollaboratorIDFunc) nextHook() func(context.Context, int64, int, string) ([]*db.Repository, error) {
  1585. f.mutex.Lock()
  1586. defer f.mutex.Unlock()
  1587. if len(f.hooks) == 0 {
  1588. return f.defaultHook
  1589. }
  1590. hook := f.hooks[0]
  1591. f.hooks = f.hooks[1:]
  1592. return hook
  1593. }
  1594. func (f *ReposStoreGetByCollaboratorIDFunc) appendCall(r0 ReposStoreGetByCollaboratorIDFuncCall) {
  1595. f.mutex.Lock()
  1596. f.history = append(f.history, r0)
  1597. f.mutex.Unlock()
  1598. }
  1599. // History returns a sequence of ReposStoreGetByCollaboratorIDFuncCall
  1600. // objects describing the invocations of this function.
  1601. func (f *ReposStoreGetByCollaboratorIDFunc) History() []ReposStoreGetByCollaboratorIDFuncCall {
  1602. f.mutex.Lock()
  1603. history := make([]ReposStoreGetByCollaboratorIDFuncCall, len(f.history))
  1604. copy(history, f.history)
  1605. f.mutex.Unlock()
  1606. return history
  1607. }
  1608. // ReposStoreGetByCollaboratorIDFuncCall is an object that describes an
  1609. // invocation of method GetByCollaboratorID on an instance of
  1610. // MockReposStore.
  1611. type ReposStoreGetByCollaboratorIDFuncCall struct {
  1612. // Arg0 is the value of the 1st argument passed to this method
  1613. // invocation.
  1614. Arg0 context.Context
  1615. // Arg1 is the value of the 2nd argument passed to this method
  1616. // invocation.
  1617. Arg1 int64
  1618. // Arg2 is the value of the 3rd argument passed to this method
  1619. // invocation.
  1620. Arg2 int
  1621. // Arg3 is the value of the 4th argument passed to this method
  1622. // invocation.
  1623. Arg3 string
  1624. // Result0 is the value of the 1st result returned from this method
  1625. // invocation.
  1626. Result0 []*db.Repository
  1627. // Result1 is the value of the 2nd result returned from this method
  1628. // invocation.
  1629. Result1 error
  1630. }
  1631. // Args returns an interface slice containing the arguments of this
  1632. // invocation.
  1633. func (c ReposStoreGetByCollaboratorIDFuncCall) Args() []interface{} {
  1634. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  1635. }
  1636. // Results returns an interface slice containing the results of this
  1637. // invocation.
  1638. func (c ReposStoreGetByCollaboratorIDFuncCall) Results() []interface{} {
  1639. return []interface{}{c.Result0, c.Result1}
  1640. }
  1641. // ReposStoreGetByCollaboratorIDWithAccessModeFunc describes the behavior
  1642. // when the GetByCollaboratorIDWithAccessMode method of the parent
  1643. // MockReposStore instance is invoked.
  1644. type ReposStoreGetByCollaboratorIDWithAccessModeFunc struct {
  1645. defaultHook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1646. hooks []func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)
  1647. history []ReposStoreGetByCollaboratorIDWithAccessModeFuncCall
  1648. mutex sync.Mutex
  1649. }
  1650. // GetByCollaboratorIDWithAccessMode delegates to the next hook function in
  1651. // the queue and stores the parameter and result values of this invocation.
  1652. func (m *MockReposStore) GetByCollaboratorIDWithAccessMode(v0 context.Context, v1 int64) (map[*db.Repository]db.AccessMode, error) {
  1653. r0, r1 := m.GetByCollaboratorIDWithAccessModeFunc.nextHook()(v0, v1)
  1654. m.GetByCollaboratorIDWithAccessModeFunc.appendCall(ReposStoreGetByCollaboratorIDWithAccessModeFuncCall{v0, v1, r0, r1})
  1655. return r0, r1
  1656. }
  1657. // SetDefaultHook sets function that is called when the
  1658. // GetByCollaboratorIDWithAccessMode method of the parent MockReposStore
  1659. // instance is invoked and the hook queue is empty.
  1660. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1661. f.defaultHook = hook
  1662. }
  1663. // PushHook adds a function to the end of hook queue. Each invocation of the
  1664. // GetByCollaboratorIDWithAccessMode method of the parent MockReposStore
  1665. // instance invokes the hook at the front of the queue and discards it.
  1666. // After the queue is empty, the default hook function is invoked for any
  1667. // future action.
  1668. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) PushHook(hook func(context.Context, int64) (map[*db.Repository]db.AccessMode, error)) {
  1669. f.mutex.Lock()
  1670. f.hooks = append(f.hooks, hook)
  1671. f.mutex.Unlock()
  1672. }
  1673. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1674. // given values.
  1675. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) SetDefaultReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1676. f.SetDefaultHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1677. return r0, r1
  1678. })
  1679. }
  1680. // PushReturn calls PushHook with a function that returns the given values.
  1681. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) PushReturn(r0 map[*db.Repository]db.AccessMode, r1 error) {
  1682. f.PushHook(func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1683. return r0, r1
  1684. })
  1685. }
  1686. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) nextHook() func(context.Context, int64) (map[*db.Repository]db.AccessMode, error) {
  1687. f.mutex.Lock()
  1688. defer f.mutex.Unlock()
  1689. if len(f.hooks) == 0 {
  1690. return f.defaultHook
  1691. }
  1692. hook := f.hooks[0]
  1693. f.hooks = f.hooks[1:]
  1694. return hook
  1695. }
  1696. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) appendCall(r0 ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) {
  1697. f.mutex.Lock()
  1698. f.history = append(f.history, r0)
  1699. f.mutex.Unlock()
  1700. }
  1701. // History returns a sequence of
  1702. // ReposStoreGetByCollaboratorIDWithAccessModeFuncCall objects describing
  1703. // the invocations of this function.
  1704. func (f *ReposStoreGetByCollaboratorIDWithAccessModeFunc) History() []ReposStoreGetByCollaboratorIDWithAccessModeFuncCall {
  1705. f.mutex.Lock()
  1706. history := make([]ReposStoreGetByCollaboratorIDWithAccessModeFuncCall, len(f.history))
  1707. copy(history, f.history)
  1708. f.mutex.Unlock()
  1709. return history
  1710. }
  1711. // ReposStoreGetByCollaboratorIDWithAccessModeFuncCall is an object that
  1712. // describes an invocation of method GetByCollaboratorIDWithAccessMode on an
  1713. // instance of MockReposStore.
  1714. type ReposStoreGetByCollaboratorIDWithAccessModeFuncCall struct {
  1715. // Arg0 is the value of the 1st argument passed to this method
  1716. // invocation.
  1717. Arg0 context.Context
  1718. // Arg1 is the value of the 2nd argument passed to this method
  1719. // invocation.
  1720. Arg1 int64
  1721. // Result0 is the value of the 1st result returned from this method
  1722. // invocation.
  1723. Result0 map[*db.Repository]db.AccessMode
  1724. // Result1 is the value of the 2nd result returned from this method
  1725. // invocation.
  1726. Result1 error
  1727. }
  1728. // Args returns an interface slice containing the arguments of this
  1729. // invocation.
  1730. func (c ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) Args() []interface{} {
  1731. return []interface{}{c.Arg0, c.Arg1}
  1732. }
  1733. // Results returns an interface slice containing the results of this
  1734. // invocation.
  1735. func (c ReposStoreGetByCollaboratorIDWithAccessModeFuncCall) Results() []interface{} {
  1736. return []interface{}{c.Result0, c.Result1}
  1737. }
  1738. // ReposStoreGetByIDFunc describes the behavior when the GetByID method of
  1739. // the parent MockReposStore instance is invoked.
  1740. type ReposStoreGetByIDFunc struct {
  1741. defaultHook func(context.Context, int64) (*db.Repository, error)
  1742. hooks []func(context.Context, int64) (*db.Repository, error)
  1743. history []ReposStoreGetByIDFuncCall
  1744. mutex sync.Mutex
  1745. }
  1746. // GetByID delegates to the next hook function in the queue and stores the
  1747. // parameter and result values of this invocation.
  1748. func (m *MockReposStore) GetByID(v0 context.Context, v1 int64) (*db.Repository, error) {
  1749. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  1750. m.GetByIDFunc.appendCall(ReposStoreGetByIDFuncCall{v0, v1, r0, r1})
  1751. return r0, r1
  1752. }
  1753. // SetDefaultHook sets function that is called when the GetByID method of
  1754. // the parent MockReposStore instance is invoked and the hook queue is
  1755. // empty.
  1756. func (f *ReposStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.Repository, error)) {
  1757. f.defaultHook = hook
  1758. }
  1759. // PushHook adds a function to the end of hook queue. Each invocation of the
  1760. // GetByID method of the parent MockReposStore instance invokes the hook at
  1761. // the front of the queue and discards it. After the queue is empty, the
  1762. // default hook function is invoked for any future action.
  1763. func (f *ReposStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.Repository, error)) {
  1764. f.mutex.Lock()
  1765. f.hooks = append(f.hooks, hook)
  1766. f.mutex.Unlock()
  1767. }
  1768. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1769. // given values.
  1770. func (f *ReposStoreGetByIDFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1771. f.SetDefaultHook(func(context.Context, int64) (*db.Repository, error) {
  1772. return r0, r1
  1773. })
  1774. }
  1775. // PushReturn calls PushHook with a function that returns the given values.
  1776. func (f *ReposStoreGetByIDFunc) PushReturn(r0 *db.Repository, r1 error) {
  1777. f.PushHook(func(context.Context, int64) (*db.Repository, error) {
  1778. return r0, r1
  1779. })
  1780. }
  1781. func (f *ReposStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.Repository, error) {
  1782. f.mutex.Lock()
  1783. defer f.mutex.Unlock()
  1784. if len(f.hooks) == 0 {
  1785. return f.defaultHook
  1786. }
  1787. hook := f.hooks[0]
  1788. f.hooks = f.hooks[1:]
  1789. return hook
  1790. }
  1791. func (f *ReposStoreGetByIDFunc) appendCall(r0 ReposStoreGetByIDFuncCall) {
  1792. f.mutex.Lock()
  1793. f.history = append(f.history, r0)
  1794. f.mutex.Unlock()
  1795. }
  1796. // History returns a sequence of ReposStoreGetByIDFuncCall objects
  1797. // describing the invocations of this function.
  1798. func (f *ReposStoreGetByIDFunc) History() []ReposStoreGetByIDFuncCall {
  1799. f.mutex.Lock()
  1800. history := make([]ReposStoreGetByIDFuncCall, len(f.history))
  1801. copy(history, f.history)
  1802. f.mutex.Unlock()
  1803. return history
  1804. }
  1805. // ReposStoreGetByIDFuncCall is an object that describes an invocation of
  1806. // method GetByID on an instance of MockReposStore.
  1807. type ReposStoreGetByIDFuncCall struct {
  1808. // Arg0 is the value of the 1st argument passed to this method
  1809. // invocation.
  1810. Arg0 context.Context
  1811. // Arg1 is the value of the 2nd argument passed to this method
  1812. // invocation.
  1813. Arg1 int64
  1814. // Result0 is the value of the 1st result returned from this method
  1815. // invocation.
  1816. Result0 *db.Repository
  1817. // Result1 is the value of the 2nd result returned from this method
  1818. // invocation.
  1819. Result1 error
  1820. }
  1821. // Args returns an interface slice containing the arguments of this
  1822. // invocation.
  1823. func (c ReposStoreGetByIDFuncCall) Args() []interface{} {
  1824. return []interface{}{c.Arg0, c.Arg1}
  1825. }
  1826. // Results returns an interface slice containing the results of this
  1827. // invocation.
  1828. func (c ReposStoreGetByIDFuncCall) Results() []interface{} {
  1829. return []interface{}{c.Result0, c.Result1}
  1830. }
  1831. // ReposStoreGetByNameFunc describes the behavior when the GetByName method
  1832. // of the parent MockReposStore instance is invoked.
  1833. type ReposStoreGetByNameFunc struct {
  1834. defaultHook func(context.Context, int64, string) (*db.Repository, error)
  1835. hooks []func(context.Context, int64, string) (*db.Repository, error)
  1836. history []ReposStoreGetByNameFuncCall
  1837. mutex sync.Mutex
  1838. }
  1839. // GetByName delegates to the next hook function in the queue and stores the
  1840. // parameter and result values of this invocation.
  1841. func (m *MockReposStore) GetByName(v0 context.Context, v1 int64, v2 string) (*db.Repository, error) {
  1842. r0, r1 := m.GetByNameFunc.nextHook()(v0, v1, v2)
  1843. m.GetByNameFunc.appendCall(ReposStoreGetByNameFuncCall{v0, v1, v2, r0, r1})
  1844. return r0, r1
  1845. }
  1846. // SetDefaultHook sets function that is called when the GetByName method of
  1847. // the parent MockReposStore instance is invoked and the hook queue is
  1848. // empty.
  1849. func (f *ReposStoreGetByNameFunc) SetDefaultHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1850. f.defaultHook = hook
  1851. }
  1852. // PushHook adds a function to the end of hook queue. Each invocation of the
  1853. // GetByName method of the parent MockReposStore instance invokes the hook
  1854. // at the front of the queue and discards it. After the queue is empty, the
  1855. // default hook function is invoked for any future action.
  1856. func (f *ReposStoreGetByNameFunc) PushHook(hook func(context.Context, int64, string) (*db.Repository, error)) {
  1857. f.mutex.Lock()
  1858. f.hooks = append(f.hooks, hook)
  1859. f.mutex.Unlock()
  1860. }
  1861. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1862. // given values.
  1863. func (f *ReposStoreGetByNameFunc) SetDefaultReturn(r0 *db.Repository, r1 error) {
  1864. f.SetDefaultHook(func(context.Context, int64, string) (*db.Repository, error) {
  1865. return r0, r1
  1866. })
  1867. }
  1868. // PushReturn calls PushHook with a function that returns the given values.
  1869. func (f *ReposStoreGetByNameFunc) PushReturn(r0 *db.Repository, r1 error) {
  1870. f.PushHook(func(context.Context, int64, string) (*db.Repository, error) {
  1871. return r0, r1
  1872. })
  1873. }
  1874. func (f *ReposStoreGetByNameFunc) nextHook() func(context.Context, int64, string) (*db.Repository, error) {
  1875. f.mutex.Lock()
  1876. defer f.mutex.Unlock()
  1877. if len(f.hooks) == 0 {
  1878. return f.defaultHook
  1879. }
  1880. hook := f.hooks[0]
  1881. f.hooks = f.hooks[1:]
  1882. return hook
  1883. }
  1884. func (f *ReposStoreGetByNameFunc) appendCall(r0 ReposStoreGetByNameFuncCall) {
  1885. f.mutex.Lock()
  1886. f.history = append(f.history, r0)
  1887. f.mutex.Unlock()
  1888. }
  1889. // History returns a sequence of ReposStoreGetByNameFuncCall objects
  1890. // describing the invocations of this function.
  1891. func (f *ReposStoreGetByNameFunc) History() []ReposStoreGetByNameFuncCall {
  1892. f.mutex.Lock()
  1893. history := make([]ReposStoreGetByNameFuncCall, len(f.history))
  1894. copy(history, f.history)
  1895. f.mutex.Unlock()
  1896. return history
  1897. }
  1898. // ReposStoreGetByNameFuncCall is an object that describes an invocation of
  1899. // method GetByName on an instance of MockReposStore.
  1900. type ReposStoreGetByNameFuncCall struct {
  1901. // Arg0 is the value of the 1st argument passed to this method
  1902. // invocation.
  1903. Arg0 context.Context
  1904. // Arg1 is the value of the 2nd argument passed to this method
  1905. // invocation.
  1906. Arg1 int64
  1907. // Arg2 is the value of the 3rd argument passed to this method
  1908. // invocation.
  1909. Arg2 string
  1910. // Result0 is the value of the 1st result returned from this method
  1911. // invocation.
  1912. Result0 *db.Repository
  1913. // Result1 is the value of the 2nd result returned from this method
  1914. // invocation.
  1915. Result1 error
  1916. }
  1917. // Args returns an interface slice containing the arguments of this
  1918. // invocation.
  1919. func (c ReposStoreGetByNameFuncCall) Args() []interface{} {
  1920. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  1921. }
  1922. // Results returns an interface slice containing the results of this
  1923. // invocation.
  1924. func (c ReposStoreGetByNameFuncCall) Results() []interface{} {
  1925. return []interface{}{c.Result0, c.Result1}
  1926. }
  1927. // ReposStoreStarFunc describes the behavior when the Star method of the
  1928. // parent MockReposStore instance is invoked.
  1929. type ReposStoreStarFunc struct {
  1930. defaultHook func(context.Context, int64, int64) error
  1931. hooks []func(context.Context, int64, int64) error
  1932. history []ReposStoreStarFuncCall
  1933. mutex sync.Mutex
  1934. }
  1935. // Star delegates to the next hook function in the queue and stores the
  1936. // parameter and result values of this invocation.
  1937. func (m *MockReposStore) Star(v0 context.Context, v1 int64, v2 int64) error {
  1938. r0 := m.StarFunc.nextHook()(v0, v1, v2)
  1939. m.StarFunc.appendCall(ReposStoreStarFuncCall{v0, v1, v2, r0})
  1940. return r0
  1941. }
  1942. // SetDefaultHook sets function that is called when the Star method of the
  1943. // parent MockReposStore instance is invoked and the hook queue is empty.
  1944. func (f *ReposStoreStarFunc) SetDefaultHook(hook func(context.Context, int64, int64) error) {
  1945. f.defaultHook = hook
  1946. }
  1947. // PushHook adds a function to the end of hook queue. Each invocation of the
  1948. // Star method of the parent MockReposStore instance invokes the hook at the
  1949. // front of the queue and discards it. After the queue is empty, the default
  1950. // hook function is invoked for any future action.
  1951. func (f *ReposStoreStarFunc) PushHook(hook func(context.Context, int64, int64) error) {
  1952. f.mutex.Lock()
  1953. f.hooks = append(f.hooks, hook)
  1954. f.mutex.Unlock()
  1955. }
  1956. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  1957. // given values.
  1958. func (f *ReposStoreStarFunc) SetDefaultReturn(r0 error) {
  1959. f.SetDefaultHook(func(context.Context, int64, int64) error {
  1960. return r0
  1961. })
  1962. }
  1963. // PushReturn calls PushHook with a function that returns the given values.
  1964. func (f *ReposStoreStarFunc) PushReturn(r0 error) {
  1965. f.PushHook(func(context.Context, int64, int64) error {
  1966. return r0
  1967. })
  1968. }
  1969. func (f *ReposStoreStarFunc) nextHook() func(context.Context, int64, int64) error {
  1970. f.mutex.Lock()
  1971. defer f.mutex.Unlock()
  1972. if len(f.hooks) == 0 {
  1973. return f.defaultHook
  1974. }
  1975. hook := f.hooks[0]
  1976. f.hooks = f.hooks[1:]
  1977. return hook
  1978. }
  1979. func (f *ReposStoreStarFunc) appendCall(r0 ReposStoreStarFuncCall) {
  1980. f.mutex.Lock()
  1981. f.history = append(f.history, r0)
  1982. f.mutex.Unlock()
  1983. }
  1984. // History returns a sequence of ReposStoreStarFuncCall objects describing
  1985. // the invocations of this function.
  1986. func (f *ReposStoreStarFunc) History() []ReposStoreStarFuncCall {
  1987. f.mutex.Lock()
  1988. history := make([]ReposStoreStarFuncCall, len(f.history))
  1989. copy(history, f.history)
  1990. f.mutex.Unlock()
  1991. return history
  1992. }
  1993. // ReposStoreStarFuncCall is an object that describes an invocation of
  1994. // method Star on an instance of MockReposStore.
  1995. type ReposStoreStarFuncCall struct {
  1996. // Arg0 is the value of the 1st argument passed to this method
  1997. // invocation.
  1998. Arg0 context.Context
  1999. // Arg1 is the value of the 2nd argument passed to this method
  2000. // invocation.
  2001. Arg1 int64
  2002. // Arg2 is the value of the 3rd argument passed to this method
  2003. // invocation.
  2004. Arg2 int64
  2005. // Result0 is the value of the 1st result returned from this method
  2006. // invocation.
  2007. Result0 error
  2008. }
  2009. // Args returns an interface slice containing the arguments of this
  2010. // invocation.
  2011. func (c ReposStoreStarFuncCall) Args() []interface{} {
  2012. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2013. }
  2014. // Results returns an interface slice containing the results of this
  2015. // invocation.
  2016. func (c ReposStoreStarFuncCall) Results() []interface{} {
  2017. return []interface{}{c.Result0}
  2018. }
  2019. // ReposStoreTouchFunc describes the behavior when the Touch method of the
  2020. // parent MockReposStore instance is invoked.
  2021. type ReposStoreTouchFunc struct {
  2022. defaultHook func(context.Context, int64) error
  2023. hooks []func(context.Context, int64) error
  2024. history []ReposStoreTouchFuncCall
  2025. mutex sync.Mutex
  2026. }
  2027. // Touch delegates to the next hook function in the queue and stores the
  2028. // parameter and result values of this invocation.
  2029. func (m *MockReposStore) Touch(v0 context.Context, v1 int64) error {
  2030. r0 := m.TouchFunc.nextHook()(v0, v1)
  2031. m.TouchFunc.appendCall(ReposStoreTouchFuncCall{v0, v1, r0})
  2032. return r0
  2033. }
  2034. // SetDefaultHook sets function that is called when the Touch method of the
  2035. // parent MockReposStore instance is invoked and the hook queue is empty.
  2036. func (f *ReposStoreTouchFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  2037. f.defaultHook = hook
  2038. }
  2039. // PushHook adds a function to the end of hook queue. Each invocation of the
  2040. // Touch method of the parent MockReposStore instance invokes the hook at
  2041. // the front of the queue and discards it. After the queue is empty, the
  2042. // default hook function is invoked for any future action.
  2043. func (f *ReposStoreTouchFunc) PushHook(hook func(context.Context, int64) error) {
  2044. f.mutex.Lock()
  2045. f.hooks = append(f.hooks, hook)
  2046. f.mutex.Unlock()
  2047. }
  2048. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2049. // given values.
  2050. func (f *ReposStoreTouchFunc) SetDefaultReturn(r0 error) {
  2051. f.SetDefaultHook(func(context.Context, int64) error {
  2052. return r0
  2053. })
  2054. }
  2055. // PushReturn calls PushHook with a function that returns the given values.
  2056. func (f *ReposStoreTouchFunc) PushReturn(r0 error) {
  2057. f.PushHook(func(context.Context, int64) error {
  2058. return r0
  2059. })
  2060. }
  2061. func (f *ReposStoreTouchFunc) nextHook() func(context.Context, int64) error {
  2062. f.mutex.Lock()
  2063. defer f.mutex.Unlock()
  2064. if len(f.hooks) == 0 {
  2065. return f.defaultHook
  2066. }
  2067. hook := f.hooks[0]
  2068. f.hooks = f.hooks[1:]
  2069. return hook
  2070. }
  2071. func (f *ReposStoreTouchFunc) appendCall(r0 ReposStoreTouchFuncCall) {
  2072. f.mutex.Lock()
  2073. f.history = append(f.history, r0)
  2074. f.mutex.Unlock()
  2075. }
  2076. // History returns a sequence of ReposStoreTouchFuncCall objects describing
  2077. // the invocations of this function.
  2078. func (f *ReposStoreTouchFunc) History() []ReposStoreTouchFuncCall {
  2079. f.mutex.Lock()
  2080. history := make([]ReposStoreTouchFuncCall, len(f.history))
  2081. copy(history, f.history)
  2082. f.mutex.Unlock()
  2083. return history
  2084. }
  2085. // ReposStoreTouchFuncCall is an object that describes an invocation of
  2086. // method Touch on an instance of MockReposStore.
  2087. type ReposStoreTouchFuncCall struct {
  2088. // Arg0 is the value of the 1st argument passed to this method
  2089. // invocation.
  2090. Arg0 context.Context
  2091. // Arg1 is the value of the 2nd argument passed to this method
  2092. // invocation.
  2093. Arg1 int64
  2094. // Result0 is the value of the 1st result returned from this method
  2095. // invocation.
  2096. Result0 error
  2097. }
  2098. // Args returns an interface slice containing the arguments of this
  2099. // invocation.
  2100. func (c ReposStoreTouchFuncCall) Args() []interface{} {
  2101. return []interface{}{c.Arg0, c.Arg1}
  2102. }
  2103. // Results returns an interface slice containing the results of this
  2104. // invocation.
  2105. func (c ReposStoreTouchFuncCall) Results() []interface{} {
  2106. return []interface{}{c.Result0}
  2107. }
  2108. // MockTwoFactorsStore is a mock implementation of the TwoFactorsStore
  2109. // interface (from the package gogs.io/gogs/internal/db) used for unit
  2110. // testing.
  2111. type MockTwoFactorsStore struct {
  2112. // CreateFunc is an instance of a mock function object controlling the
  2113. // behavior of the method Create.
  2114. CreateFunc *TwoFactorsStoreCreateFunc
  2115. // GetByUserIDFunc is an instance of a mock function object controlling
  2116. // the behavior of the method GetByUserID.
  2117. GetByUserIDFunc *TwoFactorsStoreGetByUserIDFunc
  2118. // IsEnabledFunc is an instance of a mock function object controlling
  2119. // the behavior of the method IsEnabled.
  2120. IsEnabledFunc *TwoFactorsStoreIsEnabledFunc
  2121. }
  2122. // NewMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2123. // interface. All methods return zero values for all results, unless
  2124. // overwritten.
  2125. func NewMockTwoFactorsStore() *MockTwoFactorsStore {
  2126. return &MockTwoFactorsStore{
  2127. CreateFunc: &TwoFactorsStoreCreateFunc{
  2128. defaultHook: func(context.Context, int64, string, string) (r0 error) {
  2129. return
  2130. },
  2131. },
  2132. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2133. defaultHook: func(context.Context, int64) (r0 *db.TwoFactor, r1 error) {
  2134. return
  2135. },
  2136. },
  2137. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2138. defaultHook: func(context.Context, int64) (r0 bool) {
  2139. return
  2140. },
  2141. },
  2142. }
  2143. }
  2144. // NewStrictMockTwoFactorsStore creates a new mock of the TwoFactorsStore
  2145. // interface. All methods panic on invocation, unless overwritten.
  2146. func NewStrictMockTwoFactorsStore() *MockTwoFactorsStore {
  2147. return &MockTwoFactorsStore{
  2148. CreateFunc: &TwoFactorsStoreCreateFunc{
  2149. defaultHook: func(context.Context, int64, string, string) error {
  2150. panic("unexpected invocation of MockTwoFactorsStore.Create")
  2151. },
  2152. },
  2153. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2154. defaultHook: func(context.Context, int64) (*db.TwoFactor, error) {
  2155. panic("unexpected invocation of MockTwoFactorsStore.GetByUserID")
  2156. },
  2157. },
  2158. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2159. defaultHook: func(context.Context, int64) bool {
  2160. panic("unexpected invocation of MockTwoFactorsStore.IsEnabled")
  2161. },
  2162. },
  2163. }
  2164. }
  2165. // NewMockTwoFactorsStoreFrom creates a new mock of the MockTwoFactorsStore
  2166. // interface. All methods delegate to the given implementation, unless
  2167. // overwritten.
  2168. func NewMockTwoFactorsStoreFrom(i db.TwoFactorsStore) *MockTwoFactorsStore {
  2169. return &MockTwoFactorsStore{
  2170. CreateFunc: &TwoFactorsStoreCreateFunc{
  2171. defaultHook: i.Create,
  2172. },
  2173. GetByUserIDFunc: &TwoFactorsStoreGetByUserIDFunc{
  2174. defaultHook: i.GetByUserID,
  2175. },
  2176. IsEnabledFunc: &TwoFactorsStoreIsEnabledFunc{
  2177. defaultHook: i.IsEnabled,
  2178. },
  2179. }
  2180. }
  2181. // TwoFactorsStoreCreateFunc describes the behavior when the Create method
  2182. // of the parent MockTwoFactorsStore instance is invoked.
  2183. type TwoFactorsStoreCreateFunc struct {
  2184. defaultHook func(context.Context, int64, string, string) error
  2185. hooks []func(context.Context, int64, string, string) error
  2186. history []TwoFactorsStoreCreateFuncCall
  2187. mutex sync.Mutex
  2188. }
  2189. // Create delegates to the next hook function in the queue and stores the
  2190. // parameter and result values of this invocation.
  2191. func (m *MockTwoFactorsStore) Create(v0 context.Context, v1 int64, v2 string, v3 string) error {
  2192. r0 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  2193. m.CreateFunc.appendCall(TwoFactorsStoreCreateFuncCall{v0, v1, v2, v3, r0})
  2194. return r0
  2195. }
  2196. // SetDefaultHook sets function that is called when the Create method of the
  2197. // parent MockTwoFactorsStore instance is invoked and the hook queue is
  2198. // empty.
  2199. func (f *TwoFactorsStoreCreateFunc) SetDefaultHook(hook func(context.Context, int64, string, string) error) {
  2200. f.defaultHook = hook
  2201. }
  2202. // PushHook adds a function to the end of hook queue. Each invocation of the
  2203. // Create method of the parent MockTwoFactorsStore instance invokes the hook
  2204. // at the front of the queue and discards it. After the queue is empty, the
  2205. // default hook function is invoked for any future action.
  2206. func (f *TwoFactorsStoreCreateFunc) PushHook(hook func(context.Context, int64, string, string) error) {
  2207. f.mutex.Lock()
  2208. f.hooks = append(f.hooks, hook)
  2209. f.mutex.Unlock()
  2210. }
  2211. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2212. // given values.
  2213. func (f *TwoFactorsStoreCreateFunc) SetDefaultReturn(r0 error) {
  2214. f.SetDefaultHook(func(context.Context, int64, string, string) error {
  2215. return r0
  2216. })
  2217. }
  2218. // PushReturn calls PushHook with a function that returns the given values.
  2219. func (f *TwoFactorsStoreCreateFunc) PushReturn(r0 error) {
  2220. f.PushHook(func(context.Context, int64, string, string) error {
  2221. return r0
  2222. })
  2223. }
  2224. func (f *TwoFactorsStoreCreateFunc) nextHook() func(context.Context, int64, string, string) error {
  2225. f.mutex.Lock()
  2226. defer f.mutex.Unlock()
  2227. if len(f.hooks) == 0 {
  2228. return f.defaultHook
  2229. }
  2230. hook := f.hooks[0]
  2231. f.hooks = f.hooks[1:]
  2232. return hook
  2233. }
  2234. func (f *TwoFactorsStoreCreateFunc) appendCall(r0 TwoFactorsStoreCreateFuncCall) {
  2235. f.mutex.Lock()
  2236. f.history = append(f.history, r0)
  2237. f.mutex.Unlock()
  2238. }
  2239. // History returns a sequence of TwoFactorsStoreCreateFuncCall objects
  2240. // describing the invocations of this function.
  2241. func (f *TwoFactorsStoreCreateFunc) History() []TwoFactorsStoreCreateFuncCall {
  2242. f.mutex.Lock()
  2243. history := make([]TwoFactorsStoreCreateFuncCall, len(f.history))
  2244. copy(history, f.history)
  2245. f.mutex.Unlock()
  2246. return history
  2247. }
  2248. // TwoFactorsStoreCreateFuncCall is an object that describes an invocation
  2249. // of method Create on an instance of MockTwoFactorsStore.
  2250. type TwoFactorsStoreCreateFuncCall struct {
  2251. // Arg0 is the value of the 1st argument passed to this method
  2252. // invocation.
  2253. Arg0 context.Context
  2254. // Arg1 is the value of the 2nd argument passed to this method
  2255. // invocation.
  2256. Arg1 int64
  2257. // Arg2 is the value of the 3rd argument passed to this method
  2258. // invocation.
  2259. Arg2 string
  2260. // Arg3 is the value of the 4th argument passed to this method
  2261. // invocation.
  2262. Arg3 string
  2263. // Result0 is the value of the 1st result returned from this method
  2264. // invocation.
  2265. Result0 error
  2266. }
  2267. // Args returns an interface slice containing the arguments of this
  2268. // invocation.
  2269. func (c TwoFactorsStoreCreateFuncCall) Args() []interface{} {
  2270. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2271. }
  2272. // Results returns an interface slice containing the results of this
  2273. // invocation.
  2274. func (c TwoFactorsStoreCreateFuncCall) Results() []interface{} {
  2275. return []interface{}{c.Result0}
  2276. }
  2277. // TwoFactorsStoreGetByUserIDFunc describes the behavior when the
  2278. // GetByUserID method of the parent MockTwoFactorsStore instance is invoked.
  2279. type TwoFactorsStoreGetByUserIDFunc struct {
  2280. defaultHook func(context.Context, int64) (*db.TwoFactor, error)
  2281. hooks []func(context.Context, int64) (*db.TwoFactor, error)
  2282. history []TwoFactorsStoreGetByUserIDFuncCall
  2283. mutex sync.Mutex
  2284. }
  2285. // GetByUserID delegates to the next hook function in the queue and stores
  2286. // the parameter and result values of this invocation.
  2287. func (m *MockTwoFactorsStore) GetByUserID(v0 context.Context, v1 int64) (*db.TwoFactor, error) {
  2288. r0, r1 := m.GetByUserIDFunc.nextHook()(v0, v1)
  2289. m.GetByUserIDFunc.appendCall(TwoFactorsStoreGetByUserIDFuncCall{v0, v1, r0, r1})
  2290. return r0, r1
  2291. }
  2292. // SetDefaultHook sets function that is called when the GetByUserID method
  2293. // of the parent MockTwoFactorsStore instance is invoked and the hook queue
  2294. // is empty.
  2295. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2296. f.defaultHook = hook
  2297. }
  2298. // PushHook adds a function to the end of hook queue. Each invocation of the
  2299. // GetByUserID method of the parent MockTwoFactorsStore instance invokes the
  2300. // hook at the front of the queue and discards it. After the queue is empty,
  2301. // the default hook function is invoked for any future action.
  2302. func (f *TwoFactorsStoreGetByUserIDFunc) PushHook(hook func(context.Context, int64) (*db.TwoFactor, error)) {
  2303. f.mutex.Lock()
  2304. f.hooks = append(f.hooks, hook)
  2305. f.mutex.Unlock()
  2306. }
  2307. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2308. // given values.
  2309. func (f *TwoFactorsStoreGetByUserIDFunc) SetDefaultReturn(r0 *db.TwoFactor, r1 error) {
  2310. f.SetDefaultHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2311. return r0, r1
  2312. })
  2313. }
  2314. // PushReturn calls PushHook with a function that returns the given values.
  2315. func (f *TwoFactorsStoreGetByUserIDFunc) PushReturn(r0 *db.TwoFactor, r1 error) {
  2316. f.PushHook(func(context.Context, int64) (*db.TwoFactor, error) {
  2317. return r0, r1
  2318. })
  2319. }
  2320. func (f *TwoFactorsStoreGetByUserIDFunc) nextHook() func(context.Context, int64) (*db.TwoFactor, error) {
  2321. f.mutex.Lock()
  2322. defer f.mutex.Unlock()
  2323. if len(f.hooks) == 0 {
  2324. return f.defaultHook
  2325. }
  2326. hook := f.hooks[0]
  2327. f.hooks = f.hooks[1:]
  2328. return hook
  2329. }
  2330. func (f *TwoFactorsStoreGetByUserIDFunc) appendCall(r0 TwoFactorsStoreGetByUserIDFuncCall) {
  2331. f.mutex.Lock()
  2332. f.history = append(f.history, r0)
  2333. f.mutex.Unlock()
  2334. }
  2335. // History returns a sequence of TwoFactorsStoreGetByUserIDFuncCall objects
  2336. // describing the invocations of this function.
  2337. func (f *TwoFactorsStoreGetByUserIDFunc) History() []TwoFactorsStoreGetByUserIDFuncCall {
  2338. f.mutex.Lock()
  2339. history := make([]TwoFactorsStoreGetByUserIDFuncCall, len(f.history))
  2340. copy(history, f.history)
  2341. f.mutex.Unlock()
  2342. return history
  2343. }
  2344. // TwoFactorsStoreGetByUserIDFuncCall is an object that describes an
  2345. // invocation of method GetByUserID on an instance of MockTwoFactorsStore.
  2346. type TwoFactorsStoreGetByUserIDFuncCall struct {
  2347. // Arg0 is the value of the 1st argument passed to this method
  2348. // invocation.
  2349. Arg0 context.Context
  2350. // Arg1 is the value of the 2nd argument passed to this method
  2351. // invocation.
  2352. Arg1 int64
  2353. // Result0 is the value of the 1st result returned from this method
  2354. // invocation.
  2355. Result0 *db.TwoFactor
  2356. // Result1 is the value of the 2nd result returned from this method
  2357. // invocation.
  2358. Result1 error
  2359. }
  2360. // Args returns an interface slice containing the arguments of this
  2361. // invocation.
  2362. func (c TwoFactorsStoreGetByUserIDFuncCall) Args() []interface{} {
  2363. return []interface{}{c.Arg0, c.Arg1}
  2364. }
  2365. // Results returns an interface slice containing the results of this
  2366. // invocation.
  2367. func (c TwoFactorsStoreGetByUserIDFuncCall) Results() []interface{} {
  2368. return []interface{}{c.Result0, c.Result1}
  2369. }
  2370. // TwoFactorsStoreIsEnabledFunc describes the behavior when the IsEnabled
  2371. // method of the parent MockTwoFactorsStore instance is invoked.
  2372. type TwoFactorsStoreIsEnabledFunc struct {
  2373. defaultHook func(context.Context, int64) bool
  2374. hooks []func(context.Context, int64) bool
  2375. history []TwoFactorsStoreIsEnabledFuncCall
  2376. mutex sync.Mutex
  2377. }
  2378. // IsEnabled delegates to the next hook function in the queue and stores the
  2379. // parameter and result values of this invocation.
  2380. func (m *MockTwoFactorsStore) IsEnabled(v0 context.Context, v1 int64) bool {
  2381. r0 := m.IsEnabledFunc.nextHook()(v0, v1)
  2382. m.IsEnabledFunc.appendCall(TwoFactorsStoreIsEnabledFuncCall{v0, v1, r0})
  2383. return r0
  2384. }
  2385. // SetDefaultHook sets function that is called when the IsEnabled method of
  2386. // the parent MockTwoFactorsStore instance is invoked and the hook queue is
  2387. // empty.
  2388. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
  2389. f.defaultHook = hook
  2390. }
  2391. // PushHook adds a function to the end of hook queue. Each invocation of the
  2392. // IsEnabled method of the parent MockTwoFactorsStore instance invokes the
  2393. // hook at the front of the queue and discards it. After the queue is empty,
  2394. // the default hook function is invoked for any future action.
  2395. func (f *TwoFactorsStoreIsEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
  2396. f.mutex.Lock()
  2397. f.hooks = append(f.hooks, hook)
  2398. f.mutex.Unlock()
  2399. }
  2400. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2401. // given values.
  2402. func (f *TwoFactorsStoreIsEnabledFunc) SetDefaultReturn(r0 bool) {
  2403. f.SetDefaultHook(func(context.Context, int64) bool {
  2404. return r0
  2405. })
  2406. }
  2407. // PushReturn calls PushHook with a function that returns the given values.
  2408. func (f *TwoFactorsStoreIsEnabledFunc) PushReturn(r0 bool) {
  2409. f.PushHook(func(context.Context, int64) bool {
  2410. return r0
  2411. })
  2412. }
  2413. func (f *TwoFactorsStoreIsEnabledFunc) nextHook() func(context.Context, int64) bool {
  2414. f.mutex.Lock()
  2415. defer f.mutex.Unlock()
  2416. if len(f.hooks) == 0 {
  2417. return f.defaultHook
  2418. }
  2419. hook := f.hooks[0]
  2420. f.hooks = f.hooks[1:]
  2421. return hook
  2422. }
  2423. func (f *TwoFactorsStoreIsEnabledFunc) appendCall(r0 TwoFactorsStoreIsEnabledFuncCall) {
  2424. f.mutex.Lock()
  2425. f.history = append(f.history, r0)
  2426. f.mutex.Unlock()
  2427. }
  2428. // History returns a sequence of TwoFactorsStoreIsEnabledFuncCall objects
  2429. // describing the invocations of this function.
  2430. func (f *TwoFactorsStoreIsEnabledFunc) History() []TwoFactorsStoreIsEnabledFuncCall {
  2431. f.mutex.Lock()
  2432. history := make([]TwoFactorsStoreIsEnabledFuncCall, len(f.history))
  2433. copy(history, f.history)
  2434. f.mutex.Unlock()
  2435. return history
  2436. }
  2437. // TwoFactorsStoreIsEnabledFuncCall is an object that describes an
  2438. // invocation of method IsEnabled on an instance of MockTwoFactorsStore.
  2439. type TwoFactorsStoreIsEnabledFuncCall struct {
  2440. // Arg0 is the value of the 1st argument passed to this method
  2441. // invocation.
  2442. Arg0 context.Context
  2443. // Arg1 is the value of the 2nd argument passed to this method
  2444. // invocation.
  2445. Arg1 int64
  2446. // Result0 is the value of the 1st result returned from this method
  2447. // invocation.
  2448. Result0 bool
  2449. }
  2450. // Args returns an interface slice containing the arguments of this
  2451. // invocation.
  2452. func (c TwoFactorsStoreIsEnabledFuncCall) Args() []interface{} {
  2453. return []interface{}{c.Arg0, c.Arg1}
  2454. }
  2455. // Results returns an interface slice containing the results of this
  2456. // invocation.
  2457. func (c TwoFactorsStoreIsEnabledFuncCall) Results() []interface{} {
  2458. return []interface{}{c.Result0}
  2459. }
  2460. // MockUsersStore is a mock implementation of the UsersStore interface (from
  2461. // the package gogs.io/gogs/internal/db) used for unit testing.
  2462. type MockUsersStore struct {
  2463. // AuthenticateFunc is an instance of a mock function object controlling
  2464. // the behavior of the method Authenticate.
  2465. AuthenticateFunc *UsersStoreAuthenticateFunc
  2466. // ChangeUsernameFunc is an instance of a mock function object
  2467. // controlling the behavior of the method ChangeUsername.
  2468. ChangeUsernameFunc *UsersStoreChangeUsernameFunc
  2469. // CountFunc is an instance of a mock function object controlling the
  2470. // behavior of the method Count.
  2471. CountFunc *UsersStoreCountFunc
  2472. // CreateFunc is an instance of a mock function object controlling the
  2473. // behavior of the method Create.
  2474. CreateFunc *UsersStoreCreateFunc
  2475. // DeleteByIDFunc is an instance of a mock function object controlling
  2476. // the behavior of the method DeleteByID.
  2477. DeleteByIDFunc *UsersStoreDeleteByIDFunc
  2478. // DeleteCustomAvatarFunc is an instance of a mock function object
  2479. // controlling the behavior of the method DeleteCustomAvatar.
  2480. DeleteCustomAvatarFunc *UsersStoreDeleteCustomAvatarFunc
  2481. // DeleteInactivatedFunc is an instance of a mock function object
  2482. // controlling the behavior of the method DeleteInactivated.
  2483. DeleteInactivatedFunc *UsersStoreDeleteInactivatedFunc
  2484. // GetByEmailFunc is an instance of a mock function object controlling
  2485. // the behavior of the method GetByEmail.
  2486. GetByEmailFunc *UsersStoreGetByEmailFunc
  2487. // GetByIDFunc is an instance of a mock function object controlling the
  2488. // behavior of the method GetByID.
  2489. GetByIDFunc *UsersStoreGetByIDFunc
  2490. // GetByKeyIDFunc is an instance of a mock function object controlling
  2491. // the behavior of the method GetByKeyID.
  2492. GetByKeyIDFunc *UsersStoreGetByKeyIDFunc
  2493. // GetByUsernameFunc is an instance of a mock function object
  2494. // controlling the behavior of the method GetByUsername.
  2495. GetByUsernameFunc *UsersStoreGetByUsernameFunc
  2496. // GetMailableEmailsByUsernamesFunc is an instance of a mock function
  2497. // object controlling the behavior of the method
  2498. // GetMailableEmailsByUsernames.
  2499. GetMailableEmailsByUsernamesFunc *UsersStoreGetMailableEmailsByUsernamesFunc
  2500. // HasForkedRepositoryFunc is an instance of a mock function object
  2501. // controlling the behavior of the method HasForkedRepository.
  2502. HasForkedRepositoryFunc *UsersStoreHasForkedRepositoryFunc
  2503. // IsUsernameUsedFunc is an instance of a mock function object
  2504. // controlling the behavior of the method IsUsernameUsed.
  2505. IsUsernameUsedFunc *UsersStoreIsUsernameUsedFunc
  2506. // ListFunc is an instance of a mock function object controlling the
  2507. // behavior of the method List.
  2508. ListFunc *UsersStoreListFunc
  2509. // ListFollowersFunc is an instance of a mock function object
  2510. // controlling the behavior of the method ListFollowers.
  2511. ListFollowersFunc *UsersStoreListFollowersFunc
  2512. // ListFollowingsFunc is an instance of a mock function object
  2513. // controlling the behavior of the method ListFollowings.
  2514. ListFollowingsFunc *UsersStoreListFollowingsFunc
  2515. // SearchByNameFunc is an instance of a mock function object controlling
  2516. // the behavior of the method SearchByName.
  2517. SearchByNameFunc *UsersStoreSearchByNameFunc
  2518. // UpdateFunc is an instance of a mock function object controlling the
  2519. // behavior of the method Update.
  2520. UpdateFunc *UsersStoreUpdateFunc
  2521. // UseCustomAvatarFunc is an instance of a mock function object
  2522. // controlling the behavior of the method UseCustomAvatar.
  2523. UseCustomAvatarFunc *UsersStoreUseCustomAvatarFunc
  2524. }
  2525. // NewMockUsersStore creates a new mock of the UsersStore interface. All
  2526. // methods return zero values for all results, unless overwritten.
  2527. func NewMockUsersStore() *MockUsersStore {
  2528. return &MockUsersStore{
  2529. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2530. defaultHook: func(context.Context, string, string, int64) (r0 *db.User, r1 error) {
  2531. return
  2532. },
  2533. },
  2534. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2535. defaultHook: func(context.Context, int64, string) (r0 error) {
  2536. return
  2537. },
  2538. },
  2539. CountFunc: &UsersStoreCountFunc{
  2540. defaultHook: func(context.Context) (r0 int64) {
  2541. return
  2542. },
  2543. },
  2544. CreateFunc: &UsersStoreCreateFunc{
  2545. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (r0 *db.User, r1 error) {
  2546. return
  2547. },
  2548. },
  2549. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  2550. defaultHook: func(context.Context, int64, bool) (r0 error) {
  2551. return
  2552. },
  2553. },
  2554. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2555. defaultHook: func(context.Context, int64) (r0 error) {
  2556. return
  2557. },
  2558. },
  2559. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  2560. defaultHook: func() (r0 error) {
  2561. return
  2562. },
  2563. },
  2564. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2565. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  2566. return
  2567. },
  2568. },
  2569. GetByIDFunc: &UsersStoreGetByIDFunc{
  2570. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  2571. return
  2572. },
  2573. },
  2574. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2575. defaultHook: func(context.Context, int64) (r0 *db.User, r1 error) {
  2576. return
  2577. },
  2578. },
  2579. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2580. defaultHook: func(context.Context, string) (r0 *db.User, r1 error) {
  2581. return
  2582. },
  2583. },
  2584. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2585. defaultHook: func(context.Context, []string) (r0 []string, r1 error) {
  2586. return
  2587. },
  2588. },
  2589. HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
  2590. defaultHook: func(context.Context, int64, int64) (r0 bool) {
  2591. return
  2592. },
  2593. },
  2594. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2595. defaultHook: func(context.Context, string, int64) (r0 bool) {
  2596. return
  2597. },
  2598. },
  2599. ListFunc: &UsersStoreListFunc{
  2600. defaultHook: func(context.Context, int, int) (r0 []*db.User, r1 error) {
  2601. return
  2602. },
  2603. },
  2604. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2605. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  2606. return
  2607. },
  2608. },
  2609. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2610. defaultHook: func(context.Context, int64, int, int) (r0 []*db.User, r1 error) {
  2611. return
  2612. },
  2613. },
  2614. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  2615. defaultHook: func(context.Context, string, int, int, string) (r0 []*db.User, r1 int64, r2 error) {
  2616. return
  2617. },
  2618. },
  2619. UpdateFunc: &UsersStoreUpdateFunc{
  2620. defaultHook: func(context.Context, int64, db.UpdateUserOptions) (r0 error) {
  2621. return
  2622. },
  2623. },
  2624. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  2625. defaultHook: func(context.Context, int64, []byte) (r0 error) {
  2626. return
  2627. },
  2628. },
  2629. }
  2630. }
  2631. // NewStrictMockUsersStore creates a new mock of the UsersStore interface.
  2632. // All methods panic on invocation, unless overwritten.
  2633. func NewStrictMockUsersStore() *MockUsersStore {
  2634. return &MockUsersStore{
  2635. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2636. defaultHook: func(context.Context, string, string, int64) (*db.User, error) {
  2637. panic("unexpected invocation of MockUsersStore.Authenticate")
  2638. },
  2639. },
  2640. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2641. defaultHook: func(context.Context, int64, string) error {
  2642. panic("unexpected invocation of MockUsersStore.ChangeUsername")
  2643. },
  2644. },
  2645. CountFunc: &UsersStoreCountFunc{
  2646. defaultHook: func(context.Context) int64 {
  2647. panic("unexpected invocation of MockUsersStore.Count")
  2648. },
  2649. },
  2650. CreateFunc: &UsersStoreCreateFunc{
  2651. defaultHook: func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  2652. panic("unexpected invocation of MockUsersStore.Create")
  2653. },
  2654. },
  2655. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  2656. defaultHook: func(context.Context, int64, bool) error {
  2657. panic("unexpected invocation of MockUsersStore.DeleteByID")
  2658. },
  2659. },
  2660. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2661. defaultHook: func(context.Context, int64) error {
  2662. panic("unexpected invocation of MockUsersStore.DeleteCustomAvatar")
  2663. },
  2664. },
  2665. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  2666. defaultHook: func() error {
  2667. panic("unexpected invocation of MockUsersStore.DeleteInactivated")
  2668. },
  2669. },
  2670. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2671. defaultHook: func(context.Context, string) (*db.User, error) {
  2672. panic("unexpected invocation of MockUsersStore.GetByEmail")
  2673. },
  2674. },
  2675. GetByIDFunc: &UsersStoreGetByIDFunc{
  2676. defaultHook: func(context.Context, int64) (*db.User, error) {
  2677. panic("unexpected invocation of MockUsersStore.GetByID")
  2678. },
  2679. },
  2680. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2681. defaultHook: func(context.Context, int64) (*db.User, error) {
  2682. panic("unexpected invocation of MockUsersStore.GetByKeyID")
  2683. },
  2684. },
  2685. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2686. defaultHook: func(context.Context, string) (*db.User, error) {
  2687. panic("unexpected invocation of MockUsersStore.GetByUsername")
  2688. },
  2689. },
  2690. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2691. defaultHook: func(context.Context, []string) ([]string, error) {
  2692. panic("unexpected invocation of MockUsersStore.GetMailableEmailsByUsernames")
  2693. },
  2694. },
  2695. HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
  2696. defaultHook: func(context.Context, int64, int64) bool {
  2697. panic("unexpected invocation of MockUsersStore.HasForkedRepository")
  2698. },
  2699. },
  2700. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2701. defaultHook: func(context.Context, string, int64) bool {
  2702. panic("unexpected invocation of MockUsersStore.IsUsernameUsed")
  2703. },
  2704. },
  2705. ListFunc: &UsersStoreListFunc{
  2706. defaultHook: func(context.Context, int, int) ([]*db.User, error) {
  2707. panic("unexpected invocation of MockUsersStore.List")
  2708. },
  2709. },
  2710. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2711. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  2712. panic("unexpected invocation of MockUsersStore.ListFollowers")
  2713. },
  2714. },
  2715. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2716. defaultHook: func(context.Context, int64, int, int) ([]*db.User, error) {
  2717. panic("unexpected invocation of MockUsersStore.ListFollowings")
  2718. },
  2719. },
  2720. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  2721. defaultHook: func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  2722. panic("unexpected invocation of MockUsersStore.SearchByName")
  2723. },
  2724. },
  2725. UpdateFunc: &UsersStoreUpdateFunc{
  2726. defaultHook: func(context.Context, int64, db.UpdateUserOptions) error {
  2727. panic("unexpected invocation of MockUsersStore.Update")
  2728. },
  2729. },
  2730. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  2731. defaultHook: func(context.Context, int64, []byte) error {
  2732. panic("unexpected invocation of MockUsersStore.UseCustomAvatar")
  2733. },
  2734. },
  2735. }
  2736. }
  2737. // NewMockUsersStoreFrom creates a new mock of the MockUsersStore interface.
  2738. // All methods delegate to the given implementation, unless overwritten.
  2739. func NewMockUsersStoreFrom(i db.UsersStore) *MockUsersStore {
  2740. return &MockUsersStore{
  2741. AuthenticateFunc: &UsersStoreAuthenticateFunc{
  2742. defaultHook: i.Authenticate,
  2743. },
  2744. ChangeUsernameFunc: &UsersStoreChangeUsernameFunc{
  2745. defaultHook: i.ChangeUsername,
  2746. },
  2747. CountFunc: &UsersStoreCountFunc{
  2748. defaultHook: i.Count,
  2749. },
  2750. CreateFunc: &UsersStoreCreateFunc{
  2751. defaultHook: i.Create,
  2752. },
  2753. DeleteByIDFunc: &UsersStoreDeleteByIDFunc{
  2754. defaultHook: i.DeleteByID,
  2755. },
  2756. DeleteCustomAvatarFunc: &UsersStoreDeleteCustomAvatarFunc{
  2757. defaultHook: i.DeleteCustomAvatar,
  2758. },
  2759. DeleteInactivatedFunc: &UsersStoreDeleteInactivatedFunc{
  2760. defaultHook: i.DeleteInactivated,
  2761. },
  2762. GetByEmailFunc: &UsersStoreGetByEmailFunc{
  2763. defaultHook: i.GetByEmail,
  2764. },
  2765. GetByIDFunc: &UsersStoreGetByIDFunc{
  2766. defaultHook: i.GetByID,
  2767. },
  2768. GetByKeyIDFunc: &UsersStoreGetByKeyIDFunc{
  2769. defaultHook: i.GetByKeyID,
  2770. },
  2771. GetByUsernameFunc: &UsersStoreGetByUsernameFunc{
  2772. defaultHook: i.GetByUsername,
  2773. },
  2774. GetMailableEmailsByUsernamesFunc: &UsersStoreGetMailableEmailsByUsernamesFunc{
  2775. defaultHook: i.GetMailableEmailsByUsernames,
  2776. },
  2777. HasForkedRepositoryFunc: &UsersStoreHasForkedRepositoryFunc{
  2778. defaultHook: i.HasForkedRepository,
  2779. },
  2780. IsUsernameUsedFunc: &UsersStoreIsUsernameUsedFunc{
  2781. defaultHook: i.IsUsernameUsed,
  2782. },
  2783. ListFunc: &UsersStoreListFunc{
  2784. defaultHook: i.List,
  2785. },
  2786. ListFollowersFunc: &UsersStoreListFollowersFunc{
  2787. defaultHook: i.ListFollowers,
  2788. },
  2789. ListFollowingsFunc: &UsersStoreListFollowingsFunc{
  2790. defaultHook: i.ListFollowings,
  2791. },
  2792. SearchByNameFunc: &UsersStoreSearchByNameFunc{
  2793. defaultHook: i.SearchByName,
  2794. },
  2795. UpdateFunc: &UsersStoreUpdateFunc{
  2796. defaultHook: i.Update,
  2797. },
  2798. UseCustomAvatarFunc: &UsersStoreUseCustomAvatarFunc{
  2799. defaultHook: i.UseCustomAvatar,
  2800. },
  2801. }
  2802. }
  2803. // UsersStoreAuthenticateFunc describes the behavior when the Authenticate
  2804. // method of the parent MockUsersStore instance is invoked.
  2805. type UsersStoreAuthenticateFunc struct {
  2806. defaultHook func(context.Context, string, string, int64) (*db.User, error)
  2807. hooks []func(context.Context, string, string, int64) (*db.User, error)
  2808. history []UsersStoreAuthenticateFuncCall
  2809. mutex sync.Mutex
  2810. }
  2811. // Authenticate delegates to the next hook function in the queue and stores
  2812. // the parameter and result values of this invocation.
  2813. func (m *MockUsersStore) Authenticate(v0 context.Context, v1 string, v2 string, v3 int64) (*db.User, error) {
  2814. r0, r1 := m.AuthenticateFunc.nextHook()(v0, v1, v2, v3)
  2815. m.AuthenticateFunc.appendCall(UsersStoreAuthenticateFuncCall{v0, v1, v2, v3, r0, r1})
  2816. return r0, r1
  2817. }
  2818. // SetDefaultHook sets function that is called when the Authenticate method
  2819. // of the parent MockUsersStore instance is invoked and the hook queue is
  2820. // empty.
  2821. func (f *UsersStoreAuthenticateFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  2822. f.defaultHook = hook
  2823. }
  2824. // PushHook adds a function to the end of hook queue. Each invocation of the
  2825. // Authenticate method of the parent MockUsersStore instance invokes the
  2826. // hook at the front of the queue and discards it. After the queue is empty,
  2827. // the default hook function is invoked for any future action.
  2828. func (f *UsersStoreAuthenticateFunc) PushHook(hook func(context.Context, string, string, int64) (*db.User, error)) {
  2829. f.mutex.Lock()
  2830. f.hooks = append(f.hooks, hook)
  2831. f.mutex.Unlock()
  2832. }
  2833. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2834. // given values.
  2835. func (f *UsersStoreAuthenticateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  2836. f.SetDefaultHook(func(context.Context, string, string, int64) (*db.User, error) {
  2837. return r0, r1
  2838. })
  2839. }
  2840. // PushReturn calls PushHook with a function that returns the given values.
  2841. func (f *UsersStoreAuthenticateFunc) PushReturn(r0 *db.User, r1 error) {
  2842. f.PushHook(func(context.Context, string, string, int64) (*db.User, error) {
  2843. return r0, r1
  2844. })
  2845. }
  2846. func (f *UsersStoreAuthenticateFunc) nextHook() func(context.Context, string, string, int64) (*db.User, error) {
  2847. f.mutex.Lock()
  2848. defer f.mutex.Unlock()
  2849. if len(f.hooks) == 0 {
  2850. return f.defaultHook
  2851. }
  2852. hook := f.hooks[0]
  2853. f.hooks = f.hooks[1:]
  2854. return hook
  2855. }
  2856. func (f *UsersStoreAuthenticateFunc) appendCall(r0 UsersStoreAuthenticateFuncCall) {
  2857. f.mutex.Lock()
  2858. f.history = append(f.history, r0)
  2859. f.mutex.Unlock()
  2860. }
  2861. // History returns a sequence of UsersStoreAuthenticateFuncCall objects
  2862. // describing the invocations of this function.
  2863. func (f *UsersStoreAuthenticateFunc) History() []UsersStoreAuthenticateFuncCall {
  2864. f.mutex.Lock()
  2865. history := make([]UsersStoreAuthenticateFuncCall, len(f.history))
  2866. copy(history, f.history)
  2867. f.mutex.Unlock()
  2868. return history
  2869. }
  2870. // UsersStoreAuthenticateFuncCall is an object that describes an invocation
  2871. // of method Authenticate on an instance of MockUsersStore.
  2872. type UsersStoreAuthenticateFuncCall struct {
  2873. // Arg0 is the value of the 1st argument passed to this method
  2874. // invocation.
  2875. Arg0 context.Context
  2876. // Arg1 is the value of the 2nd argument passed to this method
  2877. // invocation.
  2878. Arg1 string
  2879. // Arg2 is the value of the 3rd argument passed to this method
  2880. // invocation.
  2881. Arg2 string
  2882. // Arg3 is the value of the 4th argument passed to this method
  2883. // invocation.
  2884. Arg3 int64
  2885. // Result0 is the value of the 1st result returned from this method
  2886. // invocation.
  2887. Result0 *db.User
  2888. // Result1 is the value of the 2nd result returned from this method
  2889. // invocation.
  2890. Result1 error
  2891. }
  2892. // Args returns an interface slice containing the arguments of this
  2893. // invocation.
  2894. func (c UsersStoreAuthenticateFuncCall) Args() []interface{} {
  2895. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  2896. }
  2897. // Results returns an interface slice containing the results of this
  2898. // invocation.
  2899. func (c UsersStoreAuthenticateFuncCall) Results() []interface{} {
  2900. return []interface{}{c.Result0, c.Result1}
  2901. }
  2902. // UsersStoreChangeUsernameFunc describes the behavior when the
  2903. // ChangeUsername method of the parent MockUsersStore instance is invoked.
  2904. type UsersStoreChangeUsernameFunc struct {
  2905. defaultHook func(context.Context, int64, string) error
  2906. hooks []func(context.Context, int64, string) error
  2907. history []UsersStoreChangeUsernameFuncCall
  2908. mutex sync.Mutex
  2909. }
  2910. // ChangeUsername delegates to the next hook function in the queue and
  2911. // stores the parameter and result values of this invocation.
  2912. func (m *MockUsersStore) ChangeUsername(v0 context.Context, v1 int64, v2 string) error {
  2913. r0 := m.ChangeUsernameFunc.nextHook()(v0, v1, v2)
  2914. m.ChangeUsernameFunc.appendCall(UsersStoreChangeUsernameFuncCall{v0, v1, v2, r0})
  2915. return r0
  2916. }
  2917. // SetDefaultHook sets function that is called when the ChangeUsername
  2918. // method of the parent MockUsersStore instance is invoked and the hook
  2919. // queue is empty.
  2920. func (f *UsersStoreChangeUsernameFunc) SetDefaultHook(hook func(context.Context, int64, string) error) {
  2921. f.defaultHook = hook
  2922. }
  2923. // PushHook adds a function to the end of hook queue. Each invocation of the
  2924. // ChangeUsername method of the parent MockUsersStore instance invokes the
  2925. // hook at the front of the queue and discards it. After the queue is empty,
  2926. // the default hook function is invoked for any future action.
  2927. func (f *UsersStoreChangeUsernameFunc) PushHook(hook func(context.Context, int64, string) error) {
  2928. f.mutex.Lock()
  2929. f.hooks = append(f.hooks, hook)
  2930. f.mutex.Unlock()
  2931. }
  2932. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  2933. // given values.
  2934. func (f *UsersStoreChangeUsernameFunc) SetDefaultReturn(r0 error) {
  2935. f.SetDefaultHook(func(context.Context, int64, string) error {
  2936. return r0
  2937. })
  2938. }
  2939. // PushReturn calls PushHook with a function that returns the given values.
  2940. func (f *UsersStoreChangeUsernameFunc) PushReturn(r0 error) {
  2941. f.PushHook(func(context.Context, int64, string) error {
  2942. return r0
  2943. })
  2944. }
  2945. func (f *UsersStoreChangeUsernameFunc) nextHook() func(context.Context, int64, string) error {
  2946. f.mutex.Lock()
  2947. defer f.mutex.Unlock()
  2948. if len(f.hooks) == 0 {
  2949. return f.defaultHook
  2950. }
  2951. hook := f.hooks[0]
  2952. f.hooks = f.hooks[1:]
  2953. return hook
  2954. }
  2955. func (f *UsersStoreChangeUsernameFunc) appendCall(r0 UsersStoreChangeUsernameFuncCall) {
  2956. f.mutex.Lock()
  2957. f.history = append(f.history, r0)
  2958. f.mutex.Unlock()
  2959. }
  2960. // History returns a sequence of UsersStoreChangeUsernameFuncCall objects
  2961. // describing the invocations of this function.
  2962. func (f *UsersStoreChangeUsernameFunc) History() []UsersStoreChangeUsernameFuncCall {
  2963. f.mutex.Lock()
  2964. history := make([]UsersStoreChangeUsernameFuncCall, len(f.history))
  2965. copy(history, f.history)
  2966. f.mutex.Unlock()
  2967. return history
  2968. }
  2969. // UsersStoreChangeUsernameFuncCall is an object that describes an
  2970. // invocation of method ChangeUsername on an instance of MockUsersStore.
  2971. type UsersStoreChangeUsernameFuncCall struct {
  2972. // Arg0 is the value of the 1st argument passed to this method
  2973. // invocation.
  2974. Arg0 context.Context
  2975. // Arg1 is the value of the 2nd argument passed to this method
  2976. // invocation.
  2977. Arg1 int64
  2978. // Arg2 is the value of the 3rd argument passed to this method
  2979. // invocation.
  2980. Arg2 string
  2981. // Result0 is the value of the 1st result returned from this method
  2982. // invocation.
  2983. Result0 error
  2984. }
  2985. // Args returns an interface slice containing the arguments of this
  2986. // invocation.
  2987. func (c UsersStoreChangeUsernameFuncCall) Args() []interface{} {
  2988. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  2989. }
  2990. // Results returns an interface slice containing the results of this
  2991. // invocation.
  2992. func (c UsersStoreChangeUsernameFuncCall) Results() []interface{} {
  2993. return []interface{}{c.Result0}
  2994. }
  2995. // UsersStoreCountFunc describes the behavior when the Count method of the
  2996. // parent MockUsersStore instance is invoked.
  2997. type UsersStoreCountFunc struct {
  2998. defaultHook func(context.Context) int64
  2999. hooks []func(context.Context) int64
  3000. history []UsersStoreCountFuncCall
  3001. mutex sync.Mutex
  3002. }
  3003. // Count delegates to the next hook function in the queue and stores the
  3004. // parameter and result values of this invocation.
  3005. func (m *MockUsersStore) Count(v0 context.Context) int64 {
  3006. r0 := m.CountFunc.nextHook()(v0)
  3007. m.CountFunc.appendCall(UsersStoreCountFuncCall{v0, r0})
  3008. return r0
  3009. }
  3010. // SetDefaultHook sets function that is called when the Count method of the
  3011. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3012. func (f *UsersStoreCountFunc) SetDefaultHook(hook func(context.Context) int64) {
  3013. f.defaultHook = hook
  3014. }
  3015. // PushHook adds a function to the end of hook queue. Each invocation of the
  3016. // Count method of the parent MockUsersStore instance invokes the hook at
  3017. // the front of the queue and discards it. After the queue is empty, the
  3018. // default hook function is invoked for any future action.
  3019. func (f *UsersStoreCountFunc) PushHook(hook func(context.Context) int64) {
  3020. f.mutex.Lock()
  3021. f.hooks = append(f.hooks, hook)
  3022. f.mutex.Unlock()
  3023. }
  3024. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3025. // given values.
  3026. func (f *UsersStoreCountFunc) SetDefaultReturn(r0 int64) {
  3027. f.SetDefaultHook(func(context.Context) int64 {
  3028. return r0
  3029. })
  3030. }
  3031. // PushReturn calls PushHook with a function that returns the given values.
  3032. func (f *UsersStoreCountFunc) PushReturn(r0 int64) {
  3033. f.PushHook(func(context.Context) int64 {
  3034. return r0
  3035. })
  3036. }
  3037. func (f *UsersStoreCountFunc) nextHook() func(context.Context) int64 {
  3038. f.mutex.Lock()
  3039. defer f.mutex.Unlock()
  3040. if len(f.hooks) == 0 {
  3041. return f.defaultHook
  3042. }
  3043. hook := f.hooks[0]
  3044. f.hooks = f.hooks[1:]
  3045. return hook
  3046. }
  3047. func (f *UsersStoreCountFunc) appendCall(r0 UsersStoreCountFuncCall) {
  3048. f.mutex.Lock()
  3049. f.history = append(f.history, r0)
  3050. f.mutex.Unlock()
  3051. }
  3052. // History returns a sequence of UsersStoreCountFuncCall objects describing
  3053. // the invocations of this function.
  3054. func (f *UsersStoreCountFunc) History() []UsersStoreCountFuncCall {
  3055. f.mutex.Lock()
  3056. history := make([]UsersStoreCountFuncCall, len(f.history))
  3057. copy(history, f.history)
  3058. f.mutex.Unlock()
  3059. return history
  3060. }
  3061. // UsersStoreCountFuncCall is an object that describes an invocation of
  3062. // method Count on an instance of MockUsersStore.
  3063. type UsersStoreCountFuncCall struct {
  3064. // Arg0 is the value of the 1st argument passed to this method
  3065. // invocation.
  3066. Arg0 context.Context
  3067. // Result0 is the value of the 1st result returned from this method
  3068. // invocation.
  3069. Result0 int64
  3070. }
  3071. // Args returns an interface slice containing the arguments of this
  3072. // invocation.
  3073. func (c UsersStoreCountFuncCall) Args() []interface{} {
  3074. return []interface{}{c.Arg0}
  3075. }
  3076. // Results returns an interface slice containing the results of this
  3077. // invocation.
  3078. func (c UsersStoreCountFuncCall) Results() []interface{} {
  3079. return []interface{}{c.Result0}
  3080. }
  3081. // UsersStoreCreateFunc describes the behavior when the Create method of the
  3082. // parent MockUsersStore instance is invoked.
  3083. type UsersStoreCreateFunc struct {
  3084. defaultHook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  3085. hooks []func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)
  3086. history []UsersStoreCreateFuncCall
  3087. mutex sync.Mutex
  3088. }
  3089. // Create delegates to the next hook function in the queue and stores the
  3090. // parameter and result values of this invocation.
  3091. func (m *MockUsersStore) Create(v0 context.Context, v1 string, v2 string, v3 db.CreateUserOptions) (*db.User, error) {
  3092. r0, r1 := m.CreateFunc.nextHook()(v0, v1, v2, v3)
  3093. m.CreateFunc.appendCall(UsersStoreCreateFuncCall{v0, v1, v2, v3, r0, r1})
  3094. return r0, r1
  3095. }
  3096. // SetDefaultHook sets function that is called when the Create method of the
  3097. // parent MockUsersStore instance is invoked and the hook queue is empty.
  3098. func (f *UsersStoreCreateFunc) SetDefaultHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  3099. f.defaultHook = hook
  3100. }
  3101. // PushHook adds a function to the end of hook queue. Each invocation of the
  3102. // Create method of the parent MockUsersStore instance invokes the hook at
  3103. // the front of the queue and discards it. After the queue is empty, the
  3104. // default hook function is invoked for any future action.
  3105. func (f *UsersStoreCreateFunc) PushHook(hook func(context.Context, string, string, db.CreateUserOptions) (*db.User, error)) {
  3106. f.mutex.Lock()
  3107. f.hooks = append(f.hooks, hook)
  3108. f.mutex.Unlock()
  3109. }
  3110. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3111. // given values.
  3112. func (f *UsersStoreCreateFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3113. f.SetDefaultHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3114. return r0, r1
  3115. })
  3116. }
  3117. // PushReturn calls PushHook with a function that returns the given values.
  3118. func (f *UsersStoreCreateFunc) PushReturn(r0 *db.User, r1 error) {
  3119. f.PushHook(func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3120. return r0, r1
  3121. })
  3122. }
  3123. func (f *UsersStoreCreateFunc) nextHook() func(context.Context, string, string, db.CreateUserOptions) (*db.User, error) {
  3124. f.mutex.Lock()
  3125. defer f.mutex.Unlock()
  3126. if len(f.hooks) == 0 {
  3127. return f.defaultHook
  3128. }
  3129. hook := f.hooks[0]
  3130. f.hooks = f.hooks[1:]
  3131. return hook
  3132. }
  3133. func (f *UsersStoreCreateFunc) appendCall(r0 UsersStoreCreateFuncCall) {
  3134. f.mutex.Lock()
  3135. f.history = append(f.history, r0)
  3136. f.mutex.Unlock()
  3137. }
  3138. // History returns a sequence of UsersStoreCreateFuncCall objects describing
  3139. // the invocations of this function.
  3140. func (f *UsersStoreCreateFunc) History() []UsersStoreCreateFuncCall {
  3141. f.mutex.Lock()
  3142. history := make([]UsersStoreCreateFuncCall, len(f.history))
  3143. copy(history, f.history)
  3144. f.mutex.Unlock()
  3145. return history
  3146. }
  3147. // UsersStoreCreateFuncCall is an object that describes an invocation of
  3148. // method Create on an instance of MockUsersStore.
  3149. type UsersStoreCreateFuncCall struct {
  3150. // Arg0 is the value of the 1st argument passed to this method
  3151. // invocation.
  3152. Arg0 context.Context
  3153. // Arg1 is the value of the 2nd argument passed to this method
  3154. // invocation.
  3155. Arg1 string
  3156. // Arg2 is the value of the 3rd argument passed to this method
  3157. // invocation.
  3158. Arg2 string
  3159. // Arg3 is the value of the 4th argument passed to this method
  3160. // invocation.
  3161. Arg3 db.CreateUserOptions
  3162. // Result0 is the value of the 1st result returned from this method
  3163. // invocation.
  3164. Result0 *db.User
  3165. // Result1 is the value of the 2nd result returned from this method
  3166. // invocation.
  3167. Result1 error
  3168. }
  3169. // Args returns an interface slice containing the arguments of this
  3170. // invocation.
  3171. func (c UsersStoreCreateFuncCall) Args() []interface{} {
  3172. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  3173. }
  3174. // Results returns an interface slice containing the results of this
  3175. // invocation.
  3176. func (c UsersStoreCreateFuncCall) Results() []interface{} {
  3177. return []interface{}{c.Result0, c.Result1}
  3178. }
  3179. // UsersStoreDeleteByIDFunc describes the behavior when the DeleteByID
  3180. // method of the parent MockUsersStore instance is invoked.
  3181. type UsersStoreDeleteByIDFunc struct {
  3182. defaultHook func(context.Context, int64, bool) error
  3183. hooks []func(context.Context, int64, bool) error
  3184. history []UsersStoreDeleteByIDFuncCall
  3185. mutex sync.Mutex
  3186. }
  3187. // DeleteByID delegates to the next hook function in the queue and stores
  3188. // the parameter and result values of this invocation.
  3189. func (m *MockUsersStore) DeleteByID(v0 context.Context, v1 int64, v2 bool) error {
  3190. r0 := m.DeleteByIDFunc.nextHook()(v0, v1, v2)
  3191. m.DeleteByIDFunc.appendCall(UsersStoreDeleteByIDFuncCall{v0, v1, v2, r0})
  3192. return r0
  3193. }
  3194. // SetDefaultHook sets function that is called when the DeleteByID method of
  3195. // the parent MockUsersStore instance is invoked and the hook queue is
  3196. // empty.
  3197. func (f *UsersStoreDeleteByIDFunc) SetDefaultHook(hook func(context.Context, int64, bool) error) {
  3198. f.defaultHook = hook
  3199. }
  3200. // PushHook adds a function to the end of hook queue. Each invocation of the
  3201. // DeleteByID method of the parent MockUsersStore instance invokes the hook
  3202. // at the front of the queue and discards it. After the queue is empty, the
  3203. // default hook function is invoked for any future action.
  3204. func (f *UsersStoreDeleteByIDFunc) PushHook(hook func(context.Context, int64, bool) error) {
  3205. f.mutex.Lock()
  3206. f.hooks = append(f.hooks, hook)
  3207. f.mutex.Unlock()
  3208. }
  3209. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3210. // given values.
  3211. func (f *UsersStoreDeleteByIDFunc) SetDefaultReturn(r0 error) {
  3212. f.SetDefaultHook(func(context.Context, int64, bool) error {
  3213. return r0
  3214. })
  3215. }
  3216. // PushReturn calls PushHook with a function that returns the given values.
  3217. func (f *UsersStoreDeleteByIDFunc) PushReturn(r0 error) {
  3218. f.PushHook(func(context.Context, int64, bool) error {
  3219. return r0
  3220. })
  3221. }
  3222. func (f *UsersStoreDeleteByIDFunc) nextHook() func(context.Context, int64, bool) error {
  3223. f.mutex.Lock()
  3224. defer f.mutex.Unlock()
  3225. if len(f.hooks) == 0 {
  3226. return f.defaultHook
  3227. }
  3228. hook := f.hooks[0]
  3229. f.hooks = f.hooks[1:]
  3230. return hook
  3231. }
  3232. func (f *UsersStoreDeleteByIDFunc) appendCall(r0 UsersStoreDeleteByIDFuncCall) {
  3233. f.mutex.Lock()
  3234. f.history = append(f.history, r0)
  3235. f.mutex.Unlock()
  3236. }
  3237. // History returns a sequence of UsersStoreDeleteByIDFuncCall objects
  3238. // describing the invocations of this function.
  3239. func (f *UsersStoreDeleteByIDFunc) History() []UsersStoreDeleteByIDFuncCall {
  3240. f.mutex.Lock()
  3241. history := make([]UsersStoreDeleteByIDFuncCall, len(f.history))
  3242. copy(history, f.history)
  3243. f.mutex.Unlock()
  3244. return history
  3245. }
  3246. // UsersStoreDeleteByIDFuncCall is an object that describes an invocation of
  3247. // method DeleteByID on an instance of MockUsersStore.
  3248. type UsersStoreDeleteByIDFuncCall struct {
  3249. // Arg0 is the value of the 1st argument passed to this method
  3250. // invocation.
  3251. Arg0 context.Context
  3252. // Arg1 is the value of the 2nd argument passed to this method
  3253. // invocation.
  3254. Arg1 int64
  3255. // Arg2 is the value of the 3rd argument passed to this method
  3256. // invocation.
  3257. Arg2 bool
  3258. // Result0 is the value of the 1st result returned from this method
  3259. // invocation.
  3260. Result0 error
  3261. }
  3262. // Args returns an interface slice containing the arguments of this
  3263. // invocation.
  3264. func (c UsersStoreDeleteByIDFuncCall) Args() []interface{} {
  3265. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  3266. }
  3267. // Results returns an interface slice containing the results of this
  3268. // invocation.
  3269. func (c UsersStoreDeleteByIDFuncCall) Results() []interface{} {
  3270. return []interface{}{c.Result0}
  3271. }
  3272. // UsersStoreDeleteCustomAvatarFunc describes the behavior when the
  3273. // DeleteCustomAvatar method of the parent MockUsersStore instance is
  3274. // invoked.
  3275. type UsersStoreDeleteCustomAvatarFunc struct {
  3276. defaultHook func(context.Context, int64) error
  3277. hooks []func(context.Context, int64) error
  3278. history []UsersStoreDeleteCustomAvatarFuncCall
  3279. mutex sync.Mutex
  3280. }
  3281. // DeleteCustomAvatar delegates to the next hook function in the queue and
  3282. // stores the parameter and result values of this invocation.
  3283. func (m *MockUsersStore) DeleteCustomAvatar(v0 context.Context, v1 int64) error {
  3284. r0 := m.DeleteCustomAvatarFunc.nextHook()(v0, v1)
  3285. m.DeleteCustomAvatarFunc.appendCall(UsersStoreDeleteCustomAvatarFuncCall{v0, v1, r0})
  3286. return r0
  3287. }
  3288. // SetDefaultHook sets function that is called when the DeleteCustomAvatar
  3289. // method of the parent MockUsersStore instance is invoked and the hook
  3290. // queue is empty.
  3291. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64) error) {
  3292. f.defaultHook = hook
  3293. }
  3294. // PushHook adds a function to the end of hook queue. Each invocation of the
  3295. // DeleteCustomAvatar method of the parent MockUsersStore instance invokes
  3296. // the hook at the front of the queue and discards it. After the queue is
  3297. // empty, the default hook function is invoked for any future action.
  3298. func (f *UsersStoreDeleteCustomAvatarFunc) PushHook(hook func(context.Context, int64) error) {
  3299. f.mutex.Lock()
  3300. f.hooks = append(f.hooks, hook)
  3301. f.mutex.Unlock()
  3302. }
  3303. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3304. // given values.
  3305. func (f *UsersStoreDeleteCustomAvatarFunc) SetDefaultReturn(r0 error) {
  3306. f.SetDefaultHook(func(context.Context, int64) error {
  3307. return r0
  3308. })
  3309. }
  3310. // PushReturn calls PushHook with a function that returns the given values.
  3311. func (f *UsersStoreDeleteCustomAvatarFunc) PushReturn(r0 error) {
  3312. f.PushHook(func(context.Context, int64) error {
  3313. return r0
  3314. })
  3315. }
  3316. func (f *UsersStoreDeleteCustomAvatarFunc) nextHook() func(context.Context, int64) error {
  3317. f.mutex.Lock()
  3318. defer f.mutex.Unlock()
  3319. if len(f.hooks) == 0 {
  3320. return f.defaultHook
  3321. }
  3322. hook := f.hooks[0]
  3323. f.hooks = f.hooks[1:]
  3324. return hook
  3325. }
  3326. func (f *UsersStoreDeleteCustomAvatarFunc) appendCall(r0 UsersStoreDeleteCustomAvatarFuncCall) {
  3327. f.mutex.Lock()
  3328. f.history = append(f.history, r0)
  3329. f.mutex.Unlock()
  3330. }
  3331. // History returns a sequence of UsersStoreDeleteCustomAvatarFuncCall
  3332. // objects describing the invocations of this function.
  3333. func (f *UsersStoreDeleteCustomAvatarFunc) History() []UsersStoreDeleteCustomAvatarFuncCall {
  3334. f.mutex.Lock()
  3335. history := make([]UsersStoreDeleteCustomAvatarFuncCall, len(f.history))
  3336. copy(history, f.history)
  3337. f.mutex.Unlock()
  3338. return history
  3339. }
  3340. // UsersStoreDeleteCustomAvatarFuncCall is an object that describes an
  3341. // invocation of method DeleteCustomAvatar on an instance of MockUsersStore.
  3342. type UsersStoreDeleteCustomAvatarFuncCall struct {
  3343. // Arg0 is the value of the 1st argument passed to this method
  3344. // invocation.
  3345. Arg0 context.Context
  3346. // Arg1 is the value of the 2nd argument passed to this method
  3347. // invocation.
  3348. Arg1 int64
  3349. // Result0 is the value of the 1st result returned from this method
  3350. // invocation.
  3351. Result0 error
  3352. }
  3353. // Args returns an interface slice containing the arguments of this
  3354. // invocation.
  3355. func (c UsersStoreDeleteCustomAvatarFuncCall) Args() []interface{} {
  3356. return []interface{}{c.Arg0, c.Arg1}
  3357. }
  3358. // Results returns an interface slice containing the results of this
  3359. // invocation.
  3360. func (c UsersStoreDeleteCustomAvatarFuncCall) Results() []interface{} {
  3361. return []interface{}{c.Result0}
  3362. }
  3363. // UsersStoreDeleteInactivatedFunc describes the behavior when the
  3364. // DeleteInactivated method of the parent MockUsersStore instance is
  3365. // invoked.
  3366. type UsersStoreDeleteInactivatedFunc struct {
  3367. defaultHook func() error
  3368. hooks []func() error
  3369. history []UsersStoreDeleteInactivatedFuncCall
  3370. mutex sync.Mutex
  3371. }
  3372. // DeleteInactivated delegates to the next hook function in the queue and
  3373. // stores the parameter and result values of this invocation.
  3374. func (m *MockUsersStore) DeleteInactivated() error {
  3375. r0 := m.DeleteInactivatedFunc.nextHook()()
  3376. m.DeleteInactivatedFunc.appendCall(UsersStoreDeleteInactivatedFuncCall{r0})
  3377. return r0
  3378. }
  3379. // SetDefaultHook sets function that is called when the DeleteInactivated
  3380. // method of the parent MockUsersStore instance is invoked and the hook
  3381. // queue is empty.
  3382. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultHook(hook func() error) {
  3383. f.defaultHook = hook
  3384. }
  3385. // PushHook adds a function to the end of hook queue. Each invocation of the
  3386. // DeleteInactivated method of the parent MockUsersStore instance invokes
  3387. // the hook at the front of the queue and discards it. After the queue is
  3388. // empty, the default hook function is invoked for any future action.
  3389. func (f *UsersStoreDeleteInactivatedFunc) PushHook(hook func() error) {
  3390. f.mutex.Lock()
  3391. f.hooks = append(f.hooks, hook)
  3392. f.mutex.Unlock()
  3393. }
  3394. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3395. // given values.
  3396. func (f *UsersStoreDeleteInactivatedFunc) SetDefaultReturn(r0 error) {
  3397. f.SetDefaultHook(func() error {
  3398. return r0
  3399. })
  3400. }
  3401. // PushReturn calls PushHook with a function that returns the given values.
  3402. func (f *UsersStoreDeleteInactivatedFunc) PushReturn(r0 error) {
  3403. f.PushHook(func() error {
  3404. return r0
  3405. })
  3406. }
  3407. func (f *UsersStoreDeleteInactivatedFunc) nextHook() func() error {
  3408. f.mutex.Lock()
  3409. defer f.mutex.Unlock()
  3410. if len(f.hooks) == 0 {
  3411. return f.defaultHook
  3412. }
  3413. hook := f.hooks[0]
  3414. f.hooks = f.hooks[1:]
  3415. return hook
  3416. }
  3417. func (f *UsersStoreDeleteInactivatedFunc) appendCall(r0 UsersStoreDeleteInactivatedFuncCall) {
  3418. f.mutex.Lock()
  3419. f.history = append(f.history, r0)
  3420. f.mutex.Unlock()
  3421. }
  3422. // History returns a sequence of UsersStoreDeleteInactivatedFuncCall objects
  3423. // describing the invocations of this function.
  3424. func (f *UsersStoreDeleteInactivatedFunc) History() []UsersStoreDeleteInactivatedFuncCall {
  3425. f.mutex.Lock()
  3426. history := make([]UsersStoreDeleteInactivatedFuncCall, len(f.history))
  3427. copy(history, f.history)
  3428. f.mutex.Unlock()
  3429. return history
  3430. }
  3431. // UsersStoreDeleteInactivatedFuncCall is an object that describes an
  3432. // invocation of method DeleteInactivated on an instance of MockUsersStore.
  3433. type UsersStoreDeleteInactivatedFuncCall struct {
  3434. // Result0 is the value of the 1st result returned from this method
  3435. // invocation.
  3436. Result0 error
  3437. }
  3438. // Args returns an interface slice containing the arguments of this
  3439. // invocation.
  3440. func (c UsersStoreDeleteInactivatedFuncCall) Args() []interface{} {
  3441. return []interface{}{}
  3442. }
  3443. // Results returns an interface slice containing the results of this
  3444. // invocation.
  3445. func (c UsersStoreDeleteInactivatedFuncCall) Results() []interface{} {
  3446. return []interface{}{c.Result0}
  3447. }
  3448. // UsersStoreGetByEmailFunc describes the behavior when the GetByEmail
  3449. // method of the parent MockUsersStore instance is invoked.
  3450. type UsersStoreGetByEmailFunc struct {
  3451. defaultHook func(context.Context, string) (*db.User, error)
  3452. hooks []func(context.Context, string) (*db.User, error)
  3453. history []UsersStoreGetByEmailFuncCall
  3454. mutex sync.Mutex
  3455. }
  3456. // GetByEmail delegates to the next hook function in the queue and stores
  3457. // the parameter and result values of this invocation.
  3458. func (m *MockUsersStore) GetByEmail(v0 context.Context, v1 string) (*db.User, error) {
  3459. r0, r1 := m.GetByEmailFunc.nextHook()(v0, v1)
  3460. m.GetByEmailFunc.appendCall(UsersStoreGetByEmailFuncCall{v0, v1, r0, r1})
  3461. return r0, r1
  3462. }
  3463. // SetDefaultHook sets function that is called when the GetByEmail method of
  3464. // the parent MockUsersStore instance is invoked and the hook queue is
  3465. // empty.
  3466. func (f *UsersStoreGetByEmailFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  3467. f.defaultHook = hook
  3468. }
  3469. // PushHook adds a function to the end of hook queue. Each invocation of the
  3470. // GetByEmail method of the parent MockUsersStore instance invokes the hook
  3471. // at the front of the queue and discards it. After the queue is empty, the
  3472. // default hook function is invoked for any future action.
  3473. func (f *UsersStoreGetByEmailFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  3474. f.mutex.Lock()
  3475. f.hooks = append(f.hooks, hook)
  3476. f.mutex.Unlock()
  3477. }
  3478. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3479. // given values.
  3480. func (f *UsersStoreGetByEmailFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3481. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  3482. return r0, r1
  3483. })
  3484. }
  3485. // PushReturn calls PushHook with a function that returns the given values.
  3486. func (f *UsersStoreGetByEmailFunc) PushReturn(r0 *db.User, r1 error) {
  3487. f.PushHook(func(context.Context, string) (*db.User, error) {
  3488. return r0, r1
  3489. })
  3490. }
  3491. func (f *UsersStoreGetByEmailFunc) nextHook() func(context.Context, string) (*db.User, error) {
  3492. f.mutex.Lock()
  3493. defer f.mutex.Unlock()
  3494. if len(f.hooks) == 0 {
  3495. return f.defaultHook
  3496. }
  3497. hook := f.hooks[0]
  3498. f.hooks = f.hooks[1:]
  3499. return hook
  3500. }
  3501. func (f *UsersStoreGetByEmailFunc) appendCall(r0 UsersStoreGetByEmailFuncCall) {
  3502. f.mutex.Lock()
  3503. f.history = append(f.history, r0)
  3504. f.mutex.Unlock()
  3505. }
  3506. // History returns a sequence of UsersStoreGetByEmailFuncCall objects
  3507. // describing the invocations of this function.
  3508. func (f *UsersStoreGetByEmailFunc) History() []UsersStoreGetByEmailFuncCall {
  3509. f.mutex.Lock()
  3510. history := make([]UsersStoreGetByEmailFuncCall, len(f.history))
  3511. copy(history, f.history)
  3512. f.mutex.Unlock()
  3513. return history
  3514. }
  3515. // UsersStoreGetByEmailFuncCall is an object that describes an invocation of
  3516. // method GetByEmail on an instance of MockUsersStore.
  3517. type UsersStoreGetByEmailFuncCall struct {
  3518. // Arg0 is the value of the 1st argument passed to this method
  3519. // invocation.
  3520. Arg0 context.Context
  3521. // Arg1 is the value of the 2nd argument passed to this method
  3522. // invocation.
  3523. Arg1 string
  3524. // Result0 is the value of the 1st result returned from this method
  3525. // invocation.
  3526. Result0 *db.User
  3527. // Result1 is the value of the 2nd result returned from this method
  3528. // invocation.
  3529. Result1 error
  3530. }
  3531. // Args returns an interface slice containing the arguments of this
  3532. // invocation.
  3533. func (c UsersStoreGetByEmailFuncCall) Args() []interface{} {
  3534. return []interface{}{c.Arg0, c.Arg1}
  3535. }
  3536. // Results returns an interface slice containing the results of this
  3537. // invocation.
  3538. func (c UsersStoreGetByEmailFuncCall) Results() []interface{} {
  3539. return []interface{}{c.Result0, c.Result1}
  3540. }
  3541. // UsersStoreGetByIDFunc describes the behavior when the GetByID method of
  3542. // the parent MockUsersStore instance is invoked.
  3543. type UsersStoreGetByIDFunc struct {
  3544. defaultHook func(context.Context, int64) (*db.User, error)
  3545. hooks []func(context.Context, int64) (*db.User, error)
  3546. history []UsersStoreGetByIDFuncCall
  3547. mutex sync.Mutex
  3548. }
  3549. // GetByID delegates to the next hook function in the queue and stores the
  3550. // parameter and result values of this invocation.
  3551. func (m *MockUsersStore) GetByID(v0 context.Context, v1 int64) (*db.User, error) {
  3552. r0, r1 := m.GetByIDFunc.nextHook()(v0, v1)
  3553. m.GetByIDFunc.appendCall(UsersStoreGetByIDFuncCall{v0, v1, r0, r1})
  3554. return r0, r1
  3555. }
  3556. // SetDefaultHook sets function that is called when the GetByID method of
  3557. // the parent MockUsersStore instance is invoked and the hook queue is
  3558. // empty.
  3559. func (f *UsersStoreGetByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  3560. f.defaultHook = hook
  3561. }
  3562. // PushHook adds a function to the end of hook queue. Each invocation of the
  3563. // GetByID method of the parent MockUsersStore instance invokes the hook at
  3564. // the front of the queue and discards it. After the queue is empty, the
  3565. // default hook function is invoked for any future action.
  3566. func (f *UsersStoreGetByIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  3567. f.mutex.Lock()
  3568. f.hooks = append(f.hooks, hook)
  3569. f.mutex.Unlock()
  3570. }
  3571. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3572. // given values.
  3573. func (f *UsersStoreGetByIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3574. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  3575. return r0, r1
  3576. })
  3577. }
  3578. // PushReturn calls PushHook with a function that returns the given values.
  3579. func (f *UsersStoreGetByIDFunc) PushReturn(r0 *db.User, r1 error) {
  3580. f.PushHook(func(context.Context, int64) (*db.User, error) {
  3581. return r0, r1
  3582. })
  3583. }
  3584. func (f *UsersStoreGetByIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  3585. f.mutex.Lock()
  3586. defer f.mutex.Unlock()
  3587. if len(f.hooks) == 0 {
  3588. return f.defaultHook
  3589. }
  3590. hook := f.hooks[0]
  3591. f.hooks = f.hooks[1:]
  3592. return hook
  3593. }
  3594. func (f *UsersStoreGetByIDFunc) appendCall(r0 UsersStoreGetByIDFuncCall) {
  3595. f.mutex.Lock()
  3596. f.history = append(f.history, r0)
  3597. f.mutex.Unlock()
  3598. }
  3599. // History returns a sequence of UsersStoreGetByIDFuncCall objects
  3600. // describing the invocations of this function.
  3601. func (f *UsersStoreGetByIDFunc) History() []UsersStoreGetByIDFuncCall {
  3602. f.mutex.Lock()
  3603. history := make([]UsersStoreGetByIDFuncCall, len(f.history))
  3604. copy(history, f.history)
  3605. f.mutex.Unlock()
  3606. return history
  3607. }
  3608. // UsersStoreGetByIDFuncCall is an object that describes an invocation of
  3609. // method GetByID on an instance of MockUsersStore.
  3610. type UsersStoreGetByIDFuncCall struct {
  3611. // Arg0 is the value of the 1st argument passed to this method
  3612. // invocation.
  3613. Arg0 context.Context
  3614. // Arg1 is the value of the 2nd argument passed to this method
  3615. // invocation.
  3616. Arg1 int64
  3617. // Result0 is the value of the 1st result returned from this method
  3618. // invocation.
  3619. Result0 *db.User
  3620. // Result1 is the value of the 2nd result returned from this method
  3621. // invocation.
  3622. Result1 error
  3623. }
  3624. // Args returns an interface slice containing the arguments of this
  3625. // invocation.
  3626. func (c UsersStoreGetByIDFuncCall) Args() []interface{} {
  3627. return []interface{}{c.Arg0, c.Arg1}
  3628. }
  3629. // Results returns an interface slice containing the results of this
  3630. // invocation.
  3631. func (c UsersStoreGetByIDFuncCall) Results() []interface{} {
  3632. return []interface{}{c.Result0, c.Result1}
  3633. }
  3634. // UsersStoreGetByKeyIDFunc describes the behavior when the GetByKeyID
  3635. // method of the parent MockUsersStore instance is invoked.
  3636. type UsersStoreGetByKeyIDFunc struct {
  3637. defaultHook func(context.Context, int64) (*db.User, error)
  3638. hooks []func(context.Context, int64) (*db.User, error)
  3639. history []UsersStoreGetByKeyIDFuncCall
  3640. mutex sync.Mutex
  3641. }
  3642. // GetByKeyID delegates to the next hook function in the queue and stores
  3643. // the parameter and result values of this invocation.
  3644. func (m *MockUsersStore) GetByKeyID(v0 context.Context, v1 int64) (*db.User, error) {
  3645. r0, r1 := m.GetByKeyIDFunc.nextHook()(v0, v1)
  3646. m.GetByKeyIDFunc.appendCall(UsersStoreGetByKeyIDFuncCall{v0, v1, r0, r1})
  3647. return r0, r1
  3648. }
  3649. // SetDefaultHook sets function that is called when the GetByKeyID method of
  3650. // the parent MockUsersStore instance is invoked and the hook queue is
  3651. // empty.
  3652. func (f *UsersStoreGetByKeyIDFunc) SetDefaultHook(hook func(context.Context, int64) (*db.User, error)) {
  3653. f.defaultHook = hook
  3654. }
  3655. // PushHook adds a function to the end of hook queue. Each invocation of the
  3656. // GetByKeyID method of the parent MockUsersStore instance invokes the hook
  3657. // at the front of the queue and discards it. After the queue is empty, the
  3658. // default hook function is invoked for any future action.
  3659. func (f *UsersStoreGetByKeyIDFunc) PushHook(hook func(context.Context, int64) (*db.User, error)) {
  3660. f.mutex.Lock()
  3661. f.hooks = append(f.hooks, hook)
  3662. f.mutex.Unlock()
  3663. }
  3664. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3665. // given values.
  3666. func (f *UsersStoreGetByKeyIDFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3667. f.SetDefaultHook(func(context.Context, int64) (*db.User, error) {
  3668. return r0, r1
  3669. })
  3670. }
  3671. // PushReturn calls PushHook with a function that returns the given values.
  3672. func (f *UsersStoreGetByKeyIDFunc) PushReturn(r0 *db.User, r1 error) {
  3673. f.PushHook(func(context.Context, int64) (*db.User, error) {
  3674. return r0, r1
  3675. })
  3676. }
  3677. func (f *UsersStoreGetByKeyIDFunc) nextHook() func(context.Context, int64) (*db.User, error) {
  3678. f.mutex.Lock()
  3679. defer f.mutex.Unlock()
  3680. if len(f.hooks) == 0 {
  3681. return f.defaultHook
  3682. }
  3683. hook := f.hooks[0]
  3684. f.hooks = f.hooks[1:]
  3685. return hook
  3686. }
  3687. func (f *UsersStoreGetByKeyIDFunc) appendCall(r0 UsersStoreGetByKeyIDFuncCall) {
  3688. f.mutex.Lock()
  3689. f.history = append(f.history, r0)
  3690. f.mutex.Unlock()
  3691. }
  3692. // History returns a sequence of UsersStoreGetByKeyIDFuncCall objects
  3693. // describing the invocations of this function.
  3694. func (f *UsersStoreGetByKeyIDFunc) History() []UsersStoreGetByKeyIDFuncCall {
  3695. f.mutex.Lock()
  3696. history := make([]UsersStoreGetByKeyIDFuncCall, len(f.history))
  3697. copy(history, f.history)
  3698. f.mutex.Unlock()
  3699. return history
  3700. }
  3701. // UsersStoreGetByKeyIDFuncCall is an object that describes an invocation of
  3702. // method GetByKeyID on an instance of MockUsersStore.
  3703. type UsersStoreGetByKeyIDFuncCall struct {
  3704. // Arg0 is the value of the 1st argument passed to this method
  3705. // invocation.
  3706. Arg0 context.Context
  3707. // Arg1 is the value of the 2nd argument passed to this method
  3708. // invocation.
  3709. Arg1 int64
  3710. // Result0 is the value of the 1st result returned from this method
  3711. // invocation.
  3712. Result0 *db.User
  3713. // Result1 is the value of the 2nd result returned from this method
  3714. // invocation.
  3715. Result1 error
  3716. }
  3717. // Args returns an interface slice containing the arguments of this
  3718. // invocation.
  3719. func (c UsersStoreGetByKeyIDFuncCall) Args() []interface{} {
  3720. return []interface{}{c.Arg0, c.Arg1}
  3721. }
  3722. // Results returns an interface slice containing the results of this
  3723. // invocation.
  3724. func (c UsersStoreGetByKeyIDFuncCall) Results() []interface{} {
  3725. return []interface{}{c.Result0, c.Result1}
  3726. }
  3727. // UsersStoreGetByUsernameFunc describes the behavior when the GetByUsername
  3728. // method of the parent MockUsersStore instance is invoked.
  3729. type UsersStoreGetByUsernameFunc struct {
  3730. defaultHook func(context.Context, string) (*db.User, error)
  3731. hooks []func(context.Context, string) (*db.User, error)
  3732. history []UsersStoreGetByUsernameFuncCall
  3733. mutex sync.Mutex
  3734. }
  3735. // GetByUsername delegates to the next hook function in the queue and stores
  3736. // the parameter and result values of this invocation.
  3737. func (m *MockUsersStore) GetByUsername(v0 context.Context, v1 string) (*db.User, error) {
  3738. r0, r1 := m.GetByUsernameFunc.nextHook()(v0, v1)
  3739. m.GetByUsernameFunc.appendCall(UsersStoreGetByUsernameFuncCall{v0, v1, r0, r1})
  3740. return r0, r1
  3741. }
  3742. // SetDefaultHook sets function that is called when the GetByUsername method
  3743. // of the parent MockUsersStore instance is invoked and the hook queue is
  3744. // empty.
  3745. func (f *UsersStoreGetByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*db.User, error)) {
  3746. f.defaultHook = hook
  3747. }
  3748. // PushHook adds a function to the end of hook queue. Each invocation of the
  3749. // GetByUsername method of the parent MockUsersStore instance invokes the
  3750. // hook at the front of the queue and discards it. After the queue is empty,
  3751. // the default hook function is invoked for any future action.
  3752. func (f *UsersStoreGetByUsernameFunc) PushHook(hook func(context.Context, string) (*db.User, error)) {
  3753. f.mutex.Lock()
  3754. f.hooks = append(f.hooks, hook)
  3755. f.mutex.Unlock()
  3756. }
  3757. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3758. // given values.
  3759. func (f *UsersStoreGetByUsernameFunc) SetDefaultReturn(r0 *db.User, r1 error) {
  3760. f.SetDefaultHook(func(context.Context, string) (*db.User, error) {
  3761. return r0, r1
  3762. })
  3763. }
  3764. // PushReturn calls PushHook with a function that returns the given values.
  3765. func (f *UsersStoreGetByUsernameFunc) PushReturn(r0 *db.User, r1 error) {
  3766. f.PushHook(func(context.Context, string) (*db.User, error) {
  3767. return r0, r1
  3768. })
  3769. }
  3770. func (f *UsersStoreGetByUsernameFunc) nextHook() func(context.Context, string) (*db.User, error) {
  3771. f.mutex.Lock()
  3772. defer f.mutex.Unlock()
  3773. if len(f.hooks) == 0 {
  3774. return f.defaultHook
  3775. }
  3776. hook := f.hooks[0]
  3777. f.hooks = f.hooks[1:]
  3778. return hook
  3779. }
  3780. func (f *UsersStoreGetByUsernameFunc) appendCall(r0 UsersStoreGetByUsernameFuncCall) {
  3781. f.mutex.Lock()
  3782. f.history = append(f.history, r0)
  3783. f.mutex.Unlock()
  3784. }
  3785. // History returns a sequence of UsersStoreGetByUsernameFuncCall objects
  3786. // describing the invocations of this function.
  3787. func (f *UsersStoreGetByUsernameFunc) History() []UsersStoreGetByUsernameFuncCall {
  3788. f.mutex.Lock()
  3789. history := make([]UsersStoreGetByUsernameFuncCall, len(f.history))
  3790. copy(history, f.history)
  3791. f.mutex.Unlock()
  3792. return history
  3793. }
  3794. // UsersStoreGetByUsernameFuncCall is an object that describes an invocation
  3795. // of method GetByUsername on an instance of MockUsersStore.
  3796. type UsersStoreGetByUsernameFuncCall struct {
  3797. // Arg0 is the value of the 1st argument passed to this method
  3798. // invocation.
  3799. Arg0 context.Context
  3800. // Arg1 is the value of the 2nd argument passed to this method
  3801. // invocation.
  3802. Arg1 string
  3803. // Result0 is the value of the 1st result returned from this method
  3804. // invocation.
  3805. Result0 *db.User
  3806. // Result1 is the value of the 2nd result returned from this method
  3807. // invocation.
  3808. Result1 error
  3809. }
  3810. // Args returns an interface slice containing the arguments of this
  3811. // invocation.
  3812. func (c UsersStoreGetByUsernameFuncCall) Args() []interface{} {
  3813. return []interface{}{c.Arg0, c.Arg1}
  3814. }
  3815. // Results returns an interface slice containing the results of this
  3816. // invocation.
  3817. func (c UsersStoreGetByUsernameFuncCall) Results() []interface{} {
  3818. return []interface{}{c.Result0, c.Result1}
  3819. }
  3820. // UsersStoreGetMailableEmailsByUsernamesFunc describes the behavior when
  3821. // the GetMailableEmailsByUsernames method of the parent MockUsersStore
  3822. // instance is invoked.
  3823. type UsersStoreGetMailableEmailsByUsernamesFunc struct {
  3824. defaultHook func(context.Context, []string) ([]string, error)
  3825. hooks []func(context.Context, []string) ([]string, error)
  3826. history []UsersStoreGetMailableEmailsByUsernamesFuncCall
  3827. mutex sync.Mutex
  3828. }
  3829. // GetMailableEmailsByUsernames delegates to the next hook function in the
  3830. // queue and stores the parameter and result values of this invocation.
  3831. func (m *MockUsersStore) GetMailableEmailsByUsernames(v0 context.Context, v1 []string) ([]string, error) {
  3832. r0, r1 := m.GetMailableEmailsByUsernamesFunc.nextHook()(v0, v1)
  3833. m.GetMailableEmailsByUsernamesFunc.appendCall(UsersStoreGetMailableEmailsByUsernamesFuncCall{v0, v1, r0, r1})
  3834. return r0, r1
  3835. }
  3836. // SetDefaultHook sets function that is called when the
  3837. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  3838. // is invoked and the hook queue is empty.
  3839. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultHook(hook func(context.Context, []string) ([]string, error)) {
  3840. f.defaultHook = hook
  3841. }
  3842. // PushHook adds a function to the end of hook queue. Each invocation of the
  3843. // GetMailableEmailsByUsernames method of the parent MockUsersStore instance
  3844. // invokes the hook at the front of the queue and discards it. After the
  3845. // queue is empty, the default hook function is invoked for any future
  3846. // action.
  3847. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushHook(hook func(context.Context, []string) ([]string, error)) {
  3848. f.mutex.Lock()
  3849. f.hooks = append(f.hooks, hook)
  3850. f.mutex.Unlock()
  3851. }
  3852. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3853. // given values.
  3854. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) SetDefaultReturn(r0 []string, r1 error) {
  3855. f.SetDefaultHook(func(context.Context, []string) ([]string, error) {
  3856. return r0, r1
  3857. })
  3858. }
  3859. // PushReturn calls PushHook with a function that returns the given values.
  3860. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) PushReturn(r0 []string, r1 error) {
  3861. f.PushHook(func(context.Context, []string) ([]string, error) {
  3862. return r0, r1
  3863. })
  3864. }
  3865. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) nextHook() func(context.Context, []string) ([]string, error) {
  3866. f.mutex.Lock()
  3867. defer f.mutex.Unlock()
  3868. if len(f.hooks) == 0 {
  3869. return f.defaultHook
  3870. }
  3871. hook := f.hooks[0]
  3872. f.hooks = f.hooks[1:]
  3873. return hook
  3874. }
  3875. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) appendCall(r0 UsersStoreGetMailableEmailsByUsernamesFuncCall) {
  3876. f.mutex.Lock()
  3877. f.history = append(f.history, r0)
  3878. f.mutex.Unlock()
  3879. }
  3880. // History returns a sequence of
  3881. // UsersStoreGetMailableEmailsByUsernamesFuncCall objects describing the
  3882. // invocations of this function.
  3883. func (f *UsersStoreGetMailableEmailsByUsernamesFunc) History() []UsersStoreGetMailableEmailsByUsernamesFuncCall {
  3884. f.mutex.Lock()
  3885. history := make([]UsersStoreGetMailableEmailsByUsernamesFuncCall, len(f.history))
  3886. copy(history, f.history)
  3887. f.mutex.Unlock()
  3888. return history
  3889. }
  3890. // UsersStoreGetMailableEmailsByUsernamesFuncCall is an object that
  3891. // describes an invocation of method GetMailableEmailsByUsernames on an
  3892. // instance of MockUsersStore.
  3893. type UsersStoreGetMailableEmailsByUsernamesFuncCall struct {
  3894. // Arg0 is the value of the 1st argument passed to this method
  3895. // invocation.
  3896. Arg0 context.Context
  3897. // Arg1 is the value of the 2nd argument passed to this method
  3898. // invocation.
  3899. Arg1 []string
  3900. // Result0 is the value of the 1st result returned from this method
  3901. // invocation.
  3902. Result0 []string
  3903. // Result1 is the value of the 2nd result returned from this method
  3904. // invocation.
  3905. Result1 error
  3906. }
  3907. // Args returns an interface slice containing the arguments of this
  3908. // invocation.
  3909. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Args() []interface{} {
  3910. return []interface{}{c.Arg0, c.Arg1}
  3911. }
  3912. // Results returns an interface slice containing the results of this
  3913. // invocation.
  3914. func (c UsersStoreGetMailableEmailsByUsernamesFuncCall) Results() []interface{} {
  3915. return []interface{}{c.Result0, c.Result1}
  3916. }
  3917. // UsersStoreHasForkedRepositoryFunc describes the behavior when the
  3918. // HasForkedRepository method of the parent MockUsersStore instance is
  3919. // invoked.
  3920. type UsersStoreHasForkedRepositoryFunc struct {
  3921. defaultHook func(context.Context, int64, int64) bool
  3922. hooks []func(context.Context, int64, int64) bool
  3923. history []UsersStoreHasForkedRepositoryFuncCall
  3924. mutex sync.Mutex
  3925. }
  3926. // HasForkedRepository delegates to the next hook function in the queue and
  3927. // stores the parameter and result values of this invocation.
  3928. func (m *MockUsersStore) HasForkedRepository(v0 context.Context, v1 int64, v2 int64) bool {
  3929. r0 := m.HasForkedRepositoryFunc.nextHook()(v0, v1, v2)
  3930. m.HasForkedRepositoryFunc.appendCall(UsersStoreHasForkedRepositoryFuncCall{v0, v1, v2, r0})
  3931. return r0
  3932. }
  3933. // SetDefaultHook sets function that is called when the HasForkedRepository
  3934. // method of the parent MockUsersStore instance is invoked and the hook
  3935. // queue is empty.
  3936. func (f *UsersStoreHasForkedRepositoryFunc) SetDefaultHook(hook func(context.Context, int64, int64) bool) {
  3937. f.defaultHook = hook
  3938. }
  3939. // PushHook adds a function to the end of hook queue. Each invocation of the
  3940. // HasForkedRepository method of the parent MockUsersStore instance invokes
  3941. // the hook at the front of the queue and discards it. After the queue is
  3942. // empty, the default hook function is invoked for any future action.
  3943. func (f *UsersStoreHasForkedRepositoryFunc) PushHook(hook func(context.Context, int64, int64) bool) {
  3944. f.mutex.Lock()
  3945. f.hooks = append(f.hooks, hook)
  3946. f.mutex.Unlock()
  3947. }
  3948. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  3949. // given values.
  3950. func (f *UsersStoreHasForkedRepositoryFunc) SetDefaultReturn(r0 bool) {
  3951. f.SetDefaultHook(func(context.Context, int64, int64) bool {
  3952. return r0
  3953. })
  3954. }
  3955. // PushReturn calls PushHook with a function that returns the given values.
  3956. func (f *UsersStoreHasForkedRepositoryFunc) PushReturn(r0 bool) {
  3957. f.PushHook(func(context.Context, int64, int64) bool {
  3958. return r0
  3959. })
  3960. }
  3961. func (f *UsersStoreHasForkedRepositoryFunc) nextHook() func(context.Context, int64, int64) bool {
  3962. f.mutex.Lock()
  3963. defer f.mutex.Unlock()
  3964. if len(f.hooks) == 0 {
  3965. return f.defaultHook
  3966. }
  3967. hook := f.hooks[0]
  3968. f.hooks = f.hooks[1:]
  3969. return hook
  3970. }
  3971. func (f *UsersStoreHasForkedRepositoryFunc) appendCall(r0 UsersStoreHasForkedRepositoryFuncCall) {
  3972. f.mutex.Lock()
  3973. f.history = append(f.history, r0)
  3974. f.mutex.Unlock()
  3975. }
  3976. // History returns a sequence of UsersStoreHasForkedRepositoryFuncCall
  3977. // objects describing the invocations of this function.
  3978. func (f *UsersStoreHasForkedRepositoryFunc) History() []UsersStoreHasForkedRepositoryFuncCall {
  3979. f.mutex.Lock()
  3980. history := make([]UsersStoreHasForkedRepositoryFuncCall, len(f.history))
  3981. copy(history, f.history)
  3982. f.mutex.Unlock()
  3983. return history
  3984. }
  3985. // UsersStoreHasForkedRepositoryFuncCall is an object that describes an
  3986. // invocation of method HasForkedRepository on an instance of
  3987. // MockUsersStore.
  3988. type UsersStoreHasForkedRepositoryFuncCall struct {
  3989. // Arg0 is the value of the 1st argument passed to this method
  3990. // invocation.
  3991. Arg0 context.Context
  3992. // Arg1 is the value of the 2nd argument passed to this method
  3993. // invocation.
  3994. Arg1 int64
  3995. // Arg2 is the value of the 3rd argument passed to this method
  3996. // invocation.
  3997. Arg2 int64
  3998. // Result0 is the value of the 1st result returned from this method
  3999. // invocation.
  4000. Result0 bool
  4001. }
  4002. // Args returns an interface slice containing the arguments of this
  4003. // invocation.
  4004. func (c UsersStoreHasForkedRepositoryFuncCall) Args() []interface{} {
  4005. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4006. }
  4007. // Results returns an interface slice containing the results of this
  4008. // invocation.
  4009. func (c UsersStoreHasForkedRepositoryFuncCall) Results() []interface{} {
  4010. return []interface{}{c.Result0}
  4011. }
  4012. // UsersStoreIsUsernameUsedFunc describes the behavior when the
  4013. // IsUsernameUsed method of the parent MockUsersStore instance is invoked.
  4014. type UsersStoreIsUsernameUsedFunc struct {
  4015. defaultHook func(context.Context, string, int64) bool
  4016. hooks []func(context.Context, string, int64) bool
  4017. history []UsersStoreIsUsernameUsedFuncCall
  4018. mutex sync.Mutex
  4019. }
  4020. // IsUsernameUsed delegates to the next hook function in the queue and
  4021. // stores the parameter and result values of this invocation.
  4022. func (m *MockUsersStore) IsUsernameUsed(v0 context.Context, v1 string, v2 int64) bool {
  4023. r0 := m.IsUsernameUsedFunc.nextHook()(v0, v1, v2)
  4024. m.IsUsernameUsedFunc.appendCall(UsersStoreIsUsernameUsedFuncCall{v0, v1, v2, r0})
  4025. return r0
  4026. }
  4027. // SetDefaultHook sets function that is called when the IsUsernameUsed
  4028. // method of the parent MockUsersStore instance is invoked and the hook
  4029. // queue is empty.
  4030. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultHook(hook func(context.Context, string, int64) bool) {
  4031. f.defaultHook = hook
  4032. }
  4033. // PushHook adds a function to the end of hook queue. Each invocation of the
  4034. // IsUsernameUsed method of the parent MockUsersStore instance invokes the
  4035. // hook at the front of the queue and discards it. After the queue is empty,
  4036. // the default hook function is invoked for any future action.
  4037. func (f *UsersStoreIsUsernameUsedFunc) PushHook(hook func(context.Context, string, int64) bool) {
  4038. f.mutex.Lock()
  4039. f.hooks = append(f.hooks, hook)
  4040. f.mutex.Unlock()
  4041. }
  4042. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4043. // given values.
  4044. func (f *UsersStoreIsUsernameUsedFunc) SetDefaultReturn(r0 bool) {
  4045. f.SetDefaultHook(func(context.Context, string, int64) bool {
  4046. return r0
  4047. })
  4048. }
  4049. // PushReturn calls PushHook with a function that returns the given values.
  4050. func (f *UsersStoreIsUsernameUsedFunc) PushReturn(r0 bool) {
  4051. f.PushHook(func(context.Context, string, int64) bool {
  4052. return r0
  4053. })
  4054. }
  4055. func (f *UsersStoreIsUsernameUsedFunc) nextHook() func(context.Context, string, int64) bool {
  4056. f.mutex.Lock()
  4057. defer f.mutex.Unlock()
  4058. if len(f.hooks) == 0 {
  4059. return f.defaultHook
  4060. }
  4061. hook := f.hooks[0]
  4062. f.hooks = f.hooks[1:]
  4063. return hook
  4064. }
  4065. func (f *UsersStoreIsUsernameUsedFunc) appendCall(r0 UsersStoreIsUsernameUsedFuncCall) {
  4066. f.mutex.Lock()
  4067. f.history = append(f.history, r0)
  4068. f.mutex.Unlock()
  4069. }
  4070. // History returns a sequence of UsersStoreIsUsernameUsedFuncCall objects
  4071. // describing the invocations of this function.
  4072. func (f *UsersStoreIsUsernameUsedFunc) History() []UsersStoreIsUsernameUsedFuncCall {
  4073. f.mutex.Lock()
  4074. history := make([]UsersStoreIsUsernameUsedFuncCall, len(f.history))
  4075. copy(history, f.history)
  4076. f.mutex.Unlock()
  4077. return history
  4078. }
  4079. // UsersStoreIsUsernameUsedFuncCall is an object that describes an
  4080. // invocation of method IsUsernameUsed on an instance of MockUsersStore.
  4081. type UsersStoreIsUsernameUsedFuncCall struct {
  4082. // Arg0 is the value of the 1st argument passed to this method
  4083. // invocation.
  4084. Arg0 context.Context
  4085. // Arg1 is the value of the 2nd argument passed to this method
  4086. // invocation.
  4087. Arg1 string
  4088. // Arg2 is the value of the 3rd argument passed to this method
  4089. // invocation.
  4090. Arg2 int64
  4091. // Result0 is the value of the 1st result returned from this method
  4092. // invocation.
  4093. Result0 bool
  4094. }
  4095. // Args returns an interface slice containing the arguments of this
  4096. // invocation.
  4097. func (c UsersStoreIsUsernameUsedFuncCall) Args() []interface{} {
  4098. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4099. }
  4100. // Results returns an interface slice containing the results of this
  4101. // invocation.
  4102. func (c UsersStoreIsUsernameUsedFuncCall) Results() []interface{} {
  4103. return []interface{}{c.Result0}
  4104. }
  4105. // UsersStoreListFunc describes the behavior when the List method of the
  4106. // parent MockUsersStore instance is invoked.
  4107. type UsersStoreListFunc struct {
  4108. defaultHook func(context.Context, int, int) ([]*db.User, error)
  4109. hooks []func(context.Context, int, int) ([]*db.User, error)
  4110. history []UsersStoreListFuncCall
  4111. mutex sync.Mutex
  4112. }
  4113. // List delegates to the next hook function in the queue and stores the
  4114. // parameter and result values of this invocation.
  4115. func (m *MockUsersStore) List(v0 context.Context, v1 int, v2 int) ([]*db.User, error) {
  4116. r0, r1 := m.ListFunc.nextHook()(v0, v1, v2)
  4117. m.ListFunc.appendCall(UsersStoreListFuncCall{v0, v1, v2, r0, r1})
  4118. return r0, r1
  4119. }
  4120. // SetDefaultHook sets function that is called when the List method of the
  4121. // parent MockUsersStore instance is invoked and the hook queue is empty.
  4122. func (f *UsersStoreListFunc) SetDefaultHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  4123. f.defaultHook = hook
  4124. }
  4125. // PushHook adds a function to the end of hook queue. Each invocation of the
  4126. // List method of the parent MockUsersStore instance invokes the hook at the
  4127. // front of the queue and discards it. After the queue is empty, the default
  4128. // hook function is invoked for any future action.
  4129. func (f *UsersStoreListFunc) PushHook(hook func(context.Context, int, int) ([]*db.User, error)) {
  4130. f.mutex.Lock()
  4131. f.hooks = append(f.hooks, hook)
  4132. f.mutex.Unlock()
  4133. }
  4134. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4135. // given values.
  4136. func (f *UsersStoreListFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4137. f.SetDefaultHook(func(context.Context, int, int) ([]*db.User, error) {
  4138. return r0, r1
  4139. })
  4140. }
  4141. // PushReturn calls PushHook with a function that returns the given values.
  4142. func (f *UsersStoreListFunc) PushReturn(r0 []*db.User, r1 error) {
  4143. f.PushHook(func(context.Context, int, int) ([]*db.User, error) {
  4144. return r0, r1
  4145. })
  4146. }
  4147. func (f *UsersStoreListFunc) nextHook() func(context.Context, int, int) ([]*db.User, error) {
  4148. f.mutex.Lock()
  4149. defer f.mutex.Unlock()
  4150. if len(f.hooks) == 0 {
  4151. return f.defaultHook
  4152. }
  4153. hook := f.hooks[0]
  4154. f.hooks = f.hooks[1:]
  4155. return hook
  4156. }
  4157. func (f *UsersStoreListFunc) appendCall(r0 UsersStoreListFuncCall) {
  4158. f.mutex.Lock()
  4159. f.history = append(f.history, r0)
  4160. f.mutex.Unlock()
  4161. }
  4162. // History returns a sequence of UsersStoreListFuncCall objects describing
  4163. // the invocations of this function.
  4164. func (f *UsersStoreListFunc) History() []UsersStoreListFuncCall {
  4165. f.mutex.Lock()
  4166. history := make([]UsersStoreListFuncCall, len(f.history))
  4167. copy(history, f.history)
  4168. f.mutex.Unlock()
  4169. return history
  4170. }
  4171. // UsersStoreListFuncCall is an object that describes an invocation of
  4172. // method List on an instance of MockUsersStore.
  4173. type UsersStoreListFuncCall struct {
  4174. // Arg0 is the value of the 1st argument passed to this method
  4175. // invocation.
  4176. Arg0 context.Context
  4177. // Arg1 is the value of the 2nd argument passed to this method
  4178. // invocation.
  4179. Arg1 int
  4180. // Arg2 is the value of the 3rd argument passed to this method
  4181. // invocation.
  4182. Arg2 int
  4183. // Result0 is the value of the 1st result returned from this method
  4184. // invocation.
  4185. Result0 []*db.User
  4186. // Result1 is the value of the 2nd result returned from this method
  4187. // invocation.
  4188. Result1 error
  4189. }
  4190. // Args returns an interface slice containing the arguments of this
  4191. // invocation.
  4192. func (c UsersStoreListFuncCall) Args() []interface{} {
  4193. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4194. }
  4195. // Results returns an interface slice containing the results of this
  4196. // invocation.
  4197. func (c UsersStoreListFuncCall) Results() []interface{} {
  4198. return []interface{}{c.Result0, c.Result1}
  4199. }
  4200. // UsersStoreListFollowersFunc describes the behavior when the ListFollowers
  4201. // method of the parent MockUsersStore instance is invoked.
  4202. type UsersStoreListFollowersFunc struct {
  4203. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  4204. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  4205. history []UsersStoreListFollowersFuncCall
  4206. mutex sync.Mutex
  4207. }
  4208. // ListFollowers delegates to the next hook function in the queue and stores
  4209. // the parameter and result values of this invocation.
  4210. func (m *MockUsersStore) ListFollowers(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  4211. r0, r1 := m.ListFollowersFunc.nextHook()(v0, v1, v2, v3)
  4212. m.ListFollowersFunc.appendCall(UsersStoreListFollowersFuncCall{v0, v1, v2, v3, r0, r1})
  4213. return r0, r1
  4214. }
  4215. // SetDefaultHook sets function that is called when the ListFollowers method
  4216. // of the parent MockUsersStore instance is invoked and the hook queue is
  4217. // empty.
  4218. func (f *UsersStoreListFollowersFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4219. f.defaultHook = hook
  4220. }
  4221. // PushHook adds a function to the end of hook queue. Each invocation of the
  4222. // ListFollowers method of the parent MockUsersStore instance invokes the
  4223. // hook at the front of the queue and discards it. After the queue is empty,
  4224. // the default hook function is invoked for any future action.
  4225. func (f *UsersStoreListFollowersFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4226. f.mutex.Lock()
  4227. f.hooks = append(f.hooks, hook)
  4228. f.mutex.Unlock()
  4229. }
  4230. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4231. // given values.
  4232. func (f *UsersStoreListFollowersFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4233. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4234. return r0, r1
  4235. })
  4236. }
  4237. // PushReturn calls PushHook with a function that returns the given values.
  4238. func (f *UsersStoreListFollowersFunc) PushReturn(r0 []*db.User, r1 error) {
  4239. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4240. return r0, r1
  4241. })
  4242. }
  4243. func (f *UsersStoreListFollowersFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  4244. f.mutex.Lock()
  4245. defer f.mutex.Unlock()
  4246. if len(f.hooks) == 0 {
  4247. return f.defaultHook
  4248. }
  4249. hook := f.hooks[0]
  4250. f.hooks = f.hooks[1:]
  4251. return hook
  4252. }
  4253. func (f *UsersStoreListFollowersFunc) appendCall(r0 UsersStoreListFollowersFuncCall) {
  4254. f.mutex.Lock()
  4255. f.history = append(f.history, r0)
  4256. f.mutex.Unlock()
  4257. }
  4258. // History returns a sequence of UsersStoreListFollowersFuncCall objects
  4259. // describing the invocations of this function.
  4260. func (f *UsersStoreListFollowersFunc) History() []UsersStoreListFollowersFuncCall {
  4261. f.mutex.Lock()
  4262. history := make([]UsersStoreListFollowersFuncCall, len(f.history))
  4263. copy(history, f.history)
  4264. f.mutex.Unlock()
  4265. return history
  4266. }
  4267. // UsersStoreListFollowersFuncCall is an object that describes an invocation
  4268. // of method ListFollowers on an instance of MockUsersStore.
  4269. type UsersStoreListFollowersFuncCall struct {
  4270. // Arg0 is the value of the 1st argument passed to this method
  4271. // invocation.
  4272. Arg0 context.Context
  4273. // Arg1 is the value of the 2nd argument passed to this method
  4274. // invocation.
  4275. Arg1 int64
  4276. // Arg2 is the value of the 3rd argument passed to this method
  4277. // invocation.
  4278. Arg2 int
  4279. // Arg3 is the value of the 4th argument passed to this method
  4280. // invocation.
  4281. Arg3 int
  4282. // Result0 is the value of the 1st result returned from this method
  4283. // invocation.
  4284. Result0 []*db.User
  4285. // Result1 is the value of the 2nd result returned from this method
  4286. // invocation.
  4287. Result1 error
  4288. }
  4289. // Args returns an interface slice containing the arguments of this
  4290. // invocation.
  4291. func (c UsersStoreListFollowersFuncCall) Args() []interface{} {
  4292. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  4293. }
  4294. // Results returns an interface slice containing the results of this
  4295. // invocation.
  4296. func (c UsersStoreListFollowersFuncCall) Results() []interface{} {
  4297. return []interface{}{c.Result0, c.Result1}
  4298. }
  4299. // UsersStoreListFollowingsFunc describes the behavior when the
  4300. // ListFollowings method of the parent MockUsersStore instance is invoked.
  4301. type UsersStoreListFollowingsFunc struct {
  4302. defaultHook func(context.Context, int64, int, int) ([]*db.User, error)
  4303. hooks []func(context.Context, int64, int, int) ([]*db.User, error)
  4304. history []UsersStoreListFollowingsFuncCall
  4305. mutex sync.Mutex
  4306. }
  4307. // ListFollowings delegates to the next hook function in the queue and
  4308. // stores the parameter and result values of this invocation.
  4309. func (m *MockUsersStore) ListFollowings(v0 context.Context, v1 int64, v2 int, v3 int) ([]*db.User, error) {
  4310. r0, r1 := m.ListFollowingsFunc.nextHook()(v0, v1, v2, v3)
  4311. m.ListFollowingsFunc.appendCall(UsersStoreListFollowingsFuncCall{v0, v1, v2, v3, r0, r1})
  4312. return r0, r1
  4313. }
  4314. // SetDefaultHook sets function that is called when the ListFollowings
  4315. // method of the parent MockUsersStore instance is invoked and the hook
  4316. // queue is empty.
  4317. func (f *UsersStoreListFollowingsFunc) SetDefaultHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4318. f.defaultHook = hook
  4319. }
  4320. // PushHook adds a function to the end of hook queue. Each invocation of the
  4321. // ListFollowings method of the parent MockUsersStore instance invokes the
  4322. // hook at the front of the queue and discards it. After the queue is empty,
  4323. // the default hook function is invoked for any future action.
  4324. func (f *UsersStoreListFollowingsFunc) PushHook(hook func(context.Context, int64, int, int) ([]*db.User, error)) {
  4325. f.mutex.Lock()
  4326. f.hooks = append(f.hooks, hook)
  4327. f.mutex.Unlock()
  4328. }
  4329. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4330. // given values.
  4331. func (f *UsersStoreListFollowingsFunc) SetDefaultReturn(r0 []*db.User, r1 error) {
  4332. f.SetDefaultHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4333. return r0, r1
  4334. })
  4335. }
  4336. // PushReturn calls PushHook with a function that returns the given values.
  4337. func (f *UsersStoreListFollowingsFunc) PushReturn(r0 []*db.User, r1 error) {
  4338. f.PushHook(func(context.Context, int64, int, int) ([]*db.User, error) {
  4339. return r0, r1
  4340. })
  4341. }
  4342. func (f *UsersStoreListFollowingsFunc) nextHook() func(context.Context, int64, int, int) ([]*db.User, error) {
  4343. f.mutex.Lock()
  4344. defer f.mutex.Unlock()
  4345. if len(f.hooks) == 0 {
  4346. return f.defaultHook
  4347. }
  4348. hook := f.hooks[0]
  4349. f.hooks = f.hooks[1:]
  4350. return hook
  4351. }
  4352. func (f *UsersStoreListFollowingsFunc) appendCall(r0 UsersStoreListFollowingsFuncCall) {
  4353. f.mutex.Lock()
  4354. f.history = append(f.history, r0)
  4355. f.mutex.Unlock()
  4356. }
  4357. // History returns a sequence of UsersStoreListFollowingsFuncCall objects
  4358. // describing the invocations of this function.
  4359. func (f *UsersStoreListFollowingsFunc) History() []UsersStoreListFollowingsFuncCall {
  4360. f.mutex.Lock()
  4361. history := make([]UsersStoreListFollowingsFuncCall, len(f.history))
  4362. copy(history, f.history)
  4363. f.mutex.Unlock()
  4364. return history
  4365. }
  4366. // UsersStoreListFollowingsFuncCall is an object that describes an
  4367. // invocation of method ListFollowings on an instance of MockUsersStore.
  4368. type UsersStoreListFollowingsFuncCall struct {
  4369. // Arg0 is the value of the 1st argument passed to this method
  4370. // invocation.
  4371. Arg0 context.Context
  4372. // Arg1 is the value of the 2nd argument passed to this method
  4373. // invocation.
  4374. Arg1 int64
  4375. // Arg2 is the value of the 3rd argument passed to this method
  4376. // invocation.
  4377. Arg2 int
  4378. // Arg3 is the value of the 4th argument passed to this method
  4379. // invocation.
  4380. Arg3 int
  4381. // Result0 is the value of the 1st result returned from this method
  4382. // invocation.
  4383. Result0 []*db.User
  4384. // Result1 is the value of the 2nd result returned from this method
  4385. // invocation.
  4386. Result1 error
  4387. }
  4388. // Args returns an interface slice containing the arguments of this
  4389. // invocation.
  4390. func (c UsersStoreListFollowingsFuncCall) Args() []interface{} {
  4391. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
  4392. }
  4393. // Results returns an interface slice containing the results of this
  4394. // invocation.
  4395. func (c UsersStoreListFollowingsFuncCall) Results() []interface{} {
  4396. return []interface{}{c.Result0, c.Result1}
  4397. }
  4398. // UsersStoreSearchByNameFunc describes the behavior when the SearchByName
  4399. // method of the parent MockUsersStore instance is invoked.
  4400. type UsersStoreSearchByNameFunc struct {
  4401. defaultHook func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  4402. hooks []func(context.Context, string, int, int, string) ([]*db.User, int64, error)
  4403. history []UsersStoreSearchByNameFuncCall
  4404. mutex sync.Mutex
  4405. }
  4406. // SearchByName delegates to the next hook function in the queue and stores
  4407. // the parameter and result values of this invocation.
  4408. func (m *MockUsersStore) SearchByName(v0 context.Context, v1 string, v2 int, v3 int, v4 string) ([]*db.User, int64, error) {
  4409. r0, r1, r2 := m.SearchByNameFunc.nextHook()(v0, v1, v2, v3, v4)
  4410. m.SearchByNameFunc.appendCall(UsersStoreSearchByNameFuncCall{v0, v1, v2, v3, v4, r0, r1, r2})
  4411. return r0, r1, r2
  4412. }
  4413. // SetDefaultHook sets function that is called when the SearchByName method
  4414. // of the parent MockUsersStore instance is invoked and the hook queue is
  4415. // empty.
  4416. func (f *UsersStoreSearchByNameFunc) SetDefaultHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  4417. f.defaultHook = hook
  4418. }
  4419. // PushHook adds a function to the end of hook queue. Each invocation of the
  4420. // SearchByName method of the parent MockUsersStore instance invokes the
  4421. // hook at the front of the queue and discards it. After the queue is empty,
  4422. // the default hook function is invoked for any future action.
  4423. func (f *UsersStoreSearchByNameFunc) PushHook(hook func(context.Context, string, int, int, string) ([]*db.User, int64, error)) {
  4424. f.mutex.Lock()
  4425. f.hooks = append(f.hooks, hook)
  4426. f.mutex.Unlock()
  4427. }
  4428. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4429. // given values.
  4430. func (f *UsersStoreSearchByNameFunc) SetDefaultReturn(r0 []*db.User, r1 int64, r2 error) {
  4431. f.SetDefaultHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4432. return r0, r1, r2
  4433. })
  4434. }
  4435. // PushReturn calls PushHook with a function that returns the given values.
  4436. func (f *UsersStoreSearchByNameFunc) PushReturn(r0 []*db.User, r1 int64, r2 error) {
  4437. f.PushHook(func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4438. return r0, r1, r2
  4439. })
  4440. }
  4441. func (f *UsersStoreSearchByNameFunc) nextHook() func(context.Context, string, int, int, string) ([]*db.User, int64, error) {
  4442. f.mutex.Lock()
  4443. defer f.mutex.Unlock()
  4444. if len(f.hooks) == 0 {
  4445. return f.defaultHook
  4446. }
  4447. hook := f.hooks[0]
  4448. f.hooks = f.hooks[1:]
  4449. return hook
  4450. }
  4451. func (f *UsersStoreSearchByNameFunc) appendCall(r0 UsersStoreSearchByNameFuncCall) {
  4452. f.mutex.Lock()
  4453. f.history = append(f.history, r0)
  4454. f.mutex.Unlock()
  4455. }
  4456. // History returns a sequence of UsersStoreSearchByNameFuncCall objects
  4457. // describing the invocations of this function.
  4458. func (f *UsersStoreSearchByNameFunc) History() []UsersStoreSearchByNameFuncCall {
  4459. f.mutex.Lock()
  4460. history := make([]UsersStoreSearchByNameFuncCall, len(f.history))
  4461. copy(history, f.history)
  4462. f.mutex.Unlock()
  4463. return history
  4464. }
  4465. // UsersStoreSearchByNameFuncCall is an object that describes an invocation
  4466. // of method SearchByName on an instance of MockUsersStore.
  4467. type UsersStoreSearchByNameFuncCall struct {
  4468. // Arg0 is the value of the 1st argument passed to this method
  4469. // invocation.
  4470. Arg0 context.Context
  4471. // Arg1 is the value of the 2nd argument passed to this method
  4472. // invocation.
  4473. Arg1 string
  4474. // Arg2 is the value of the 3rd argument passed to this method
  4475. // invocation.
  4476. Arg2 int
  4477. // Arg3 is the value of the 4th argument passed to this method
  4478. // invocation.
  4479. Arg3 int
  4480. // Arg4 is the value of the 5th argument passed to this method
  4481. // invocation.
  4482. Arg4 string
  4483. // Result0 is the value of the 1st result returned from this method
  4484. // invocation.
  4485. Result0 []*db.User
  4486. // Result1 is the value of the 2nd result returned from this method
  4487. // invocation.
  4488. Result1 int64
  4489. // Result2 is the value of the 3rd result returned from this method
  4490. // invocation.
  4491. Result2 error
  4492. }
  4493. // Args returns an interface slice containing the arguments of this
  4494. // invocation.
  4495. func (c UsersStoreSearchByNameFuncCall) Args() []interface{} {
  4496. return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
  4497. }
  4498. // Results returns an interface slice containing the results of this
  4499. // invocation.
  4500. func (c UsersStoreSearchByNameFuncCall) Results() []interface{} {
  4501. return []interface{}{c.Result0, c.Result1, c.Result2}
  4502. }
  4503. // UsersStoreUpdateFunc describes the behavior when the Update method of the
  4504. // parent MockUsersStore instance is invoked.
  4505. type UsersStoreUpdateFunc struct {
  4506. defaultHook func(context.Context, int64, db.UpdateUserOptions) error
  4507. hooks []func(context.Context, int64, db.UpdateUserOptions) error
  4508. history []UsersStoreUpdateFuncCall
  4509. mutex sync.Mutex
  4510. }
  4511. // Update delegates to the next hook function in the queue and stores the
  4512. // parameter and result values of this invocation.
  4513. func (m *MockUsersStore) Update(v0 context.Context, v1 int64, v2 db.UpdateUserOptions) error {
  4514. r0 := m.UpdateFunc.nextHook()(v0, v1, v2)
  4515. m.UpdateFunc.appendCall(UsersStoreUpdateFuncCall{v0, v1, v2, r0})
  4516. return r0
  4517. }
  4518. // SetDefaultHook sets function that is called when the Update method of the
  4519. // parent MockUsersStore instance is invoked and the hook queue is empty.
  4520. func (f *UsersStoreUpdateFunc) SetDefaultHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  4521. f.defaultHook = hook
  4522. }
  4523. // PushHook adds a function to the end of hook queue. Each invocation of the
  4524. // Update method of the parent MockUsersStore instance invokes the hook at
  4525. // the front of the queue and discards it. After the queue is empty, the
  4526. // default hook function is invoked for any future action.
  4527. func (f *UsersStoreUpdateFunc) PushHook(hook func(context.Context, int64, db.UpdateUserOptions) error) {
  4528. f.mutex.Lock()
  4529. f.hooks = append(f.hooks, hook)
  4530. f.mutex.Unlock()
  4531. }
  4532. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4533. // given values.
  4534. func (f *UsersStoreUpdateFunc) SetDefaultReturn(r0 error) {
  4535. f.SetDefaultHook(func(context.Context, int64, db.UpdateUserOptions) error {
  4536. return r0
  4537. })
  4538. }
  4539. // PushReturn calls PushHook with a function that returns the given values.
  4540. func (f *UsersStoreUpdateFunc) PushReturn(r0 error) {
  4541. f.PushHook(func(context.Context, int64, db.UpdateUserOptions) error {
  4542. return r0
  4543. })
  4544. }
  4545. func (f *UsersStoreUpdateFunc) nextHook() func(context.Context, int64, db.UpdateUserOptions) error {
  4546. f.mutex.Lock()
  4547. defer f.mutex.Unlock()
  4548. if len(f.hooks) == 0 {
  4549. return f.defaultHook
  4550. }
  4551. hook := f.hooks[0]
  4552. f.hooks = f.hooks[1:]
  4553. return hook
  4554. }
  4555. func (f *UsersStoreUpdateFunc) appendCall(r0 UsersStoreUpdateFuncCall) {
  4556. f.mutex.Lock()
  4557. f.history = append(f.history, r0)
  4558. f.mutex.Unlock()
  4559. }
  4560. // History returns a sequence of UsersStoreUpdateFuncCall objects describing
  4561. // the invocations of this function.
  4562. func (f *UsersStoreUpdateFunc) History() []UsersStoreUpdateFuncCall {
  4563. f.mutex.Lock()
  4564. history := make([]UsersStoreUpdateFuncCall, len(f.history))
  4565. copy(history, f.history)
  4566. f.mutex.Unlock()
  4567. return history
  4568. }
  4569. // UsersStoreUpdateFuncCall is an object that describes an invocation of
  4570. // method Update on an instance of MockUsersStore.
  4571. type UsersStoreUpdateFuncCall struct {
  4572. // Arg0 is the value of the 1st argument passed to this method
  4573. // invocation.
  4574. Arg0 context.Context
  4575. // Arg1 is the value of the 2nd argument passed to this method
  4576. // invocation.
  4577. Arg1 int64
  4578. // Arg2 is the value of the 3rd argument passed to this method
  4579. // invocation.
  4580. Arg2 db.UpdateUserOptions
  4581. // Result0 is the value of the 1st result returned from this method
  4582. // invocation.
  4583. Result0 error
  4584. }
  4585. // Args returns an interface slice containing the arguments of this
  4586. // invocation.
  4587. func (c UsersStoreUpdateFuncCall) Args() []interface{} {
  4588. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4589. }
  4590. // Results returns an interface slice containing the results of this
  4591. // invocation.
  4592. func (c UsersStoreUpdateFuncCall) Results() []interface{} {
  4593. return []interface{}{c.Result0}
  4594. }
  4595. // UsersStoreUseCustomAvatarFunc describes the behavior when the
  4596. // UseCustomAvatar method of the parent MockUsersStore instance is invoked.
  4597. type UsersStoreUseCustomAvatarFunc struct {
  4598. defaultHook func(context.Context, int64, []byte) error
  4599. hooks []func(context.Context, int64, []byte) error
  4600. history []UsersStoreUseCustomAvatarFuncCall
  4601. mutex sync.Mutex
  4602. }
  4603. // UseCustomAvatar delegates to the next hook function in the queue and
  4604. // stores the parameter and result values of this invocation.
  4605. func (m *MockUsersStore) UseCustomAvatar(v0 context.Context, v1 int64, v2 []byte) error {
  4606. r0 := m.UseCustomAvatarFunc.nextHook()(v0, v1, v2)
  4607. m.UseCustomAvatarFunc.appendCall(UsersStoreUseCustomAvatarFuncCall{v0, v1, v2, r0})
  4608. return r0
  4609. }
  4610. // SetDefaultHook sets function that is called when the UseCustomAvatar
  4611. // method of the parent MockUsersStore instance is invoked and the hook
  4612. // queue is empty.
  4613. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultHook(hook func(context.Context, int64, []byte) error) {
  4614. f.defaultHook = hook
  4615. }
  4616. // PushHook adds a function to the end of hook queue. Each invocation of the
  4617. // UseCustomAvatar method of the parent MockUsersStore instance invokes the
  4618. // hook at the front of the queue and discards it. After the queue is empty,
  4619. // the default hook function is invoked for any future action.
  4620. func (f *UsersStoreUseCustomAvatarFunc) PushHook(hook func(context.Context, int64, []byte) error) {
  4621. f.mutex.Lock()
  4622. f.hooks = append(f.hooks, hook)
  4623. f.mutex.Unlock()
  4624. }
  4625. // SetDefaultReturn calls SetDefaultHook with a function that returns the
  4626. // given values.
  4627. func (f *UsersStoreUseCustomAvatarFunc) SetDefaultReturn(r0 error) {
  4628. f.SetDefaultHook(func(context.Context, int64, []byte) error {
  4629. return r0
  4630. })
  4631. }
  4632. // PushReturn calls PushHook with a function that returns the given values.
  4633. func (f *UsersStoreUseCustomAvatarFunc) PushReturn(r0 error) {
  4634. f.PushHook(func(context.Context, int64, []byte) error {
  4635. return r0
  4636. })
  4637. }
  4638. func (f *UsersStoreUseCustomAvatarFunc) nextHook() func(context.Context, int64, []byte) error {
  4639. f.mutex.Lock()
  4640. defer f.mutex.Unlock()
  4641. if len(f.hooks) == 0 {
  4642. return f.defaultHook
  4643. }
  4644. hook := f.hooks[0]
  4645. f.hooks = f.hooks[1:]
  4646. return hook
  4647. }
  4648. func (f *UsersStoreUseCustomAvatarFunc) appendCall(r0 UsersStoreUseCustomAvatarFuncCall) {
  4649. f.mutex.Lock()
  4650. f.history = append(f.history, r0)
  4651. f.mutex.Unlock()
  4652. }
  4653. // History returns a sequence of UsersStoreUseCustomAvatarFuncCall objects
  4654. // describing the invocations of this function.
  4655. func (f *UsersStoreUseCustomAvatarFunc) History() []UsersStoreUseCustomAvatarFuncCall {
  4656. f.mutex.Lock()
  4657. history := make([]UsersStoreUseCustomAvatarFuncCall, len(f.history))
  4658. copy(history, f.history)
  4659. f.mutex.Unlock()
  4660. return history
  4661. }
  4662. // UsersStoreUseCustomAvatarFuncCall is an object that describes an
  4663. // invocation of method UseCustomAvatar on an instance of MockUsersStore.
  4664. type UsersStoreUseCustomAvatarFuncCall struct {
  4665. // Arg0 is the value of the 1st argument passed to this method
  4666. // invocation.
  4667. Arg0 context.Context
  4668. // Arg1 is the value of the 2nd argument passed to this method
  4669. // invocation.
  4670. Arg1 int64
  4671. // Arg2 is the value of the 3rd argument passed to this method
  4672. // invocation.
  4673. Arg2 []byte
  4674. // Result0 is the value of the 1st result returned from this method
  4675. // invocation.
  4676. Result0 error
  4677. }
  4678. // Args returns an interface slice containing the arguments of this
  4679. // invocation.
  4680. func (c UsersStoreUseCustomAvatarFuncCall) Args() []interface{} {
  4681. return []interface{}{c.Arg0, c.Arg1, c.Arg2}
  4682. }
  4683. // Results returns an interface slice containing the results of this
  4684. // invocation.
  4685. func (c UsersStoreUseCustomAvatarFuncCall) Results() []interface{} {
  4686. return []interface{}{c.Result0}
  4687. }