// Code generated by moq; DO NOT EDIT. // github.com/matryer/moq package db_mock import ( "context" "gitea.theedgeofrage.com/TheEdgeOfRage/ytrssil-api/db" "gitea.theedgeofrage.com/TheEdgeOfRage/ytrssil-api/models" "sync" ) // Ensure, that DBMock does implement db.DB. // If this is not the case, regenerate this file with moq. var _ db.DB = &DBMock{} // DBMock is a mock implementation of db.DB. // // func TestSomethingThatUsesDB(t *testing.T) { // // // make and configure a mocked db.DB // mockedDB := &DBMock{ // AuthenticateUserFunc: func(ctx context.Context, username string, password string) (bool, error) { // panic("mock out the AuthenticateUser method") // }, // CreateUserFunc: func(ctx context.Context, user models.User) error { // panic("mock out the CreateUser method") // }, // GetNewVideosFunc: func(ctx context.Context, username string) ([]*models.Video, error) { // panic("mock out the GetNewVideos method") // }, // } // // // use mockedDB in code that requires db.DB // // and then make assertions. // // } type DBMock struct { // AuthenticateUserFunc mocks the AuthenticateUser method. AuthenticateUserFunc func(ctx context.Context, username string, password string) (bool, error) // CreateUserFunc mocks the CreateUser method. CreateUserFunc func(ctx context.Context, user models.User) error // GetNewVideosFunc mocks the GetNewVideos method. GetNewVideosFunc func(ctx context.Context, username string) ([]*models.Video, error) // calls tracks calls to the methods. calls struct { // AuthenticateUser holds details about calls to the AuthenticateUser method. AuthenticateUser []struct { // Ctx is the ctx argument value. Ctx context.Context // Username is the username argument value. Username string // Password is the password argument value. Password string } // CreateUser holds details about calls to the CreateUser method. CreateUser []struct { // Ctx is the ctx argument value. Ctx context.Context // User is the user argument value. User models.User } // GetNewVideos holds details about calls to the GetNewVideos method. GetNewVideos []struct { // Ctx is the ctx argument value. Ctx context.Context // Username is the username argument value. Username string } } lockAuthenticateUser sync.RWMutex lockCreateUser sync.RWMutex lockGetNewVideos sync.RWMutex } // AuthenticateUser calls AuthenticateUserFunc. func (mock *DBMock) AuthenticateUser(ctx context.Context, username string, password string) (bool, error) { if mock.AuthenticateUserFunc == nil { panic("DBMock.AuthenticateUserFunc: method is nil but DB.AuthenticateUser was just called") } callInfo := struct { Ctx context.Context Username string Password string }{ Ctx: ctx, Username: username, Password: password, } mock.lockAuthenticateUser.Lock() mock.calls.AuthenticateUser = append(mock.calls.AuthenticateUser, callInfo) mock.lockAuthenticateUser.Unlock() return mock.AuthenticateUserFunc(ctx, username, password) } // AuthenticateUserCalls gets all the calls that were made to AuthenticateUser. // Check the length with: // // len(mockedDB.AuthenticateUserCalls()) func (mock *DBMock) AuthenticateUserCalls() []struct { Ctx context.Context Username string Password string } { var calls []struct { Ctx context.Context Username string Password string } mock.lockAuthenticateUser.RLock() calls = mock.calls.AuthenticateUser mock.lockAuthenticateUser.RUnlock() return calls } // CreateUser calls CreateUserFunc. func (mock *DBMock) CreateUser(ctx context.Context, user models.User) error { if mock.CreateUserFunc == nil { panic("DBMock.CreateUserFunc: method is nil but DB.CreateUser was just called") } callInfo := struct { Ctx context.Context User models.User }{ Ctx: ctx, User: user, } mock.lockCreateUser.Lock() mock.calls.CreateUser = append(mock.calls.CreateUser, callInfo) mock.lockCreateUser.Unlock() return mock.CreateUserFunc(ctx, user) } // CreateUserCalls gets all the calls that were made to CreateUser. // Check the length with: // // len(mockedDB.CreateUserCalls()) func (mock *DBMock) CreateUserCalls() []struct { Ctx context.Context User models.User } { var calls []struct { Ctx context.Context User models.User } mock.lockCreateUser.RLock() calls = mock.calls.CreateUser mock.lockCreateUser.RUnlock() return calls } // GetNewVideos calls GetNewVideosFunc. func (mock *DBMock) GetNewVideos(ctx context.Context, username string) ([]*models.Video, error) { if mock.GetNewVideosFunc == nil { panic("DBMock.GetNewVideosFunc: method is nil but DB.GetNewVideos was just called") } callInfo := struct { Ctx context.Context Username string }{ Ctx: ctx, Username: username, } mock.lockGetNewVideos.Lock() mock.calls.GetNewVideos = append(mock.calls.GetNewVideos, callInfo) mock.lockGetNewVideos.Unlock() return mock.GetNewVideosFunc(ctx, username) } // GetNewVideosCalls gets all the calls that were made to GetNewVideos. // Check the length with: // // len(mockedDB.GetNewVideosCalls()) func (mock *DBMock) GetNewVideosCalls() []struct { Ctx context.Context Username string } { var calls []struct { Ctx context.Context Username string } mock.lockGetNewVideos.RLock() calls = mock.calls.GetNewVideos mock.lockGetNewVideos.RUnlock() return calls }