diff --git a/mocks/biz/SettingRepo.go b/mocks/biz/SettingRepo.go index 1ced4c34..8c71783b 100644 --- a/mocks/biz/SettingRepo.go +++ b/mocks/biz/SettingRepo.go @@ -9,8 +9,6 @@ import ( mock "github.com/stretchr/testify/mock" - otp "github.com/pquerna/otp" - request "github.com/tnb-labs/panel/internal/http/request" ) @@ -73,118 +71,6 @@ func (_c *SettingRepo_Delete_Call) RunAndReturn(run func(biz.SettingKey) error) return _c } -// GenerateAPIKey provides a mock function with no fields -func (_m *SettingRepo) GenerateAPIKey() (string, error) { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GenerateAPIKey") - } - - var r0 string - var r1 error - if rf, ok := ret.Get(0).(func() (string, error)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SettingRepo_GenerateAPIKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateAPIKey' -type SettingRepo_GenerateAPIKey_Call struct { - *mock.Call -} - -// GenerateAPIKey is a helper method to define mock.On call -func (_e *SettingRepo_Expecter) GenerateAPIKey() *SettingRepo_GenerateAPIKey_Call { - return &SettingRepo_GenerateAPIKey_Call{Call: _e.mock.On("GenerateAPIKey")} -} - -func (_c *SettingRepo_GenerateAPIKey_Call) Run(run func()) *SettingRepo_GenerateAPIKey_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *SettingRepo_GenerateAPIKey_Call) Return(_a0 string, _a1 error) *SettingRepo_GenerateAPIKey_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *SettingRepo_GenerateAPIKey_Call) RunAndReturn(run func() (string, error)) *SettingRepo_GenerateAPIKey_Call { - _c.Call.Return(run) - return _c -} - -// GenerateTwoFAKey provides a mock function with no fields -func (_m *SettingRepo) GenerateTwoFAKey() (*otp.Key, error) { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GenerateTwoFAKey") - } - - var r0 *otp.Key - var r1 error - if rf, ok := ret.Get(0).(func() (*otp.Key, error)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() *otp.Key); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*otp.Key) - } - } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// SettingRepo_GenerateTwoFAKey_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateTwoFAKey' -type SettingRepo_GenerateTwoFAKey_Call struct { - *mock.Call -} - -// GenerateTwoFAKey is a helper method to define mock.On call -func (_e *SettingRepo_Expecter) GenerateTwoFAKey() *SettingRepo_GenerateTwoFAKey_Call { - return &SettingRepo_GenerateTwoFAKey_Call{Call: _e.mock.On("GenerateTwoFAKey")} -} - -func (_c *SettingRepo_GenerateTwoFAKey_Call) Run(run func()) *SettingRepo_GenerateTwoFAKey_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *SettingRepo_GenerateTwoFAKey_Call) Return(_a0 *otp.Key, _a1 error) *SettingRepo_GenerateTwoFAKey_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *SettingRepo_GenerateTwoFAKey_Call) RunAndReturn(run func() (*otp.Key, error)) *SettingRepo_GenerateTwoFAKey_Call { - _c.Call.Return(run) - return _c -} - // Get provides a mock function with given fields: key, defaultValue func (_m *SettingRepo) Get(key biz.SettingKey, defaultValue ...string) (string, error) { _va := make([]interface{}, len(defaultValue)) diff --git a/mocks/biz/UserTokenRepo.go b/mocks/biz/UserTokenRepo.go new file mode 100644 index 00000000..275a7e53 --- /dev/null +++ b/mocks/biz/UserTokenRepo.go @@ -0,0 +1,198 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + mock "github.com/stretchr/testify/mock" + biz "github.com/tnb-labs/panel/internal/biz" +) + +// UserTokenRepo is an autogenerated mock type for the UserTokenRepo type +type UserTokenRepo struct { + mock.Mock +} + +type UserTokenRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *UserTokenRepo) EXPECT() *UserTokenRepo_Expecter { + return &UserTokenRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: userID, ips +func (_m *UserTokenRepo) Create(userID uint, ips []string) (*biz.UserToken, error) { + ret := _m.Called(userID, ips) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *biz.UserToken + var r1 error + if rf, ok := ret.Get(0).(func(uint, []string) (*biz.UserToken, error)); ok { + return rf(userID, ips) + } + if rf, ok := ret.Get(0).(func(uint, []string) *biz.UserToken); ok { + r0 = rf(userID, ips) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.UserToken) + } + } + + if rf, ok := ret.Get(1).(func(uint, []string) error); ok { + r1 = rf(userID, ips) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserTokenRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type UserTokenRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - userID uint +// - ips []string +func (_e *UserTokenRepo_Expecter) Create(userID interface{}, ips interface{}) *UserTokenRepo_Create_Call { + return &UserTokenRepo_Create_Call{Call: _e.mock.On("Create", userID, ips)} +} + +func (_c *UserTokenRepo_Create_Call) Run(run func(userID uint, ips []string)) *UserTokenRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].([]string)) + }) + return _c +} + +func (_c *UserTokenRepo_Create_Call) Return(_a0 *biz.UserToken, _a1 error) *UserTokenRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserTokenRepo_Create_Call) RunAndReturn(run func(uint, []string) (*biz.UserToken, error)) *UserTokenRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *UserTokenRepo) Get(id uint) (*biz.UserToken, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.UserToken + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.UserToken, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.UserToken); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.UserToken) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserTokenRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type UserTokenRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *UserTokenRepo_Expecter) Get(id interface{}) *UserTokenRepo_Get_Call { + return &UserTokenRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *UserTokenRepo_Get_Call) Run(run func(id uint)) *UserTokenRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *UserTokenRepo_Get_Call) Return(_a0 *biz.UserToken, _a1 error) *UserTokenRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserTokenRepo_Get_Call) RunAndReturn(run func(uint) (*biz.UserToken, error)) *UserTokenRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// Save provides a mock function with given fields: user +func (_m *UserTokenRepo) Save(user *biz.UserToken) error { + ret := _m.Called(user) + + if len(ret) == 0 { + panic("no return value specified for Save") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*biz.UserToken) error); ok { + r0 = rf(user) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserTokenRepo_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save' +type UserTokenRepo_Save_Call struct { + *mock.Call +} + +// Save is a helper method to define mock.On call +// - user *biz.UserToken +func (_e *UserTokenRepo_Expecter) Save(user interface{}) *UserTokenRepo_Save_Call { + return &UserTokenRepo_Save_Call{Call: _e.mock.On("Save", user)} +} + +func (_c *UserTokenRepo_Save_Call) Run(run func(user *biz.UserToken)) *UserTokenRepo_Save_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*biz.UserToken)) + }) + return _c +} + +func (_c *UserTokenRepo_Save_Call) Return(_a0 error) *UserTokenRepo_Save_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserTokenRepo_Save_Call) RunAndReturn(run func(*biz.UserToken) error) *UserTokenRepo_Save_Call { + _c.Call.Return(run) + return _c +} + +// NewUserTokenRepo creates a new instance of UserTokenRepo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewUserTokenRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *UserTokenRepo { + mock := &UserTokenRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}