1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564 |
- // Code generated by go-mockgen 1.3.7; DO NOT EDIT.
- //
- // This file was generated by running `go-mockgen` at the root of this repository.
- // To add additional mocks to this or another package, add a new entry to the
- // mockgen.yaml file in the root of this repository.
- package lfs
- import (
- "context"
- "sync"
- database "gogs.io/gogs/internal/database"
- lfsutil "gogs.io/gogs/internal/lfsutil"
- )
- // MockStore is a mock implementation of the Store interface (from the
- // package gogs.io/gogs/internal/route/lfs) used for unit testing.
- type MockStore struct {
- // AuthenticateUserFunc is an instance of a mock function object
- // controlling the behavior of the method AuthenticateUser.
- AuthenticateUserFunc *StoreAuthenticateUserFunc
- // AuthorizeRepositoryAccessFunc is an instance of a mock function
- // object controlling the behavior of the method
- // AuthorizeRepositoryAccess.
- AuthorizeRepositoryAccessFunc *StoreAuthorizeRepositoryAccessFunc
- // CreateLFSObjectFunc is an instance of a mock function object
- // controlling the behavior of the method CreateLFSObject.
- CreateLFSObjectFunc *StoreCreateLFSObjectFunc
- // CreateUserFunc is an instance of a mock function object controlling
- // the behavior of the method CreateUser.
- CreateUserFunc *StoreCreateUserFunc
- // GetAccessTokenBySHA1Func is an instance of a mock function object
- // controlling the behavior of the method GetAccessTokenBySHA1.
- GetAccessTokenBySHA1Func *StoreGetAccessTokenBySHA1Func
- // GetLFSObjectByOIDFunc is an instance of a mock function object
- // controlling the behavior of the method GetLFSObjectByOID.
- GetLFSObjectByOIDFunc *StoreGetLFSObjectByOIDFunc
- // GetLFSObjectsByOIDsFunc is an instance of a mock function object
- // controlling the behavior of the method GetLFSObjectsByOIDs.
- GetLFSObjectsByOIDsFunc *StoreGetLFSObjectsByOIDsFunc
- // GetRepositoryByNameFunc is an instance of a mock function object
- // controlling the behavior of the method GetRepositoryByName.
- GetRepositoryByNameFunc *StoreGetRepositoryByNameFunc
- // GetUserByIDFunc is an instance of a mock function object controlling
- // the behavior of the method GetUserByID.
- GetUserByIDFunc *StoreGetUserByIDFunc
- // GetUserByUsernameFunc is an instance of a mock function object
- // controlling the behavior of the method GetUserByUsername.
- GetUserByUsernameFunc *StoreGetUserByUsernameFunc
- // IsTwoFactorEnabledFunc is an instance of a mock function object
- // controlling the behavior of the method IsTwoFactorEnabled.
- IsTwoFactorEnabledFunc *StoreIsTwoFactorEnabledFunc
- // TouchAccessTokenByIDFunc is an instance of a mock function object
- // controlling the behavior of the method TouchAccessTokenByID.
- TouchAccessTokenByIDFunc *StoreTouchAccessTokenByIDFunc
- }
- // NewMockStore creates a new mock of the Store interface. All methods
- // return zero values for all results, unless overwritten.
- func NewMockStore() *MockStore {
- return &MockStore{
- AuthenticateUserFunc: &StoreAuthenticateUserFunc{
- defaultHook: func(context.Context, string, string, int64) (r0 *database.User, r1 error) {
- return
- },
- },
- AuthorizeRepositoryAccessFunc: &StoreAuthorizeRepositoryAccessFunc{
- defaultHook: func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) (r0 bool) {
- return
- },
- },
- CreateLFSObjectFunc: &StoreCreateLFSObjectFunc{
- defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) (r0 error) {
- return
- },
- },
- CreateUserFunc: &StoreCreateUserFunc{
- defaultHook: func(context.Context, string, string, database.CreateUserOptions) (r0 *database.User, r1 error) {
- return
- },
- },
- GetAccessTokenBySHA1Func: &StoreGetAccessTokenBySHA1Func{
- defaultHook: func(context.Context, string) (r0 *database.AccessToken, r1 error) {
- return
- },
- },
- GetLFSObjectByOIDFunc: &StoreGetLFSObjectByOIDFunc{
- defaultHook: func(context.Context, int64, lfsutil.OID) (r0 *database.LFSObject, r1 error) {
- return
- },
- },
- GetLFSObjectsByOIDsFunc: &StoreGetLFSObjectsByOIDsFunc{
- defaultHook: func(context.Context, int64, ...lfsutil.OID) (r0 []*database.LFSObject, r1 error) {
- return
- },
- },
- GetRepositoryByNameFunc: &StoreGetRepositoryByNameFunc{
- defaultHook: func(context.Context, int64, string) (r0 *database.Repository, r1 error) {
- return
- },
- },
- GetUserByIDFunc: &StoreGetUserByIDFunc{
- defaultHook: func(context.Context, int64) (r0 *database.User, r1 error) {
- return
- },
- },
- GetUserByUsernameFunc: &StoreGetUserByUsernameFunc{
- defaultHook: func(context.Context, string) (r0 *database.User, r1 error) {
- return
- },
- },
- IsTwoFactorEnabledFunc: &StoreIsTwoFactorEnabledFunc{
- defaultHook: func(context.Context, int64) (r0 bool) {
- return
- },
- },
- TouchAccessTokenByIDFunc: &StoreTouchAccessTokenByIDFunc{
- defaultHook: func(context.Context, int64) (r0 error) {
- return
- },
- },
- }
- }
- // NewStrictMockStore creates a new mock of the Store interface. All methods
- // panic on invocation, unless overwritten.
- func NewStrictMockStore() *MockStore {
- return &MockStore{
- AuthenticateUserFunc: &StoreAuthenticateUserFunc{
- defaultHook: func(context.Context, string, string, int64) (*database.User, error) {
- panic("unexpected invocation of MockStore.AuthenticateUser")
- },
- },
- AuthorizeRepositoryAccessFunc: &StoreAuthorizeRepositoryAccessFunc{
- defaultHook: func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
- panic("unexpected invocation of MockStore.AuthorizeRepositoryAccess")
- },
- },
- CreateLFSObjectFunc: &StoreCreateLFSObjectFunc{
- defaultHook: func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
- panic("unexpected invocation of MockStore.CreateLFSObject")
- },
- },
- CreateUserFunc: &StoreCreateUserFunc{
- defaultHook: func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
- panic("unexpected invocation of MockStore.CreateUser")
- },
- },
- GetAccessTokenBySHA1Func: &StoreGetAccessTokenBySHA1Func{
- defaultHook: func(context.Context, string) (*database.AccessToken, error) {
- panic("unexpected invocation of MockStore.GetAccessTokenBySHA1")
- },
- },
- GetLFSObjectByOIDFunc: &StoreGetLFSObjectByOIDFunc{
- defaultHook: func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
- panic("unexpected invocation of MockStore.GetLFSObjectByOID")
- },
- },
- GetLFSObjectsByOIDsFunc: &StoreGetLFSObjectsByOIDsFunc{
- defaultHook: func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
- panic("unexpected invocation of MockStore.GetLFSObjectsByOIDs")
- },
- },
- GetRepositoryByNameFunc: &StoreGetRepositoryByNameFunc{
- defaultHook: func(context.Context, int64, string) (*database.Repository, error) {
- panic("unexpected invocation of MockStore.GetRepositoryByName")
- },
- },
- GetUserByIDFunc: &StoreGetUserByIDFunc{
- defaultHook: func(context.Context, int64) (*database.User, error) {
- panic("unexpected invocation of MockStore.GetUserByID")
- },
- },
- GetUserByUsernameFunc: &StoreGetUserByUsernameFunc{
- defaultHook: func(context.Context, string) (*database.User, error) {
- panic("unexpected invocation of MockStore.GetUserByUsername")
- },
- },
- IsTwoFactorEnabledFunc: &StoreIsTwoFactorEnabledFunc{
- defaultHook: func(context.Context, int64) bool {
- panic("unexpected invocation of MockStore.IsTwoFactorEnabled")
- },
- },
- TouchAccessTokenByIDFunc: &StoreTouchAccessTokenByIDFunc{
- defaultHook: func(context.Context, int64) error {
- panic("unexpected invocation of MockStore.TouchAccessTokenByID")
- },
- },
- }
- }
- // NewMockStoreFrom creates a new mock of the MockStore interface. All
- // methods delegate to the given implementation, unless overwritten.
- func NewMockStoreFrom(i Store) *MockStore {
- return &MockStore{
- AuthenticateUserFunc: &StoreAuthenticateUserFunc{
- defaultHook: i.AuthenticateUser,
- },
- AuthorizeRepositoryAccessFunc: &StoreAuthorizeRepositoryAccessFunc{
- defaultHook: i.AuthorizeRepositoryAccess,
- },
- CreateLFSObjectFunc: &StoreCreateLFSObjectFunc{
- defaultHook: i.CreateLFSObject,
- },
- CreateUserFunc: &StoreCreateUserFunc{
- defaultHook: i.CreateUser,
- },
- GetAccessTokenBySHA1Func: &StoreGetAccessTokenBySHA1Func{
- defaultHook: i.GetAccessTokenBySHA1,
- },
- GetLFSObjectByOIDFunc: &StoreGetLFSObjectByOIDFunc{
- defaultHook: i.GetLFSObjectByOID,
- },
- GetLFSObjectsByOIDsFunc: &StoreGetLFSObjectsByOIDsFunc{
- defaultHook: i.GetLFSObjectsByOIDs,
- },
- GetRepositoryByNameFunc: &StoreGetRepositoryByNameFunc{
- defaultHook: i.GetRepositoryByName,
- },
- GetUserByIDFunc: &StoreGetUserByIDFunc{
- defaultHook: i.GetUserByID,
- },
- GetUserByUsernameFunc: &StoreGetUserByUsernameFunc{
- defaultHook: i.GetUserByUsername,
- },
- IsTwoFactorEnabledFunc: &StoreIsTwoFactorEnabledFunc{
- defaultHook: i.IsTwoFactorEnabled,
- },
- TouchAccessTokenByIDFunc: &StoreTouchAccessTokenByIDFunc{
- defaultHook: i.TouchAccessTokenByID,
- },
- }
- }
- // StoreAuthenticateUserFunc describes the behavior when the
- // AuthenticateUser method of the parent MockStore instance is invoked.
- type StoreAuthenticateUserFunc struct {
- defaultHook func(context.Context, string, string, int64) (*database.User, error)
- hooks []func(context.Context, string, string, int64) (*database.User, error)
- history []StoreAuthenticateUserFuncCall
- mutex sync.Mutex
- }
- // AuthenticateUser delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) AuthenticateUser(v0 context.Context, v1 string, v2 string, v3 int64) (*database.User, error) {
- r0, r1 := m.AuthenticateUserFunc.nextHook()(v0, v1, v2, v3)
- m.AuthenticateUserFunc.appendCall(StoreAuthenticateUserFuncCall{v0, v1, v2, v3, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the AuthenticateUser
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreAuthenticateUserFunc) SetDefaultHook(hook func(context.Context, string, string, int64) (*database.User, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // AuthenticateUser method of the parent MockStore instance invokes the hook
- // at the front of the queue and discards it. After the queue is empty, the
- // default hook function is invoked for any future action.
- func (f *StoreAuthenticateUserFunc) PushHook(hook func(context.Context, string, string, int64) (*database.User, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreAuthenticateUserFunc) SetDefaultReturn(r0 *database.User, r1 error) {
- f.SetDefaultHook(func(context.Context, string, string, int64) (*database.User, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreAuthenticateUserFunc) PushReturn(r0 *database.User, r1 error) {
- f.PushHook(func(context.Context, string, string, int64) (*database.User, error) {
- return r0, r1
- })
- }
- func (f *StoreAuthenticateUserFunc) nextHook() func(context.Context, string, string, int64) (*database.User, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreAuthenticateUserFunc) appendCall(r0 StoreAuthenticateUserFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreAuthenticateUserFuncCall objects
- // describing the invocations of this function.
- func (f *StoreAuthenticateUserFunc) History() []StoreAuthenticateUserFuncCall {
- f.mutex.Lock()
- history := make([]StoreAuthenticateUserFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreAuthenticateUserFuncCall is an object that describes an invocation
- // of method AuthenticateUser on an instance of MockStore.
- type StoreAuthenticateUserFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 string
- // Arg2 is the value of the 3rd argument passed to this method
- // invocation.
- Arg2 string
- // Arg3 is the value of the 4th argument passed to this method
- // invocation.
- Arg3 int64
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.User
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreAuthenticateUserFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreAuthenticateUserFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreAuthorizeRepositoryAccessFunc describes the behavior when the
- // AuthorizeRepositoryAccess method of the parent MockStore instance is
- // invoked.
- type StoreAuthorizeRepositoryAccessFunc struct {
- defaultHook func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool
- hooks []func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool
- history []StoreAuthorizeRepositoryAccessFuncCall
- mutex sync.Mutex
- }
- // AuthorizeRepositoryAccess delegates to the next hook function in the
- // queue and stores the parameter and result values of this invocation.
- func (m *MockStore) AuthorizeRepositoryAccess(v0 context.Context, v1 int64, v2 int64, v3 database.AccessMode, v4 database.AccessModeOptions) bool {
- r0 := m.AuthorizeRepositoryAccessFunc.nextHook()(v0, v1, v2, v3, v4)
- m.AuthorizeRepositoryAccessFunc.appendCall(StoreAuthorizeRepositoryAccessFuncCall{v0, v1, v2, v3, v4, r0})
- return r0
- }
- // SetDefaultHook sets function that is called when the
- // AuthorizeRepositoryAccess method of the parent MockStore instance is
- // invoked and the hook queue is empty.
- func (f *StoreAuthorizeRepositoryAccessFunc) SetDefaultHook(hook func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // AuthorizeRepositoryAccess method of the parent MockStore instance invokes
- // the hook at the front of the queue and discards it. After the queue is
- // empty, the default hook function is invoked for any future action.
- func (f *StoreAuthorizeRepositoryAccessFunc) PushHook(hook func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreAuthorizeRepositoryAccessFunc) SetDefaultReturn(r0 bool) {
- f.SetDefaultHook(func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
- return r0
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreAuthorizeRepositoryAccessFunc) PushReturn(r0 bool) {
- f.PushHook(func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
- return r0
- })
- }
- func (f *StoreAuthorizeRepositoryAccessFunc) nextHook() func(context.Context, int64, int64, database.AccessMode, database.AccessModeOptions) bool {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreAuthorizeRepositoryAccessFunc) appendCall(r0 StoreAuthorizeRepositoryAccessFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreAuthorizeRepositoryAccessFuncCall
- // objects describing the invocations of this function.
- func (f *StoreAuthorizeRepositoryAccessFunc) History() []StoreAuthorizeRepositoryAccessFuncCall {
- f.mutex.Lock()
- history := make([]StoreAuthorizeRepositoryAccessFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreAuthorizeRepositoryAccessFuncCall is an object that describes an
- // invocation of method AuthorizeRepositoryAccess on an instance of
- // MockStore.
- type StoreAuthorizeRepositoryAccessFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Arg2 is the value of the 3rd argument passed to this method
- // invocation.
- Arg2 int64
- // Arg3 is the value of the 4th argument passed to this method
- // invocation.
- Arg3 database.AccessMode
- // Arg4 is the value of the 5th argument passed to this method
- // invocation.
- Arg4 database.AccessModeOptions
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 bool
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreAuthorizeRepositoryAccessFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreAuthorizeRepositoryAccessFuncCall) Results() []interface{} {
- return []interface{}{c.Result0}
- }
- // StoreCreateLFSObjectFunc describes the behavior when the CreateLFSObject
- // method of the parent MockStore instance is invoked.
- type StoreCreateLFSObjectFunc struct {
- defaultHook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
- hooks []func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error
- history []StoreCreateLFSObjectFuncCall
- mutex sync.Mutex
- }
- // CreateLFSObject delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) CreateLFSObject(v0 context.Context, v1 int64, v2 lfsutil.OID, v3 int64, v4 lfsutil.Storage) error {
- r0 := m.CreateLFSObjectFunc.nextHook()(v0, v1, v2, v3, v4)
- m.CreateLFSObjectFunc.appendCall(StoreCreateLFSObjectFuncCall{v0, v1, v2, v3, v4, r0})
- return r0
- }
- // SetDefaultHook sets function that is called when the CreateLFSObject
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreCreateLFSObjectFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // CreateLFSObject method of the parent MockStore instance invokes the hook
- // at the front of the queue and discards it. After the queue is empty, the
- // default hook function is invoked for any future action.
- func (f *StoreCreateLFSObjectFunc) PushHook(hook func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreCreateLFSObjectFunc) SetDefaultReturn(r0 error) {
- f.SetDefaultHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
- return r0
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreCreateLFSObjectFunc) PushReturn(r0 error) {
- f.PushHook(func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
- return r0
- })
- }
- func (f *StoreCreateLFSObjectFunc) nextHook() func(context.Context, int64, lfsutil.OID, int64, lfsutil.Storage) error {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreCreateLFSObjectFunc) appendCall(r0 StoreCreateLFSObjectFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreCreateLFSObjectFuncCall objects
- // describing the invocations of this function.
- func (f *StoreCreateLFSObjectFunc) History() []StoreCreateLFSObjectFuncCall {
- f.mutex.Lock()
- history := make([]StoreCreateLFSObjectFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreCreateLFSObjectFuncCall is an object that describes an invocation of
- // method CreateLFSObject on an instance of MockStore.
- type StoreCreateLFSObjectFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Arg2 is the value of the 3rd argument passed to this method
- // invocation.
- Arg2 lfsutil.OID
- // Arg3 is the value of the 4th argument passed to this method
- // invocation.
- Arg3 int64
- // Arg4 is the value of the 5th argument passed to this method
- // invocation.
- Arg4 lfsutil.Storage
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreCreateLFSObjectFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3, c.Arg4}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreCreateLFSObjectFuncCall) Results() []interface{} {
- return []interface{}{c.Result0}
- }
- // StoreCreateUserFunc describes the behavior when the CreateUser method of
- // the parent MockStore instance is invoked.
- type StoreCreateUserFunc struct {
- defaultHook func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)
- hooks []func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)
- history []StoreCreateUserFuncCall
- mutex sync.Mutex
- }
- // CreateUser delegates to the next hook function in the queue and stores
- // the parameter and result values of this invocation.
- func (m *MockStore) CreateUser(v0 context.Context, v1 string, v2 string, v3 database.CreateUserOptions) (*database.User, error) {
- r0, r1 := m.CreateUserFunc.nextHook()(v0, v1, v2, v3)
- m.CreateUserFunc.appendCall(StoreCreateUserFuncCall{v0, v1, v2, v3, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the CreateUser method of
- // the parent MockStore instance is invoked and the hook queue is empty.
- func (f *StoreCreateUserFunc) SetDefaultHook(hook func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // CreateUser method of the parent MockStore instance invokes the hook at
- // the front of the queue and discards it. After the queue is empty, the
- // default hook function is invoked for any future action.
- func (f *StoreCreateUserFunc) PushHook(hook func(context.Context, string, string, database.CreateUserOptions) (*database.User, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreCreateUserFunc) SetDefaultReturn(r0 *database.User, r1 error) {
- f.SetDefaultHook(func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreCreateUserFunc) PushReturn(r0 *database.User, r1 error) {
- f.PushHook(func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
- return r0, r1
- })
- }
- func (f *StoreCreateUserFunc) nextHook() func(context.Context, string, string, database.CreateUserOptions) (*database.User, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreCreateUserFunc) appendCall(r0 StoreCreateUserFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreCreateUserFuncCall objects describing
- // the invocations of this function.
- func (f *StoreCreateUserFunc) History() []StoreCreateUserFuncCall {
- f.mutex.Lock()
- history := make([]StoreCreateUserFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreCreateUserFuncCall is an object that describes an invocation of
- // method CreateUser on an instance of MockStore.
- type StoreCreateUserFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 string
- // Arg2 is the value of the 3rd argument passed to this method
- // invocation.
- Arg2 string
- // Arg3 is the value of the 4th argument passed to this method
- // invocation.
- Arg3 database.CreateUserOptions
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.User
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreCreateUserFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1, c.Arg2, c.Arg3}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreCreateUserFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreGetAccessTokenBySHA1Func describes the behavior when the
- // GetAccessTokenBySHA1 method of the parent MockStore instance is invoked.
- type StoreGetAccessTokenBySHA1Func struct {
- defaultHook func(context.Context, string) (*database.AccessToken, error)
- hooks []func(context.Context, string) (*database.AccessToken, error)
- history []StoreGetAccessTokenBySHA1FuncCall
- mutex sync.Mutex
- }
- // GetAccessTokenBySHA1 delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) GetAccessTokenBySHA1(v0 context.Context, v1 string) (*database.AccessToken, error) {
- r0, r1 := m.GetAccessTokenBySHA1Func.nextHook()(v0, v1)
- m.GetAccessTokenBySHA1Func.appendCall(StoreGetAccessTokenBySHA1FuncCall{v0, v1, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the GetAccessTokenBySHA1
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreGetAccessTokenBySHA1Func) SetDefaultHook(hook func(context.Context, string) (*database.AccessToken, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // GetAccessTokenBySHA1 method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreGetAccessTokenBySHA1Func) PushHook(hook func(context.Context, string) (*database.AccessToken, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreGetAccessTokenBySHA1Func) SetDefaultReturn(r0 *database.AccessToken, r1 error) {
- f.SetDefaultHook(func(context.Context, string) (*database.AccessToken, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreGetAccessTokenBySHA1Func) PushReturn(r0 *database.AccessToken, r1 error) {
- f.PushHook(func(context.Context, string) (*database.AccessToken, error) {
- return r0, r1
- })
- }
- func (f *StoreGetAccessTokenBySHA1Func) nextHook() func(context.Context, string) (*database.AccessToken, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreGetAccessTokenBySHA1Func) appendCall(r0 StoreGetAccessTokenBySHA1FuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreGetAccessTokenBySHA1FuncCall objects
- // describing the invocations of this function.
- func (f *StoreGetAccessTokenBySHA1Func) History() []StoreGetAccessTokenBySHA1FuncCall {
- f.mutex.Lock()
- history := make([]StoreGetAccessTokenBySHA1FuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreGetAccessTokenBySHA1FuncCall is an object that describes an
- // invocation of method GetAccessTokenBySHA1 on an instance of MockStore.
- type StoreGetAccessTokenBySHA1FuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 string
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.AccessToken
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreGetAccessTokenBySHA1FuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreGetAccessTokenBySHA1FuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreGetLFSObjectByOIDFunc describes the behavior when the
- // GetLFSObjectByOID method of the parent MockStore instance is invoked.
- type StoreGetLFSObjectByOIDFunc struct {
- defaultHook func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)
- hooks []func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)
- history []StoreGetLFSObjectByOIDFuncCall
- mutex sync.Mutex
- }
- // GetLFSObjectByOID delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) GetLFSObjectByOID(v0 context.Context, v1 int64, v2 lfsutil.OID) (*database.LFSObject, error) {
- r0, r1 := m.GetLFSObjectByOIDFunc.nextHook()(v0, v1, v2)
- m.GetLFSObjectByOIDFunc.appendCall(StoreGetLFSObjectByOIDFuncCall{v0, v1, v2, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the GetLFSObjectByOID
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreGetLFSObjectByOIDFunc) SetDefaultHook(hook func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // GetLFSObjectByOID method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreGetLFSObjectByOIDFunc) PushHook(hook func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreGetLFSObjectByOIDFunc) SetDefaultReturn(r0 *database.LFSObject, r1 error) {
- f.SetDefaultHook(func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreGetLFSObjectByOIDFunc) PushReturn(r0 *database.LFSObject, r1 error) {
- f.PushHook(func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
- return r0, r1
- })
- }
- func (f *StoreGetLFSObjectByOIDFunc) nextHook() func(context.Context, int64, lfsutil.OID) (*database.LFSObject, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreGetLFSObjectByOIDFunc) appendCall(r0 StoreGetLFSObjectByOIDFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreGetLFSObjectByOIDFuncCall objects
- // describing the invocations of this function.
- func (f *StoreGetLFSObjectByOIDFunc) History() []StoreGetLFSObjectByOIDFuncCall {
- f.mutex.Lock()
- history := make([]StoreGetLFSObjectByOIDFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreGetLFSObjectByOIDFuncCall is an object that describes an invocation
- // of method GetLFSObjectByOID on an instance of MockStore.
- type StoreGetLFSObjectByOIDFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Arg2 is the value of the 3rd argument passed to this method
- // invocation.
- Arg2 lfsutil.OID
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.LFSObject
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreGetLFSObjectByOIDFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1, c.Arg2}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreGetLFSObjectByOIDFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreGetLFSObjectsByOIDsFunc describes the behavior when the
- // GetLFSObjectsByOIDs method of the parent MockStore instance is invoked.
- type StoreGetLFSObjectsByOIDsFunc struct {
- defaultHook func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)
- hooks []func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)
- history []StoreGetLFSObjectsByOIDsFuncCall
- mutex sync.Mutex
- }
- // GetLFSObjectsByOIDs delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) GetLFSObjectsByOIDs(v0 context.Context, v1 int64, v2 ...lfsutil.OID) ([]*database.LFSObject, error) {
- r0, r1 := m.GetLFSObjectsByOIDsFunc.nextHook()(v0, v1, v2...)
- m.GetLFSObjectsByOIDsFunc.appendCall(StoreGetLFSObjectsByOIDsFuncCall{v0, v1, v2, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the GetLFSObjectsByOIDs
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreGetLFSObjectsByOIDsFunc) SetDefaultHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // GetLFSObjectsByOIDs method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreGetLFSObjectsByOIDsFunc) PushHook(hook func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreGetLFSObjectsByOIDsFunc) SetDefaultReturn(r0 []*database.LFSObject, r1 error) {
- f.SetDefaultHook(func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreGetLFSObjectsByOIDsFunc) PushReturn(r0 []*database.LFSObject, r1 error) {
- f.PushHook(func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
- return r0, r1
- })
- }
- func (f *StoreGetLFSObjectsByOIDsFunc) nextHook() func(context.Context, int64, ...lfsutil.OID) ([]*database.LFSObject, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreGetLFSObjectsByOIDsFunc) appendCall(r0 StoreGetLFSObjectsByOIDsFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreGetLFSObjectsByOIDsFuncCall objects
- // describing the invocations of this function.
- func (f *StoreGetLFSObjectsByOIDsFunc) History() []StoreGetLFSObjectsByOIDsFuncCall {
- f.mutex.Lock()
- history := make([]StoreGetLFSObjectsByOIDsFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreGetLFSObjectsByOIDsFuncCall is an object that describes an
- // invocation of method GetLFSObjectsByOIDs on an instance of MockStore.
- type StoreGetLFSObjectsByOIDsFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Arg2 is a slice containing the values of the variadic arguments
- // passed to this method invocation.
- Arg2 []lfsutil.OID
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 []*database.LFSObject
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation. The variadic slice argument is flattened in this array such
- // that one positional argument and three variadic arguments would result in
- // a slice of four, not two.
- func (c StoreGetLFSObjectsByOIDsFuncCall) Args() []interface{} {
- trailing := []interface{}{}
- for _, val := range c.Arg2 {
- trailing = append(trailing, val)
- }
- return append([]interface{}{c.Arg0, c.Arg1}, trailing...)
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreGetLFSObjectsByOIDsFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreGetRepositoryByNameFunc describes the behavior when the
- // GetRepositoryByName method of the parent MockStore instance is invoked.
- type StoreGetRepositoryByNameFunc struct {
- defaultHook func(context.Context, int64, string) (*database.Repository, error)
- hooks []func(context.Context, int64, string) (*database.Repository, error)
- history []StoreGetRepositoryByNameFuncCall
- mutex sync.Mutex
- }
- // GetRepositoryByName delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) GetRepositoryByName(v0 context.Context, v1 int64, v2 string) (*database.Repository, error) {
- r0, r1 := m.GetRepositoryByNameFunc.nextHook()(v0, v1, v2)
- m.GetRepositoryByNameFunc.appendCall(StoreGetRepositoryByNameFuncCall{v0, v1, v2, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the GetRepositoryByName
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreGetRepositoryByNameFunc) SetDefaultHook(hook func(context.Context, int64, string) (*database.Repository, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // GetRepositoryByName method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreGetRepositoryByNameFunc) PushHook(hook func(context.Context, int64, string) (*database.Repository, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreGetRepositoryByNameFunc) SetDefaultReturn(r0 *database.Repository, r1 error) {
- f.SetDefaultHook(func(context.Context, int64, string) (*database.Repository, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreGetRepositoryByNameFunc) PushReturn(r0 *database.Repository, r1 error) {
- f.PushHook(func(context.Context, int64, string) (*database.Repository, error) {
- return r0, r1
- })
- }
- func (f *StoreGetRepositoryByNameFunc) nextHook() func(context.Context, int64, string) (*database.Repository, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreGetRepositoryByNameFunc) appendCall(r0 StoreGetRepositoryByNameFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreGetRepositoryByNameFuncCall objects
- // describing the invocations of this function.
- func (f *StoreGetRepositoryByNameFunc) History() []StoreGetRepositoryByNameFuncCall {
- f.mutex.Lock()
- history := make([]StoreGetRepositoryByNameFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreGetRepositoryByNameFuncCall is an object that describes an
- // invocation of method GetRepositoryByName on an instance of MockStore.
- type StoreGetRepositoryByNameFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Arg2 is the value of the 3rd argument passed to this method
- // invocation.
- Arg2 string
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.Repository
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreGetRepositoryByNameFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1, c.Arg2}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreGetRepositoryByNameFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreGetUserByIDFunc describes the behavior when the GetUserByID method
- // of the parent MockStore instance is invoked.
- type StoreGetUserByIDFunc struct {
- defaultHook func(context.Context, int64) (*database.User, error)
- hooks []func(context.Context, int64) (*database.User, error)
- history []StoreGetUserByIDFuncCall
- mutex sync.Mutex
- }
- // GetUserByID delegates to the next hook function in the queue and stores
- // the parameter and result values of this invocation.
- func (m *MockStore) GetUserByID(v0 context.Context, v1 int64) (*database.User, error) {
- r0, r1 := m.GetUserByIDFunc.nextHook()(v0, v1)
- m.GetUserByIDFunc.appendCall(StoreGetUserByIDFuncCall{v0, v1, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the GetUserByID method
- // of the parent MockStore instance is invoked and the hook queue is empty.
- func (f *StoreGetUserByIDFunc) SetDefaultHook(hook func(context.Context, int64) (*database.User, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // GetUserByID method of the parent MockStore instance invokes the hook at
- // the front of the queue and discards it. After the queue is empty, the
- // default hook function is invoked for any future action.
- func (f *StoreGetUserByIDFunc) PushHook(hook func(context.Context, int64) (*database.User, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreGetUserByIDFunc) SetDefaultReturn(r0 *database.User, r1 error) {
- f.SetDefaultHook(func(context.Context, int64) (*database.User, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreGetUserByIDFunc) PushReturn(r0 *database.User, r1 error) {
- f.PushHook(func(context.Context, int64) (*database.User, error) {
- return r0, r1
- })
- }
- func (f *StoreGetUserByIDFunc) nextHook() func(context.Context, int64) (*database.User, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreGetUserByIDFunc) appendCall(r0 StoreGetUserByIDFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreGetUserByIDFuncCall objects describing
- // the invocations of this function.
- func (f *StoreGetUserByIDFunc) History() []StoreGetUserByIDFuncCall {
- f.mutex.Lock()
- history := make([]StoreGetUserByIDFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreGetUserByIDFuncCall is an object that describes an invocation of
- // method GetUserByID on an instance of MockStore.
- type StoreGetUserByIDFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.User
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreGetUserByIDFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreGetUserByIDFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreGetUserByUsernameFunc describes the behavior when the
- // GetUserByUsername method of the parent MockStore instance is invoked.
- type StoreGetUserByUsernameFunc struct {
- defaultHook func(context.Context, string) (*database.User, error)
- hooks []func(context.Context, string) (*database.User, error)
- history []StoreGetUserByUsernameFuncCall
- mutex sync.Mutex
- }
- // GetUserByUsername delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) GetUserByUsername(v0 context.Context, v1 string) (*database.User, error) {
- r0, r1 := m.GetUserByUsernameFunc.nextHook()(v0, v1)
- m.GetUserByUsernameFunc.appendCall(StoreGetUserByUsernameFuncCall{v0, v1, r0, r1})
- return r0, r1
- }
- // SetDefaultHook sets function that is called when the GetUserByUsername
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreGetUserByUsernameFunc) SetDefaultHook(hook func(context.Context, string) (*database.User, error)) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // GetUserByUsername method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreGetUserByUsernameFunc) PushHook(hook func(context.Context, string) (*database.User, error)) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreGetUserByUsernameFunc) SetDefaultReturn(r0 *database.User, r1 error) {
- f.SetDefaultHook(func(context.Context, string) (*database.User, error) {
- return r0, r1
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreGetUserByUsernameFunc) PushReturn(r0 *database.User, r1 error) {
- f.PushHook(func(context.Context, string) (*database.User, error) {
- return r0, r1
- })
- }
- func (f *StoreGetUserByUsernameFunc) nextHook() func(context.Context, string) (*database.User, error) {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreGetUserByUsernameFunc) appendCall(r0 StoreGetUserByUsernameFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreGetUserByUsernameFuncCall objects
- // describing the invocations of this function.
- func (f *StoreGetUserByUsernameFunc) History() []StoreGetUserByUsernameFuncCall {
- f.mutex.Lock()
- history := make([]StoreGetUserByUsernameFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreGetUserByUsernameFuncCall is an object that describes an invocation
- // of method GetUserByUsername on an instance of MockStore.
- type StoreGetUserByUsernameFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 string
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 *database.User
- // Result1 is the value of the 2nd result returned from this method
- // invocation.
- Result1 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreGetUserByUsernameFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreGetUserByUsernameFuncCall) Results() []interface{} {
- return []interface{}{c.Result0, c.Result1}
- }
- // StoreIsTwoFactorEnabledFunc describes the behavior when the
- // IsTwoFactorEnabled method of the parent MockStore instance is invoked.
- type StoreIsTwoFactorEnabledFunc struct {
- defaultHook func(context.Context, int64) bool
- hooks []func(context.Context, int64) bool
- history []StoreIsTwoFactorEnabledFuncCall
- mutex sync.Mutex
- }
- // IsTwoFactorEnabled delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) IsTwoFactorEnabled(v0 context.Context, v1 int64) bool {
- r0 := m.IsTwoFactorEnabledFunc.nextHook()(v0, v1)
- m.IsTwoFactorEnabledFunc.appendCall(StoreIsTwoFactorEnabledFuncCall{v0, v1, r0})
- return r0
- }
- // SetDefaultHook sets function that is called when the IsTwoFactorEnabled
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreIsTwoFactorEnabledFunc) SetDefaultHook(hook func(context.Context, int64) bool) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // IsTwoFactorEnabled method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreIsTwoFactorEnabledFunc) PushHook(hook func(context.Context, int64) bool) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreIsTwoFactorEnabledFunc) SetDefaultReturn(r0 bool) {
- f.SetDefaultHook(func(context.Context, int64) bool {
- return r0
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreIsTwoFactorEnabledFunc) PushReturn(r0 bool) {
- f.PushHook(func(context.Context, int64) bool {
- return r0
- })
- }
- func (f *StoreIsTwoFactorEnabledFunc) nextHook() func(context.Context, int64) bool {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreIsTwoFactorEnabledFunc) appendCall(r0 StoreIsTwoFactorEnabledFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreIsTwoFactorEnabledFuncCall objects
- // describing the invocations of this function.
- func (f *StoreIsTwoFactorEnabledFunc) History() []StoreIsTwoFactorEnabledFuncCall {
- f.mutex.Lock()
- history := make([]StoreIsTwoFactorEnabledFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreIsTwoFactorEnabledFuncCall is an object that describes an invocation
- // of method IsTwoFactorEnabled on an instance of MockStore.
- type StoreIsTwoFactorEnabledFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 bool
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreIsTwoFactorEnabledFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreIsTwoFactorEnabledFuncCall) Results() []interface{} {
- return []interface{}{c.Result0}
- }
- // StoreTouchAccessTokenByIDFunc describes the behavior when the
- // TouchAccessTokenByID method of the parent MockStore instance is invoked.
- type StoreTouchAccessTokenByIDFunc struct {
- defaultHook func(context.Context, int64) error
- hooks []func(context.Context, int64) error
- history []StoreTouchAccessTokenByIDFuncCall
- mutex sync.Mutex
- }
- // TouchAccessTokenByID delegates to the next hook function in the queue and
- // stores the parameter and result values of this invocation.
- func (m *MockStore) TouchAccessTokenByID(v0 context.Context, v1 int64) error {
- r0 := m.TouchAccessTokenByIDFunc.nextHook()(v0, v1)
- m.TouchAccessTokenByIDFunc.appendCall(StoreTouchAccessTokenByIDFuncCall{v0, v1, r0})
- return r0
- }
- // SetDefaultHook sets function that is called when the TouchAccessTokenByID
- // method of the parent MockStore instance is invoked and the hook queue is
- // empty.
- func (f *StoreTouchAccessTokenByIDFunc) SetDefaultHook(hook func(context.Context, int64) error) {
- f.defaultHook = hook
- }
- // PushHook adds a function to the end of hook queue. Each invocation of the
- // TouchAccessTokenByID method of the parent MockStore instance invokes the
- // hook at the front of the queue and discards it. After the queue is empty,
- // the default hook function is invoked for any future action.
- func (f *StoreTouchAccessTokenByIDFunc) PushHook(hook func(context.Context, int64) error) {
- f.mutex.Lock()
- f.hooks = append(f.hooks, hook)
- f.mutex.Unlock()
- }
- // SetDefaultReturn calls SetDefaultHook with a function that returns the
- // given values.
- func (f *StoreTouchAccessTokenByIDFunc) SetDefaultReturn(r0 error) {
- f.SetDefaultHook(func(context.Context, int64) error {
- return r0
- })
- }
- // PushReturn calls PushHook with a function that returns the given values.
- func (f *StoreTouchAccessTokenByIDFunc) PushReturn(r0 error) {
- f.PushHook(func(context.Context, int64) error {
- return r0
- })
- }
- func (f *StoreTouchAccessTokenByIDFunc) nextHook() func(context.Context, int64) error {
- f.mutex.Lock()
- defer f.mutex.Unlock()
- if len(f.hooks) == 0 {
- return f.defaultHook
- }
- hook := f.hooks[0]
- f.hooks = f.hooks[1:]
- return hook
- }
- func (f *StoreTouchAccessTokenByIDFunc) appendCall(r0 StoreTouchAccessTokenByIDFuncCall) {
- f.mutex.Lock()
- f.history = append(f.history, r0)
- f.mutex.Unlock()
- }
- // History returns a sequence of StoreTouchAccessTokenByIDFuncCall objects
- // describing the invocations of this function.
- func (f *StoreTouchAccessTokenByIDFunc) History() []StoreTouchAccessTokenByIDFuncCall {
- f.mutex.Lock()
- history := make([]StoreTouchAccessTokenByIDFuncCall, len(f.history))
- copy(history, f.history)
- f.mutex.Unlock()
- return history
- }
- // StoreTouchAccessTokenByIDFuncCall is an object that describes an
- // invocation of method TouchAccessTokenByID on an instance of MockStore.
- type StoreTouchAccessTokenByIDFuncCall struct {
- // Arg0 is the value of the 1st argument passed to this method
- // invocation.
- Arg0 context.Context
- // Arg1 is the value of the 2nd argument passed to this method
- // invocation.
- Arg1 int64
- // Result0 is the value of the 1st result returned from this method
- // invocation.
- Result0 error
- }
- // Args returns an interface slice containing the arguments of this
- // invocation.
- func (c StoreTouchAccessTokenByIDFuncCall) Args() []interface{} {
- return []interface{}{c.Arg0, c.Arg1}
- }
- // Results returns an interface slice containing the results of this
- // invocation.
- func (c StoreTouchAccessTokenByIDFuncCall) Results() []interface{} {
- return []interface{}{c.Result0}
- }
|