From 015fb76d4ca110f16e158fe1e10fef632cefa29d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Mon, 16 Dec 2024 02:53:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=9F=E6=88=90mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/mockery.yml | 22 + mocks/biz/AppRepo.go | 690 +++++++++++++++++++++++++++ mocks/biz/BackupRepo.go | 496 +++++++++++++++++++ mocks/biz/CacheRepo.go | 243 ++++++++++ mocks/biz/CertAccountRepo.go | 369 ++++++++++++++ mocks/biz/CertDNSRepo.go | 311 ++++++++++++ mocks/biz/CertRepo.go | 756 +++++++++++++++++++++++++++++ mocks/biz/ContainerImageRepo.go | 230 +++++++++ mocks/biz/ContainerNetworkRepo.go | 240 ++++++++++ mocks/biz/ContainerRepo.go | 677 ++++++++++++++++++++++++++ mocks/biz/ContainerVolumeRepo.go | 240 ++++++++++ mocks/biz/CronRepo.go | 401 ++++++++++++++++ mocks/biz/DatabaseRepo.go | 242 ++++++++++ mocks/biz/DatabaseServerRepo.go | 550 +++++++++++++++++++++ mocks/biz/DatabaseUserRepo.go | 447 +++++++++++++++++ mocks/biz/MonitorRepo.go | 246 ++++++++++ mocks/biz/SSHRepo.go | 299 ++++++++++++ mocks/biz/SafeRepo.go | 242 ++++++++++ mocks/biz/SettingRepo.go | 390 +++++++++++++++ mocks/biz/TaskRepo.go | 343 ++++++++++++++ mocks/biz/UserRepo.go | 257 ++++++++++ mocks/biz/WebsiteRepo.go | 765 ++++++++++++++++++++++++++++++ 22 files changed, 8456 insertions(+) create mode 100644 .github/workflows/mockery.yml create mode 100644 mocks/biz/AppRepo.go create mode 100644 mocks/biz/BackupRepo.go create mode 100644 mocks/biz/CacheRepo.go create mode 100644 mocks/biz/CertAccountRepo.go create mode 100644 mocks/biz/CertDNSRepo.go create mode 100644 mocks/biz/CertRepo.go create mode 100644 mocks/biz/ContainerImageRepo.go create mode 100644 mocks/biz/ContainerNetworkRepo.go create mode 100644 mocks/biz/ContainerRepo.go create mode 100644 mocks/biz/ContainerVolumeRepo.go create mode 100644 mocks/biz/CronRepo.go create mode 100644 mocks/biz/DatabaseRepo.go create mode 100644 mocks/biz/DatabaseServerRepo.go create mode 100644 mocks/biz/DatabaseUserRepo.go create mode 100644 mocks/biz/MonitorRepo.go create mode 100644 mocks/biz/SSHRepo.go create mode 100644 mocks/biz/SafeRepo.go create mode 100644 mocks/biz/SettingRepo.go create mode 100644 mocks/biz/TaskRepo.go create mode 100644 mocks/biz/UserRepo.go create mode 100644 mocks/biz/WebsiteRepo.go diff --git a/.github/workflows/mockery.yml b/.github/workflows/mockery.yml new file mode 100644 index 00000000..afb7d42a --- /dev/null +++ b/.github/workflows/mockery.yml @@ -0,0 +1,22 @@ +name: Mockery +on: + push: + branches: + - main + pull_request: +jobs: + mockery: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Install Mockery + run: | + go install github.com/vektra/mockery/v2@latest + - name: Generate Mocks + run: | + ~/go/bin/mockery + - uses: stefanzweifel/git-auto-commit-action@v5 + name: Commit changes + with: + commit_message: "chore: update mocks" diff --git a/mocks/biz/AppRepo.go b/mocks/biz/AppRepo.go new file mode 100644 index 00000000..3a03cacd --- /dev/null +++ b/mocks/biz/AppRepo.go @@ -0,0 +1,690 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + api "github.com/TheTNB/panel/pkg/api" + + mock "github.com/stretchr/testify/mock" +) + +// AppRepo is an autogenerated mock type for the AppRepo type +type AppRepo struct { + mock.Mock +} + +type AppRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *AppRepo) EXPECT() *AppRepo_Expecter { + return &AppRepo_Expecter{mock: &_m.Mock} +} + +// All provides a mock function with no fields +func (_m *AppRepo) All() api.Apps { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for All") + } + + var r0 api.Apps + if rf, ok := ret.Get(0).(func() api.Apps); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(api.Apps) + } + } + + return r0 +} + +// AppRepo_All_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'All' +type AppRepo_All_Call struct { + *mock.Call +} + +// All is a helper method to define mock.On call +func (_e *AppRepo_Expecter) All() *AppRepo_All_Call { + return &AppRepo_All_Call{Call: _e.mock.On("All")} +} + +func (_c *AppRepo_All_Call) Run(run func()) *AppRepo_All_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *AppRepo_All_Call) Return(_a0 api.Apps) *AppRepo_All_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AppRepo_All_Call) RunAndReturn(run func() api.Apps) *AppRepo_All_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: slug +func (_m *AppRepo) Get(slug string) (*api.App, error) { + ret := _m.Called(slug) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *api.App + var r1 error + if rf, ok := ret.Get(0).(func(string) (*api.App, error)); ok { + return rf(slug) + } + if rf, ok := ret.Get(0).(func(string) *api.App); ok { + r0 = rf(slug) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*api.App) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(slug) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AppRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type AppRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - slug string +func (_e *AppRepo_Expecter) Get(slug interface{}) *AppRepo_Get_Call { + return &AppRepo_Get_Call{Call: _e.mock.On("Get", slug)} +} + +func (_c *AppRepo_Get_Call) Run(run func(slug string)) *AppRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *AppRepo_Get_Call) Return(_a0 *api.App, _a1 error) *AppRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AppRepo_Get_Call) RunAndReturn(run func(string) (*api.App, error)) *AppRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetHomeShow provides a mock function with no fields +func (_m *AppRepo) GetHomeShow() ([]map[string]string, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetHomeShow") + } + + var r0 []map[string]string + var r1 error + if rf, ok := ret.Get(0).(func() ([]map[string]string, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []map[string]string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]map[string]string) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AppRepo_GetHomeShow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHomeShow' +type AppRepo_GetHomeShow_Call struct { + *mock.Call +} + +// GetHomeShow is a helper method to define mock.On call +func (_e *AppRepo_Expecter) GetHomeShow() *AppRepo_GetHomeShow_Call { + return &AppRepo_GetHomeShow_Call{Call: _e.mock.On("GetHomeShow")} +} + +func (_c *AppRepo_GetHomeShow_Call) Run(run func()) *AppRepo_GetHomeShow_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *AppRepo_GetHomeShow_Call) Return(_a0 []map[string]string, _a1 error) *AppRepo_GetHomeShow_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AppRepo_GetHomeShow_Call) RunAndReturn(run func() ([]map[string]string, error)) *AppRepo_GetHomeShow_Call { + _c.Call.Return(run) + return _c +} + +// GetInstalled provides a mock function with given fields: slug +func (_m *AppRepo) GetInstalled(slug string) (*biz.App, error) { + ret := _m.Called(slug) + + if len(ret) == 0 { + panic("no return value specified for GetInstalled") + } + + var r0 *biz.App + var r1 error + if rf, ok := ret.Get(0).(func(string) (*biz.App, error)); ok { + return rf(slug) + } + if rf, ok := ret.Get(0).(func(string) *biz.App); ok { + r0 = rf(slug) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.App) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(slug) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AppRepo_GetInstalled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInstalled' +type AppRepo_GetInstalled_Call struct { + *mock.Call +} + +// GetInstalled is a helper method to define mock.On call +// - slug string +func (_e *AppRepo_Expecter) GetInstalled(slug interface{}) *AppRepo_GetInstalled_Call { + return &AppRepo_GetInstalled_Call{Call: _e.mock.On("GetInstalled", slug)} +} + +func (_c *AppRepo_GetInstalled_Call) Run(run func(slug string)) *AppRepo_GetInstalled_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *AppRepo_GetInstalled_Call) Return(_a0 *biz.App, _a1 error) *AppRepo_GetInstalled_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AppRepo_GetInstalled_Call) RunAndReturn(run func(string) (*biz.App, error)) *AppRepo_GetInstalled_Call { + _c.Call.Return(run) + return _c +} + +// GetInstalledAll provides a mock function with given fields: query, cond +func (_m *AppRepo) GetInstalledAll(query string, cond ...string) ([]*biz.App, error) { + _va := make([]interface{}, len(cond)) + for _i := range cond { + _va[_i] = cond[_i] + } + var _ca []interface{} + _ca = append(_ca, query) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetInstalledAll") + } + + var r0 []*biz.App + var r1 error + if rf, ok := ret.Get(0).(func(string, ...string) ([]*biz.App, error)); ok { + return rf(query, cond...) + } + if rf, ok := ret.Get(0).(func(string, ...string) []*biz.App); ok { + r0 = rf(query, cond...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.App) + } + } + + if rf, ok := ret.Get(1).(func(string, ...string) error); ok { + r1 = rf(query, cond...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AppRepo_GetInstalledAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetInstalledAll' +type AppRepo_GetInstalledAll_Call struct { + *mock.Call +} + +// GetInstalledAll is a helper method to define mock.On call +// - query string +// - cond ...string +func (_e *AppRepo_Expecter) GetInstalledAll(query interface{}, cond ...interface{}) *AppRepo_GetInstalledAll_Call { + return &AppRepo_GetInstalledAll_Call{Call: _e.mock.On("GetInstalledAll", + append([]interface{}{query}, cond...)...)} +} + +func (_c *AppRepo_GetInstalledAll_Call) Run(run func(query string, cond ...string)) *AppRepo_GetInstalledAll_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *AppRepo_GetInstalledAll_Call) Return(_a0 []*biz.App, _a1 error) *AppRepo_GetInstalledAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AppRepo_GetInstalledAll_Call) RunAndReturn(run func(string, ...string) ([]*biz.App, error)) *AppRepo_GetInstalledAll_Call { + _c.Call.Return(run) + return _c +} + +// Install provides a mock function with given fields: channel, slug +func (_m *AppRepo) Install(channel string, slug string) error { + ret := _m.Called(channel, slug) + + if len(ret) == 0 { + panic("no return value specified for Install") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(channel, slug) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AppRepo_Install_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Install' +type AppRepo_Install_Call struct { + *mock.Call +} + +// Install is a helper method to define mock.On call +// - channel string +// - slug string +func (_e *AppRepo_Expecter) Install(channel interface{}, slug interface{}) *AppRepo_Install_Call { + return &AppRepo_Install_Call{Call: _e.mock.On("Install", channel, slug)} +} + +func (_c *AppRepo_Install_Call) Run(run func(channel string, slug string)) *AppRepo_Install_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *AppRepo_Install_Call) Return(_a0 error) *AppRepo_Install_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AppRepo_Install_Call) RunAndReturn(run func(string, string) error) *AppRepo_Install_Call { + _c.Call.Return(run) + return _c +} + +// Installed provides a mock function with no fields +func (_m *AppRepo) Installed() ([]*biz.App, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Installed") + } + + var r0 []*biz.App + var r1 error + if rf, ok := ret.Get(0).(func() ([]*biz.App, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []*biz.App); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.App) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AppRepo_Installed_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Installed' +type AppRepo_Installed_Call struct { + *mock.Call +} + +// Installed is a helper method to define mock.On call +func (_e *AppRepo_Expecter) Installed() *AppRepo_Installed_Call { + return &AppRepo_Installed_Call{Call: _e.mock.On("Installed")} +} + +func (_c *AppRepo_Installed_Call) Run(run func()) *AppRepo_Installed_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *AppRepo_Installed_Call) Return(_a0 []*biz.App, _a1 error) *AppRepo_Installed_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AppRepo_Installed_Call) RunAndReturn(run func() ([]*biz.App, error)) *AppRepo_Installed_Call { + _c.Call.Return(run) + return _c +} + +// IsInstalled provides a mock function with given fields: query, cond +func (_m *AppRepo) IsInstalled(query string, cond ...string) (bool, error) { + _va := make([]interface{}, len(cond)) + for _i := range cond { + _va[_i] = cond[_i] + } + var _ca []interface{} + _ca = append(_ca, query) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for IsInstalled") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(string, ...string) (bool, error)); ok { + return rf(query, cond...) + } + if rf, ok := ret.Get(0).(func(string, ...string) bool); ok { + r0 = rf(query, cond...) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(string, ...string) error); ok { + r1 = rf(query, cond...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// AppRepo_IsInstalled_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsInstalled' +type AppRepo_IsInstalled_Call struct { + *mock.Call +} + +// IsInstalled is a helper method to define mock.On call +// - query string +// - cond ...string +func (_e *AppRepo_Expecter) IsInstalled(query interface{}, cond ...interface{}) *AppRepo_IsInstalled_Call { + return &AppRepo_IsInstalled_Call{Call: _e.mock.On("IsInstalled", + append([]interface{}{query}, cond...)...)} +} + +func (_c *AppRepo_IsInstalled_Call) Run(run func(query string, cond ...string)) *AppRepo_IsInstalled_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *AppRepo_IsInstalled_Call) Return(_a0 bool, _a1 error) *AppRepo_IsInstalled_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *AppRepo_IsInstalled_Call) RunAndReturn(run func(string, ...string) (bool, error)) *AppRepo_IsInstalled_Call { + _c.Call.Return(run) + return _c +} + +// UnInstall provides a mock function with given fields: slug +func (_m *AppRepo) UnInstall(slug string) error { + ret := _m.Called(slug) + + if len(ret) == 0 { + panic("no return value specified for UnInstall") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(slug) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AppRepo_UnInstall_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnInstall' +type AppRepo_UnInstall_Call struct { + *mock.Call +} + +// UnInstall is a helper method to define mock.On call +// - slug string +func (_e *AppRepo_Expecter) UnInstall(slug interface{}) *AppRepo_UnInstall_Call { + return &AppRepo_UnInstall_Call{Call: _e.mock.On("UnInstall", slug)} +} + +func (_c *AppRepo_UnInstall_Call) Run(run func(slug string)) *AppRepo_UnInstall_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *AppRepo_UnInstall_Call) Return(_a0 error) *AppRepo_UnInstall_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AppRepo_UnInstall_Call) RunAndReturn(run func(string) error) *AppRepo_UnInstall_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: slug +func (_m *AppRepo) Update(slug string) error { + ret := _m.Called(slug) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(slug) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AppRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type AppRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - slug string +func (_e *AppRepo_Expecter) Update(slug interface{}) *AppRepo_Update_Call { + return &AppRepo_Update_Call{Call: _e.mock.On("Update", slug)} +} + +func (_c *AppRepo_Update_Call) Run(run func(slug string)) *AppRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *AppRepo_Update_Call) Return(_a0 error) *AppRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AppRepo_Update_Call) RunAndReturn(run func(string) error) *AppRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// UpdateExist provides a mock function with given fields: slug +func (_m *AppRepo) UpdateExist(slug string) bool { + ret := _m.Called(slug) + + if len(ret) == 0 { + panic("no return value specified for UpdateExist") + } + + var r0 bool + if rf, ok := ret.Get(0).(func(string) bool); ok { + r0 = rf(slug) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// AppRepo_UpdateExist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateExist' +type AppRepo_UpdateExist_Call struct { + *mock.Call +} + +// UpdateExist is a helper method to define mock.On call +// - slug string +func (_e *AppRepo_Expecter) UpdateExist(slug interface{}) *AppRepo_UpdateExist_Call { + return &AppRepo_UpdateExist_Call{Call: _e.mock.On("UpdateExist", slug)} +} + +func (_c *AppRepo_UpdateExist_Call) Run(run func(slug string)) *AppRepo_UpdateExist_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *AppRepo_UpdateExist_Call) Return(_a0 bool) *AppRepo_UpdateExist_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AppRepo_UpdateExist_Call) RunAndReturn(run func(string) bool) *AppRepo_UpdateExist_Call { + _c.Call.Return(run) + return _c +} + +// UpdateShow provides a mock function with given fields: slug, show +func (_m *AppRepo) UpdateShow(slug string, show bool) error { + ret := _m.Called(slug, show) + + if len(ret) == 0 { + panic("no return value specified for UpdateShow") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, bool) error); ok { + r0 = rf(slug, show) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// AppRepo_UpdateShow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateShow' +type AppRepo_UpdateShow_Call struct { + *mock.Call +} + +// UpdateShow is a helper method to define mock.On call +// - slug string +// - show bool +func (_e *AppRepo_Expecter) UpdateShow(slug interface{}, show interface{}) *AppRepo_UpdateShow_Call { + return &AppRepo_UpdateShow_Call{Call: _e.mock.On("UpdateShow", slug, show)} +} + +func (_c *AppRepo_UpdateShow_Call) Run(run func(slug string, show bool)) *AppRepo_UpdateShow_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(bool)) + }) + return _c +} + +func (_c *AppRepo_UpdateShow_Call) Return(_a0 error) *AppRepo_UpdateShow_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *AppRepo_UpdateShow_Call) RunAndReturn(run func(string, bool) error) *AppRepo_UpdateShow_Call { + _c.Call.Return(run) + return _c +} + +// NewAppRepo creates a new instance of AppRepo. 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 NewAppRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *AppRepo { + mock := &AppRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/BackupRepo.go b/mocks/biz/BackupRepo.go new file mode 100644 index 00000000..faadd133 --- /dev/null +++ b/mocks/biz/BackupRepo.go @@ -0,0 +1,496 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + types "github.com/TheTNB/panel/pkg/types" +) + +// BackupRepo is an autogenerated mock type for the BackupRepo type +type BackupRepo struct { + mock.Mock +} + +type BackupRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *BackupRepo) EXPECT() *BackupRepo_Expecter { + return &BackupRepo_Expecter{mock: &_m.Mock} +} + +// ClearExpired provides a mock function with given fields: path, prefix, save +func (_m *BackupRepo) ClearExpired(path string, prefix string, save int) error { + ret := _m.Called(path, prefix, save) + + if len(ret) == 0 { + panic("no return value specified for ClearExpired") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, int) error); ok { + r0 = rf(path, prefix, save) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_ClearExpired_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearExpired' +type BackupRepo_ClearExpired_Call struct { + *mock.Call +} + +// ClearExpired is a helper method to define mock.On call +// - path string +// - prefix string +// - save int +func (_e *BackupRepo_Expecter) ClearExpired(path interface{}, prefix interface{}, save interface{}) *BackupRepo_ClearExpired_Call { + return &BackupRepo_ClearExpired_Call{Call: _e.mock.On("ClearExpired", path, prefix, save)} +} + +func (_c *BackupRepo_ClearExpired_Call) Run(run func(path string, prefix string, save int)) *BackupRepo_ClearExpired_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(int)) + }) + return _c +} + +func (_c *BackupRepo_ClearExpired_Call) Return(_a0 error) *BackupRepo_ClearExpired_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_ClearExpired_Call) RunAndReturn(run func(string, string, int) error) *BackupRepo_ClearExpired_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: typ, target, path +func (_m *BackupRepo) Create(typ biz.BackupType, target string, path ...string) error { + _va := make([]interface{}, len(path)) + for _i := range path { + _va[_i] = path[_i] + } + var _ca []interface{} + _ca = append(_ca, typ, target) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(biz.BackupType, string, ...string) error); ok { + r0 = rf(typ, target, path...) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type BackupRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - typ biz.BackupType +// - target string +// - path ...string +func (_e *BackupRepo_Expecter) Create(typ interface{}, target interface{}, path ...interface{}) *BackupRepo_Create_Call { + return &BackupRepo_Create_Call{Call: _e.mock.On("Create", + append([]interface{}{typ, target}, path...)...)} +} + +func (_c *BackupRepo_Create_Call) Run(run func(typ biz.BackupType, target string, path ...string)) *BackupRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-2) + for i, a := range args[2:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(biz.BackupType), args[1].(string), variadicArgs...) + }) + return _c +} + +func (_c *BackupRepo_Create_Call) Return(_a0 error) *BackupRepo_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_Create_Call) RunAndReturn(run func(biz.BackupType, string, ...string) error) *BackupRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// CutoffLog provides a mock function with given fields: path, target +func (_m *BackupRepo) CutoffLog(path string, target string) error { + ret := _m.Called(path, target) + + if len(ret) == 0 { + panic("no return value specified for CutoffLog") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(path, target) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_CutoffLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CutoffLog' +type BackupRepo_CutoffLog_Call struct { + *mock.Call +} + +// CutoffLog is a helper method to define mock.On call +// - path string +// - target string +func (_e *BackupRepo_Expecter) CutoffLog(path interface{}, target interface{}) *BackupRepo_CutoffLog_Call { + return &BackupRepo_CutoffLog_Call{Call: _e.mock.On("CutoffLog", path, target)} +} + +func (_c *BackupRepo_CutoffLog_Call) Run(run func(path string, target string)) *BackupRepo_CutoffLog_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *BackupRepo_CutoffLog_Call) Return(_a0 error) *BackupRepo_CutoffLog_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_CutoffLog_Call) RunAndReturn(run func(string, string) error) *BackupRepo_CutoffLog_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: typ, name +func (_m *BackupRepo) Delete(typ biz.BackupType, name string) error { + ret := _m.Called(typ, name) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(biz.BackupType, string) error); ok { + r0 = rf(typ, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type BackupRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - typ biz.BackupType +// - name string +func (_e *BackupRepo_Expecter) Delete(typ interface{}, name interface{}) *BackupRepo_Delete_Call { + return &BackupRepo_Delete_Call{Call: _e.mock.On("Delete", typ, name)} +} + +func (_c *BackupRepo_Delete_Call) Run(run func(typ biz.BackupType, name string)) *BackupRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.BackupType), args[1].(string)) + }) + return _c +} + +func (_c *BackupRepo_Delete_Call) Return(_a0 error) *BackupRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_Delete_Call) RunAndReturn(run func(biz.BackupType, string) error) *BackupRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// FixPanel provides a mock function with no fields +func (_m *BackupRepo) FixPanel() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for FixPanel") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_FixPanel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FixPanel' +type BackupRepo_FixPanel_Call struct { + *mock.Call +} + +// FixPanel is a helper method to define mock.On call +func (_e *BackupRepo_Expecter) FixPanel() *BackupRepo_FixPanel_Call { + return &BackupRepo_FixPanel_Call{Call: _e.mock.On("FixPanel")} +} + +func (_c *BackupRepo_FixPanel_Call) Run(run func()) *BackupRepo_FixPanel_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *BackupRepo_FixPanel_Call) Return(_a0 error) *BackupRepo_FixPanel_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_FixPanel_Call) RunAndReturn(run func() error) *BackupRepo_FixPanel_Call { + _c.Call.Return(run) + return _c +} + +// GetPath provides a mock function with given fields: typ +func (_m *BackupRepo) GetPath(typ biz.BackupType) (string, error) { + ret := _m.Called(typ) + + if len(ret) == 0 { + panic("no return value specified for GetPath") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(biz.BackupType) (string, error)); ok { + return rf(typ) + } + if rf, ok := ret.Get(0).(func(biz.BackupType) string); ok { + r0 = rf(typ) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(biz.BackupType) error); ok { + r1 = rf(typ) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// BackupRepo_GetPath_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPath' +type BackupRepo_GetPath_Call struct { + *mock.Call +} + +// GetPath is a helper method to define mock.On call +// - typ biz.BackupType +func (_e *BackupRepo_Expecter) GetPath(typ interface{}) *BackupRepo_GetPath_Call { + return &BackupRepo_GetPath_Call{Call: _e.mock.On("GetPath", typ)} +} + +func (_c *BackupRepo_GetPath_Call) Run(run func(typ biz.BackupType)) *BackupRepo_GetPath_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.BackupType)) + }) + return _c +} + +func (_c *BackupRepo_GetPath_Call) Return(_a0 string, _a1 error) *BackupRepo_GetPath_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *BackupRepo_GetPath_Call) RunAndReturn(run func(biz.BackupType) (string, error)) *BackupRepo_GetPath_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: typ +func (_m *BackupRepo) List(typ biz.BackupType) ([]*types.BackupFile, error) { + ret := _m.Called(typ) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*types.BackupFile + var r1 error + if rf, ok := ret.Get(0).(func(biz.BackupType) ([]*types.BackupFile, error)); ok { + return rf(typ) + } + if rf, ok := ret.Get(0).(func(biz.BackupType) []*types.BackupFile); ok { + r0 = rf(typ) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*types.BackupFile) + } + } + + if rf, ok := ret.Get(1).(func(biz.BackupType) error); ok { + r1 = rf(typ) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// BackupRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type BackupRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - typ biz.BackupType +func (_e *BackupRepo_Expecter) List(typ interface{}) *BackupRepo_List_Call { + return &BackupRepo_List_Call{Call: _e.mock.On("List", typ)} +} + +func (_c *BackupRepo_List_Call) Run(run func(typ biz.BackupType)) *BackupRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.BackupType)) + }) + return _c +} + +func (_c *BackupRepo_List_Call) Return(_a0 []*types.BackupFile, _a1 error) *BackupRepo_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *BackupRepo_List_Call) RunAndReturn(run func(biz.BackupType) ([]*types.BackupFile, error)) *BackupRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Restore provides a mock function with given fields: typ, backup, target +func (_m *BackupRepo) Restore(typ biz.BackupType, backup string, target string) error { + ret := _m.Called(typ, backup, target) + + if len(ret) == 0 { + panic("no return value specified for Restore") + } + + var r0 error + if rf, ok := ret.Get(0).(func(biz.BackupType, string, string) error); ok { + r0 = rf(typ, backup, target) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_Restore_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Restore' +type BackupRepo_Restore_Call struct { + *mock.Call +} + +// Restore is a helper method to define mock.On call +// - typ biz.BackupType +// - backup string +// - target string +func (_e *BackupRepo_Expecter) Restore(typ interface{}, backup interface{}, target interface{}) *BackupRepo_Restore_Call { + return &BackupRepo_Restore_Call{Call: _e.mock.On("Restore", typ, backup, target)} +} + +func (_c *BackupRepo_Restore_Call) Run(run func(typ biz.BackupType, backup string, target string)) *BackupRepo_Restore_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.BackupType), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *BackupRepo_Restore_Call) Return(_a0 error) *BackupRepo_Restore_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_Restore_Call) RunAndReturn(run func(biz.BackupType, string, string) error) *BackupRepo_Restore_Call { + _c.Call.Return(run) + return _c +} + +// UpdatePanel provides a mock function with given fields: version, url, checksum +func (_m *BackupRepo) UpdatePanel(version string, url string, checksum string) error { + ret := _m.Called(version, url, checksum) + + if len(ret) == 0 { + panic("no return value specified for UpdatePanel") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string, string) error); ok { + r0 = rf(version, url, checksum) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// BackupRepo_UpdatePanel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePanel' +type BackupRepo_UpdatePanel_Call struct { + *mock.Call +} + +// UpdatePanel is a helper method to define mock.On call +// - version string +// - url string +// - checksum string +func (_e *BackupRepo_Expecter) UpdatePanel(version interface{}, url interface{}, checksum interface{}) *BackupRepo_UpdatePanel_Call { + return &BackupRepo_UpdatePanel_Call{Call: _e.mock.On("UpdatePanel", version, url, checksum)} +} + +func (_c *BackupRepo_UpdatePanel_Call) Run(run func(version string, url string, checksum string)) *BackupRepo_UpdatePanel_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *BackupRepo_UpdatePanel_Call) Return(_a0 error) *BackupRepo_UpdatePanel_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *BackupRepo_UpdatePanel_Call) RunAndReturn(run func(string, string, string) error) *BackupRepo_UpdatePanel_Call { + _c.Call.Return(run) + return _c +} + +// NewBackupRepo creates a new instance of BackupRepo. 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 NewBackupRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *BackupRepo { + mock := &BackupRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/CacheRepo.go b/mocks/biz/CacheRepo.go new file mode 100644 index 00000000..def4a625 --- /dev/null +++ b/mocks/biz/CacheRepo.go @@ -0,0 +1,243 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" +) + +// CacheRepo is an autogenerated mock type for the CacheRepo type +type CacheRepo struct { + mock.Mock +} + +type CacheRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *CacheRepo) EXPECT() *CacheRepo_Expecter { + return &CacheRepo_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: key, defaultValue +func (_m *CacheRepo) Get(key biz.CacheKey, defaultValue ...string) (string, error) { + _va := make([]interface{}, len(defaultValue)) + for _i := range defaultValue { + _va[_i] = defaultValue[_i] + } + var _ca []interface{} + _ca = append(_ca, key) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(biz.CacheKey, ...string) (string, error)); ok { + return rf(key, defaultValue...) + } + if rf, ok := ret.Get(0).(func(biz.CacheKey, ...string) string); ok { + r0 = rf(key, defaultValue...) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(biz.CacheKey, ...string) error); ok { + r1 = rf(key, defaultValue...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CacheRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type CacheRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - key biz.CacheKey +// - defaultValue ...string +func (_e *CacheRepo_Expecter) Get(key interface{}, defaultValue ...interface{}) *CacheRepo_Get_Call { + return &CacheRepo_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{key}, defaultValue...)...)} +} + +func (_c *CacheRepo_Get_Call) Run(run func(key biz.CacheKey, defaultValue ...string)) *CacheRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(biz.CacheKey), variadicArgs...) + }) + return _c +} + +func (_c *CacheRepo_Get_Call) Return(_a0 string, _a1 error) *CacheRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CacheRepo_Get_Call) RunAndReturn(run func(biz.CacheKey, ...string) (string, error)) *CacheRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// Set provides a mock function with given fields: key, value +func (_m *CacheRepo) Set(key biz.CacheKey, value string) error { + ret := _m.Called(key, value) + + if len(ret) == 0 { + panic("no return value specified for Set") + } + + var r0 error + if rf, ok := ret.Get(0).(func(biz.CacheKey, string) error); ok { + r0 = rf(key, value) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CacheRepo_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type CacheRepo_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - key biz.CacheKey +// - value string +func (_e *CacheRepo_Expecter) Set(key interface{}, value interface{}) *CacheRepo_Set_Call { + return &CacheRepo_Set_Call{Call: _e.mock.On("Set", key, value)} +} + +func (_c *CacheRepo_Set_Call) Run(run func(key biz.CacheKey, value string)) *CacheRepo_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.CacheKey), args[1].(string)) + }) + return _c +} + +func (_c *CacheRepo_Set_Call) Return(_a0 error) *CacheRepo_Set_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CacheRepo_Set_Call) RunAndReturn(run func(biz.CacheKey, string) error) *CacheRepo_Set_Call { + _c.Call.Return(run) + return _c +} + +// UpdateApps provides a mock function with no fields +func (_m *CacheRepo) UpdateApps() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for UpdateApps") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CacheRepo_UpdateApps_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateApps' +type CacheRepo_UpdateApps_Call struct { + *mock.Call +} + +// UpdateApps is a helper method to define mock.On call +func (_e *CacheRepo_Expecter) UpdateApps() *CacheRepo_UpdateApps_Call { + return &CacheRepo_UpdateApps_Call{Call: _e.mock.On("UpdateApps")} +} + +func (_c *CacheRepo_UpdateApps_Call) Run(run func()) *CacheRepo_UpdateApps_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *CacheRepo_UpdateApps_Call) Return(_a0 error) *CacheRepo_UpdateApps_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CacheRepo_UpdateApps_Call) RunAndReturn(run func() error) *CacheRepo_UpdateApps_Call { + _c.Call.Return(run) + return _c +} + +// UpdateRewrites provides a mock function with no fields +func (_m *CacheRepo) UpdateRewrites() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for UpdateRewrites") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CacheRepo_UpdateRewrites_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRewrites' +type CacheRepo_UpdateRewrites_Call struct { + *mock.Call +} + +// UpdateRewrites is a helper method to define mock.On call +func (_e *CacheRepo_Expecter) UpdateRewrites() *CacheRepo_UpdateRewrites_Call { + return &CacheRepo_UpdateRewrites_Call{Call: _e.mock.On("UpdateRewrites")} +} + +func (_c *CacheRepo_UpdateRewrites_Call) Run(run func()) *CacheRepo_UpdateRewrites_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *CacheRepo_UpdateRewrites_Call) Return(_a0 error) *CacheRepo_UpdateRewrites_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CacheRepo_UpdateRewrites_Call) RunAndReturn(run func() error) *CacheRepo_UpdateRewrites_Call { + _c.Call.Return(run) + return _c +} + +// NewCacheRepo creates a new instance of CacheRepo. 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 NewCacheRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *CacheRepo { + mock := &CacheRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/CertAccountRepo.go b/mocks/biz/CertAccountRepo.go new file mode 100644 index 00000000..348a4e41 --- /dev/null +++ b/mocks/biz/CertAccountRepo.go @@ -0,0 +1,369 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// CertAccountRepo is an autogenerated mock type for the CertAccountRepo type +type CertAccountRepo struct { + mock.Mock +} + +type CertAccountRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *CertAccountRepo) EXPECT() *CertAccountRepo_Expecter { + return &CertAccountRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *CertAccountRepo) Create(req *request.CertAccountCreate) (*biz.CertAccount, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *biz.CertAccount + var r1 error + if rf, ok := ret.Get(0).(func(*request.CertAccountCreate) (*biz.CertAccount, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.CertAccountCreate) *biz.CertAccount); ok { + r0 = rf(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.CertAccount) + } + } + + if rf, ok := ret.Get(1).(func(*request.CertAccountCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertAccountRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type CertAccountRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.CertAccountCreate +func (_e *CertAccountRepo_Expecter) Create(req interface{}) *CertAccountRepo_Create_Call { + return &CertAccountRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *CertAccountRepo_Create_Call) Run(run func(req *request.CertAccountCreate)) *CertAccountRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertAccountCreate)) + }) + return _c +} + +func (_c *CertAccountRepo_Create_Call) Return(_a0 *biz.CertAccount, _a1 error) *CertAccountRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertAccountRepo_Create_Call) RunAndReturn(run func(*request.CertAccountCreate) (*biz.CertAccount, error)) *CertAccountRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *CertAccountRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertAccountRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type CertAccountRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *CertAccountRepo_Expecter) Delete(id interface{}) *CertAccountRepo_Delete_Call { + return &CertAccountRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *CertAccountRepo_Delete_Call) Run(run func(id uint)) *CertAccountRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertAccountRepo_Delete_Call) Return(_a0 error) *CertAccountRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertAccountRepo_Delete_Call) RunAndReturn(run func(uint) error) *CertAccountRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *CertAccountRepo) Get(id uint) (*biz.CertAccount, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.CertAccount + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.CertAccount, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.CertAccount); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.CertAccount) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertAccountRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type CertAccountRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *CertAccountRepo_Expecter) Get(id interface{}) *CertAccountRepo_Get_Call { + return &CertAccountRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *CertAccountRepo_Get_Call) Run(run func(id uint)) *CertAccountRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertAccountRepo_Get_Call) Return(_a0 *biz.CertAccount, _a1 error) *CertAccountRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertAccountRepo_Get_Call) RunAndReturn(run func(uint) (*biz.CertAccount, error)) *CertAccountRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetDefault provides a mock function with given fields: userID +func (_m *CertAccountRepo) GetDefault(userID uint) (*biz.CertAccount, error) { + ret := _m.Called(userID) + + if len(ret) == 0 { + panic("no return value specified for GetDefault") + } + + var r0 *biz.CertAccount + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.CertAccount, error)); ok { + return rf(userID) + } + if rf, ok := ret.Get(0).(func(uint) *biz.CertAccount); ok { + r0 = rf(userID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.CertAccount) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(userID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertAccountRepo_GetDefault_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDefault' +type CertAccountRepo_GetDefault_Call struct { + *mock.Call +} + +// GetDefault is a helper method to define mock.On call +// - userID uint +func (_e *CertAccountRepo_Expecter) GetDefault(userID interface{}) *CertAccountRepo_GetDefault_Call { + return &CertAccountRepo_GetDefault_Call{Call: _e.mock.On("GetDefault", userID)} +} + +func (_c *CertAccountRepo_GetDefault_Call) Run(run func(userID uint)) *CertAccountRepo_GetDefault_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertAccountRepo_GetDefault_Call) Return(_a0 *biz.CertAccount, _a1 error) *CertAccountRepo_GetDefault_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertAccountRepo_GetDefault_Call) RunAndReturn(run func(uint) (*biz.CertAccount, error)) *CertAccountRepo_GetDefault_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *CertAccountRepo) List(page uint, limit uint) ([]*biz.CertAccount, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.CertAccount + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.CertAccount, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.CertAccount); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.CertAccount) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// CertAccountRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type CertAccountRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *CertAccountRepo_Expecter) List(page interface{}, limit interface{}) *CertAccountRepo_List_Call { + return &CertAccountRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *CertAccountRepo_List_Call) Run(run func(page uint, limit uint)) *CertAccountRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *CertAccountRepo_List_Call) Return(_a0 []*biz.CertAccount, _a1 int64, _a2 error) *CertAccountRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *CertAccountRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.CertAccount, int64, error)) *CertAccountRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *CertAccountRepo) Update(req *request.CertAccountUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.CertAccountUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertAccountRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type CertAccountRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.CertAccountUpdate +func (_e *CertAccountRepo_Expecter) Update(req interface{}) *CertAccountRepo_Update_Call { + return &CertAccountRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *CertAccountRepo_Update_Call) Run(run func(req *request.CertAccountUpdate)) *CertAccountRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertAccountUpdate)) + }) + return _c +} + +func (_c *CertAccountRepo_Update_Call) Return(_a0 error) *CertAccountRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertAccountRepo_Update_Call) RunAndReturn(run func(*request.CertAccountUpdate) error) *CertAccountRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewCertAccountRepo creates a new instance of CertAccountRepo. 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 NewCertAccountRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *CertAccountRepo { + mock := &CertAccountRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/CertDNSRepo.go b/mocks/biz/CertDNSRepo.go new file mode 100644 index 00000000..2c52904d --- /dev/null +++ b/mocks/biz/CertDNSRepo.go @@ -0,0 +1,311 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// CertDNSRepo is an autogenerated mock type for the CertDNSRepo type +type CertDNSRepo struct { + mock.Mock +} + +type CertDNSRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *CertDNSRepo) EXPECT() *CertDNSRepo_Expecter { + return &CertDNSRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *CertDNSRepo) Create(req *request.CertDNSCreate) (*biz.CertDNS, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *biz.CertDNS + var r1 error + if rf, ok := ret.Get(0).(func(*request.CertDNSCreate) (*biz.CertDNS, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.CertDNSCreate) *biz.CertDNS); ok { + r0 = rf(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.CertDNS) + } + } + + if rf, ok := ret.Get(1).(func(*request.CertDNSCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertDNSRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type CertDNSRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.CertDNSCreate +func (_e *CertDNSRepo_Expecter) Create(req interface{}) *CertDNSRepo_Create_Call { + return &CertDNSRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *CertDNSRepo_Create_Call) Run(run func(req *request.CertDNSCreate)) *CertDNSRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertDNSCreate)) + }) + return _c +} + +func (_c *CertDNSRepo_Create_Call) Return(_a0 *biz.CertDNS, _a1 error) *CertDNSRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertDNSRepo_Create_Call) RunAndReturn(run func(*request.CertDNSCreate) (*biz.CertDNS, error)) *CertDNSRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *CertDNSRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertDNSRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type CertDNSRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *CertDNSRepo_Expecter) Delete(id interface{}) *CertDNSRepo_Delete_Call { + return &CertDNSRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *CertDNSRepo_Delete_Call) Run(run func(id uint)) *CertDNSRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertDNSRepo_Delete_Call) Return(_a0 error) *CertDNSRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertDNSRepo_Delete_Call) RunAndReturn(run func(uint) error) *CertDNSRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *CertDNSRepo) Get(id uint) (*biz.CertDNS, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.CertDNS + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.CertDNS, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.CertDNS); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.CertDNS) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertDNSRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type CertDNSRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *CertDNSRepo_Expecter) Get(id interface{}) *CertDNSRepo_Get_Call { + return &CertDNSRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *CertDNSRepo_Get_Call) Run(run func(id uint)) *CertDNSRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertDNSRepo_Get_Call) Return(_a0 *biz.CertDNS, _a1 error) *CertDNSRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertDNSRepo_Get_Call) RunAndReturn(run func(uint) (*biz.CertDNS, error)) *CertDNSRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *CertDNSRepo) List(page uint, limit uint) ([]*biz.CertDNS, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.CertDNS + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.CertDNS, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.CertDNS); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.CertDNS) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// CertDNSRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type CertDNSRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *CertDNSRepo_Expecter) List(page interface{}, limit interface{}) *CertDNSRepo_List_Call { + return &CertDNSRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *CertDNSRepo_List_Call) Run(run func(page uint, limit uint)) *CertDNSRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *CertDNSRepo_List_Call) Return(_a0 []*biz.CertDNS, _a1 int64, _a2 error) *CertDNSRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *CertDNSRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.CertDNS, int64, error)) *CertDNSRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *CertDNSRepo) Update(req *request.CertDNSUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.CertDNSUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertDNSRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type CertDNSRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.CertDNSUpdate +func (_e *CertDNSRepo_Expecter) Update(req interface{}) *CertDNSRepo_Update_Call { + return &CertDNSRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *CertDNSRepo_Update_Call) Run(run func(req *request.CertDNSUpdate)) *CertDNSRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertDNSUpdate)) + }) + return _c +} + +func (_c *CertDNSRepo_Update_Call) Return(_a0 error) *CertDNSRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertDNSRepo_Update_Call) RunAndReturn(run func(*request.CertDNSUpdate) error) *CertDNSRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewCertDNSRepo creates a new instance of CertDNSRepo. 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 NewCertDNSRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *CertDNSRepo { + mock := &CertDNSRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/CertRepo.go b/mocks/biz/CertRepo.go new file mode 100644 index 00000000..b85a65a1 --- /dev/null +++ b/mocks/biz/CertRepo.go @@ -0,0 +1,756 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + acme "github.com/TheTNB/panel/pkg/acme" + + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" + + types "github.com/TheTNB/panel/pkg/types" +) + +// CertRepo is an autogenerated mock type for the CertRepo type +type CertRepo struct { + mock.Mock +} + +type CertRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *CertRepo) EXPECT() *CertRepo_Expecter { + return &CertRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *CertRepo) Create(req *request.CertCreate) (*biz.Cert, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *biz.Cert + var r1 error + if rf, ok := ret.Get(0).(func(*request.CertCreate) (*biz.Cert, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.CertCreate) *biz.Cert); ok { + r0 = rf(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Cert) + } + } + + if rf, ok := ret.Get(1).(func(*request.CertCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type CertRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.CertCreate +func (_e *CertRepo_Expecter) Create(req interface{}) *CertRepo_Create_Call { + return &CertRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *CertRepo_Create_Call) Run(run func(req *request.CertCreate)) *CertRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertCreate)) + }) + return _c +} + +func (_c *CertRepo_Create_Call) Return(_a0 *biz.Cert, _a1 error) *CertRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_Create_Call) RunAndReturn(run func(*request.CertCreate) (*biz.Cert, error)) *CertRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *CertRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type CertRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) Delete(id interface{}) *CertRepo_Delete_Call { + return &CertRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *CertRepo_Delete_Call) Run(run func(id uint)) *CertRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_Delete_Call) Return(_a0 error) *CertRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertRepo_Delete_Call) RunAndReturn(run func(uint) error) *CertRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Deploy provides a mock function with given fields: ID, WebsiteID +func (_m *CertRepo) Deploy(ID uint, WebsiteID uint) error { + ret := _m.Called(ID, WebsiteID) + + if len(ret) == 0 { + panic("no return value specified for Deploy") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, uint) error); ok { + r0 = rf(ID, WebsiteID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertRepo_Deploy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deploy' +type CertRepo_Deploy_Call struct { + *mock.Call +} + +// Deploy is a helper method to define mock.On call +// - ID uint +// - WebsiteID uint +func (_e *CertRepo_Expecter) Deploy(ID interface{}, WebsiteID interface{}) *CertRepo_Deploy_Call { + return &CertRepo_Deploy_Call{Call: _e.mock.On("Deploy", ID, WebsiteID)} +} + +func (_c *CertRepo_Deploy_Call) Run(run func(ID uint, WebsiteID uint)) *CertRepo_Deploy_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *CertRepo_Deploy_Call) Return(_a0 error) *CertRepo_Deploy_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertRepo_Deploy_Call) RunAndReturn(run func(uint, uint) error) *CertRepo_Deploy_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *CertRepo) Get(id uint) (*biz.Cert, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.Cert + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.Cert, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.Cert); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Cert) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type CertRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) Get(id interface{}) *CertRepo_Get_Call { + return &CertRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *CertRepo_Get_Call) Run(run func(id uint)) *CertRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_Get_Call) Return(_a0 *biz.Cert, _a1 error) *CertRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_Get_Call) RunAndReturn(run func(uint) (*biz.Cert, error)) *CertRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByWebsite provides a mock function with given fields: WebsiteID +func (_m *CertRepo) GetByWebsite(WebsiteID uint) (*biz.Cert, error) { + ret := _m.Called(WebsiteID) + + if len(ret) == 0 { + panic("no return value specified for GetByWebsite") + } + + var r0 *biz.Cert + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.Cert, error)); ok { + return rf(WebsiteID) + } + if rf, ok := ret.Get(0).(func(uint) *biz.Cert); ok { + r0 = rf(WebsiteID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Cert) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(WebsiteID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_GetByWebsite_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByWebsite' +type CertRepo_GetByWebsite_Call struct { + *mock.Call +} + +// GetByWebsite is a helper method to define mock.On call +// - WebsiteID uint +func (_e *CertRepo_Expecter) GetByWebsite(WebsiteID interface{}) *CertRepo_GetByWebsite_Call { + return &CertRepo_GetByWebsite_Call{Call: _e.mock.On("GetByWebsite", WebsiteID)} +} + +func (_c *CertRepo_GetByWebsite_Call) Run(run func(WebsiteID uint)) *CertRepo_GetByWebsite_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_GetByWebsite_Call) Return(_a0 *biz.Cert, _a1 error) *CertRepo_GetByWebsite_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_GetByWebsite_Call) RunAndReturn(run func(uint) (*biz.Cert, error)) *CertRepo_GetByWebsite_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *CertRepo) List(page uint, limit uint) ([]*types.CertList, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*types.CertList + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*types.CertList, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*types.CertList); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*types.CertList) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// CertRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type CertRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *CertRepo_Expecter) List(page interface{}, limit interface{}) *CertRepo_List_Call { + return &CertRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *CertRepo_List_Call) Run(run func(page uint, limit uint)) *CertRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *CertRepo_List_Call) Return(_a0 []*types.CertList, _a1 int64, _a2 error) *CertRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *CertRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*types.CertList, int64, error)) *CertRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// ManualDNS provides a mock function with given fields: id +func (_m *CertRepo) ManualDNS(id uint) ([]acme.DNSRecord, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ManualDNS") + } + + var r0 []acme.DNSRecord + var r1 error + if rf, ok := ret.Get(0).(func(uint) ([]acme.DNSRecord, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) []acme.DNSRecord); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]acme.DNSRecord) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_ManualDNS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ManualDNS' +type CertRepo_ManualDNS_Call struct { + *mock.Call +} + +// ManualDNS is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) ManualDNS(id interface{}) *CertRepo_ManualDNS_Call { + return &CertRepo_ManualDNS_Call{Call: _e.mock.On("ManualDNS", id)} +} + +func (_c *CertRepo_ManualDNS_Call) Run(run func(id uint)) *CertRepo_ManualDNS_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_ManualDNS_Call) Return(_a0 []acme.DNSRecord, _a1 error) *CertRepo_ManualDNS_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_ManualDNS_Call) RunAndReturn(run func(uint) ([]acme.DNSRecord, error)) *CertRepo_ManualDNS_Call { + _c.Call.Return(run) + return _c +} + +// ObtainAuto provides a mock function with given fields: id +func (_m *CertRepo) ObtainAuto(id uint) (*acme.Certificate, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ObtainAuto") + } + + var r0 *acme.Certificate + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*acme.Certificate, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *acme.Certificate); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*acme.Certificate) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_ObtainAuto_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObtainAuto' +type CertRepo_ObtainAuto_Call struct { + *mock.Call +} + +// ObtainAuto is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) ObtainAuto(id interface{}) *CertRepo_ObtainAuto_Call { + return &CertRepo_ObtainAuto_Call{Call: _e.mock.On("ObtainAuto", id)} +} + +func (_c *CertRepo_ObtainAuto_Call) Run(run func(id uint)) *CertRepo_ObtainAuto_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_ObtainAuto_Call) Return(_a0 *acme.Certificate, _a1 error) *CertRepo_ObtainAuto_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_ObtainAuto_Call) RunAndReturn(run func(uint) (*acme.Certificate, error)) *CertRepo_ObtainAuto_Call { + _c.Call.Return(run) + return _c +} + +// ObtainManual provides a mock function with given fields: id +func (_m *CertRepo) ObtainManual(id uint) (*acme.Certificate, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ObtainManual") + } + + var r0 *acme.Certificate + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*acme.Certificate, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *acme.Certificate); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*acme.Certificate) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_ObtainManual_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObtainManual' +type CertRepo_ObtainManual_Call struct { + *mock.Call +} + +// ObtainManual is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) ObtainManual(id interface{}) *CertRepo_ObtainManual_Call { + return &CertRepo_ObtainManual_Call{Call: _e.mock.On("ObtainManual", id)} +} + +func (_c *CertRepo_ObtainManual_Call) Run(run func(id uint)) *CertRepo_ObtainManual_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_ObtainManual_Call) Return(_a0 *acme.Certificate, _a1 error) *CertRepo_ObtainManual_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_ObtainManual_Call) RunAndReturn(run func(uint) (*acme.Certificate, error)) *CertRepo_ObtainManual_Call { + _c.Call.Return(run) + return _c +} + +// ObtainSelfSigned provides a mock function with given fields: id +func (_m *CertRepo) ObtainSelfSigned(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ObtainSelfSigned") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertRepo_ObtainSelfSigned_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObtainSelfSigned' +type CertRepo_ObtainSelfSigned_Call struct { + *mock.Call +} + +// ObtainSelfSigned is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) ObtainSelfSigned(id interface{}) *CertRepo_ObtainSelfSigned_Call { + return &CertRepo_ObtainSelfSigned_Call{Call: _e.mock.On("ObtainSelfSigned", id)} +} + +func (_c *CertRepo_ObtainSelfSigned_Call) Run(run func(id uint)) *CertRepo_ObtainSelfSigned_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_ObtainSelfSigned_Call) Return(_a0 error) *CertRepo_ObtainSelfSigned_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertRepo_ObtainSelfSigned_Call) RunAndReturn(run func(uint) error) *CertRepo_ObtainSelfSigned_Call { + _c.Call.Return(run) + return _c +} + +// Renew provides a mock function with given fields: id +func (_m *CertRepo) Renew(id uint) (*acme.Certificate, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Renew") + } + + var r0 *acme.Certificate + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*acme.Certificate, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *acme.Certificate); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*acme.Certificate) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_Renew_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Renew' +type CertRepo_Renew_Call struct { + *mock.Call +} + +// Renew is a helper method to define mock.On call +// - id uint +func (_e *CertRepo_Expecter) Renew(id interface{}) *CertRepo_Renew_Call { + return &CertRepo_Renew_Call{Call: _e.mock.On("Renew", id)} +} + +func (_c *CertRepo_Renew_Call) Run(run func(id uint)) *CertRepo_Renew_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CertRepo_Renew_Call) Return(_a0 *acme.Certificate, _a1 error) *CertRepo_Renew_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_Renew_Call) RunAndReturn(run func(uint) (*acme.Certificate, error)) *CertRepo_Renew_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *CertRepo) Update(req *request.CertUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.CertUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CertRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type CertRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.CertUpdate +func (_e *CertRepo_Expecter) Update(req interface{}) *CertRepo_Update_Call { + return &CertRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *CertRepo_Update_Call) Run(run func(req *request.CertUpdate)) *CertRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertUpdate)) + }) + return _c +} + +func (_c *CertRepo_Update_Call) Return(_a0 error) *CertRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CertRepo_Update_Call) RunAndReturn(run func(*request.CertUpdate) error) *CertRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// Upload provides a mock function with given fields: req +func (_m *CertRepo) Upload(req *request.CertUpload) (*biz.Cert, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Upload") + } + + var r0 *biz.Cert + var r1 error + if rf, ok := ret.Get(0).(func(*request.CertUpload) (*biz.Cert, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.CertUpload) *biz.Cert); ok { + r0 = rf(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Cert) + } + } + + if rf, ok := ret.Get(1).(func(*request.CertUpload) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CertRepo_Upload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upload' +type CertRepo_Upload_Call struct { + *mock.Call +} + +// Upload is a helper method to define mock.On call +// - req *request.CertUpload +func (_e *CertRepo_Expecter) Upload(req interface{}) *CertRepo_Upload_Call { + return &CertRepo_Upload_Call{Call: _e.mock.On("Upload", req)} +} + +func (_c *CertRepo_Upload_Call) Run(run func(req *request.CertUpload)) *CertRepo_Upload_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CertUpload)) + }) + return _c +} + +func (_c *CertRepo_Upload_Call) Return(_a0 *biz.Cert, _a1 error) *CertRepo_Upload_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CertRepo_Upload_Call) RunAndReturn(run func(*request.CertUpload) (*biz.Cert, error)) *CertRepo_Upload_Call { + _c.Call.Return(run) + return _c +} + +// NewCertRepo creates a new instance of CertRepo. 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 NewCertRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *CertRepo { + mock := &CertRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/ContainerImageRepo.go b/mocks/biz/ContainerImageRepo.go new file mode 100644 index 00000000..2f2cd3fd --- /dev/null +++ b/mocks/biz/ContainerImageRepo.go @@ -0,0 +1,230 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + request "github.com/TheTNB/panel/internal/http/request" + types "github.com/TheTNB/panel/pkg/types" + mock "github.com/stretchr/testify/mock" +) + +// ContainerImageRepo is an autogenerated mock type for the ContainerImageRepo type +type ContainerImageRepo struct { + mock.Mock +} + +type ContainerImageRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *ContainerImageRepo) EXPECT() *ContainerImageRepo_Expecter { + return &ContainerImageRepo_Expecter{mock: &_m.Mock} +} + +// List provides a mock function with no fields +func (_m *ContainerImageRepo) List() ([]types.ContainerImage, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []types.ContainerImage + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.ContainerImage, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.ContainerImage); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.ContainerImage) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerImageRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type ContainerImageRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +func (_e *ContainerImageRepo_Expecter) List() *ContainerImageRepo_List_Call { + return &ContainerImageRepo_List_Call{Call: _e.mock.On("List")} +} + +func (_c *ContainerImageRepo_List_Call) Run(run func()) *ContainerImageRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerImageRepo_List_Call) Return(_a0 []types.ContainerImage, _a1 error) *ContainerImageRepo_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerImageRepo_List_Call) RunAndReturn(run func() ([]types.ContainerImage, error)) *ContainerImageRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Prune provides a mock function with no fields +func (_m *ContainerImageRepo) Prune() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Prune") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerImageRepo_Prune_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prune' +type ContainerImageRepo_Prune_Call struct { + *mock.Call +} + +// Prune is a helper method to define mock.On call +func (_e *ContainerImageRepo_Expecter) Prune() *ContainerImageRepo_Prune_Call { + return &ContainerImageRepo_Prune_Call{Call: _e.mock.On("Prune")} +} + +func (_c *ContainerImageRepo_Prune_Call) Run(run func()) *ContainerImageRepo_Prune_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerImageRepo_Prune_Call) Return(_a0 error) *ContainerImageRepo_Prune_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerImageRepo_Prune_Call) RunAndReturn(run func() error) *ContainerImageRepo_Prune_Call { + _c.Call.Return(run) + return _c +} + +// Pull provides a mock function with given fields: req +func (_m *ContainerImageRepo) Pull(req *request.ContainerImagePull) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Pull") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.ContainerImagePull) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerImageRepo_Pull_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pull' +type ContainerImageRepo_Pull_Call struct { + *mock.Call +} + +// Pull is a helper method to define mock.On call +// - req *request.ContainerImagePull +func (_e *ContainerImageRepo_Expecter) Pull(req interface{}) *ContainerImageRepo_Pull_Call { + return &ContainerImageRepo_Pull_Call{Call: _e.mock.On("Pull", req)} +} + +func (_c *ContainerImageRepo_Pull_Call) Run(run func(req *request.ContainerImagePull)) *ContainerImageRepo_Pull_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.ContainerImagePull)) + }) + return _c +} + +func (_c *ContainerImageRepo_Pull_Call) Return(_a0 error) *ContainerImageRepo_Pull_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerImageRepo_Pull_Call) RunAndReturn(run func(*request.ContainerImagePull) error) *ContainerImageRepo_Pull_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: id +func (_m *ContainerImageRepo) Remove(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerImageRepo_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type ContainerImageRepo_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - id string +func (_e *ContainerImageRepo_Expecter) Remove(id interface{}) *ContainerImageRepo_Remove_Call { + return &ContainerImageRepo_Remove_Call{Call: _e.mock.On("Remove", id)} +} + +func (_c *ContainerImageRepo_Remove_Call) Run(run func(id string)) *ContainerImageRepo_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerImageRepo_Remove_Call) Return(_a0 error) *ContainerImageRepo_Remove_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerImageRepo_Remove_Call) RunAndReturn(run func(string) error) *ContainerImageRepo_Remove_Call { + _c.Call.Return(run) + return _c +} + +// NewContainerImageRepo creates a new instance of ContainerImageRepo. 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 NewContainerImageRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *ContainerImageRepo { + mock := &ContainerImageRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/ContainerNetworkRepo.go b/mocks/biz/ContainerNetworkRepo.go new file mode 100644 index 00000000..131cfd1c --- /dev/null +++ b/mocks/biz/ContainerNetworkRepo.go @@ -0,0 +1,240 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + request "github.com/TheTNB/panel/internal/http/request" + types "github.com/TheTNB/panel/pkg/types" + mock "github.com/stretchr/testify/mock" +) + +// ContainerNetworkRepo is an autogenerated mock type for the ContainerNetworkRepo type +type ContainerNetworkRepo struct { + mock.Mock +} + +type ContainerNetworkRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *ContainerNetworkRepo) EXPECT() *ContainerNetworkRepo_Expecter { + return &ContainerNetworkRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *ContainerNetworkRepo) Create(req *request.ContainerNetworkCreate) (string, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*request.ContainerNetworkCreate) (string, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.ContainerNetworkCreate) string); ok { + r0 = rf(req) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*request.ContainerNetworkCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerNetworkRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type ContainerNetworkRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.ContainerNetworkCreate +func (_e *ContainerNetworkRepo_Expecter) Create(req interface{}) *ContainerNetworkRepo_Create_Call { + return &ContainerNetworkRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *ContainerNetworkRepo_Create_Call) Run(run func(req *request.ContainerNetworkCreate)) *ContainerNetworkRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.ContainerNetworkCreate)) + }) + return _c +} + +func (_c *ContainerNetworkRepo_Create_Call) Return(_a0 string, _a1 error) *ContainerNetworkRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerNetworkRepo_Create_Call) RunAndReturn(run func(*request.ContainerNetworkCreate) (string, error)) *ContainerNetworkRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with no fields +func (_m *ContainerNetworkRepo) List() ([]types.ContainerNetwork, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []types.ContainerNetwork + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.ContainerNetwork, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.ContainerNetwork); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.ContainerNetwork) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerNetworkRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type ContainerNetworkRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +func (_e *ContainerNetworkRepo_Expecter) List() *ContainerNetworkRepo_List_Call { + return &ContainerNetworkRepo_List_Call{Call: _e.mock.On("List")} +} + +func (_c *ContainerNetworkRepo_List_Call) Run(run func()) *ContainerNetworkRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerNetworkRepo_List_Call) Return(_a0 []types.ContainerNetwork, _a1 error) *ContainerNetworkRepo_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerNetworkRepo_List_Call) RunAndReturn(run func() ([]types.ContainerNetwork, error)) *ContainerNetworkRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Prune provides a mock function with no fields +func (_m *ContainerNetworkRepo) Prune() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Prune") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerNetworkRepo_Prune_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prune' +type ContainerNetworkRepo_Prune_Call struct { + *mock.Call +} + +// Prune is a helper method to define mock.On call +func (_e *ContainerNetworkRepo_Expecter) Prune() *ContainerNetworkRepo_Prune_Call { + return &ContainerNetworkRepo_Prune_Call{Call: _e.mock.On("Prune")} +} + +func (_c *ContainerNetworkRepo_Prune_Call) Run(run func()) *ContainerNetworkRepo_Prune_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerNetworkRepo_Prune_Call) Return(_a0 error) *ContainerNetworkRepo_Prune_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerNetworkRepo_Prune_Call) RunAndReturn(run func() error) *ContainerNetworkRepo_Prune_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: id +func (_m *ContainerNetworkRepo) Remove(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerNetworkRepo_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type ContainerNetworkRepo_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - id string +func (_e *ContainerNetworkRepo_Expecter) Remove(id interface{}) *ContainerNetworkRepo_Remove_Call { + return &ContainerNetworkRepo_Remove_Call{Call: _e.mock.On("Remove", id)} +} + +func (_c *ContainerNetworkRepo_Remove_Call) Run(run func(id string)) *ContainerNetworkRepo_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerNetworkRepo_Remove_Call) Return(_a0 error) *ContainerNetworkRepo_Remove_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerNetworkRepo_Remove_Call) RunAndReturn(run func(string) error) *ContainerNetworkRepo_Remove_Call { + _c.Call.Return(run) + return _c +} + +// NewContainerNetworkRepo creates a new instance of ContainerNetworkRepo. 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 NewContainerNetworkRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *ContainerNetworkRepo { + mock := &ContainerNetworkRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/ContainerRepo.go b/mocks/biz/ContainerRepo.go new file mode 100644 index 00000000..b48a6b8a --- /dev/null +++ b/mocks/biz/ContainerRepo.go @@ -0,0 +1,677 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + request "github.com/TheTNB/panel/internal/http/request" + types "github.com/TheTNB/panel/pkg/types" + mock "github.com/stretchr/testify/mock" +) + +// ContainerRepo is an autogenerated mock type for the ContainerRepo type +type ContainerRepo struct { + mock.Mock +} + +type ContainerRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *ContainerRepo) EXPECT() *ContainerRepo_Expecter { + return &ContainerRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *ContainerRepo) Create(req *request.ContainerCreate) (string, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*request.ContainerCreate) (string, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.ContainerCreate) string); ok { + r0 = rf(req) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*request.ContainerCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type ContainerRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.ContainerCreate +func (_e *ContainerRepo_Expecter) Create(req interface{}) *ContainerRepo_Create_Call { + return &ContainerRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *ContainerRepo_Create_Call) Run(run func(req *request.ContainerCreate)) *ContainerRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.ContainerCreate)) + }) + return _c +} + +func (_c *ContainerRepo_Create_Call) Return(_a0 string, _a1 error) *ContainerRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerRepo_Create_Call) RunAndReturn(run func(*request.ContainerCreate) (string, error)) *ContainerRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Kill provides a mock function with given fields: id +func (_m *ContainerRepo) Kill(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Kill") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Kill_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Kill' +type ContainerRepo_Kill_Call struct { + *mock.Call +} + +// Kill is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Kill(id interface{}) *ContainerRepo_Kill_Call { + return &ContainerRepo_Kill_Call{Call: _e.mock.On("Kill", id)} +} + +func (_c *ContainerRepo_Kill_Call) Run(run func(id string)) *ContainerRepo_Kill_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Kill_Call) Return(_a0 error) *ContainerRepo_Kill_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Kill_Call) RunAndReturn(run func(string) error) *ContainerRepo_Kill_Call { + _c.Call.Return(run) + return _c +} + +// ListAll provides a mock function with no fields +func (_m *ContainerRepo) ListAll() ([]types.Container, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ListAll") + } + + var r0 []types.Container + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.Container, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.Container); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Container) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerRepo_ListAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAll' +type ContainerRepo_ListAll_Call struct { + *mock.Call +} + +// ListAll is a helper method to define mock.On call +func (_e *ContainerRepo_Expecter) ListAll() *ContainerRepo_ListAll_Call { + return &ContainerRepo_ListAll_Call{Call: _e.mock.On("ListAll")} +} + +func (_c *ContainerRepo_ListAll_Call) Run(run func()) *ContainerRepo_ListAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerRepo_ListAll_Call) Return(_a0 []types.Container, _a1 error) *ContainerRepo_ListAll_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerRepo_ListAll_Call) RunAndReturn(run func() ([]types.Container, error)) *ContainerRepo_ListAll_Call { + _c.Call.Return(run) + return _c +} + +// ListByName provides a mock function with given fields: name +func (_m *ContainerRepo) ListByName(name string) ([]types.Container, error) { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for ListByName") + } + + var r0 []types.Container + var r1 error + if rf, ok := ret.Get(0).(func(string) ([]types.Container, error)); ok { + return rf(name) + } + if rf, ok := ret.Get(0).(func(string) []types.Container); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.Container) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerRepo_ListByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByName' +type ContainerRepo_ListByName_Call struct { + *mock.Call +} + +// ListByName is a helper method to define mock.On call +// - name string +func (_e *ContainerRepo_Expecter) ListByName(name interface{}) *ContainerRepo_ListByName_Call { + return &ContainerRepo_ListByName_Call{Call: _e.mock.On("ListByName", name)} +} + +func (_c *ContainerRepo_ListByName_Call) Run(run func(name string)) *ContainerRepo_ListByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_ListByName_Call) Return(_a0 []types.Container, _a1 error) *ContainerRepo_ListByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerRepo_ListByName_Call) RunAndReturn(run func(string) ([]types.Container, error)) *ContainerRepo_ListByName_Call { + _c.Call.Return(run) + return _c +} + +// Logs provides a mock function with given fields: id +func (_m *ContainerRepo) Logs(id string) (string, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Logs") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(string) (string, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(string) string); ok { + r0 = rf(id) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerRepo_Logs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Logs' +type ContainerRepo_Logs_Call struct { + *mock.Call +} + +// Logs is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Logs(id interface{}) *ContainerRepo_Logs_Call { + return &ContainerRepo_Logs_Call{Call: _e.mock.On("Logs", id)} +} + +func (_c *ContainerRepo_Logs_Call) Run(run func(id string)) *ContainerRepo_Logs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Logs_Call) Return(_a0 string, _a1 error) *ContainerRepo_Logs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerRepo_Logs_Call) RunAndReturn(run func(string) (string, error)) *ContainerRepo_Logs_Call { + _c.Call.Return(run) + return _c +} + +// Pause provides a mock function with given fields: id +func (_m *ContainerRepo) Pause(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Pause") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Pause_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Pause' +type ContainerRepo_Pause_Call struct { + *mock.Call +} + +// Pause is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Pause(id interface{}) *ContainerRepo_Pause_Call { + return &ContainerRepo_Pause_Call{Call: _e.mock.On("Pause", id)} +} + +func (_c *ContainerRepo_Pause_Call) Run(run func(id string)) *ContainerRepo_Pause_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Pause_Call) Return(_a0 error) *ContainerRepo_Pause_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Pause_Call) RunAndReturn(run func(string) error) *ContainerRepo_Pause_Call { + _c.Call.Return(run) + return _c +} + +// Prune provides a mock function with no fields +func (_m *ContainerRepo) Prune() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Prune") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Prune_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prune' +type ContainerRepo_Prune_Call struct { + *mock.Call +} + +// Prune is a helper method to define mock.On call +func (_e *ContainerRepo_Expecter) Prune() *ContainerRepo_Prune_Call { + return &ContainerRepo_Prune_Call{Call: _e.mock.On("Prune")} +} + +func (_c *ContainerRepo_Prune_Call) Run(run func()) *ContainerRepo_Prune_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerRepo_Prune_Call) Return(_a0 error) *ContainerRepo_Prune_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Prune_Call) RunAndReturn(run func() error) *ContainerRepo_Prune_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: id +func (_m *ContainerRepo) Remove(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type ContainerRepo_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Remove(id interface{}) *ContainerRepo_Remove_Call { + return &ContainerRepo_Remove_Call{Call: _e.mock.On("Remove", id)} +} + +func (_c *ContainerRepo_Remove_Call) Run(run func(id string)) *ContainerRepo_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Remove_Call) Return(_a0 error) *ContainerRepo_Remove_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Remove_Call) RunAndReturn(run func(string) error) *ContainerRepo_Remove_Call { + _c.Call.Return(run) + return _c +} + +// Rename provides a mock function with given fields: id, newName +func (_m *ContainerRepo) Rename(id string, newName string) error { + ret := _m.Called(id, newName) + + if len(ret) == 0 { + panic("no return value specified for Rename") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(id, newName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Rename_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Rename' +type ContainerRepo_Rename_Call struct { + *mock.Call +} + +// Rename is a helper method to define mock.On call +// - id string +// - newName string +func (_e *ContainerRepo_Expecter) Rename(id interface{}, newName interface{}) *ContainerRepo_Rename_Call { + return &ContainerRepo_Rename_Call{Call: _e.mock.On("Rename", id, newName)} +} + +func (_c *ContainerRepo_Rename_Call) Run(run func(id string, newName string)) *ContainerRepo_Rename_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Rename_Call) Return(_a0 error) *ContainerRepo_Rename_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Rename_Call) RunAndReturn(run func(string, string) error) *ContainerRepo_Rename_Call { + _c.Call.Return(run) + return _c +} + +// Restart provides a mock function with given fields: id +func (_m *ContainerRepo) Restart(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Restart") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Restart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Restart' +type ContainerRepo_Restart_Call struct { + *mock.Call +} + +// Restart is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Restart(id interface{}) *ContainerRepo_Restart_Call { + return &ContainerRepo_Restart_Call{Call: _e.mock.On("Restart", id)} +} + +func (_c *ContainerRepo_Restart_Call) Run(run func(id string)) *ContainerRepo_Restart_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Restart_Call) Return(_a0 error) *ContainerRepo_Restart_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Restart_Call) RunAndReturn(run func(string) error) *ContainerRepo_Restart_Call { + _c.Call.Return(run) + return _c +} + +// Start provides a mock function with given fields: id +func (_m *ContainerRepo) Start(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Start") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type ContainerRepo_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Start(id interface{}) *ContainerRepo_Start_Call { + return &ContainerRepo_Start_Call{Call: _e.mock.On("Start", id)} +} + +func (_c *ContainerRepo_Start_Call) Run(run func(id string)) *ContainerRepo_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Start_Call) Return(_a0 error) *ContainerRepo_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Start_Call) RunAndReturn(run func(string) error) *ContainerRepo_Start_Call { + _c.Call.Return(run) + return _c +} + +// Stop provides a mock function with given fields: id +func (_m *ContainerRepo) Stop(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Stop") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type ContainerRepo_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Stop(id interface{}) *ContainerRepo_Stop_Call { + return &ContainerRepo_Stop_Call{Call: _e.mock.On("Stop", id)} +} + +func (_c *ContainerRepo_Stop_Call) Run(run func(id string)) *ContainerRepo_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Stop_Call) Return(_a0 error) *ContainerRepo_Stop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Stop_Call) RunAndReturn(run func(string) error) *ContainerRepo_Stop_Call { + _c.Call.Return(run) + return _c +} + +// Unpause provides a mock function with given fields: id +func (_m *ContainerRepo) Unpause(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Unpause") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerRepo_Unpause_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unpause' +type ContainerRepo_Unpause_Call struct { + *mock.Call +} + +// Unpause is a helper method to define mock.On call +// - id string +func (_e *ContainerRepo_Expecter) Unpause(id interface{}) *ContainerRepo_Unpause_Call { + return &ContainerRepo_Unpause_Call{Call: _e.mock.On("Unpause", id)} +} + +func (_c *ContainerRepo_Unpause_Call) Run(run func(id string)) *ContainerRepo_Unpause_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerRepo_Unpause_Call) Return(_a0 error) *ContainerRepo_Unpause_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerRepo_Unpause_Call) RunAndReturn(run func(string) error) *ContainerRepo_Unpause_Call { + _c.Call.Return(run) + return _c +} + +// NewContainerRepo creates a new instance of ContainerRepo. 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 NewContainerRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *ContainerRepo { + mock := &ContainerRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/ContainerVolumeRepo.go b/mocks/biz/ContainerVolumeRepo.go new file mode 100644 index 00000000..2c88eebc --- /dev/null +++ b/mocks/biz/ContainerVolumeRepo.go @@ -0,0 +1,240 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + request "github.com/TheTNB/panel/internal/http/request" + types "github.com/TheTNB/panel/pkg/types" + mock "github.com/stretchr/testify/mock" +) + +// ContainerVolumeRepo is an autogenerated mock type for the ContainerVolumeRepo type +type ContainerVolumeRepo struct { + mock.Mock +} + +type ContainerVolumeRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *ContainerVolumeRepo) EXPECT() *ContainerVolumeRepo_Expecter { + return &ContainerVolumeRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *ContainerVolumeRepo) Create(req *request.ContainerVolumeCreate) (string, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(*request.ContainerVolumeCreate) (string, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.ContainerVolumeCreate) string); ok { + r0 = rf(req) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(*request.ContainerVolumeCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerVolumeRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type ContainerVolumeRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.ContainerVolumeCreate +func (_e *ContainerVolumeRepo_Expecter) Create(req interface{}) *ContainerVolumeRepo_Create_Call { + return &ContainerVolumeRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *ContainerVolumeRepo_Create_Call) Run(run func(req *request.ContainerVolumeCreate)) *ContainerVolumeRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.ContainerVolumeCreate)) + }) + return _c +} + +func (_c *ContainerVolumeRepo_Create_Call) Return(_a0 string, _a1 error) *ContainerVolumeRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerVolumeRepo_Create_Call) RunAndReturn(run func(*request.ContainerVolumeCreate) (string, error)) *ContainerVolumeRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with no fields +func (_m *ContainerVolumeRepo) List() ([]types.ContainerVolume, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []types.ContainerVolume + var r1 error + if rf, ok := ret.Get(0).(func() ([]types.ContainerVolume, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() []types.ContainerVolume); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]types.ContainerVolume) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ContainerVolumeRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type ContainerVolumeRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +func (_e *ContainerVolumeRepo_Expecter) List() *ContainerVolumeRepo_List_Call { + return &ContainerVolumeRepo_List_Call{Call: _e.mock.On("List")} +} + +func (_c *ContainerVolumeRepo_List_Call) Run(run func()) *ContainerVolumeRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerVolumeRepo_List_Call) Return(_a0 []types.ContainerVolume, _a1 error) *ContainerVolumeRepo_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ContainerVolumeRepo_List_Call) RunAndReturn(run func() ([]types.ContainerVolume, error)) *ContainerVolumeRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Prune provides a mock function with no fields +func (_m *ContainerVolumeRepo) Prune() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Prune") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerVolumeRepo_Prune_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prune' +type ContainerVolumeRepo_Prune_Call struct { + *mock.Call +} + +// Prune is a helper method to define mock.On call +func (_e *ContainerVolumeRepo_Expecter) Prune() *ContainerVolumeRepo_Prune_Call { + return &ContainerVolumeRepo_Prune_Call{Call: _e.mock.On("Prune")} +} + +func (_c *ContainerVolumeRepo_Prune_Call) Run(run func()) *ContainerVolumeRepo_Prune_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ContainerVolumeRepo_Prune_Call) Return(_a0 error) *ContainerVolumeRepo_Prune_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerVolumeRepo_Prune_Call) RunAndReturn(run func() error) *ContainerVolumeRepo_Prune_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: id +func (_m *ContainerVolumeRepo) Remove(id string) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// ContainerVolumeRepo_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type ContainerVolumeRepo_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - id string +func (_e *ContainerVolumeRepo_Expecter) Remove(id interface{}) *ContainerVolumeRepo_Remove_Call { + return &ContainerVolumeRepo_Remove_Call{Call: _e.mock.On("Remove", id)} +} + +func (_c *ContainerVolumeRepo_Remove_Call) Run(run func(id string)) *ContainerVolumeRepo_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *ContainerVolumeRepo_Remove_Call) Return(_a0 error) *ContainerVolumeRepo_Remove_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ContainerVolumeRepo_Remove_Call) RunAndReturn(run func(string) error) *ContainerVolumeRepo_Remove_Call { + _c.Call.Return(run) + return _c +} + +// NewContainerVolumeRepo creates a new instance of ContainerVolumeRepo. 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 NewContainerVolumeRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *ContainerVolumeRepo { + mock := &ContainerVolumeRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/CronRepo.go b/mocks/biz/CronRepo.go new file mode 100644 index 00000000..1f9a556e --- /dev/null +++ b/mocks/biz/CronRepo.go @@ -0,0 +1,401 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// CronRepo is an autogenerated mock type for the CronRepo type +type CronRepo struct { + mock.Mock +} + +type CronRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *CronRepo) EXPECT() *CronRepo_Expecter { + return &CronRepo_Expecter{mock: &_m.Mock} +} + +// Count provides a mock function with no fields +func (_m *CronRepo) Count() (int64, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Count") + } + + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func() (int64, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() int64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int64) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CronRepo_Count_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Count' +type CronRepo_Count_Call struct { + *mock.Call +} + +// Count is a helper method to define mock.On call +func (_e *CronRepo_Expecter) Count() *CronRepo_Count_Call { + return &CronRepo_Count_Call{Call: _e.mock.On("Count")} +} + +func (_c *CronRepo_Count_Call) Run(run func()) *CronRepo_Count_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *CronRepo_Count_Call) Return(_a0 int64, _a1 error) *CronRepo_Count_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CronRepo_Count_Call) RunAndReturn(run func() (int64, error)) *CronRepo_Count_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: req +func (_m *CronRepo) Create(req *request.CronCreate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.CronCreate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CronRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type CronRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.CronCreate +func (_e *CronRepo_Expecter) Create(req interface{}) *CronRepo_Create_Call { + return &CronRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *CronRepo_Create_Call) Run(run func(req *request.CronCreate)) *CronRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CronCreate)) + }) + return _c +} + +func (_c *CronRepo_Create_Call) Return(_a0 error) *CronRepo_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CronRepo_Create_Call) RunAndReturn(run func(*request.CronCreate) error) *CronRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *CronRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CronRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type CronRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *CronRepo_Expecter) Delete(id interface{}) *CronRepo_Delete_Call { + return &CronRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *CronRepo_Delete_Call) Run(run func(id uint)) *CronRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CronRepo_Delete_Call) Return(_a0 error) *CronRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CronRepo_Delete_Call) RunAndReturn(run func(uint) error) *CronRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *CronRepo) Get(id uint) (*biz.Cron, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.Cron + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.Cron, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.Cron); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Cron) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// CronRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type CronRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *CronRepo_Expecter) Get(id interface{}) *CronRepo_Get_Call { + return &CronRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *CronRepo_Get_Call) Run(run func(id uint)) *CronRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *CronRepo_Get_Call) Return(_a0 *biz.Cron, _a1 error) *CronRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *CronRepo_Get_Call) RunAndReturn(run func(uint) (*biz.Cron, error)) *CronRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *CronRepo) List(page uint, limit uint) ([]*biz.Cron, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.Cron + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.Cron, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.Cron); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.Cron) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// CronRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type CronRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *CronRepo_Expecter) List(page interface{}, limit interface{}) *CronRepo_List_Call { + return &CronRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *CronRepo_List_Call) Run(run func(page uint, limit uint)) *CronRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *CronRepo_List_Call) Return(_a0 []*biz.Cron, _a1 int64, _a2 error) *CronRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *CronRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.Cron, int64, error)) *CronRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Status provides a mock function with given fields: id, status +func (_m *CronRepo) Status(id uint, status bool) error { + ret := _m.Called(id, status) + + if len(ret) == 0 { + panic("no return value specified for Status") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, bool) error); ok { + r0 = rf(id, status) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CronRepo_Status_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Status' +type CronRepo_Status_Call struct { + *mock.Call +} + +// Status is a helper method to define mock.On call +// - id uint +// - status bool +func (_e *CronRepo_Expecter) Status(id interface{}, status interface{}) *CronRepo_Status_Call { + return &CronRepo_Status_Call{Call: _e.mock.On("Status", id, status)} +} + +func (_c *CronRepo_Status_Call) Run(run func(id uint, status bool)) *CronRepo_Status_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(bool)) + }) + return _c +} + +func (_c *CronRepo_Status_Call) Return(_a0 error) *CronRepo_Status_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CronRepo_Status_Call) RunAndReturn(run func(uint, bool) error) *CronRepo_Status_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *CronRepo) Update(req *request.CronUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.CronUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// CronRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type CronRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.CronUpdate +func (_e *CronRepo_Expecter) Update(req interface{}) *CronRepo_Update_Call { + return &CronRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *CronRepo_Update_Call) Run(run func(req *request.CronUpdate)) *CronRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.CronUpdate)) + }) + return _c +} + +func (_c *CronRepo_Update_Call) Return(_a0 error) *CronRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *CronRepo_Update_Call) RunAndReturn(run func(*request.CronUpdate) error) *CronRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewCronRepo creates a new instance of CronRepo. 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 NewCronRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *CronRepo { + mock := &CronRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/DatabaseRepo.go b/mocks/biz/DatabaseRepo.go new file mode 100644 index 00000000..3c215311 --- /dev/null +++ b/mocks/biz/DatabaseRepo.go @@ -0,0 +1,242 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// DatabaseRepo is an autogenerated mock type for the DatabaseRepo type +type DatabaseRepo struct { + mock.Mock +} + +type DatabaseRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *DatabaseRepo) EXPECT() *DatabaseRepo_Expecter { + return &DatabaseRepo_Expecter{mock: &_m.Mock} +} + +// Comment provides a mock function with given fields: req +func (_m *DatabaseRepo) Comment(req *request.DatabaseComment) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Comment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseComment) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseRepo_Comment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Comment' +type DatabaseRepo_Comment_Call struct { + *mock.Call +} + +// Comment is a helper method to define mock.On call +// - req *request.DatabaseComment +func (_e *DatabaseRepo_Expecter) Comment(req interface{}) *DatabaseRepo_Comment_Call { + return &DatabaseRepo_Comment_Call{Call: _e.mock.On("Comment", req)} +} + +func (_c *DatabaseRepo_Comment_Call) Run(run func(req *request.DatabaseComment)) *DatabaseRepo_Comment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseComment)) + }) + return _c +} + +func (_c *DatabaseRepo_Comment_Call) Return(_a0 error) *DatabaseRepo_Comment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseRepo_Comment_Call) RunAndReturn(run func(*request.DatabaseComment) error) *DatabaseRepo_Comment_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: req +func (_m *DatabaseRepo) Create(req *request.DatabaseCreate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseCreate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type DatabaseRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.DatabaseCreate +func (_e *DatabaseRepo_Expecter) Create(req interface{}) *DatabaseRepo_Create_Call { + return &DatabaseRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *DatabaseRepo_Create_Call) Run(run func(req *request.DatabaseCreate)) *DatabaseRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseCreate)) + }) + return _c +} + +func (_c *DatabaseRepo_Create_Call) Return(_a0 error) *DatabaseRepo_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseRepo_Create_Call) RunAndReturn(run func(*request.DatabaseCreate) error) *DatabaseRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: serverID, name +func (_m *DatabaseRepo) Delete(serverID uint, name string) error { + ret := _m.Called(serverID, name) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, string) error); ok { + r0 = rf(serverID, name) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type DatabaseRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - serverID uint +// - name string +func (_e *DatabaseRepo_Expecter) Delete(serverID interface{}, name interface{}) *DatabaseRepo_Delete_Call { + return &DatabaseRepo_Delete_Call{Call: _e.mock.On("Delete", serverID, name)} +} + +func (_c *DatabaseRepo_Delete_Call) Run(run func(serverID uint, name string)) *DatabaseRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(string)) + }) + return _c +} + +func (_c *DatabaseRepo_Delete_Call) Return(_a0 error) *DatabaseRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseRepo_Delete_Call) RunAndReturn(run func(uint, string) error) *DatabaseRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *DatabaseRepo) List(page uint, limit uint) ([]*biz.Database, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.Database + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.Database, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.Database); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.Database) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// DatabaseRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type DatabaseRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *DatabaseRepo_Expecter) List(page interface{}, limit interface{}) *DatabaseRepo_List_Call { + return &DatabaseRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *DatabaseRepo_List_Call) Run(run func(page uint, limit uint)) *DatabaseRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *DatabaseRepo_List_Call) Return(_a0 []*biz.Database, _a1 int64, _a2 error) *DatabaseRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *DatabaseRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.Database, int64, error)) *DatabaseRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// NewDatabaseRepo creates a new instance of DatabaseRepo. 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 NewDatabaseRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *DatabaseRepo { + mock := &DatabaseRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/DatabaseServerRepo.go b/mocks/biz/DatabaseServerRepo.go new file mode 100644 index 00000000..6657b186 --- /dev/null +++ b/mocks/biz/DatabaseServerRepo.go @@ -0,0 +1,550 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// DatabaseServerRepo is an autogenerated mock type for the DatabaseServerRepo type +type DatabaseServerRepo struct { + mock.Mock +} + +type DatabaseServerRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *DatabaseServerRepo) EXPECT() *DatabaseServerRepo_Expecter { + return &DatabaseServerRepo_Expecter{mock: &_m.Mock} +} + +// ClearUsers provides a mock function with given fields: id +func (_m *DatabaseServerRepo) ClearUsers(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ClearUsers") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseServerRepo_ClearUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearUsers' +type DatabaseServerRepo_ClearUsers_Call struct { + *mock.Call +} + +// ClearUsers is a helper method to define mock.On call +// - id uint +func (_e *DatabaseServerRepo_Expecter) ClearUsers(id interface{}) *DatabaseServerRepo_ClearUsers_Call { + return &DatabaseServerRepo_ClearUsers_Call{Call: _e.mock.On("ClearUsers", id)} +} + +func (_c *DatabaseServerRepo_ClearUsers_Call) Run(run func(id uint)) *DatabaseServerRepo_ClearUsers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *DatabaseServerRepo_ClearUsers_Call) Return(_a0 error) *DatabaseServerRepo_ClearUsers_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseServerRepo_ClearUsers_Call) RunAndReturn(run func(uint) error) *DatabaseServerRepo_ClearUsers_Call { + _c.Call.Return(run) + return _c +} + +// Count provides a mock function with no fields +func (_m *DatabaseServerRepo) Count() (int64, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Count") + } + + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func() (int64, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() int64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int64) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DatabaseServerRepo_Count_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Count' +type DatabaseServerRepo_Count_Call struct { + *mock.Call +} + +// Count is a helper method to define mock.On call +func (_e *DatabaseServerRepo_Expecter) Count() *DatabaseServerRepo_Count_Call { + return &DatabaseServerRepo_Count_Call{Call: _e.mock.On("Count")} +} + +func (_c *DatabaseServerRepo_Count_Call) Run(run func()) *DatabaseServerRepo_Count_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *DatabaseServerRepo_Count_Call) Return(_a0 int64, _a1 error) *DatabaseServerRepo_Count_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *DatabaseServerRepo_Count_Call) RunAndReturn(run func() (int64, error)) *DatabaseServerRepo_Count_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: req +func (_m *DatabaseServerRepo) Create(req *request.DatabaseServerCreate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseServerCreate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseServerRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type DatabaseServerRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.DatabaseServerCreate +func (_e *DatabaseServerRepo_Expecter) Create(req interface{}) *DatabaseServerRepo_Create_Call { + return &DatabaseServerRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *DatabaseServerRepo_Create_Call) Run(run func(req *request.DatabaseServerCreate)) *DatabaseServerRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseServerCreate)) + }) + return _c +} + +func (_c *DatabaseServerRepo_Create_Call) Return(_a0 error) *DatabaseServerRepo_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseServerRepo_Create_Call) RunAndReturn(run func(*request.DatabaseServerCreate) error) *DatabaseServerRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *DatabaseServerRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseServerRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type DatabaseServerRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *DatabaseServerRepo_Expecter) Delete(id interface{}) *DatabaseServerRepo_Delete_Call { + return &DatabaseServerRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *DatabaseServerRepo_Delete_Call) Run(run func(id uint)) *DatabaseServerRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *DatabaseServerRepo_Delete_Call) Return(_a0 error) *DatabaseServerRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseServerRepo_Delete_Call) RunAndReturn(run func(uint) error) *DatabaseServerRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *DatabaseServerRepo) Get(id uint) (*biz.DatabaseServer, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.DatabaseServer + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.DatabaseServer, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.DatabaseServer); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.DatabaseServer) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DatabaseServerRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type DatabaseServerRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *DatabaseServerRepo_Expecter) Get(id interface{}) *DatabaseServerRepo_Get_Call { + return &DatabaseServerRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *DatabaseServerRepo_Get_Call) Run(run func(id uint)) *DatabaseServerRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *DatabaseServerRepo_Get_Call) Return(_a0 *biz.DatabaseServer, _a1 error) *DatabaseServerRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *DatabaseServerRepo_Get_Call) RunAndReturn(run func(uint) (*biz.DatabaseServer, error)) *DatabaseServerRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByName provides a mock function with given fields: name +func (_m *DatabaseServerRepo) GetByName(name string) (*biz.DatabaseServer, error) { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for GetByName") + } + + var r0 *biz.DatabaseServer + var r1 error + if rf, ok := ret.Get(0).(func(string) (*biz.DatabaseServer, error)); ok { + return rf(name) + } + if rf, ok := ret.Get(0).(func(string) *biz.DatabaseServer); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.DatabaseServer) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DatabaseServerRepo_GetByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByName' +type DatabaseServerRepo_GetByName_Call struct { + *mock.Call +} + +// GetByName is a helper method to define mock.On call +// - name string +func (_e *DatabaseServerRepo_Expecter) GetByName(name interface{}) *DatabaseServerRepo_GetByName_Call { + return &DatabaseServerRepo_GetByName_Call{Call: _e.mock.On("GetByName", name)} +} + +func (_c *DatabaseServerRepo_GetByName_Call) Run(run func(name string)) *DatabaseServerRepo_GetByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *DatabaseServerRepo_GetByName_Call) Return(_a0 *biz.DatabaseServer, _a1 error) *DatabaseServerRepo_GetByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *DatabaseServerRepo_GetByName_Call) RunAndReturn(run func(string) (*biz.DatabaseServer, error)) *DatabaseServerRepo_GetByName_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *DatabaseServerRepo) List(page uint, limit uint) ([]*biz.DatabaseServer, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.DatabaseServer + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.DatabaseServer, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.DatabaseServer); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.DatabaseServer) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// DatabaseServerRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type DatabaseServerRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *DatabaseServerRepo_Expecter) List(page interface{}, limit interface{}) *DatabaseServerRepo_List_Call { + return &DatabaseServerRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *DatabaseServerRepo_List_Call) Run(run func(page uint, limit uint)) *DatabaseServerRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *DatabaseServerRepo_List_Call) Return(_a0 []*biz.DatabaseServer, _a1 int64, _a2 error) *DatabaseServerRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *DatabaseServerRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.DatabaseServer, int64, error)) *DatabaseServerRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Sync provides a mock function with given fields: id +func (_m *DatabaseServerRepo) Sync(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Sync") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseServerRepo_Sync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sync' +type DatabaseServerRepo_Sync_Call struct { + *mock.Call +} + +// Sync is a helper method to define mock.On call +// - id uint +func (_e *DatabaseServerRepo_Expecter) Sync(id interface{}) *DatabaseServerRepo_Sync_Call { + return &DatabaseServerRepo_Sync_Call{Call: _e.mock.On("Sync", id)} +} + +func (_c *DatabaseServerRepo_Sync_Call) Run(run func(id uint)) *DatabaseServerRepo_Sync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *DatabaseServerRepo_Sync_Call) Return(_a0 error) *DatabaseServerRepo_Sync_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseServerRepo_Sync_Call) RunAndReturn(run func(uint) error) *DatabaseServerRepo_Sync_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *DatabaseServerRepo) Update(req *request.DatabaseServerUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseServerUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseServerRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type DatabaseServerRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.DatabaseServerUpdate +func (_e *DatabaseServerRepo_Expecter) Update(req interface{}) *DatabaseServerRepo_Update_Call { + return &DatabaseServerRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *DatabaseServerRepo_Update_Call) Run(run func(req *request.DatabaseServerUpdate)) *DatabaseServerRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseServerUpdate)) + }) + return _c +} + +func (_c *DatabaseServerRepo_Update_Call) Return(_a0 error) *DatabaseServerRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseServerRepo_Update_Call) RunAndReturn(run func(*request.DatabaseServerUpdate) error) *DatabaseServerRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// UpdateRemark provides a mock function with given fields: req +func (_m *DatabaseServerRepo) UpdateRemark(req *request.DatabaseServerUpdateRemark) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for UpdateRemark") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseServerUpdateRemark) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseServerRepo_UpdateRemark_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRemark' +type DatabaseServerRepo_UpdateRemark_Call struct { + *mock.Call +} + +// UpdateRemark is a helper method to define mock.On call +// - req *request.DatabaseServerUpdateRemark +func (_e *DatabaseServerRepo_Expecter) UpdateRemark(req interface{}) *DatabaseServerRepo_UpdateRemark_Call { + return &DatabaseServerRepo_UpdateRemark_Call{Call: _e.mock.On("UpdateRemark", req)} +} + +func (_c *DatabaseServerRepo_UpdateRemark_Call) Run(run func(req *request.DatabaseServerUpdateRemark)) *DatabaseServerRepo_UpdateRemark_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseServerUpdateRemark)) + }) + return _c +} + +func (_c *DatabaseServerRepo_UpdateRemark_Call) Return(_a0 error) *DatabaseServerRepo_UpdateRemark_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseServerRepo_UpdateRemark_Call) RunAndReturn(run func(*request.DatabaseServerUpdateRemark) error) *DatabaseServerRepo_UpdateRemark_Call { + _c.Call.Return(run) + return _c +} + +// NewDatabaseServerRepo creates a new instance of DatabaseServerRepo. 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 NewDatabaseServerRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *DatabaseServerRepo { + mock := &DatabaseServerRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/DatabaseUserRepo.go b/mocks/biz/DatabaseUserRepo.go new file mode 100644 index 00000000..077504ac --- /dev/null +++ b/mocks/biz/DatabaseUserRepo.go @@ -0,0 +1,447 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// DatabaseUserRepo is an autogenerated mock type for the DatabaseUserRepo type +type DatabaseUserRepo struct { + mock.Mock +} + +type DatabaseUserRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *DatabaseUserRepo) EXPECT() *DatabaseUserRepo_Expecter { + return &DatabaseUserRepo_Expecter{mock: &_m.Mock} +} + +// Count provides a mock function with no fields +func (_m *DatabaseUserRepo) Count() (int64, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Count") + } + + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func() (int64, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() int64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int64) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DatabaseUserRepo_Count_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Count' +type DatabaseUserRepo_Count_Call struct { + *mock.Call +} + +// Count is a helper method to define mock.On call +func (_e *DatabaseUserRepo_Expecter) Count() *DatabaseUserRepo_Count_Call { + return &DatabaseUserRepo_Count_Call{Call: _e.mock.On("Count")} +} + +func (_c *DatabaseUserRepo_Count_Call) Run(run func()) *DatabaseUserRepo_Count_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *DatabaseUserRepo_Count_Call) Return(_a0 int64, _a1 error) *DatabaseUserRepo_Count_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *DatabaseUserRepo_Count_Call) RunAndReturn(run func() (int64, error)) *DatabaseUserRepo_Count_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: req +func (_m *DatabaseUserRepo) Create(req *request.DatabaseUserCreate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseUserCreate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseUserRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type DatabaseUserRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.DatabaseUserCreate +func (_e *DatabaseUserRepo_Expecter) Create(req interface{}) *DatabaseUserRepo_Create_Call { + return &DatabaseUserRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *DatabaseUserRepo_Create_Call) Run(run func(req *request.DatabaseUserCreate)) *DatabaseUserRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseUserCreate)) + }) + return _c +} + +func (_c *DatabaseUserRepo_Create_Call) Return(_a0 error) *DatabaseUserRepo_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseUserRepo_Create_Call) RunAndReturn(run func(*request.DatabaseUserCreate) error) *DatabaseUserRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *DatabaseUserRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseUserRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type DatabaseUserRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *DatabaseUserRepo_Expecter) Delete(id interface{}) *DatabaseUserRepo_Delete_Call { + return &DatabaseUserRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *DatabaseUserRepo_Delete_Call) Run(run func(id uint)) *DatabaseUserRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *DatabaseUserRepo_Delete_Call) Return(_a0 error) *DatabaseUserRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseUserRepo_Delete_Call) RunAndReturn(run func(uint) error) *DatabaseUserRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// DeleteByNames provides a mock function with given fields: serverID, names +func (_m *DatabaseUserRepo) DeleteByNames(serverID uint, names []string) error { + ret := _m.Called(serverID, names) + + if len(ret) == 0 { + panic("no return value specified for DeleteByNames") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, []string) error); ok { + r0 = rf(serverID, names) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseUserRepo_DeleteByNames_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteByNames' +type DatabaseUserRepo_DeleteByNames_Call struct { + *mock.Call +} + +// DeleteByNames is a helper method to define mock.On call +// - serverID uint +// - names []string +func (_e *DatabaseUserRepo_Expecter) DeleteByNames(serverID interface{}, names interface{}) *DatabaseUserRepo_DeleteByNames_Call { + return &DatabaseUserRepo_DeleteByNames_Call{Call: _e.mock.On("DeleteByNames", serverID, names)} +} + +func (_c *DatabaseUserRepo_DeleteByNames_Call) Run(run func(serverID uint, names []string)) *DatabaseUserRepo_DeleteByNames_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].([]string)) + }) + return _c +} + +func (_c *DatabaseUserRepo_DeleteByNames_Call) Return(_a0 error) *DatabaseUserRepo_DeleteByNames_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseUserRepo_DeleteByNames_Call) RunAndReturn(run func(uint, []string) error) *DatabaseUserRepo_DeleteByNames_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *DatabaseUserRepo) Get(id uint) (*biz.DatabaseUser, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.DatabaseUser + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.DatabaseUser, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.DatabaseUser); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.DatabaseUser) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// DatabaseUserRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type DatabaseUserRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *DatabaseUserRepo_Expecter) Get(id interface{}) *DatabaseUserRepo_Get_Call { + return &DatabaseUserRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *DatabaseUserRepo_Get_Call) Run(run func(id uint)) *DatabaseUserRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *DatabaseUserRepo_Get_Call) Return(_a0 *biz.DatabaseUser, _a1 error) *DatabaseUserRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *DatabaseUserRepo_Get_Call) RunAndReturn(run func(uint) (*biz.DatabaseUser, error)) *DatabaseUserRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *DatabaseUserRepo) List(page uint, limit uint) ([]*biz.DatabaseUser, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.DatabaseUser + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.DatabaseUser, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.DatabaseUser); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.DatabaseUser) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// DatabaseUserRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type DatabaseUserRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *DatabaseUserRepo_Expecter) List(page interface{}, limit interface{}) *DatabaseUserRepo_List_Call { + return &DatabaseUserRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *DatabaseUserRepo_List_Call) Run(run func(page uint, limit uint)) *DatabaseUserRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *DatabaseUserRepo_List_Call) Return(_a0 []*biz.DatabaseUser, _a1 int64, _a2 error) *DatabaseUserRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *DatabaseUserRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.DatabaseUser, int64, error)) *DatabaseUserRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *DatabaseUserRepo) Update(req *request.DatabaseUserUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseUserUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseUserRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type DatabaseUserRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.DatabaseUserUpdate +func (_e *DatabaseUserRepo_Expecter) Update(req interface{}) *DatabaseUserRepo_Update_Call { + return &DatabaseUserRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *DatabaseUserRepo_Update_Call) Run(run func(req *request.DatabaseUserUpdate)) *DatabaseUserRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseUserUpdate)) + }) + return _c +} + +func (_c *DatabaseUserRepo_Update_Call) Return(_a0 error) *DatabaseUserRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseUserRepo_Update_Call) RunAndReturn(run func(*request.DatabaseUserUpdate) error) *DatabaseUserRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// UpdateRemark provides a mock function with given fields: req +func (_m *DatabaseUserRepo) UpdateRemark(req *request.DatabaseUserUpdateRemark) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for UpdateRemark") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.DatabaseUserUpdateRemark) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// DatabaseUserRepo_UpdateRemark_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRemark' +type DatabaseUserRepo_UpdateRemark_Call struct { + *mock.Call +} + +// UpdateRemark is a helper method to define mock.On call +// - req *request.DatabaseUserUpdateRemark +func (_e *DatabaseUserRepo_Expecter) UpdateRemark(req interface{}) *DatabaseUserRepo_UpdateRemark_Call { + return &DatabaseUserRepo_UpdateRemark_Call{Call: _e.mock.On("UpdateRemark", req)} +} + +func (_c *DatabaseUserRepo_UpdateRemark_Call) Run(run func(req *request.DatabaseUserUpdateRemark)) *DatabaseUserRepo_UpdateRemark_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.DatabaseUserUpdateRemark)) + }) + return _c +} + +func (_c *DatabaseUserRepo_UpdateRemark_Call) Return(_a0 error) *DatabaseUserRepo_UpdateRemark_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *DatabaseUserRepo_UpdateRemark_Call) RunAndReturn(run func(*request.DatabaseUserUpdateRemark) error) *DatabaseUserRepo_UpdateRemark_Call { + _c.Call.Return(run) + return _c +} + +// NewDatabaseUserRepo creates a new instance of DatabaseUserRepo. 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 NewDatabaseUserRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *DatabaseUserRepo { + mock := &DatabaseUserRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/MonitorRepo.go b/mocks/biz/MonitorRepo.go new file mode 100644 index 00000000..7e638cef --- /dev/null +++ b/mocks/biz/MonitorRepo.go @@ -0,0 +1,246 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" + + time "time" +) + +// MonitorRepo is an autogenerated mock type for the MonitorRepo type +type MonitorRepo struct { + mock.Mock +} + +type MonitorRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *MonitorRepo) EXPECT() *MonitorRepo_Expecter { + return &MonitorRepo_Expecter{mock: &_m.Mock} +} + +// Clear provides a mock function with no fields +func (_m *MonitorRepo) Clear() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Clear") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MonitorRepo_Clear_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clear' +type MonitorRepo_Clear_Call struct { + *mock.Call +} + +// Clear is a helper method to define mock.On call +func (_e *MonitorRepo_Expecter) Clear() *MonitorRepo_Clear_Call { + return &MonitorRepo_Clear_Call{Call: _e.mock.On("Clear")} +} + +func (_c *MonitorRepo_Clear_Call) Run(run func()) *MonitorRepo_Clear_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MonitorRepo_Clear_Call) Return(_a0 error) *MonitorRepo_Clear_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MonitorRepo_Clear_Call) RunAndReturn(run func() error) *MonitorRepo_Clear_Call { + _c.Call.Return(run) + return _c +} + +// GetSetting provides a mock function with no fields +func (_m *MonitorRepo) GetSetting() (*request.MonitorSetting, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetSetting") + } + + var r0 *request.MonitorSetting + var r1 error + if rf, ok := ret.Get(0).(func() (*request.MonitorSetting, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *request.MonitorSetting); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*request.MonitorSetting) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MonitorRepo_GetSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSetting' +type MonitorRepo_GetSetting_Call struct { + *mock.Call +} + +// GetSetting is a helper method to define mock.On call +func (_e *MonitorRepo_Expecter) GetSetting() *MonitorRepo_GetSetting_Call { + return &MonitorRepo_GetSetting_Call{Call: _e.mock.On("GetSetting")} +} + +func (_c *MonitorRepo_GetSetting_Call) Run(run func()) *MonitorRepo_GetSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MonitorRepo_GetSetting_Call) Return(_a0 *request.MonitorSetting, _a1 error) *MonitorRepo_GetSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MonitorRepo_GetSetting_Call) RunAndReturn(run func() (*request.MonitorSetting, error)) *MonitorRepo_GetSetting_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: start, end +func (_m *MonitorRepo) List(start time.Time, end time.Time) ([]*biz.Monitor, error) { + ret := _m.Called(start, end) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.Monitor + var r1 error + if rf, ok := ret.Get(0).(func(time.Time, time.Time) ([]*biz.Monitor, error)); ok { + return rf(start, end) + } + if rf, ok := ret.Get(0).(func(time.Time, time.Time) []*biz.Monitor); ok { + r0 = rf(start, end) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.Monitor) + } + } + + if rf, ok := ret.Get(1).(func(time.Time, time.Time) error); ok { + r1 = rf(start, end) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MonitorRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MonitorRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - start time.Time +// - end time.Time +func (_e *MonitorRepo_Expecter) List(start interface{}, end interface{}) *MonitorRepo_List_Call { + return &MonitorRepo_List_Call{Call: _e.mock.On("List", start, end)} +} + +func (_c *MonitorRepo_List_Call) Run(run func(start time.Time, end time.Time)) *MonitorRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(time.Time), args[1].(time.Time)) + }) + return _c +} + +func (_c *MonitorRepo_List_Call) Return(_a0 []*biz.Monitor, _a1 error) *MonitorRepo_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MonitorRepo_List_Call) RunAndReturn(run func(time.Time, time.Time) ([]*biz.Monitor, error)) *MonitorRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// UpdateSetting provides a mock function with given fields: setting +func (_m *MonitorRepo) UpdateSetting(setting *request.MonitorSetting) error { + ret := _m.Called(setting) + + if len(ret) == 0 { + panic("no return value specified for UpdateSetting") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.MonitorSetting) error); ok { + r0 = rf(setting) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MonitorRepo_UpdateSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSetting' +type MonitorRepo_UpdateSetting_Call struct { + *mock.Call +} + +// UpdateSetting is a helper method to define mock.On call +// - setting *request.MonitorSetting +func (_e *MonitorRepo_Expecter) UpdateSetting(setting interface{}) *MonitorRepo_UpdateSetting_Call { + return &MonitorRepo_UpdateSetting_Call{Call: _e.mock.On("UpdateSetting", setting)} +} + +func (_c *MonitorRepo_UpdateSetting_Call) Run(run func(setting *request.MonitorSetting)) *MonitorRepo_UpdateSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.MonitorSetting)) + }) + return _c +} + +func (_c *MonitorRepo_UpdateSetting_Call) Return(_a0 error) *MonitorRepo_UpdateSetting_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MonitorRepo_UpdateSetting_Call) RunAndReturn(run func(*request.MonitorSetting) error) *MonitorRepo_UpdateSetting_Call { + _c.Call.Return(run) + return _c +} + +// NewMonitorRepo creates a new instance of MonitorRepo. 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 NewMonitorRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *MonitorRepo { + mock := &MonitorRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/SSHRepo.go b/mocks/biz/SSHRepo.go new file mode 100644 index 00000000..5290f169 --- /dev/null +++ b/mocks/biz/SSHRepo.go @@ -0,0 +1,299 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// SSHRepo is an autogenerated mock type for the SSHRepo type +type SSHRepo struct { + mock.Mock +} + +type SSHRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *SSHRepo) EXPECT() *SSHRepo_Expecter { + return &SSHRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: req +func (_m *SSHRepo) Create(req *request.SSHCreate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.SSHCreate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SSHRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type SSHRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.SSHCreate +func (_e *SSHRepo_Expecter) Create(req interface{}) *SSHRepo_Create_Call { + return &SSHRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *SSHRepo_Create_Call) Run(run func(req *request.SSHCreate)) *SSHRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.SSHCreate)) + }) + return _c +} + +func (_c *SSHRepo_Create_Call) Return(_a0 error) *SSHRepo_Create_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SSHRepo_Create_Call) RunAndReturn(run func(*request.SSHCreate) error) *SSHRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: id +func (_m *SSHRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SSHRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type SSHRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *SSHRepo_Expecter) Delete(id interface{}) *SSHRepo_Delete_Call { + return &SSHRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *SSHRepo_Delete_Call) Run(run func(id uint)) *SSHRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *SSHRepo_Delete_Call) Return(_a0 error) *SSHRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SSHRepo_Delete_Call) RunAndReturn(run func(uint) error) *SSHRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *SSHRepo) Get(id uint) (*biz.SSH, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.SSH + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.SSH, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.SSH); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.SSH) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SSHRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type SSHRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *SSHRepo_Expecter) Get(id interface{}) *SSHRepo_Get_Call { + return &SSHRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *SSHRepo_Get_Call) Run(run func(id uint)) *SSHRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *SSHRepo_Get_Call) Return(_a0 *biz.SSH, _a1 error) *SSHRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SSHRepo_Get_Call) RunAndReturn(run func(uint) (*biz.SSH, error)) *SSHRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *SSHRepo) List(page uint, limit uint) ([]*biz.SSH, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.SSH + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.SSH, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.SSH); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.SSH) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// SSHRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type SSHRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *SSHRepo_Expecter) List(page interface{}, limit interface{}) *SSHRepo_List_Call { + return &SSHRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *SSHRepo_List_Call) Run(run func(page uint, limit uint)) *SSHRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *SSHRepo_List_Call) Return(_a0 []*biz.SSH, _a1 int64, _a2 error) *SSHRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *SSHRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.SSH, int64, error)) *SSHRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *SSHRepo) Update(req *request.SSHUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.SSHUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SSHRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type SSHRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.SSHUpdate +func (_e *SSHRepo_Expecter) Update(req interface{}) *SSHRepo_Update_Call { + return &SSHRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *SSHRepo_Update_Call) Run(run func(req *request.SSHUpdate)) *SSHRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.SSHUpdate)) + }) + return _c +} + +func (_c *SSHRepo_Update_Call) Return(_a0 error) *SSHRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SSHRepo_Update_Call) RunAndReturn(run func(*request.SSHUpdate) error) *SSHRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewSSHRepo creates a new instance of SSHRepo. 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 NewSSHRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *SSHRepo { + mock := &SSHRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/SafeRepo.go b/mocks/biz/SafeRepo.go new file mode 100644 index 00000000..37dcf80c --- /dev/null +++ b/mocks/biz/SafeRepo.go @@ -0,0 +1,242 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import mock "github.com/stretchr/testify/mock" + +// SafeRepo is an autogenerated mock type for the SafeRepo type +type SafeRepo struct { + mock.Mock +} + +type SafeRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *SafeRepo) EXPECT() *SafeRepo_Expecter { + return &SafeRepo_Expecter{mock: &_m.Mock} +} + +// GetPingStatus provides a mock function with no fields +func (_m *SafeRepo) GetPingStatus() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetPingStatus") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SafeRepo_GetPingStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPingStatus' +type SafeRepo_GetPingStatus_Call struct { + *mock.Call +} + +// GetPingStatus is a helper method to define mock.On call +func (_e *SafeRepo_Expecter) GetPingStatus() *SafeRepo_GetPingStatus_Call { + return &SafeRepo_GetPingStatus_Call{Call: _e.mock.On("GetPingStatus")} +} + +func (_c *SafeRepo_GetPingStatus_Call) Run(run func()) *SafeRepo_GetPingStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SafeRepo_GetPingStatus_Call) Return(_a0 bool, _a1 error) *SafeRepo_GetPingStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SafeRepo_GetPingStatus_Call) RunAndReturn(run func() (bool, error)) *SafeRepo_GetPingStatus_Call { + _c.Call.Return(run) + return _c +} + +// GetSSH provides a mock function with no fields +func (_m *SafeRepo) GetSSH() (uint, bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetSSH") + } + + var r0 uint + var r1 bool + var r2 error + if rf, ok := ret.Get(0).(func() (uint, bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() uint); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(uint) + } + + if rf, ok := ret.Get(1).(func() bool); ok { + r1 = rf() + } else { + r1 = ret.Get(1).(bool) + } + + if rf, ok := ret.Get(2).(func() error); ok { + r2 = rf() + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// SafeRepo_GetSSH_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSSH' +type SafeRepo_GetSSH_Call struct { + *mock.Call +} + +// GetSSH is a helper method to define mock.On call +func (_e *SafeRepo_Expecter) GetSSH() *SafeRepo_GetSSH_Call { + return &SafeRepo_GetSSH_Call{Call: _e.mock.On("GetSSH")} +} + +func (_c *SafeRepo_GetSSH_Call) Run(run func()) *SafeRepo_GetSSH_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SafeRepo_GetSSH_Call) Return(_a0 uint, _a1 bool, _a2 error) *SafeRepo_GetSSH_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *SafeRepo_GetSSH_Call) RunAndReturn(run func() (uint, bool, error)) *SafeRepo_GetSSH_Call { + _c.Call.Return(run) + return _c +} + +// UpdatePingStatus provides a mock function with given fields: status +func (_m *SafeRepo) UpdatePingStatus(status bool) error { + ret := _m.Called(status) + + if len(ret) == 0 { + panic("no return value specified for UpdatePingStatus") + } + + var r0 error + if rf, ok := ret.Get(0).(func(bool) error); ok { + r0 = rf(status) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SafeRepo_UpdatePingStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePingStatus' +type SafeRepo_UpdatePingStatus_Call struct { + *mock.Call +} + +// UpdatePingStatus is a helper method to define mock.On call +// - status bool +func (_e *SafeRepo_Expecter) UpdatePingStatus(status interface{}) *SafeRepo_UpdatePingStatus_Call { + return &SafeRepo_UpdatePingStatus_Call{Call: _e.mock.On("UpdatePingStatus", status)} +} + +func (_c *SafeRepo_UpdatePingStatus_Call) Run(run func(status bool)) *SafeRepo_UpdatePingStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *SafeRepo_UpdatePingStatus_Call) Return(_a0 error) *SafeRepo_UpdatePingStatus_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SafeRepo_UpdatePingStatus_Call) RunAndReturn(run func(bool) error) *SafeRepo_UpdatePingStatus_Call { + _c.Call.Return(run) + return _c +} + +// UpdateSSH provides a mock function with given fields: port, status +func (_m *SafeRepo) UpdateSSH(port uint, status bool) error { + ret := _m.Called(port, status) + + if len(ret) == 0 { + panic("no return value specified for UpdateSSH") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, bool) error); ok { + r0 = rf(port, status) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SafeRepo_UpdateSSH_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateSSH' +type SafeRepo_UpdateSSH_Call struct { + *mock.Call +} + +// UpdateSSH is a helper method to define mock.On call +// - port uint +// - status bool +func (_e *SafeRepo_Expecter) UpdateSSH(port interface{}, status interface{}) *SafeRepo_UpdateSSH_Call { + return &SafeRepo_UpdateSSH_Call{Call: _e.mock.On("UpdateSSH", port, status)} +} + +func (_c *SafeRepo_UpdateSSH_Call) Run(run func(port uint, status bool)) *SafeRepo_UpdateSSH_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(bool)) + }) + return _c +} + +func (_c *SafeRepo_UpdateSSH_Call) Return(_a0 error) *SafeRepo_UpdateSSH_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SafeRepo_UpdateSSH_Call) RunAndReturn(run func(uint, bool) error) *SafeRepo_UpdateSSH_Call { + _c.Call.Return(run) + return _c +} + +// NewSafeRepo creates a new instance of SafeRepo. 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 NewSafeRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *SafeRepo { + mock := &SafeRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/SettingRepo.go b/mocks/biz/SettingRepo.go new file mode 100644 index 00000000..b715eeb5 --- /dev/null +++ b/mocks/biz/SettingRepo.go @@ -0,0 +1,390 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + context "context" + + biz "github.com/TheTNB/panel/internal/biz" + + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" +) + +// SettingRepo is an autogenerated mock type for the SettingRepo type +type SettingRepo struct { + mock.Mock +} + +type SettingRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *SettingRepo) EXPECT() *SettingRepo_Expecter { + return &SettingRepo_Expecter{mock: &_m.Mock} +} + +// Delete provides a mock function with given fields: key +func (_m *SettingRepo) Delete(key biz.SettingKey) error { + ret := _m.Called(key) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(biz.SettingKey) error); ok { + r0 = rf(key) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SettingRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type SettingRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - key biz.SettingKey +func (_e *SettingRepo_Expecter) Delete(key interface{}) *SettingRepo_Delete_Call { + return &SettingRepo_Delete_Call{Call: _e.mock.On("Delete", key)} +} + +func (_c *SettingRepo_Delete_Call) Run(run func(key biz.SettingKey)) *SettingRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.SettingKey)) + }) + return _c +} + +func (_c *SettingRepo_Delete_Call) Return(_a0 error) *SettingRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SettingRepo_Delete_Call) RunAndReturn(run func(biz.SettingKey) error) *SettingRepo_Delete_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)) + for _i := range defaultValue { + _va[_i] = defaultValue[_i] + } + var _ca []interface{} + _ca = append(_ca, key) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 string + var r1 error + if rf, ok := ret.Get(0).(func(biz.SettingKey, ...string) (string, error)); ok { + return rf(key, defaultValue...) + } + if rf, ok := ret.Get(0).(func(biz.SettingKey, ...string) string); ok { + r0 = rf(key, defaultValue...) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(biz.SettingKey, ...string) error); ok { + r1 = rf(key, defaultValue...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SettingRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type SettingRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - key biz.SettingKey +// - defaultValue ...string +func (_e *SettingRepo_Expecter) Get(key interface{}, defaultValue ...interface{}) *SettingRepo_Get_Call { + return &SettingRepo_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{key}, defaultValue...)...)} +} + +func (_c *SettingRepo_Get_Call) Run(run func(key biz.SettingKey, defaultValue ...string)) *SettingRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]string, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(string) + } + } + run(args[0].(biz.SettingKey), variadicArgs...) + }) + return _c +} + +func (_c *SettingRepo_Get_Call) Return(_a0 string, _a1 error) *SettingRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SettingRepo_Get_Call) RunAndReturn(run func(biz.SettingKey, ...string) (string, error)) *SettingRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetBool provides a mock function with given fields: key, defaultValue +func (_m *SettingRepo) GetBool(key biz.SettingKey, defaultValue ...bool) (bool, error) { + _va := make([]interface{}, len(defaultValue)) + for _i := range defaultValue { + _va[_i] = defaultValue[_i] + } + var _ca []interface{} + _ca = append(_ca, key) + _ca = append(_ca, _va...) + ret := _m.Called(_ca...) + + if len(ret) == 0 { + panic("no return value specified for GetBool") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(biz.SettingKey, ...bool) (bool, error)); ok { + return rf(key, defaultValue...) + } + if rf, ok := ret.Get(0).(func(biz.SettingKey, ...bool) bool); ok { + r0 = rf(key, defaultValue...) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(biz.SettingKey, ...bool) error); ok { + r1 = rf(key, defaultValue...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SettingRepo_GetBool_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBool' +type SettingRepo_GetBool_Call struct { + *mock.Call +} + +// GetBool is a helper method to define mock.On call +// - key biz.SettingKey +// - defaultValue ...bool +func (_e *SettingRepo_Expecter) GetBool(key interface{}, defaultValue ...interface{}) *SettingRepo_GetBool_Call { + return &SettingRepo_GetBool_Call{Call: _e.mock.On("GetBool", + append([]interface{}{key}, defaultValue...)...)} +} + +func (_c *SettingRepo_GetBool_Call) Run(run func(key biz.SettingKey, defaultValue ...bool)) *SettingRepo_GetBool_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]bool, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(bool) + } + } + run(args[0].(biz.SettingKey), variadicArgs...) + }) + return _c +} + +func (_c *SettingRepo_GetBool_Call) Return(_a0 bool, _a1 error) *SettingRepo_GetBool_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SettingRepo_GetBool_Call) RunAndReturn(run func(biz.SettingKey, ...bool) (bool, error)) *SettingRepo_GetBool_Call { + _c.Call.Return(run) + return _c +} + +// GetPanelSetting provides a mock function with given fields: ctx +func (_m *SettingRepo) GetPanelSetting(ctx context.Context) (*request.PanelSetting, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetPanelSetting") + } + + var r0 *request.PanelSetting + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*request.PanelSetting, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *request.PanelSetting); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*request.PanelSetting) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SettingRepo_GetPanelSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetPanelSetting' +type SettingRepo_GetPanelSetting_Call struct { + *mock.Call +} + +// GetPanelSetting is a helper method to define mock.On call +// - ctx context.Context +func (_e *SettingRepo_Expecter) GetPanelSetting(ctx interface{}) *SettingRepo_GetPanelSetting_Call { + return &SettingRepo_GetPanelSetting_Call{Call: _e.mock.On("GetPanelSetting", ctx)} +} + +func (_c *SettingRepo_GetPanelSetting_Call) Run(run func(ctx context.Context)) *SettingRepo_GetPanelSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SettingRepo_GetPanelSetting_Call) Return(_a0 *request.PanelSetting, _a1 error) *SettingRepo_GetPanelSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SettingRepo_GetPanelSetting_Call) RunAndReturn(run func(context.Context) (*request.PanelSetting, error)) *SettingRepo_GetPanelSetting_Call { + _c.Call.Return(run) + return _c +} + +// Set provides a mock function with given fields: key, value +func (_m *SettingRepo) Set(key biz.SettingKey, value string) error { + ret := _m.Called(key, value) + + if len(ret) == 0 { + panic("no return value specified for Set") + } + + var r0 error + if rf, ok := ret.Get(0).(func(biz.SettingKey, string) error); ok { + r0 = rf(key, value) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SettingRepo_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set' +type SettingRepo_Set_Call struct { + *mock.Call +} + +// Set is a helper method to define mock.On call +// - key biz.SettingKey +// - value string +func (_e *SettingRepo_Expecter) Set(key interface{}, value interface{}) *SettingRepo_Set_Call { + return &SettingRepo_Set_Call{Call: _e.mock.On("Set", key, value)} +} + +func (_c *SettingRepo_Set_Call) Run(run func(key biz.SettingKey, value string)) *SettingRepo_Set_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(biz.SettingKey), args[1].(string)) + }) + return _c +} + +func (_c *SettingRepo_Set_Call) Return(_a0 error) *SettingRepo_Set_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SettingRepo_Set_Call) RunAndReturn(run func(biz.SettingKey, string) error) *SettingRepo_Set_Call { + _c.Call.Return(run) + return _c +} + +// UpdatePanelSetting provides a mock function with given fields: ctx, setting +func (_m *SettingRepo) UpdatePanelSetting(ctx context.Context, setting *request.PanelSetting) (bool, error) { + ret := _m.Called(ctx, setting) + + if len(ret) == 0 { + panic("no return value specified for UpdatePanelSetting") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *request.PanelSetting) (bool, error)); ok { + return rf(ctx, setting) + } + if rf, ok := ret.Get(0).(func(context.Context, *request.PanelSetting) bool); ok { + r0 = rf(ctx, setting) + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func(context.Context, *request.PanelSetting) error); ok { + r1 = rf(ctx, setting) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SettingRepo_UpdatePanelSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdatePanelSetting' +type SettingRepo_UpdatePanelSetting_Call struct { + *mock.Call +} + +// UpdatePanelSetting is a helper method to define mock.On call +// - ctx context.Context +// - setting *request.PanelSetting +func (_e *SettingRepo_Expecter) UpdatePanelSetting(ctx interface{}, setting interface{}) *SettingRepo_UpdatePanelSetting_Call { + return &SettingRepo_UpdatePanelSetting_Call{Call: _e.mock.On("UpdatePanelSetting", ctx, setting)} +} + +func (_c *SettingRepo_UpdatePanelSetting_Call) Run(run func(ctx context.Context, setting *request.PanelSetting)) *SettingRepo_UpdatePanelSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*request.PanelSetting)) + }) + return _c +} + +func (_c *SettingRepo_UpdatePanelSetting_Call) Return(_a0 bool, _a1 error) *SettingRepo_UpdatePanelSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SettingRepo_UpdatePanelSetting_Call) RunAndReturn(run func(context.Context, *request.PanelSetting) (bool, error)) *SettingRepo_UpdatePanelSetting_Call { + _c.Call.Return(run) + return _c +} + +// NewSettingRepo creates a new instance of SettingRepo. 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 NewSettingRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *SettingRepo { + mock := &SettingRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/TaskRepo.go b/mocks/biz/TaskRepo.go new file mode 100644 index 00000000..91adb67a --- /dev/null +++ b/mocks/biz/TaskRepo.go @@ -0,0 +1,343 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" +) + +// TaskRepo is an autogenerated mock type for the TaskRepo type +type TaskRepo struct { + mock.Mock +} + +type TaskRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *TaskRepo) EXPECT() *TaskRepo_Expecter { + return &TaskRepo_Expecter{mock: &_m.Mock} +} + +// Delete provides a mock function with given fields: id +func (_m *TaskRepo) Delete(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// TaskRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type TaskRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - id uint +func (_e *TaskRepo_Expecter) Delete(id interface{}) *TaskRepo_Delete_Call { + return &TaskRepo_Delete_Call{Call: _e.mock.On("Delete", id)} +} + +func (_c *TaskRepo_Delete_Call) Run(run func(id uint)) *TaskRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *TaskRepo_Delete_Call) Return(_a0 error) *TaskRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *TaskRepo_Delete_Call) RunAndReturn(run func(uint) error) *TaskRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *TaskRepo) Get(id uint) (*biz.Task, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.Task + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.Task, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.Task); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Task) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// TaskRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type TaskRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *TaskRepo_Expecter) Get(id interface{}) *TaskRepo_Get_Call { + return &TaskRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *TaskRepo_Get_Call) Run(run func(id uint)) *TaskRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *TaskRepo_Get_Call) Return(_a0 *biz.Task, _a1 error) *TaskRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *TaskRepo_Get_Call) RunAndReturn(run func(uint) (*biz.Task, error)) *TaskRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// HasRunningTask provides a mock function with no fields +func (_m *TaskRepo) HasRunningTask() bool { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for HasRunningTask") + } + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// TaskRepo_HasRunningTask_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HasRunningTask' +type TaskRepo_HasRunningTask_Call struct { + *mock.Call +} + +// HasRunningTask is a helper method to define mock.On call +func (_e *TaskRepo_Expecter) HasRunningTask() *TaskRepo_HasRunningTask_Call { + return &TaskRepo_HasRunningTask_Call{Call: _e.mock.On("HasRunningTask")} +} + +func (_c *TaskRepo_HasRunningTask_Call) Run(run func()) *TaskRepo_HasRunningTask_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *TaskRepo_HasRunningTask_Call) Return(_a0 bool) *TaskRepo_HasRunningTask_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *TaskRepo_HasRunningTask_Call) RunAndReturn(run func() bool) *TaskRepo_HasRunningTask_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *TaskRepo) List(page uint, limit uint) ([]*biz.Task, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.Task + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.Task, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.Task); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.Task) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// TaskRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type TaskRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *TaskRepo_Expecter) List(page interface{}, limit interface{}) *TaskRepo_List_Call { + return &TaskRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *TaskRepo_List_Call) Run(run func(page uint, limit uint)) *TaskRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *TaskRepo_List_Call) Return(_a0 []*biz.Task, _a1 int64, _a2 error) *TaskRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *TaskRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.Task, int64, error)) *TaskRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// Push provides a mock function with given fields: task +func (_m *TaskRepo) Push(task *biz.Task) error { + ret := _m.Called(task) + + if len(ret) == 0 { + panic("no return value specified for Push") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*biz.Task) error); ok { + r0 = rf(task) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// TaskRepo_Push_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Push' +type TaskRepo_Push_Call struct { + *mock.Call +} + +// Push is a helper method to define mock.On call +// - task *biz.Task +func (_e *TaskRepo_Expecter) Push(task interface{}) *TaskRepo_Push_Call { + return &TaskRepo_Push_Call{Call: _e.mock.On("Push", task)} +} + +func (_c *TaskRepo_Push_Call) Run(run func(task *biz.Task)) *TaskRepo_Push_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*biz.Task)) + }) + return _c +} + +func (_c *TaskRepo_Push_Call) Return(_a0 error) *TaskRepo_Push_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *TaskRepo_Push_Call) RunAndReturn(run func(*biz.Task) error) *TaskRepo_Push_Call { + _c.Call.Return(run) + return _c +} + +// UpdateStatus provides a mock function with given fields: id, status +func (_m *TaskRepo) UpdateStatus(id uint, status biz.TaskStatus) error { + ret := _m.Called(id, status) + + if len(ret) == 0 { + panic("no return value specified for UpdateStatus") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, biz.TaskStatus) error); ok { + r0 = rf(id, status) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// TaskRepo_UpdateStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateStatus' +type TaskRepo_UpdateStatus_Call struct { + *mock.Call +} + +// UpdateStatus is a helper method to define mock.On call +// - id uint +// - status biz.TaskStatus +func (_e *TaskRepo_Expecter) UpdateStatus(id interface{}, status interface{}) *TaskRepo_UpdateStatus_Call { + return &TaskRepo_UpdateStatus_Call{Call: _e.mock.On("UpdateStatus", id, status)} +} + +func (_c *TaskRepo_UpdateStatus_Call) Run(run func(id uint, status biz.TaskStatus)) *TaskRepo_UpdateStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(biz.TaskStatus)) + }) + return _c +} + +func (_c *TaskRepo_UpdateStatus_Call) Return(_a0 error) *TaskRepo_UpdateStatus_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *TaskRepo_UpdateStatus_Call) RunAndReturn(run func(uint, biz.TaskStatus) error) *TaskRepo_UpdateStatus_Call { + _c.Call.Return(run) + return _c +} + +// NewTaskRepo creates a new instance of TaskRepo. 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 NewTaskRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *TaskRepo { + mock := &TaskRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/UserRepo.go b/mocks/biz/UserRepo.go new file mode 100644 index 00000000..df028326 --- /dev/null +++ b/mocks/biz/UserRepo.go @@ -0,0 +1,257 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + biz "github.com/TheTNB/panel/internal/biz" + mock "github.com/stretchr/testify/mock" +) + +// UserRepo is an autogenerated mock type for the UserRepo type +type UserRepo struct { + mock.Mock +} + +type UserRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *UserRepo) EXPECT() *UserRepo_Expecter { + return &UserRepo_Expecter{mock: &_m.Mock} +} + +// CheckPassword provides a mock function with given fields: username, password +func (_m *UserRepo) CheckPassword(username string, password string) (*biz.User, error) { + ret := _m.Called(username, password) + + if len(ret) == 0 { + panic("no return value specified for CheckPassword") + } + + var r0 *biz.User + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*biz.User, error)); ok { + return rf(username, password) + } + if rf, ok := ret.Get(0).(func(string, string) *biz.User); ok { + r0 = rf(username, password) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.User) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(username, password) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserRepo_CheckPassword_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckPassword' +type UserRepo_CheckPassword_Call struct { + *mock.Call +} + +// CheckPassword is a helper method to define mock.On call +// - username string +// - password string +func (_e *UserRepo_Expecter) CheckPassword(username interface{}, password interface{}) *UserRepo_CheckPassword_Call { + return &UserRepo_CheckPassword_Call{Call: _e.mock.On("CheckPassword", username, password)} +} + +func (_c *UserRepo_CheckPassword_Call) Run(run func(username string, password string)) *UserRepo_CheckPassword_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *UserRepo_CheckPassword_Call) Return(_a0 *biz.User, _a1 error) *UserRepo_CheckPassword_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserRepo_CheckPassword_Call) RunAndReturn(run func(string, string) (*biz.User, error)) *UserRepo_CheckPassword_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: username, password +func (_m *UserRepo) Create(username string, password string) (*biz.User, error) { + ret := _m.Called(username, password) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *biz.User + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*biz.User, error)); ok { + return rf(username, password) + } + if rf, ok := ret.Get(0).(func(string, string) *biz.User); ok { + r0 = rf(username, password) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.User) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(username, password) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type UserRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - username string +// - password string +func (_e *UserRepo_Expecter) Create(username interface{}, password interface{}) *UserRepo_Create_Call { + return &UserRepo_Create_Call{Call: _e.mock.On("Create", username, password)} +} + +func (_c *UserRepo_Create_Call) Run(run func(username string, password string)) *UserRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *UserRepo_Create_Call) Return(_a0 *biz.User, _a1 error) *UserRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserRepo_Create_Call) RunAndReturn(run func(string, string) (*biz.User, error)) *UserRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *UserRepo) Get(id uint) (*biz.User, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *biz.User + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*biz.User, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *biz.User); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.User) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type UserRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *UserRepo_Expecter) Get(id interface{}) *UserRepo_Get_Call { + return &UserRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *UserRepo_Get_Call) Run(run func(id uint)) *UserRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *UserRepo_Get_Call) Return(_a0 *biz.User, _a1 error) *UserRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserRepo_Get_Call) RunAndReturn(run func(uint) (*biz.User, error)) *UserRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// Save provides a mock function with given fields: user +func (_m *UserRepo) Save(user *biz.User) 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.User) error); ok { + r0 = rf(user) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// UserRepo_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save' +type UserRepo_Save_Call struct { + *mock.Call +} + +// Save is a helper method to define mock.On call +// - user *biz.User +func (_e *UserRepo_Expecter) Save(user interface{}) *UserRepo_Save_Call { + return &UserRepo_Save_Call{Call: _e.mock.On("Save", user)} +} + +func (_c *UserRepo_Save_Call) Run(run func(user *biz.User)) *UserRepo_Save_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*biz.User)) + }) + return _c +} + +func (_c *UserRepo_Save_Call) Return(_a0 error) *UserRepo_Save_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *UserRepo_Save_Call) RunAndReturn(run func(*biz.User) error) *UserRepo_Save_Call { + _c.Call.Return(run) + return _c +} + +// NewUserRepo creates a new instance of UserRepo. 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 NewUserRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *UserRepo { + mock := &UserRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/biz/WebsiteRepo.go b/mocks/biz/WebsiteRepo.go new file mode 100644 index 00000000..a8c5d080 --- /dev/null +++ b/mocks/biz/WebsiteRepo.go @@ -0,0 +1,765 @@ +// Code generated by mockery. DO NOT EDIT. + +package biz + +import ( + context "context" + + biz "github.com/TheTNB/panel/internal/biz" + + mock "github.com/stretchr/testify/mock" + + request "github.com/TheTNB/panel/internal/http/request" + + types "github.com/TheTNB/panel/pkg/types" +) + +// WebsiteRepo is an autogenerated mock type for the WebsiteRepo type +type WebsiteRepo struct { + mock.Mock +} + +type WebsiteRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *WebsiteRepo) EXPECT() *WebsiteRepo_Expecter { + return &WebsiteRepo_Expecter{mock: &_m.Mock} +} + +// ClearLog provides a mock function with given fields: id +func (_m *WebsiteRepo) ClearLog(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ClearLog") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_ClearLog_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearLog' +type WebsiteRepo_ClearLog_Call struct { + *mock.Call +} + +// ClearLog is a helper method to define mock.On call +// - id uint +func (_e *WebsiteRepo_Expecter) ClearLog(id interface{}) *WebsiteRepo_ClearLog_Call { + return &WebsiteRepo_ClearLog_Call{Call: _e.mock.On("ClearLog", id)} +} + +func (_c *WebsiteRepo_ClearLog_Call) Run(run func(id uint)) *WebsiteRepo_ClearLog_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *WebsiteRepo_ClearLog_Call) Return(_a0 error) *WebsiteRepo_ClearLog_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_ClearLog_Call) RunAndReturn(run func(uint) error) *WebsiteRepo_ClearLog_Call { + _c.Call.Return(run) + return _c +} + +// Count provides a mock function with no fields +func (_m *WebsiteRepo) Count() (int64, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Count") + } + + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func() (int64, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() int64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(int64) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WebsiteRepo_Count_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Count' +type WebsiteRepo_Count_Call struct { + *mock.Call +} + +// Count is a helper method to define mock.On call +func (_e *WebsiteRepo_Expecter) Count() *WebsiteRepo_Count_Call { + return &WebsiteRepo_Count_Call{Call: _e.mock.On("Count")} +} + +func (_c *WebsiteRepo_Count_Call) Run(run func()) *WebsiteRepo_Count_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebsiteRepo_Count_Call) Return(_a0 int64, _a1 error) *WebsiteRepo_Count_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebsiteRepo_Count_Call) RunAndReturn(run func() (int64, error)) *WebsiteRepo_Count_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: req +func (_m *WebsiteRepo) Create(req *request.WebsiteCreate) (*biz.Website, error) { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *biz.Website + var r1 error + if rf, ok := ret.Get(0).(func(*request.WebsiteCreate) (*biz.Website, error)); ok { + return rf(req) + } + if rf, ok := ret.Get(0).(func(*request.WebsiteCreate) *biz.Website); ok { + r0 = rf(req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*biz.Website) + } + } + + if rf, ok := ret.Get(1).(func(*request.WebsiteCreate) error); ok { + r1 = rf(req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WebsiteRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type WebsiteRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - req *request.WebsiteCreate +func (_e *WebsiteRepo_Expecter) Create(req interface{}) *WebsiteRepo_Create_Call { + return &WebsiteRepo_Create_Call{Call: _e.mock.On("Create", req)} +} + +func (_c *WebsiteRepo_Create_Call) Run(run func(req *request.WebsiteCreate)) *WebsiteRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.WebsiteCreate)) + }) + return _c +} + +func (_c *WebsiteRepo_Create_Call) Return(_a0 *biz.Website, _a1 error) *WebsiteRepo_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebsiteRepo_Create_Call) RunAndReturn(run func(*request.WebsiteCreate) (*biz.Website, error)) *WebsiteRepo_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: req +func (_m *WebsiteRepo) Delete(req *request.WebsiteDelete) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.WebsiteDelete) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type WebsiteRepo_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - req *request.WebsiteDelete +func (_e *WebsiteRepo_Expecter) Delete(req interface{}) *WebsiteRepo_Delete_Call { + return &WebsiteRepo_Delete_Call{Call: _e.mock.On("Delete", req)} +} + +func (_c *WebsiteRepo_Delete_Call) Run(run func(req *request.WebsiteDelete)) *WebsiteRepo_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.WebsiteDelete)) + }) + return _c +} + +func (_c *WebsiteRepo_Delete_Call) Return(_a0 error) *WebsiteRepo_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_Delete_Call) RunAndReturn(run func(*request.WebsiteDelete) error) *WebsiteRepo_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: id +func (_m *WebsiteRepo) Get(id uint) (*types.WebsiteSetting, error) { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *types.WebsiteSetting + var r1 error + if rf, ok := ret.Get(0).(func(uint) (*types.WebsiteSetting, error)); ok { + return rf(id) + } + if rf, ok := ret.Get(0).(func(uint) *types.WebsiteSetting); ok { + r0 = rf(id) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.WebsiteSetting) + } + } + + if rf, ok := ret.Get(1).(func(uint) error); ok { + r1 = rf(id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WebsiteRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type WebsiteRepo_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - id uint +func (_e *WebsiteRepo_Expecter) Get(id interface{}) *WebsiteRepo_Get_Call { + return &WebsiteRepo_Get_Call{Call: _e.mock.On("Get", id)} +} + +func (_c *WebsiteRepo_Get_Call) Run(run func(id uint)) *WebsiteRepo_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *WebsiteRepo_Get_Call) Return(_a0 *types.WebsiteSetting, _a1 error) *WebsiteRepo_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebsiteRepo_Get_Call) RunAndReturn(run func(uint) (*types.WebsiteSetting, error)) *WebsiteRepo_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByName provides a mock function with given fields: name +func (_m *WebsiteRepo) GetByName(name string) (*types.WebsiteSetting, error) { + ret := _m.Called(name) + + if len(ret) == 0 { + panic("no return value specified for GetByName") + } + + var r0 *types.WebsiteSetting + var r1 error + if rf, ok := ret.Get(0).(func(string) (*types.WebsiteSetting, error)); ok { + return rf(name) + } + if rf, ok := ret.Get(0).(func(string) *types.WebsiteSetting); ok { + r0 = rf(name) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.WebsiteSetting) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(name) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WebsiteRepo_GetByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByName' +type WebsiteRepo_GetByName_Call struct { + *mock.Call +} + +// GetByName is a helper method to define mock.On call +// - name string +func (_e *WebsiteRepo_Expecter) GetByName(name interface{}) *WebsiteRepo_GetByName_Call { + return &WebsiteRepo_GetByName_Call{Call: _e.mock.On("GetByName", name)} +} + +func (_c *WebsiteRepo_GetByName_Call) Run(run func(name string)) *WebsiteRepo_GetByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *WebsiteRepo_GetByName_Call) Return(_a0 *types.WebsiteSetting, _a1 error) *WebsiteRepo_GetByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebsiteRepo_GetByName_Call) RunAndReturn(run func(string) (*types.WebsiteSetting, error)) *WebsiteRepo_GetByName_Call { + _c.Call.Return(run) + return _c +} + +// GetRewrites provides a mock function with no fields +func (_m *WebsiteRepo) GetRewrites() (map[string]string, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetRewrites") + } + + var r0 map[string]string + var r1 error + if rf, ok := ret.Get(0).(func() (map[string]string, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() map[string]string); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]string) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// WebsiteRepo_GetRewrites_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRewrites' +type WebsiteRepo_GetRewrites_Call struct { + *mock.Call +} + +// GetRewrites is a helper method to define mock.On call +func (_e *WebsiteRepo_Expecter) GetRewrites() *WebsiteRepo_GetRewrites_Call { + return &WebsiteRepo_GetRewrites_Call{Call: _e.mock.On("GetRewrites")} +} + +func (_c *WebsiteRepo_GetRewrites_Call) Run(run func()) *WebsiteRepo_GetRewrites_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *WebsiteRepo_GetRewrites_Call) Return(_a0 map[string]string, _a1 error) *WebsiteRepo_GetRewrites_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *WebsiteRepo_GetRewrites_Call) RunAndReturn(run func() (map[string]string, error)) *WebsiteRepo_GetRewrites_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: page, limit +func (_m *WebsiteRepo) List(page uint, limit uint) ([]*biz.Website, int64, error) { + ret := _m.Called(page, limit) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 []*biz.Website + var r1 int64 + var r2 error + if rf, ok := ret.Get(0).(func(uint, uint) ([]*biz.Website, int64, error)); ok { + return rf(page, limit) + } + if rf, ok := ret.Get(0).(func(uint, uint) []*biz.Website); ok { + r0 = rf(page, limit) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*biz.Website) + } + } + + if rf, ok := ret.Get(1).(func(uint, uint) int64); ok { + r1 = rf(page, limit) + } else { + r1 = ret.Get(1).(int64) + } + + if rf, ok := ret.Get(2).(func(uint, uint) error); ok { + r2 = rf(page, limit) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// WebsiteRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type WebsiteRepo_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - page uint +// - limit uint +func (_e *WebsiteRepo_Expecter) List(page interface{}, limit interface{}) *WebsiteRepo_List_Call { + return &WebsiteRepo_List_Call{Call: _e.mock.On("List", page, limit)} +} + +func (_c *WebsiteRepo_List_Call) Run(run func(page uint, limit uint)) *WebsiteRepo_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(uint)) + }) + return _c +} + +func (_c *WebsiteRepo_List_Call) Return(_a0 []*biz.Website, _a1 int64, _a2 error) *WebsiteRepo_List_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *WebsiteRepo_List_Call) RunAndReturn(run func(uint, uint) ([]*biz.Website, int64, error)) *WebsiteRepo_List_Call { + _c.Call.Return(run) + return _c +} + +// ObtainCert provides a mock function with given fields: ctx, id +func (_m *WebsiteRepo) ObtainCert(ctx context.Context, id uint) error { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for ObtainCert") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, uint) error); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_ObtainCert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ObtainCert' +type WebsiteRepo_ObtainCert_Call struct { + *mock.Call +} + +// ObtainCert is a helper method to define mock.On call +// - ctx context.Context +// - id uint +func (_e *WebsiteRepo_Expecter) ObtainCert(ctx interface{}, id interface{}) *WebsiteRepo_ObtainCert_Call { + return &WebsiteRepo_ObtainCert_Call{Call: _e.mock.On("ObtainCert", ctx, id)} +} + +func (_c *WebsiteRepo_ObtainCert_Call) Run(run func(ctx context.Context, id uint)) *WebsiteRepo_ObtainCert_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint)) + }) + return _c +} + +func (_c *WebsiteRepo_ObtainCert_Call) Return(_a0 error) *WebsiteRepo_ObtainCert_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_ObtainCert_Call) RunAndReturn(run func(context.Context, uint) error) *WebsiteRepo_ObtainCert_Call { + _c.Call.Return(run) + return _c +} + +// ResetConfig provides a mock function with given fields: id +func (_m *WebsiteRepo) ResetConfig(id uint) error { + ret := _m.Called(id) + + if len(ret) == 0 { + panic("no return value specified for ResetConfig") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint) error); ok { + r0 = rf(id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_ResetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResetConfig' +type WebsiteRepo_ResetConfig_Call struct { + *mock.Call +} + +// ResetConfig is a helper method to define mock.On call +// - id uint +func (_e *WebsiteRepo_Expecter) ResetConfig(id interface{}) *WebsiteRepo_ResetConfig_Call { + return &WebsiteRepo_ResetConfig_Call{Call: _e.mock.On("ResetConfig", id)} +} + +func (_c *WebsiteRepo_ResetConfig_Call) Run(run func(id uint)) *WebsiteRepo_ResetConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint)) + }) + return _c +} + +func (_c *WebsiteRepo_ResetConfig_Call) Return(_a0 error) *WebsiteRepo_ResetConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_ResetConfig_Call) RunAndReturn(run func(uint) error) *WebsiteRepo_ResetConfig_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: req +func (_m *WebsiteRepo) Update(req *request.WebsiteUpdate) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.WebsiteUpdate) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type WebsiteRepo_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - req *request.WebsiteUpdate +func (_e *WebsiteRepo_Expecter) Update(req interface{}) *WebsiteRepo_Update_Call { + return &WebsiteRepo_Update_Call{Call: _e.mock.On("Update", req)} +} + +func (_c *WebsiteRepo_Update_Call) Run(run func(req *request.WebsiteUpdate)) *WebsiteRepo_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.WebsiteUpdate)) + }) + return _c +} + +func (_c *WebsiteRepo_Update_Call) Return(_a0 error) *WebsiteRepo_Update_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_Update_Call) RunAndReturn(run func(*request.WebsiteUpdate) error) *WebsiteRepo_Update_Call { + _c.Call.Return(run) + return _c +} + +// UpdateDefaultConfig provides a mock function with given fields: req +func (_m *WebsiteRepo) UpdateDefaultConfig(req *request.WebsiteDefaultConfig) error { + ret := _m.Called(req) + + if len(ret) == 0 { + panic("no return value specified for UpdateDefaultConfig") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*request.WebsiteDefaultConfig) error); ok { + r0 = rf(req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_UpdateDefaultConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateDefaultConfig' +type WebsiteRepo_UpdateDefaultConfig_Call struct { + *mock.Call +} + +// UpdateDefaultConfig is a helper method to define mock.On call +// - req *request.WebsiteDefaultConfig +func (_e *WebsiteRepo_Expecter) UpdateDefaultConfig(req interface{}) *WebsiteRepo_UpdateDefaultConfig_Call { + return &WebsiteRepo_UpdateDefaultConfig_Call{Call: _e.mock.On("UpdateDefaultConfig", req)} +} + +func (_c *WebsiteRepo_UpdateDefaultConfig_Call) Run(run func(req *request.WebsiteDefaultConfig)) *WebsiteRepo_UpdateDefaultConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*request.WebsiteDefaultConfig)) + }) + return _c +} + +func (_c *WebsiteRepo_UpdateDefaultConfig_Call) Return(_a0 error) *WebsiteRepo_UpdateDefaultConfig_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_UpdateDefaultConfig_Call) RunAndReturn(run func(*request.WebsiteDefaultConfig) error) *WebsiteRepo_UpdateDefaultConfig_Call { + _c.Call.Return(run) + return _c +} + +// UpdateRemark provides a mock function with given fields: id, remark +func (_m *WebsiteRepo) UpdateRemark(id uint, remark string) error { + ret := _m.Called(id, remark) + + if len(ret) == 0 { + panic("no return value specified for UpdateRemark") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, string) error); ok { + r0 = rf(id, remark) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_UpdateRemark_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRemark' +type WebsiteRepo_UpdateRemark_Call struct { + *mock.Call +} + +// UpdateRemark is a helper method to define mock.On call +// - id uint +// - remark string +func (_e *WebsiteRepo_Expecter) UpdateRemark(id interface{}, remark interface{}) *WebsiteRepo_UpdateRemark_Call { + return &WebsiteRepo_UpdateRemark_Call{Call: _e.mock.On("UpdateRemark", id, remark)} +} + +func (_c *WebsiteRepo_UpdateRemark_Call) Run(run func(id uint, remark string)) *WebsiteRepo_UpdateRemark_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(string)) + }) + return _c +} + +func (_c *WebsiteRepo_UpdateRemark_Call) Return(_a0 error) *WebsiteRepo_UpdateRemark_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_UpdateRemark_Call) RunAndReturn(run func(uint, string) error) *WebsiteRepo_UpdateRemark_Call { + _c.Call.Return(run) + return _c +} + +// UpdateStatus provides a mock function with given fields: id, status +func (_m *WebsiteRepo) UpdateStatus(id uint, status bool) error { + ret := _m.Called(id, status) + + if len(ret) == 0 { + panic("no return value specified for UpdateStatus") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint, bool) error); ok { + r0 = rf(id, status) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// WebsiteRepo_UpdateStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateStatus' +type WebsiteRepo_UpdateStatus_Call struct { + *mock.Call +} + +// UpdateStatus is a helper method to define mock.On call +// - id uint +// - status bool +func (_e *WebsiteRepo_Expecter) UpdateStatus(id interface{}, status interface{}) *WebsiteRepo_UpdateStatus_Call { + return &WebsiteRepo_UpdateStatus_Call{Call: _e.mock.On("UpdateStatus", id, status)} +} + +func (_c *WebsiteRepo_UpdateStatus_Call) Run(run func(id uint, status bool)) *WebsiteRepo_UpdateStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint), args[1].(bool)) + }) + return _c +} + +func (_c *WebsiteRepo_UpdateStatus_Call) Return(_a0 error) *WebsiteRepo_UpdateStatus_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *WebsiteRepo_UpdateStatus_Call) RunAndReturn(run func(uint, bool) error) *WebsiteRepo_UpdateStatus_Call { + _c.Call.Return(run) + return _c +} + +// NewWebsiteRepo creates a new instance of WebsiteRepo. 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 NewWebsiteRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *WebsiteRepo { + mock := &WebsiteRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}