diff --git a/.mockery.yml b/.mockery.yml new file mode 100644 index 0000000..855dd45 --- /dev/null +++ b/.mockery.yml @@ -0,0 +1,29 @@ +all: false +dir: "{{.InterfaceDir}}" +filename: "{{.InterfaceName}}_mock.go" +force-file-write: true +formatter: goimports +include-auto-generated: false +log-level: info +structname: "{{.Mock}}{{.InterfaceName}}" +pkgname: "{{.SrcPackageName}}" +recursive: false +require-template-schema-exists: true +template: testify +template-schema: "{{.Template}}.schema.json" +packages: + github.com/tech-thinker/gozen: + config: + all: true + github.com/tech-thinker/gozen/cmd/repository: + interfaces: + ProjectRepo: + SystemRepo: + github.com/tech-thinker/gozen/cmd/helpers: + interfaces: + CodeHelper: + ProjectHelper: + github.com/tech-thinker/gozen/wrappers: + interfaces: + FileSystemWrapper: + ShellWrapper: diff --git a/Makefile b/Makefile index 9b7e148..1145230 100644 --- a/Makefile +++ b/Makefile @@ -74,6 +74,7 @@ clean: generate-mocks: # Mockery version v2.50.0 + # It will work for below version v3 # Wrapper @mockery --name=ShellWrapper --dir=wrappers --output=wrappers --outpkg=wrappers --filename=shellWrapper_mock.go --structname=MockShellWrapper @mockery --name=FileSystemWrapper --dir=wrappers --output=wrappers --outpkg=wrappers --filename=fileSystemWrapper_mock.go --structname=MockFileSystemWrapper diff --git a/cmd/helpers/codeHelper_mock.go b/cmd/helpers/codeHelper_mock.go index 2e8c7f9..fb64971 100644 --- a/cmd/helpers/codeHelper_mock.go +++ b/cmd/helpers/codeHelper_mock.go @@ -1,45 +1,88 @@ -// Code generated by mockery v2.51.1. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package helpers import ( mock "github.com/stretchr/testify/mock" - models "github.com/tech-thinker/gozen/models" + "github.com/tech-thinker/gozen/models" ) +// NewMockCodeHelper creates a new instance of MockCodeHelper. 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 NewMockCodeHelper(t interface { + mock.TestingT + Cleanup(func()) +}) *MockCodeHelper { + mock := &MockCodeHelper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MockCodeHelper is an autogenerated mock type for the CodeHelper type type MockCodeHelper struct { mock.Mock } -// GenerateModel provides a mock function with given fields: doc -func (_m *MockCodeHelper) GenerateModel(doc models.Generator) error { - ret := _m.Called(doc) +type MockCodeHelper_Expecter struct { + mock *mock.Mock +} + +func (_m *MockCodeHelper) EXPECT() *MockCodeHelper_Expecter { + return &MockCodeHelper_Expecter{mock: &_m.Mock} +} + +// GenerateModel provides a mock function for the type MockCodeHelper +func (_mock *MockCodeHelper) GenerateModel(doc models.Generator) error { + ret := _mock.Called(doc) if len(ret) == 0 { panic("no return value specified for GenerateModel") } var r0 error - if rf, ok := ret.Get(0).(func(models.Generator) error); ok { - r0 = rf(doc) + if returnFunc, ok := ret.Get(0).(func(models.Generator) error); ok { + r0 = returnFunc(doc) } else { r0 = ret.Error(0) } - return r0 } -// NewMockCodeHelper creates a new instance of MockCodeHelper. 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 NewMockCodeHelper(t interface { - mock.TestingT - Cleanup(func()) -}) *MockCodeHelper { - mock := &MockCodeHelper{} - mock.Mock.Test(t) +// MockCodeHelper_GenerateModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GenerateModel' +type MockCodeHelper_GenerateModel_Call struct { + *mock.Call +} - t.Cleanup(func() { mock.AssertExpectations(t) }) +// GenerateModel is a helper method to define mock.On call +// - doc models.Generator +func (_e *MockCodeHelper_Expecter) GenerateModel(doc interface{}) *MockCodeHelper_GenerateModel_Call { + return &MockCodeHelper_GenerateModel_Call{Call: _e.mock.On("GenerateModel", doc)} +} - return mock +func (_c *MockCodeHelper_GenerateModel_Call) Run(run func(doc models.Generator)) *MockCodeHelper_GenerateModel_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Generator + if args[0] != nil { + arg0 = args[0].(models.Generator) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockCodeHelper_GenerateModel_Call) Return(err error) *MockCodeHelper_GenerateModel_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockCodeHelper_GenerateModel_Call) RunAndReturn(run func(doc models.Generator) error) *MockCodeHelper_GenerateModel_Call { + _c.Call.Return(run) + return _c } diff --git a/cmd/helpers/projectHelper_mock.go b/cmd/helpers/projectHelper_mock.go index 0e87dfe..83811d8 100644 --- a/cmd/helpers/projectHelper_mock.go +++ b/cmd/helpers/projectHelper_mock.go @@ -1,243 +1,649 @@ -// Code generated by mockery v2.51.1. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package helpers import ( mock "github.com/stretchr/testify/mock" - models "github.com/tech-thinker/gozen/models" + "github.com/tech-thinker/gozen/models" ) +// NewMockProjectHelper creates a new instance of MockProjectHelper. 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 NewMockProjectHelper(t interface { + mock.TestingT + Cleanup(func()) +}) *MockProjectHelper { + mock := &MockProjectHelper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + // MockProjectHelper is an autogenerated mock type for the ProjectHelper type type MockProjectHelper struct { mock.Mock } -// CreateRestAPI provides a mock function with given fields: project -func (_m *MockProjectHelper) CreateRestAPI(project models.Project) error { - ret := _m.Called(project) +type MockProjectHelper_Expecter struct { + mock *mock.Mock +} + +func (_m *MockProjectHelper) EXPECT() *MockProjectHelper_Expecter { + return &MockProjectHelper_Expecter{mock: &_m.Mock} +} + +// CreateRestAPI provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) CreateRestAPI(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for CreateRestAPI") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// CreategRPCAPI provides a mock function with given fields: project -func (_m *MockProjectHelper) CreategRPCAPI(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_CreateRestAPI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateRestAPI' +type MockProjectHelper_CreateRestAPI_Call struct { + *mock.Call +} + +// CreateRestAPI is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) CreateRestAPI(project interface{}) *MockProjectHelper_CreateRestAPI_Call { + return &MockProjectHelper_CreateRestAPI_Call{Call: _e.mock.On("CreateRestAPI", project)} +} + +func (_c *MockProjectHelper_CreateRestAPI_Call) Run(run func(project models.Project)) *MockProjectHelper_CreateRestAPI_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_CreateRestAPI_Call) Return(err error) *MockProjectHelper_CreateRestAPI_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_CreateRestAPI_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_CreateRestAPI_Call { + _c.Call.Return(run) + return _c +} + +// CreategRPCAPI provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) CreategRPCAPI(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for CreategRPCAPI") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// InitProject provides a mock function with given fields: project -func (_m *MockProjectHelper) InitProject(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_CreategRPCAPI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreategRPCAPI' +type MockProjectHelper_CreategRPCAPI_Call struct { + *mock.Call +} + +// CreategRPCAPI is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) CreategRPCAPI(project interface{}) *MockProjectHelper_CreategRPCAPI_Call { + return &MockProjectHelper_CreategRPCAPI_Call{Call: _e.mock.On("CreategRPCAPI", project)} +} + +func (_c *MockProjectHelper_CreategRPCAPI_Call) Run(run func(project models.Project)) *MockProjectHelper_CreategRPCAPI_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_CreategRPCAPI_Call) Return(err error) *MockProjectHelper_CreategRPCAPI_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_CreategRPCAPI_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_CreategRPCAPI_Call { + _c.Call.Return(run) + return _c +} + +// InitProject provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) InitProject(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for InitProject") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupConfig provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupConfig(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_InitProject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitProject' +type MockProjectHelper_InitProject_Call struct { + *mock.Call +} + +// InitProject is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) InitProject(project interface{}) *MockProjectHelper_InitProject_Call { + return &MockProjectHelper_InitProject_Call{Call: _e.mock.On("InitProject", project)} +} + +func (_c *MockProjectHelper_InitProject_Call) Run(run func(project models.Project)) *MockProjectHelper_InitProject_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_InitProject_Call) Return(err error) *MockProjectHelper_InitProject_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_InitProject_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_InitProject_Call { + _c.Call.Return(run) + return _c +} + +// SetupConfig provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupConfig(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupConfig") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupConstants provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupConstants(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupConfig' +type MockProjectHelper_SetupConfig_Call struct { + *mock.Call +} + +// SetupConfig is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupConfig(project interface{}) *MockProjectHelper_SetupConfig_Call { + return &MockProjectHelper_SetupConfig_Call{Call: _e.mock.On("SetupConfig", project)} +} + +func (_c *MockProjectHelper_SetupConfig_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupConfig_Call) Return(err error) *MockProjectHelper_SetupConfig_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupConfig_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupConfig_Call { + _c.Call.Return(run) + return _c +} + +// SetupConstants provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupConstants(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupConstants") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupDocker provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupDocker(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupConstants_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupConstants' +type MockProjectHelper_SetupConstants_Call struct { + *mock.Call +} + +// SetupConstants is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupConstants(project interface{}) *MockProjectHelper_SetupConstants_Call { + return &MockProjectHelper_SetupConstants_Call{Call: _e.mock.On("SetupConstants", project)} +} + +func (_c *MockProjectHelper_SetupConstants_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupConstants_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupConstants_Call) Return(err error) *MockProjectHelper_SetupConstants_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupConstants_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupConstants_Call { + _c.Call.Return(run) + return _c +} + +// SetupDocker provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupDocker(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupDocker") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupEnv provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupEnv(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupDocker_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupDocker' +type MockProjectHelper_SetupDocker_Call struct { + *mock.Call +} + +// SetupDocker is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupDocker(project interface{}) *MockProjectHelper_SetupDocker_Call { + return &MockProjectHelper_SetupDocker_Call{Call: _e.mock.On("SetupDocker", project)} +} + +func (_c *MockProjectHelper_SetupDocker_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupDocker_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupDocker_Call) Return(err error) *MockProjectHelper_SetupDocker_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupDocker_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupDocker_Call { + _c.Call.Return(run) + return _c +} + +// SetupEnv provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupEnv(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupEnv") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupLogger provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupLogger(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupEnv_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupEnv' +type MockProjectHelper_SetupEnv_Call struct { + *mock.Call +} + +// SetupEnv is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupEnv(project interface{}) *MockProjectHelper_SetupEnv_Call { + return &MockProjectHelper_SetupEnv_Call{Call: _e.mock.On("SetupEnv", project)} +} + +func (_c *MockProjectHelper_SetupEnv_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupEnv_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupEnv_Call) Return(err error) *MockProjectHelper_SetupEnv_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupEnv_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupEnv_Call { + _c.Call.Return(run) + return _c +} + +// SetupLogger provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupLogger(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupLogger") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupModel provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupModel(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupLogger_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupLogger' +type MockProjectHelper_SetupLogger_Call struct { + *mock.Call +} + +// SetupLogger is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupLogger(project interface{}) *MockProjectHelper_SetupLogger_Call { + return &MockProjectHelper_SetupLogger_Call{Call: _e.mock.On("SetupLogger", project)} +} + +func (_c *MockProjectHelper_SetupLogger_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupLogger_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupLogger_Call) Return(err error) *MockProjectHelper_SetupLogger_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupLogger_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupLogger_Call { + _c.Call.Return(run) + return _c +} + +// SetupModel provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupModel(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupModel") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupRepository provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupRepository(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupModel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupModel' +type MockProjectHelper_SetupModel_Call struct { + *mock.Call +} + +// SetupModel is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupModel(project interface{}) *MockProjectHelper_SetupModel_Call { + return &MockProjectHelper_SetupModel_Call{Call: _e.mock.On("SetupModel", project)} +} + +func (_c *MockProjectHelper_SetupModel_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupModel_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupModel_Call) Return(err error) *MockProjectHelper_SetupModel_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupModel_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupModel_Call { + _c.Call.Return(run) + return _c +} + +// SetupRepository provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupRepository(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupRepository") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupService provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupService(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupRepository_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupRepository' +type MockProjectHelper_SetupRepository_Call struct { + *mock.Call +} + +// SetupRepository is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupRepository(project interface{}) *MockProjectHelper_SetupRepository_Call { + return &MockProjectHelper_SetupRepository_Call{Call: _e.mock.On("SetupRepository", project)} +} + +func (_c *MockProjectHelper_SetupRepository_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupRepository_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupRepository_Call) Return(err error) *MockProjectHelper_SetupRepository_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupRepository_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupRepository_Call { + _c.Call.Return(run) + return _c +} + +// SetupService provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupService(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupService") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// SetupUtils provides a mock function with given fields: project -func (_m *MockProjectHelper) SetupUtils(project models.Project) error { - ret := _m.Called(project) +// MockProjectHelper_SetupService_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupService' +type MockProjectHelper_SetupService_Call struct { + *mock.Call +} + +// SetupService is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupService(project interface{}) *MockProjectHelper_SetupService_Call { + return &MockProjectHelper_SetupService_Call{Call: _e.mock.On("SetupService", project)} +} + +func (_c *MockProjectHelper_SetupService_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupService_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupService_Call) Return(err error) *MockProjectHelper_SetupService_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupService_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupService_Call { + _c.Call.Return(run) + return _c +} + +// SetupUtils provides a mock function for the type MockProjectHelper +func (_mock *MockProjectHelper) SetupUtils(project models.Project) error { + ret := _mock.Called(project) if len(ret) == 0 { panic("no return value specified for SetupUtils") } var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) } else { r0 = ret.Error(0) } - return r0 } -// NewMockProjectHelper creates a new instance of MockProjectHelper. 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 NewMockProjectHelper(t interface { - mock.TestingT - Cleanup(func()) -}) *MockProjectHelper { - mock := &MockProjectHelper{} - mock.Mock.Test(t) +// MockProjectHelper_SetupUtils_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupUtils' +type MockProjectHelper_SetupUtils_Call struct { + *mock.Call +} - t.Cleanup(func() { mock.AssertExpectations(t) }) +// SetupUtils is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectHelper_Expecter) SetupUtils(project interface{}) *MockProjectHelper_SetupUtils_Call { + return &MockProjectHelper_SetupUtils_Call{Call: _e.mock.On("SetupUtils", project)} +} - return mock +func (_c *MockProjectHelper_SetupUtils_Call) Run(run func(project models.Project)) *MockProjectHelper_SetupUtils_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectHelper_SetupUtils_Call) Return(err error) *MockProjectHelper_SetupUtils_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectHelper_SetupUtils_Call) RunAndReturn(run func(project models.Project) error) *MockProjectHelper_SetupUtils_Call { + _c.Call.Return(run) + return _c } diff --git a/cmd/repository/ProjectRepo_mock.go b/cmd/repository/ProjectRepo_mock.go new file mode 100644 index 0000000..474fc6d --- /dev/null +++ b/cmd/repository/ProjectRepo_mock.go @@ -0,0 +1,88 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package repository + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/tech-thinker/gozen/models" +) + +// NewMockProjectRepo creates a new instance of MockProjectRepo. 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 NewMockProjectRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *MockProjectRepo { + mock := &MockProjectRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockProjectRepo is an autogenerated mock type for the ProjectRepo type +type MockProjectRepo struct { + mock.Mock +} + +type MockProjectRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *MockProjectRepo) EXPECT() *MockProjectRepo_Expecter { + return &MockProjectRepo_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function for the type MockProjectRepo +func (_mock *MockProjectRepo) Create(project models.Project) error { + ret := _mock.Called(project) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(models.Project) error); ok { + r0 = returnFunc(project) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockProjectRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockProjectRepo_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - project models.Project +func (_e *MockProjectRepo_Expecter) Create(project interface{}) *MockProjectRepo_Create_Call { + return &MockProjectRepo_Create_Call{Call: _e.mock.On("Create", project)} +} + +func (_c *MockProjectRepo_Create_Call) Run(run func(project models.Project)) *MockProjectRepo_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 models.Project + if args[0] != nil { + arg0 = args[0].(models.Project) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockProjectRepo_Create_Call) Return(err error) *MockProjectRepo_Create_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockProjectRepo_Create_Call) RunAndReturn(run func(project models.Project) error) *MockProjectRepo_Create_Call { + _c.Call.Return(run) + return _c +} diff --git a/cmd/repository/SystemRepo_mock.go b/cmd/repository/SystemRepo_mock.go new file mode 100644 index 0000000..393a22a --- /dev/null +++ b/cmd/repository/SystemRepo_mock.go @@ -0,0 +1,323 @@ +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify + +package repository + +import ( + mock "github.com/stretchr/testify/mock" + "github.com/tech-thinker/gozen/models" +) + +// NewMockSystemRepo creates a new instance of MockSystemRepo. 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 NewMockSystemRepo(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSystemRepo { + mock := &MockSystemRepo{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} + +// MockSystemRepo is an autogenerated mock type for the SystemRepo type +type MockSystemRepo struct { + mock.Mock +} + +type MockSystemRepo_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSystemRepo) EXPECT() *MockSystemRepo_Expecter { + return &MockSystemRepo_Expecter{mock: &_m.Mock} +} + +// ExecShell provides a mock function for the type MockSystemRepo +func (_mock *MockSystemRepo) ExecShell(command string, args ...string) ([]string, error) { + var tmpRet mock.Arguments + if len(args) > 0 { + tmpRet = _mock.Called(command, args) + } else { + tmpRet = _mock.Called(command) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for ExecShell") + } + + var r0 []string + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, ...string) ([]string, error)); ok { + return returnFunc(command, args...) + } + if returnFunc, ok := ret.Get(0).(func(string, ...string) []string); ok { + r0 = returnFunc(command, args...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]string) + } + } + if returnFunc, ok := ret.Get(1).(func(string, ...string) error); ok { + r1 = returnFunc(command, args...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSystemRepo_ExecShell_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecShell' +type MockSystemRepo_ExecShell_Call struct { + *mock.Call +} + +// ExecShell is a helper method to define mock.On call +// - command string +// - args ...string +func (_e *MockSystemRepo_Expecter) ExecShell(command interface{}, args ...interface{}) *MockSystemRepo_ExecShell_Call { + return &MockSystemRepo_ExecShell_Call{Call: _e.mock.On("ExecShell", + append([]interface{}{command}, args...)...)} +} + +func (_c *MockSystemRepo_ExecShell_Call) Run(run func(command string, args ...string)) *MockSystemRepo_ExecShell_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 []string + var variadicArgs []string + if len(args) > 1 { + variadicArgs = args[1].([]string) + } + arg1 = variadicArgs + run( + arg0, + arg1..., + ) + }) + return _c +} + +func (_c *MockSystemRepo_ExecShell_Call) Return(strings []string, err error) *MockSystemRepo_ExecShell_Call { + _c.Call.Return(strings, err) + return _c +} + +func (_c *MockSystemRepo_ExecShell_Call) RunAndReturn(run func(command string, args ...string) ([]string, error)) *MockSystemRepo_ExecShell_Call { + _c.Call.Return(run) + return _c +} + +// ExecShellRaw provides a mock function for the type MockSystemRepo +func (_mock *MockSystemRepo) ExecShellRaw(command string, args ...string) ([]byte, error) { + var tmpRet mock.Arguments + if len(args) > 0 { + tmpRet = _mock.Called(command, args) + } else { + tmpRet = _mock.Called(command) + } + ret := tmpRet + + if len(ret) == 0 { + panic("no return value specified for ExecShellRaw") + } + + var r0 []byte + var r1 error + if returnFunc, ok := ret.Get(0).(func(string, ...string) ([]byte, error)); ok { + return returnFunc(command, args...) + } + if returnFunc, ok := ret.Get(0).(func(string, ...string) []byte); ok { + r0 = returnFunc(command, args...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + if returnFunc, ok := ret.Get(1).(func(string, ...string) error); ok { + r1 = returnFunc(command, args...) + } else { + r1 = ret.Error(1) + } + return r0, r1 +} + +// MockSystemRepo_ExecShellRaw_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecShellRaw' +type MockSystemRepo_ExecShellRaw_Call struct { + *mock.Call +} + +// ExecShellRaw is a helper method to define mock.On call +// - command string +// - args ...string +func (_e *MockSystemRepo_Expecter) ExecShellRaw(command interface{}, args ...interface{}) *MockSystemRepo_ExecShellRaw_Call { + return &MockSystemRepo_ExecShellRaw_Call{Call: _e.mock.On("ExecShellRaw", + append([]interface{}{command}, args...)...)} +} + +func (_c *MockSystemRepo_ExecShellRaw_Call) Run(run func(command string, args ...string)) *MockSystemRepo_ExecShellRaw_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 []string + var variadicArgs []string + if len(args) > 1 { + variadicArgs = args[1].([]string) + } + arg1 = variadicArgs + run( + arg0, + arg1..., + ) + }) + return _c +} + +func (_c *MockSystemRepo_ExecShellRaw_Call) Return(bytes []byte, err error) *MockSystemRepo_ExecShellRaw_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockSystemRepo_ExecShellRaw_Call) RunAndReturn(run func(command string, args ...string) ([]byte, error)) *MockSystemRepo_ExecShellRaw_Call { + _c.Call.Return(run) + return _c +} + +// Write provides a mock function for the type MockSystemRepo +func (_mock *MockSystemRepo) Write(appDir string, templatePath string, destination string, data interface{}) error { + ret := _mock.Called(appDir, templatePath, destination, data) + + if len(ret) == 0 { + panic("no return value specified for Write") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(string, string, string, interface{}) error); ok { + r0 = returnFunc(appDir, templatePath, destination, data) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockSystemRepo_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' +type MockSystemRepo_Write_Call struct { + *mock.Call +} + +// Write is a helper method to define mock.On call +// - appDir string +// - templatePath string +// - destination string +// - data interface{} +func (_e *MockSystemRepo_Expecter) Write(appDir interface{}, templatePath interface{}, destination interface{}, data interface{}) *MockSystemRepo_Write_Call { + return &MockSystemRepo_Write_Call{Call: _e.mock.On("Write", appDir, templatePath, destination, data)} +} + +func (_c *MockSystemRepo_Write_Call) Run(run func(appDir string, templatePath string, destination string, data interface{})) *MockSystemRepo_Write_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + var arg2 string + if args[2] != nil { + arg2 = args[2].(string) + } + var arg3 interface{} + if args[3] != nil { + arg3 = args[3].(interface{}) + } + run( + arg0, + arg1, + arg2, + arg3, + ) + }) + return _c +} + +func (_c *MockSystemRepo_Write_Call) Return(err error) *MockSystemRepo_Write_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockSystemRepo_Write_Call) RunAndReturn(run func(appDir string, templatePath string, destination string, data interface{}) error) *MockSystemRepo_Write_Call { + _c.Call.Return(run) + return _c +} + +// WriteAll provides a mock function for the type MockSystemRepo +func (_mock *MockSystemRepo) WriteAll(appDir string, fileConfigs []models.FileConfig, data interface{}) error { + ret := _mock.Called(appDir, fileConfigs, data) + + if len(ret) == 0 { + panic("no return value specified for WriteAll") + } + + var r0 error + if returnFunc, ok := ret.Get(0).(func(string, []models.FileConfig, interface{}) error); ok { + r0 = returnFunc(appDir, fileConfigs, data) + } else { + r0 = ret.Error(0) + } + return r0 +} + +// MockSystemRepo_WriteAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteAll' +type MockSystemRepo_WriteAll_Call struct { + *mock.Call +} + +// WriteAll is a helper method to define mock.On call +// - appDir string +// - fileConfigs []models.FileConfig +// - data interface{} +func (_e *MockSystemRepo_Expecter) WriteAll(appDir interface{}, fileConfigs interface{}, data interface{}) *MockSystemRepo_WriteAll_Call { + return &MockSystemRepo_WriteAll_Call{Call: _e.mock.On("WriteAll", appDir, fileConfigs, data)} +} + +func (_c *MockSystemRepo_WriteAll_Call) Run(run func(appDir string, fileConfigs []models.FileConfig, data interface{})) *MockSystemRepo_WriteAll_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 []models.FileConfig + if args[1] != nil { + arg1 = args[1].([]models.FileConfig) + } + var arg2 interface{} + if args[2] != nil { + arg2 = args[2].(interface{}) + } + run( + arg0, + arg1, + arg2, + ) + }) + return _c +} + +func (_c *MockSystemRepo_WriteAll_Call) Return(err error) *MockSystemRepo_WriteAll_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockSystemRepo_WriteAll_Call) RunAndReturn(run func(appDir string, fileConfigs []models.FileConfig, data interface{}) error) *MockSystemRepo_WriteAll_Call { + _c.Call.Return(run) + return _c +} diff --git a/cmd/repository/project_mock.go b/cmd/repository/project_mock.go deleted file mode 100644 index f7efb4b..0000000 --- a/cmd/repository/project_mock.go +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by mockery v2.51.1. DO NOT EDIT. - -package repository - -import ( - mock "github.com/stretchr/testify/mock" - models "github.com/tech-thinker/gozen/models" -) - -// MockProjectRepo is an autogenerated mock type for the ProjectRepo type -type MockProjectRepo struct { - mock.Mock -} - -// Create provides a mock function with given fields: project -func (_m *MockProjectRepo) Create(project models.Project) error { - ret := _m.Called(project) - - if len(ret) == 0 { - panic("no return value specified for Create") - } - - var r0 error - if rf, ok := ret.Get(0).(func(models.Project) error); ok { - r0 = rf(project) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewMockProjectRepo creates a new instance of MockProjectRepo. 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 NewMockProjectRepo(t interface { - mock.TestingT - Cleanup(func()) -}) *MockProjectRepo { - mock := &MockProjectRepo{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/cmd/repository/system_mock.go b/cmd/repository/system_mock.go deleted file mode 100644 index 8e245f0..0000000 --- a/cmd/repository/system_mock.go +++ /dev/null @@ -1,137 +0,0 @@ -// Code generated by mockery v2.51.1. DO NOT EDIT. - -package repository - -import ( - mock "github.com/stretchr/testify/mock" - models "github.com/tech-thinker/gozen/models" -) - -// MockSystemRepo is an autogenerated mock type for the SystemRepo type -type MockSystemRepo struct { - mock.Mock -} - -// ExecShell provides a mock function with given fields: command, args -func (_m *MockSystemRepo) ExecShell(command string, args ...string) ([]string, error) { - _va := make([]interface{}, len(args)) - for _i := range args { - _va[_i] = args[_i] - } - var _ca []interface{} - _ca = append(_ca, command) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ExecShell") - } - - var r0 []string - var r1 error - if rf, ok := ret.Get(0).(func(string, ...string) ([]string, error)); ok { - return rf(command, args...) - } - if rf, ok := ret.Get(0).(func(string, ...string) []string); ok { - r0 = rf(command, args...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } - } - - if rf, ok := ret.Get(1).(func(string, ...string) error); ok { - r1 = rf(command, args...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ExecShellRaw provides a mock function with given fields: command, args -func (_m *MockSystemRepo) ExecShellRaw(command string, args ...string) ([]byte, error) { - _va := make([]interface{}, len(args)) - for _i := range args { - _va[_i] = args[_i] - } - var _ca []interface{} - _ca = append(_ca, command) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ExecShellRaw") - } - - var r0 []byte - var r1 error - if rf, ok := ret.Get(0).(func(string, ...string) ([]byte, error)); ok { - return rf(command, args...) - } - if rf, ok := ret.Get(0).(func(string, ...string) []byte); ok { - r0 = rf(command, args...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]byte) - } - } - - if rf, ok := ret.Get(1).(func(string, ...string) error); ok { - r1 = rf(command, args...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Write provides a mock function with given fields: appDir, templatePath, destination, data -func (_m *MockSystemRepo) Write(appDir string, templatePath string, destination string, data interface{}) error { - ret := _m.Called(appDir, templatePath, destination, data) - - if len(ret) == 0 { - panic("no return value specified for Write") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string, string, string, interface{}) error); ok { - r0 = rf(appDir, templatePath, destination, data) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// WriteAll provides a mock function with given fields: appDir, fileConfigs, data -func (_m *MockSystemRepo) WriteAll(appDir string, fileConfigs []models.FileConfig, data interface{}) error { - ret := _m.Called(appDir, fileConfigs, data) - - if len(ret) == 0 { - panic("no return value specified for WriteAll") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string, []models.FileConfig, interface{}) error); ok { - r0 = rf(appDir, fileConfigs, data) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// NewMockSystemRepo creates a new instance of MockSystemRepo. 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 NewMockSystemRepo(t interface { - mock.TestingT - Cleanup(func()) -}) *MockSystemRepo { - mock := &MockSystemRepo{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/wrappers/fileSystemWrapper_mock.go b/wrappers/fileSystemWrapper_mock.go index 905e4fc..4ea819f 100644 --- a/wrappers/fileSystemWrapper_mock.go +++ b/wrappers/fileSystemWrapper_mock.go @@ -1,78 +1,195 @@ -// Code generated by mockery v2.51.1. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package wrappers -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockFileSystemWrapper creates a new instance of MockFileSystemWrapper. 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 NewMockFileSystemWrapper(t interface { + mock.TestingT + Cleanup(func()) +}) *MockFileSystemWrapper { + mock := &MockFileSystemWrapper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // MockFileSystemWrapper is an autogenerated mock type for the FileSystemWrapper type type MockFileSystemWrapper struct { mock.Mock } -// CreateDirectory provides a mock function with given fields: path -func (_m *MockFileSystemWrapper) CreateDirectory(path string) error { - ret := _m.Called(path) +type MockFileSystemWrapper_Expecter struct { + mock *mock.Mock +} + +func (_m *MockFileSystemWrapper) EXPECT() *MockFileSystemWrapper_Expecter { + return &MockFileSystemWrapper_Expecter{mock: &_m.Mock} +} + +// CreateDirectory provides a mock function for the type MockFileSystemWrapper +func (_mock *MockFileSystemWrapper) CreateDirectory(path string) error { + ret := _mock.Called(path) if len(ret) == 0 { panic("no return value specified for CreateDirectory") } var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(path) + if returnFunc, ok := ret.Get(0).(func(string) error); ok { + r0 = returnFunc(path) } else { r0 = ret.Error(0) } - return r0 } -// Destroy provides a mock function with given fields: path -func (_m *MockFileSystemWrapper) Destroy(path string) error { - ret := _m.Called(path) +// MockFileSystemWrapper_CreateDirectory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateDirectory' +type MockFileSystemWrapper_CreateDirectory_Call struct { + *mock.Call +} + +// CreateDirectory is a helper method to define mock.On call +// - path string +func (_e *MockFileSystemWrapper_Expecter) CreateDirectory(path interface{}) *MockFileSystemWrapper_CreateDirectory_Call { + return &MockFileSystemWrapper_CreateDirectory_Call{Call: _e.mock.On("CreateDirectory", path)} +} + +func (_c *MockFileSystemWrapper_CreateDirectory_Call) Run(run func(path string)) *MockFileSystemWrapper_CreateDirectory_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFileSystemWrapper_CreateDirectory_Call) Return(err error) *MockFileSystemWrapper_CreateDirectory_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFileSystemWrapper_CreateDirectory_Call) RunAndReturn(run func(path string) error) *MockFileSystemWrapper_CreateDirectory_Call { + _c.Call.Return(run) + return _c +} + +// Destroy provides a mock function for the type MockFileSystemWrapper +func (_mock *MockFileSystemWrapper) Destroy(path string) error { + ret := _mock.Called(path) if len(ret) == 0 { panic("no return value specified for Destroy") } var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(path) + if returnFunc, ok := ret.Get(0).(func(string) error); ok { + r0 = returnFunc(path) } else { r0 = ret.Error(0) } - return r0 } -// WriteFile provides a mock function with given fields: path, data -func (_m *MockFileSystemWrapper) WriteFile(path string, data string) error { - ret := _m.Called(path, data) +// MockFileSystemWrapper_Destroy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Destroy' +type MockFileSystemWrapper_Destroy_Call struct { + *mock.Call +} + +// Destroy is a helper method to define mock.On call +// - path string +func (_e *MockFileSystemWrapper_Expecter) Destroy(path interface{}) *MockFileSystemWrapper_Destroy_Call { + return &MockFileSystemWrapper_Destroy_Call{Call: _e.mock.On("Destroy", path)} +} + +func (_c *MockFileSystemWrapper_Destroy_Call) Run(run func(path string)) *MockFileSystemWrapper_Destroy_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + run( + arg0, + ) + }) + return _c +} + +func (_c *MockFileSystemWrapper_Destroy_Call) Return(err error) *MockFileSystemWrapper_Destroy_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFileSystemWrapper_Destroy_Call) RunAndReturn(run func(path string) error) *MockFileSystemWrapper_Destroy_Call { + _c.Call.Return(run) + return _c +} + +// WriteFile provides a mock function for the type MockFileSystemWrapper +func (_mock *MockFileSystemWrapper) WriteFile(path string, data string) error { + ret := _mock.Called(path, data) if len(ret) == 0 { panic("no return value specified for WriteFile") } var r0 error - if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(path, data) + if returnFunc, ok := ret.Get(0).(func(string, string) error); ok { + r0 = returnFunc(path, data) } else { r0 = ret.Error(0) } - return r0 } -// NewMockFileSystemWrapper creates a new instance of MockFileSystemWrapper. 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 NewMockFileSystemWrapper(t interface { - mock.TestingT - Cleanup(func()) -}) *MockFileSystemWrapper { - mock := &MockFileSystemWrapper{} - mock.Mock.Test(t) +// MockFileSystemWrapper_WriteFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteFile' +type MockFileSystemWrapper_WriteFile_Call struct { + *mock.Call +} - t.Cleanup(func() { mock.AssertExpectations(t) }) +// WriteFile is a helper method to define mock.On call +// - path string +// - data string +func (_e *MockFileSystemWrapper_Expecter) WriteFile(path interface{}, data interface{}) *MockFileSystemWrapper_WriteFile_Call { + return &MockFileSystemWrapper_WriteFile_Call{Call: _e.mock.On("WriteFile", path, data)} +} - return mock +func (_c *MockFileSystemWrapper_WriteFile_Call) Run(run func(path string, data string)) *MockFileSystemWrapper_WriteFile_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 string + if args[1] != nil { + arg1 = args[1].(string) + } + run( + arg0, + arg1, + ) + }) + return _c +} + +func (_c *MockFileSystemWrapper_WriteFile_Call) Return(err error) *MockFileSystemWrapper_WriteFile_Call { + _c.Call.Return(err) + return _c +} + +func (_c *MockFileSystemWrapper_WriteFile_Call) RunAndReturn(run func(path string, data string) error) *MockFileSystemWrapper_WriteFile_Call { + _c.Call.Return(run) + return _c } diff --git a/wrappers/shellWrapper_mock.go b/wrappers/shellWrapper_mock.go index 681e96f..2927fa7 100644 --- a/wrappers/shellWrapper_mock.go +++ b/wrappers/shellWrapper_mock.go @@ -1,24 +1,49 @@ -// Code generated by mockery v2.51.1. DO NOT EDIT. +// Code generated by mockery; DO NOT EDIT. +// github.com/vektra/mockery +// template: testify package wrappers -import mock "github.com/stretchr/testify/mock" +import ( + mock "github.com/stretchr/testify/mock" +) + +// NewMockShellWrapper creates a new instance of MockShellWrapper. 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 NewMockShellWrapper(t interface { + mock.TestingT + Cleanup(func()) +}) *MockShellWrapper { + mock := &MockShellWrapper{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} // MockShellWrapper is an autogenerated mock type for the ShellWrapper type type MockShellWrapper struct { mock.Mock } -// Exec provides a mock function with given fields: name, args -func (_m *MockShellWrapper) Exec(name string, args ...string) ([]byte, error) { - _va := make([]interface{}, len(args)) - for _i := range args { - _va[_i] = args[_i] +type MockShellWrapper_Expecter struct { + mock *mock.Mock +} + +func (_m *MockShellWrapper) EXPECT() *MockShellWrapper_Expecter { + return &MockShellWrapper_Expecter{mock: &_m.Mock} +} + +// Exec provides a mock function for the type MockShellWrapper +func (_mock *MockShellWrapper) Exec(name string, args ...string) ([]byte, error) { + var tmpRet mock.Arguments + if len(args) > 0 { + tmpRet = _mock.Called(name, args) + } else { + tmpRet = _mock.Called(name) } - var _ca []interface{} - _ca = append(_ca, name) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) + ret := tmpRet if len(ret) == 0 { panic("no return value specified for Exec") @@ -26,36 +51,63 @@ func (_m *MockShellWrapper) Exec(name string, args ...string) ([]byte, error) { var r0 []byte var r1 error - if rf, ok := ret.Get(0).(func(string, ...string) ([]byte, error)); ok { - return rf(name, args...) + if returnFunc, ok := ret.Get(0).(func(string, ...string) ([]byte, error)); ok { + return returnFunc(name, args...) } - if rf, ok := ret.Get(0).(func(string, ...string) []byte); ok { - r0 = rf(name, args...) + if returnFunc, ok := ret.Get(0).(func(string, ...string) []byte); ok { + r0 = returnFunc(name, args...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]byte) } } - - if rf, ok := ret.Get(1).(func(string, ...string) error); ok { - r1 = rf(name, args...) + if returnFunc, ok := ret.Get(1).(func(string, ...string) error); ok { + r1 = returnFunc(name, args...) } else { r1 = ret.Error(1) } - return r0, r1 } -// NewMockShellWrapper creates a new instance of MockShellWrapper. 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 NewMockShellWrapper(t interface { - mock.TestingT - Cleanup(func()) -}) *MockShellWrapper { - mock := &MockShellWrapper{} - mock.Mock.Test(t) +// MockShellWrapper_Exec_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exec' +type MockShellWrapper_Exec_Call struct { + *mock.Call +} - t.Cleanup(func() { mock.AssertExpectations(t) }) +// Exec is a helper method to define mock.On call +// - name string +// - args ...string +func (_e *MockShellWrapper_Expecter) Exec(name interface{}, args ...interface{}) *MockShellWrapper_Exec_Call { + return &MockShellWrapper_Exec_Call{Call: _e.mock.On("Exec", + append([]interface{}{name}, args...)...)} +} - return mock +func (_c *MockShellWrapper_Exec_Call) Run(run func(name string, args ...string)) *MockShellWrapper_Exec_Call { + _c.Call.Run(func(args mock.Arguments) { + var arg0 string + if args[0] != nil { + arg0 = args[0].(string) + } + var arg1 []string + var variadicArgs []string + if len(args) > 1 { + variadicArgs = args[1].([]string) + } + arg1 = variadicArgs + run( + arg0, + arg1..., + ) + }) + return _c +} + +func (_c *MockShellWrapper_Exec_Call) Return(bytes []byte, err error) *MockShellWrapper_Exec_Call { + _c.Call.Return(bytes, err) + return _c +} + +func (_c *MockShellWrapper_Exec_Call) RunAndReturn(run func(name string, args ...string) ([]byte, error)) *MockShellWrapper_Exec_Call { + _c.Call.Return(run) + return _c }