From 5ba83da14ba931004ec6f4c7eeda05351218c8bf Mon Sep 17 00:00:00 2001 From: John Judd Date: Thu, 12 Sep 2024 14:25:50 -0500 Subject: [PATCH] Updated mocks to use mockery Expecter. Resolves #200. (#201) --- .mockery.yaml | 3 + CHANGELOG.md | 4 + mocks/File.go | 631 +++++++++++++++++++++++++++++++++++++++++++- mocks/FileSystem.go | 199 +++++++++++++- mocks/Location.go | 464 +++++++++++++++++++++++++++++++- mocks/Options.go | 32 +++ mocks/Retry.go | 78 ++++++ 7 files changed, 1382 insertions(+), 29 deletions(-) create mode 100644 mocks/Options.go create mode 100644 mocks/Retry.go diff --git a/.mockery.yaml b/.mockery.yaml index c66fdfc0..ee6c2760 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -4,6 +4,9 @@ mockname: "{{.InterfaceName}}" outpkg: mocks with-expecter: true packages: + github.com/c2fo/vfs/v6: + config: + all: true github.com/c2fo/vfs/v6/backend/s3: config: all: true diff --git a/CHANGELOG.md b/CHANGELOG.md index a5193907..edd1e08e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [6.18.0] - 2024-09-12 +### Added +- Updated mocks to use mockery Expecter. Resolves #200. + ## [6.17.0] - 2024-09-10 ### Added - Added additionally-supported HostKeyAlgorithms for SFTP backend. Resolves #198. diff --git a/mocks/File.go b/mocks/File.go index 68181751..c408c242 100644 --- a/mocks/File.go +++ b/mocks/File.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.12.3. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -16,10 +16,22 @@ type File struct { mock.Mock } +type File_Expecter struct { + mock *mock.Mock +} + +func (_m *File) EXPECT() *File_Expecter { + return &File_Expecter{mock: &_m.Mock} +} + // Close provides a mock function with given fields: func (_m *File) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -30,10 +42,41 @@ func (_m *File) Close() error { return r0 } +// File_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type File_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *File_Expecter) Close() *File_Close_Call { + return &File_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *File_Close_Call) Run(run func()) *File_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Close_Call) Return(_a0 error) *File_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_Close_Call) RunAndReturn(run func() error) *File_Close_Call { + _c.Call.Return(run) + return _c +} + // CopyToFile provides a mock function with given fields: file func (_m *File) CopyToFile(file vfs.File) error { ret := _m.Called(file) + if len(ret) == 0 { + panic("no return value specified for CopyToFile") + } + var r0 error if rf, ok := ret.Get(0).(func(vfs.File) error); ok { r0 = rf(file) @@ -44,11 +87,47 @@ func (_m *File) CopyToFile(file vfs.File) error { return r0 } +// File_CopyToFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CopyToFile' +type File_CopyToFile_Call struct { + *mock.Call +} + +// CopyToFile is a helper method to define mock.On call +// - file vfs.File +func (_e *File_Expecter) CopyToFile(file interface{}) *File_CopyToFile_Call { + return &File_CopyToFile_Call{Call: _e.mock.On("CopyToFile", file)} +} + +func (_c *File_CopyToFile_Call) Run(run func(file vfs.File)) *File_CopyToFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(vfs.File)) + }) + return _c +} + +func (_c *File_CopyToFile_Call) Return(_a0 error) *File_CopyToFile_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_CopyToFile_Call) RunAndReturn(run func(vfs.File) error) *File_CopyToFile_Call { + _c.Call.Return(run) + return _c +} + // CopyToLocation provides a mock function with given fields: location func (_m *File) CopyToLocation(location vfs.Location) (vfs.File, error) { ret := _m.Called(location) + if len(ret) == 0 { + panic("no return value specified for CopyToLocation") + } + var r0 vfs.File + var r1 error + if rf, ok := ret.Get(0).(func(vfs.Location) (vfs.File, error)); ok { + return rf(location) + } if rf, ok := ret.Get(0).(func(vfs.Location) vfs.File); ok { r0 = rf(location) } else { @@ -57,7 +136,6 @@ func (_m *File) CopyToLocation(location vfs.Location) (vfs.File, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(vfs.Location) error); ok { r1 = rf(location) } else { @@ -67,6 +145,34 @@ func (_m *File) CopyToLocation(location vfs.Location) (vfs.File, error) { return r0, r1 } +// File_CopyToLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CopyToLocation' +type File_CopyToLocation_Call struct { + *mock.Call +} + +// CopyToLocation is a helper method to define mock.On call +// - location vfs.Location +func (_e *File_Expecter) CopyToLocation(location interface{}) *File_CopyToLocation_Call { + return &File_CopyToLocation_Call{Call: _e.mock.On("CopyToLocation", location)} +} + +func (_c *File_CopyToLocation_Call) Run(run func(location vfs.Location)) *File_CopyToLocation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(vfs.Location)) + }) + return _c +} + +func (_c *File_CopyToLocation_Call) Return(_a0 vfs.File, _a1 error) *File_CopyToLocation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *File_CopyToLocation_Call) RunAndReturn(run func(vfs.Location) (vfs.File, error)) *File_CopyToLocation_Call { + _c.Call.Return(run) + return _c +} + // Delete provides a mock function with given fields: deleteOpts func (_m *File) Delete(deleteOpts ...options.DeleteOption) error { _va := make([]interface{}, len(deleteOpts)) @@ -77,6 +183,10 @@ func (_m *File) Delete(deleteOpts ...options.DeleteOption) error { _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for Delete") + } + var r0 error if rf, ok := ret.Get(0).(func(...options.DeleteOption) error); ok { r0 = rf(deleteOpts...) @@ -87,18 +197,60 @@ func (_m *File) Delete(deleteOpts ...options.DeleteOption) error { return r0 } +// File_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type File_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - deleteOpts ...options.DeleteOption +func (_e *File_Expecter) Delete(deleteOpts ...interface{}) *File_Delete_Call { + return &File_Delete_Call{Call: _e.mock.On("Delete", + append([]interface{}{}, deleteOpts...)...)} +} + +func (_c *File_Delete_Call) Run(run func(deleteOpts ...options.DeleteOption)) *File_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]options.DeleteOption, len(args)-0) + for i, a := range args[0:] { + if a != nil { + variadicArgs[i] = a.(options.DeleteOption) + } + } + run(variadicArgs...) + }) + return _c +} + +func (_c *File_Delete_Call) Return(_a0 error) *File_Delete_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_Delete_Call) RunAndReturn(run func(...options.DeleteOption) error) *File_Delete_Call { + _c.Call.Return(run) + return _c +} + // Exists provides a mock function with given fields: func (_m *File) Exists() (bool, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Exists") + } + 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) } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -108,11 +260,46 @@ func (_m *File) Exists() (bool, error) { return r0, r1 } +// File_Exists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exists' +type File_Exists_Call struct { + *mock.Call +} + +// Exists is a helper method to define mock.On call +func (_e *File_Expecter) Exists() *File_Exists_Call { + return &File_Exists_Call{Call: _e.mock.On("Exists")} +} + +func (_c *File_Exists_Call) Run(run func()) *File_Exists_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Exists_Call) Return(_a0 bool, _a1 error) *File_Exists_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *File_Exists_Call) RunAndReturn(run func() (bool, error)) *File_Exists_Call { + _c.Call.Return(run) + return _c +} + // LastModified provides a mock function with given fields: func (_m *File) LastModified() (*time.Time, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LastModified") + } + var r0 *time.Time + var r1 error + if rf, ok := ret.Get(0).(func() (*time.Time, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() *time.Time); ok { r0 = rf() } else { @@ -121,7 +308,6 @@ func (_m *File) LastModified() (*time.Time, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -131,10 +317,41 @@ func (_m *File) LastModified() (*time.Time, error) { return r0, r1 } +// File_LastModified_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LastModified' +type File_LastModified_Call struct { + *mock.Call +} + +// LastModified is a helper method to define mock.On call +func (_e *File_Expecter) LastModified() *File_LastModified_Call { + return &File_LastModified_Call{Call: _e.mock.On("LastModified")} +} + +func (_c *File_LastModified_Call) Run(run func()) *File_LastModified_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_LastModified_Call) Return(_a0 *time.Time, _a1 error) *File_LastModified_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *File_LastModified_Call) RunAndReturn(run func() (*time.Time, error)) *File_LastModified_Call { + _c.Call.Return(run) + return _c +} + // Location provides a mock function with given fields: func (_m *File) Location() vfs.Location { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Location") + } + var r0 vfs.Location if rf, ok := ret.Get(0).(func() vfs.Location); ok { r0 = rf() @@ -147,10 +364,41 @@ func (_m *File) Location() vfs.Location { return r0 } +// File_Location_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Location' +type File_Location_Call struct { + *mock.Call +} + +// Location is a helper method to define mock.On call +func (_e *File_Expecter) Location() *File_Location_Call { + return &File_Location_Call{Call: _e.mock.On("Location")} +} + +func (_c *File_Location_Call) Run(run func()) *File_Location_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Location_Call) Return(_a0 vfs.Location) *File_Location_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_Location_Call) RunAndReturn(run func() vfs.Location) *File_Location_Call { + _c.Call.Return(run) + return _c +} + // MoveToFile provides a mock function with given fields: file func (_m *File) MoveToFile(file vfs.File) error { ret := _m.Called(file) + if len(ret) == 0 { + panic("no return value specified for MoveToFile") + } + var r0 error if rf, ok := ret.Get(0).(func(vfs.File) error); ok { r0 = rf(file) @@ -161,11 +409,47 @@ func (_m *File) MoveToFile(file vfs.File) error { return r0 } +// File_MoveToFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MoveToFile' +type File_MoveToFile_Call struct { + *mock.Call +} + +// MoveToFile is a helper method to define mock.On call +// - file vfs.File +func (_e *File_Expecter) MoveToFile(file interface{}) *File_MoveToFile_Call { + return &File_MoveToFile_Call{Call: _e.mock.On("MoveToFile", file)} +} + +func (_c *File_MoveToFile_Call) Run(run func(file vfs.File)) *File_MoveToFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(vfs.File)) + }) + return _c +} + +func (_c *File_MoveToFile_Call) Return(_a0 error) *File_MoveToFile_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_MoveToFile_Call) RunAndReturn(run func(vfs.File) error) *File_MoveToFile_Call { + _c.Call.Return(run) + return _c +} + // MoveToLocation provides a mock function with given fields: location func (_m *File) MoveToLocation(location vfs.Location) (vfs.File, error) { ret := _m.Called(location) + if len(ret) == 0 { + panic("no return value specified for MoveToLocation") + } + var r0 vfs.File + var r1 error + if rf, ok := ret.Get(0).(func(vfs.Location) (vfs.File, error)); ok { + return rf(location) + } if rf, ok := ret.Get(0).(func(vfs.Location) vfs.File); ok { r0 = rf(location) } else { @@ -174,7 +458,6 @@ func (_m *File) MoveToLocation(location vfs.Location) (vfs.File, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(vfs.Location) error); ok { r1 = rf(location) } else { @@ -184,10 +467,42 @@ func (_m *File) MoveToLocation(location vfs.Location) (vfs.File, error) { return r0, r1 } +// File_MoveToLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MoveToLocation' +type File_MoveToLocation_Call struct { + *mock.Call +} + +// MoveToLocation is a helper method to define mock.On call +// - location vfs.Location +func (_e *File_Expecter) MoveToLocation(location interface{}) *File_MoveToLocation_Call { + return &File_MoveToLocation_Call{Call: _e.mock.On("MoveToLocation", location)} +} + +func (_c *File_MoveToLocation_Call) Run(run func(location vfs.Location)) *File_MoveToLocation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(vfs.Location)) + }) + return _c +} + +func (_c *File_MoveToLocation_Call) Return(_a0 vfs.File, _a1 error) *File_MoveToLocation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *File_MoveToLocation_Call) RunAndReturn(run func(vfs.Location) (vfs.File, error)) *File_MoveToLocation_Call { + _c.Call.Return(run) + return _c +} + // Name provides a mock function with given fields: func (_m *File) Name() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Name") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -198,10 +513,41 @@ func (_m *File) Name() string { return r0 } +// File_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type File_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *File_Expecter) Name() *File_Name_Call { + return &File_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *File_Name_Call) Run(run func()) *File_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Name_Call) Return(_a0 string) *File_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_Name_Call) RunAndReturn(run func() string) *File_Name_Call { + _c.Call.Return(run) + return _c +} + // Path provides a mock function with given fields: func (_m *File) Path() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Path") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -212,18 +558,52 @@ func (_m *File) Path() string { return r0 } +// File_Path_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Path' +type File_Path_Call struct { + *mock.Call +} + +// Path is a helper method to define mock.On call +func (_e *File_Expecter) Path() *File_Path_Call { + return &File_Path_Call{Call: _e.mock.On("Path")} +} + +func (_c *File_Path_Call) Run(run func()) *File_Path_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Path_Call) Return(_a0 string) *File_Path_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_Path_Call) RunAndReturn(run func() string) *File_Path_Call { + _c.Call.Return(run) + return _c +} + // Read provides a mock function with given fields: p func (_m *File) Read(p []byte) (int, error) { ret := _m.Called(p) + if len(ret) == 0 { + panic("no return value specified for Read") + } + var r0 int + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok { + return rf(p) + } if rf, ok := ret.Get(0).(func([]byte) int); ok { r0 = rf(p) } else { r0 = ret.Get(0).(int) } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(p) } else { @@ -233,18 +613,53 @@ func (_m *File) Read(p []byte) (int, error) { return r0, r1 } +// File_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read' +type File_Read_Call struct { + *mock.Call +} + +// Read is a helper method to define mock.On call +// - p []byte +func (_e *File_Expecter) Read(p interface{}) *File_Read_Call { + return &File_Read_Call{Call: _e.mock.On("Read", p)} +} + +func (_c *File_Read_Call) Run(run func(p []byte)) *File_Read_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *File_Read_Call) Return(n int, err error) *File_Read_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *File_Read_Call) RunAndReturn(run func([]byte) (int, error)) *File_Read_Call { + _c.Call.Return(run) + return _c +} + // Seek provides a mock function with given fields: offset, whence func (_m *File) Seek(offset int64, whence int) (int64, error) { ret := _m.Called(offset, whence) + if len(ret) == 0 { + panic("no return value specified for Seek") + } + var r0 int64 + var r1 error + if rf, ok := ret.Get(0).(func(int64, int) (int64, error)); ok { + return rf(offset, whence) + } if rf, ok := ret.Get(0).(func(int64, int) int64); ok { r0 = rf(offset, whence) } else { r0 = ret.Get(0).(int64) } - var r1 error if rf, ok := ret.Get(1).(func(int64, int) error); ok { r1 = rf(offset, whence) } else { @@ -254,18 +669,54 @@ func (_m *File) Seek(offset int64, whence int) (int64, error) { return r0, r1 } +// File_Seek_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Seek' +type File_Seek_Call struct { + *mock.Call +} + +// Seek is a helper method to define mock.On call +// - offset int64 +// - whence int +func (_e *File_Expecter) Seek(offset interface{}, whence interface{}) *File_Seek_Call { + return &File_Seek_Call{Call: _e.mock.On("Seek", offset, whence)} +} + +func (_c *File_Seek_Call) Run(run func(offset int64, whence int)) *File_Seek_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(int64), args[1].(int)) + }) + return _c +} + +func (_c *File_Seek_Call) Return(_a0 int64, _a1 error) *File_Seek_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *File_Seek_Call) RunAndReturn(run func(int64, int) (int64, error)) *File_Seek_Call { + _c.Call.Return(run) + return _c +} + // Size provides a mock function with given fields: func (_m *File) Size() (uint64, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Size") + } + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func() (uint64, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() } else { r0 = ret.Get(0).(uint64) } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -275,10 +726,41 @@ func (_m *File) Size() (uint64, error) { return r0, r1 } +// File_Size_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Size' +type File_Size_Call struct { + *mock.Call +} + +// Size is a helper method to define mock.On call +func (_e *File_Expecter) Size() *File_Size_Call { + return &File_Size_Call{Call: _e.mock.On("Size")} +} + +func (_c *File_Size_Call) Run(run func()) *File_Size_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Size_Call) Return(_a0 uint64, _a1 error) *File_Size_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *File_Size_Call) RunAndReturn(run func() (uint64, error)) *File_Size_Call { + _c.Call.Return(run) + return _c +} + // String provides a mock function with given fields: func (_m *File) String() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for String") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -289,10 +771,41 @@ func (_m *File) String() string { return r0 } +// File_String_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'String' +type File_String_Call struct { + *mock.Call +} + +// String is a helper method to define mock.On call +func (_e *File_Expecter) String() *File_String_Call { + return &File_String_Call{Call: _e.mock.On("String")} +} + +func (_c *File_String_Call) Run(run func()) *File_String_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_String_Call) Return(_a0 string) *File_String_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_String_Call) RunAndReturn(run func() string) *File_String_Call { + _c.Call.Return(run) + return _c +} + // Touch provides a mock function with given fields: func (_m *File) Touch() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Touch") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -303,10 +816,41 @@ func (_m *File) Touch() error { return r0 } +// File_Touch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Touch' +type File_Touch_Call struct { + *mock.Call +} + +// Touch is a helper method to define mock.On call +func (_e *File_Expecter) Touch() *File_Touch_Call { + return &File_Touch_Call{Call: _e.mock.On("Touch")} +} + +func (_c *File_Touch_Call) Run(run func()) *File_Touch_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_Touch_Call) Return(_a0 error) *File_Touch_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_Touch_Call) RunAndReturn(run func() error) *File_Touch_Call { + _c.Call.Return(run) + return _c +} + // URI provides a mock function with given fields: func (_m *File) URI() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for URI") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -317,18 +861,52 @@ func (_m *File) URI() string { return r0 } +// File_URI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'URI' +type File_URI_Call struct { + *mock.Call +} + +// URI is a helper method to define mock.On call +func (_e *File_Expecter) URI() *File_URI_Call { + return &File_URI_Call{Call: _e.mock.On("URI")} +} + +func (_c *File_URI_Call) Run(run func()) *File_URI_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *File_URI_Call) Return(_a0 string) *File_URI_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *File_URI_Call) RunAndReturn(run func() string) *File_URI_Call { + _c.Call.Return(run) + return _c +} + // Write provides a mock function with given fields: p func (_m *File) Write(p []byte) (int, error) { ret := _m.Called(p) + if len(ret) == 0 { + panic("no return value specified for Write") + } + var r0 int + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (int, error)); ok { + return rf(p) + } if rf, ok := ret.Get(0).(func([]byte) int); ok { r0 = rf(p) } else { r0 = ret.Get(0).(int) } - var r1 error if rf, ok := ret.Get(1).(func([]byte) error); ok { r1 = rf(p) } else { @@ -338,13 +916,40 @@ func (_m *File) Write(p []byte) (int, error) { return r0, r1 } -type NewFileT interface { - mock.TestingT - Cleanup(func()) +// File_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' +type File_Write_Call struct { + *mock.Call +} + +// Write is a helper method to define mock.On call +// - p []byte +func (_e *File_Expecter) Write(p interface{}) *File_Write_Call { + return &File_Write_Call{Call: _e.mock.On("Write", p)} +} + +func (_c *File_Write_Call) Run(run func(p []byte)) *File_Write_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *File_Write_Call) Return(n int, err error) *File_Write_Call { + _c.Call.Return(n, err) + return _c +} + +func (_c *File_Write_Call) RunAndReturn(run func([]byte) (int, error)) *File_Write_Call { + _c.Call.Return(run) + return _c } // NewFile creates a new instance of File. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewFile(t NewFileT) *File { +// The first argument is typically a *testing.T value. +func NewFile(t interface { + mock.TestingT + Cleanup(func()) +}) *File { mock := &File{} mock.Mock.Test(t) diff --git a/mocks/FileSystem.go b/mocks/FileSystem.go index 604be2aa..929bdf91 100644 --- a/mocks/FileSystem.go +++ b/mocks/FileSystem.go @@ -1,19 +1,33 @@ -// Code generated by mockery v1.0.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks -import mock "github.com/stretchr/testify/mock" -import vfs "github.com/c2fo/vfs/v6" +import ( + vfs "github.com/c2fo/vfs/v6" + mock "github.com/stretchr/testify/mock" +) // FileSystem is an autogenerated mock type for the FileSystem type type FileSystem struct { mock.Mock } +type FileSystem_Expecter struct { + mock *mock.Mock +} + +func (_m *FileSystem) EXPECT() *FileSystem_Expecter { + return &FileSystem_Expecter{mock: &_m.Mock} +} + // Name provides a mock function with given fields: func (_m *FileSystem) Name() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Name") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -24,11 +38,46 @@ func (_m *FileSystem) Name() string { return r0 } +// FileSystem_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type FileSystem_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *FileSystem_Expecter) Name() *FileSystem_Name_Call { + return &FileSystem_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *FileSystem_Name_Call) Run(run func()) *FileSystem_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *FileSystem_Name_Call) Return(_a0 string) *FileSystem_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *FileSystem_Name_Call) RunAndReturn(run func() string) *FileSystem_Name_Call { + _c.Call.Return(run) + return _c +} + // NewFile provides a mock function with given fields: volume, absFilePath func (_m *FileSystem) NewFile(volume string, absFilePath string) (vfs.File, error) { ret := _m.Called(volume, absFilePath) + if len(ret) == 0 { + panic("no return value specified for NewFile") + } + var r0 vfs.File + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (vfs.File, error)); ok { + return rf(volume, absFilePath) + } if rf, ok := ret.Get(0).(func(string, string) vfs.File); ok { r0 = rf(volume, absFilePath) } else { @@ -37,7 +86,6 @@ func (_m *FileSystem) NewFile(volume string, absFilePath string) (vfs.File, erro } } - var r1 error if rf, ok := ret.Get(1).(func(string, string) error); ok { r1 = rf(volume, absFilePath) } else { @@ -47,11 +95,48 @@ func (_m *FileSystem) NewFile(volume string, absFilePath string) (vfs.File, erro return r0, r1 } +// FileSystem_NewFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewFile' +type FileSystem_NewFile_Call struct { + *mock.Call +} + +// NewFile is a helper method to define mock.On call +// - volume string +// - absFilePath string +func (_e *FileSystem_Expecter) NewFile(volume interface{}, absFilePath interface{}) *FileSystem_NewFile_Call { + return &FileSystem_NewFile_Call{Call: _e.mock.On("NewFile", volume, absFilePath)} +} + +func (_c *FileSystem_NewFile_Call) Run(run func(volume string, absFilePath string)) *FileSystem_NewFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *FileSystem_NewFile_Call) Return(_a0 vfs.File, _a1 error) *FileSystem_NewFile_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *FileSystem_NewFile_Call) RunAndReturn(run func(string, string) (vfs.File, error)) *FileSystem_NewFile_Call { + _c.Call.Return(run) + return _c +} + // NewLocation provides a mock function with given fields: volume, absLocPath func (_m *FileSystem) NewLocation(volume string, absLocPath string) (vfs.Location, error) { ret := _m.Called(volume, absLocPath) + if len(ret) == 0 { + panic("no return value specified for NewLocation") + } + var r0 vfs.Location + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (vfs.Location, error)); ok { + return rf(volume, absLocPath) + } if rf, ok := ret.Get(0).(func(string, string) vfs.Location); ok { r0 = rf(volume, absLocPath) } else { @@ -60,7 +145,6 @@ func (_m *FileSystem) NewLocation(volume string, absLocPath string) (vfs.Locatio } } - var r1 error if rf, ok := ret.Get(1).(func(string, string) error); ok { r1 = rf(volume, absLocPath) } else { @@ -70,10 +154,43 @@ func (_m *FileSystem) NewLocation(volume string, absLocPath string) (vfs.Locatio return r0, r1 } +// FileSystem_NewLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewLocation' +type FileSystem_NewLocation_Call struct { + *mock.Call +} + +// NewLocation is a helper method to define mock.On call +// - volume string +// - absLocPath string +func (_e *FileSystem_Expecter) NewLocation(volume interface{}, absLocPath interface{}) *FileSystem_NewLocation_Call { + return &FileSystem_NewLocation_Call{Call: _e.mock.On("NewLocation", volume, absLocPath)} +} + +func (_c *FileSystem_NewLocation_Call) Run(run func(volume string, absLocPath string)) *FileSystem_NewLocation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *FileSystem_NewLocation_Call) Return(_a0 vfs.Location, _a1 error) *FileSystem_NewLocation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *FileSystem_NewLocation_Call) RunAndReturn(run func(string, string) (vfs.Location, error)) *FileSystem_NewLocation_Call { + _c.Call.Return(run) + return _c +} + // Retry provides a mock function with given fields: func (_m *FileSystem) Retry() vfs.Retry { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Retry") + } + var r0 vfs.Retry if rf, ok := ret.Get(0).(func() vfs.Retry); ok { r0 = rf() @@ -86,10 +203,41 @@ func (_m *FileSystem) Retry() vfs.Retry { return r0 } +// FileSystem_Retry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Retry' +type FileSystem_Retry_Call struct { + *mock.Call +} + +// Retry is a helper method to define mock.On call +func (_e *FileSystem_Expecter) Retry() *FileSystem_Retry_Call { + return &FileSystem_Retry_Call{Call: _e.mock.On("Retry")} +} + +func (_c *FileSystem_Retry_Call) Run(run func()) *FileSystem_Retry_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *FileSystem_Retry_Call) Return(_a0 vfs.Retry) *FileSystem_Retry_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *FileSystem_Retry_Call) RunAndReturn(run func() vfs.Retry) *FileSystem_Retry_Call { + _c.Call.Return(run) + return _c +} + // Scheme provides a mock function with given fields: func (_m *FileSystem) Scheme() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Scheme") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -99,3 +247,44 @@ func (_m *FileSystem) Scheme() string { return r0 } + +// FileSystem_Scheme_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Scheme' +type FileSystem_Scheme_Call struct { + *mock.Call +} + +// Scheme is a helper method to define mock.On call +func (_e *FileSystem_Expecter) Scheme() *FileSystem_Scheme_Call { + return &FileSystem_Scheme_Call{Call: _e.mock.On("Scheme")} +} + +func (_c *FileSystem_Scheme_Call) Run(run func()) *FileSystem_Scheme_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *FileSystem_Scheme_Call) Return(_a0 string) *FileSystem_Scheme_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *FileSystem_Scheme_Call) RunAndReturn(run func() string) *FileSystem_Scheme_Call { + _c.Call.Return(run) + return _c +} + +// NewFileSystem creates a new instance of FileSystem. 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 NewFileSystem(t interface { + mock.TestingT + Cleanup(func()) +}) *FileSystem { + mock := &FileSystem{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Location.go b/mocks/Location.go index 6e97c77c..dd2c46bc 100644 --- a/mocks/Location.go +++ b/mocks/Location.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.12.3. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -16,10 +16,22 @@ type Location struct { mock.Mock } +type Location_Expecter struct { + mock *mock.Mock +} + +func (_m *Location) EXPECT() *Location_Expecter { + return &Location_Expecter{mock: &_m.Mock} +} + // ChangeDir provides a mock function with given fields: relLocPath func (_m *Location) ChangeDir(relLocPath string) error { ret := _m.Called(relLocPath) + if len(ret) == 0 { + panic("no return value specified for ChangeDir") + } + var r0 error if rf, ok := ret.Get(0).(func(string) error); ok { r0 = rf(relLocPath) @@ -30,6 +42,34 @@ func (_m *Location) ChangeDir(relLocPath string) error { return r0 } +// Location_ChangeDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeDir' +type Location_ChangeDir_Call struct { + *mock.Call +} + +// ChangeDir is a helper method to define mock.On call +// - relLocPath string +func (_e *Location_Expecter) ChangeDir(relLocPath interface{}) *Location_ChangeDir_Call { + return &Location_ChangeDir_Call{Call: _e.mock.On("ChangeDir", relLocPath)} +} + +func (_c *Location_ChangeDir_Call) Run(run func(relLocPath string)) *Location_ChangeDir_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Location_ChangeDir_Call) Return(_a0 error) *Location_ChangeDir_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_ChangeDir_Call) RunAndReturn(run func(string) error) *Location_ChangeDir_Call { + _c.Call.Return(run) + return _c +} + // DeleteFile provides a mock function with given fields: relFilePath, deleteOpts func (_m *Location) DeleteFile(relFilePath string, deleteOpts ...options.DeleteOption) error { _va := make([]interface{}, len(deleteOpts)) @@ -41,6 +81,10 @@ func (_m *Location) DeleteFile(relFilePath string, deleteOpts ...options.DeleteO _ca = append(_ca, _va...) ret := _m.Called(_ca...) + if len(ret) == 0 { + panic("no return value specified for DeleteFile") + } + var r0 error if rf, ok := ret.Get(0).(func(string, ...options.DeleteOption) error); ok { r0 = rf(relFilePath, deleteOpts...) @@ -51,18 +95,61 @@ func (_m *Location) DeleteFile(relFilePath string, deleteOpts ...options.DeleteO return r0 } +// Location_DeleteFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteFile' +type Location_DeleteFile_Call struct { + *mock.Call +} + +// DeleteFile is a helper method to define mock.On call +// - relFilePath string +// - deleteOpts ...options.DeleteOption +func (_e *Location_Expecter) DeleteFile(relFilePath interface{}, deleteOpts ...interface{}) *Location_DeleteFile_Call { + return &Location_DeleteFile_Call{Call: _e.mock.On("DeleteFile", + append([]interface{}{relFilePath}, deleteOpts...)...)} +} + +func (_c *Location_DeleteFile_Call) Run(run func(relFilePath string, deleteOpts ...options.DeleteOption)) *Location_DeleteFile_Call { + _c.Call.Run(func(args mock.Arguments) { + variadicArgs := make([]options.DeleteOption, len(args)-1) + for i, a := range args[1:] { + if a != nil { + variadicArgs[i] = a.(options.DeleteOption) + } + } + run(args[0].(string), variadicArgs...) + }) + return _c +} + +func (_c *Location_DeleteFile_Call) Return(_a0 error) *Location_DeleteFile_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_DeleteFile_Call) RunAndReturn(run func(string, ...options.DeleteOption) error) *Location_DeleteFile_Call { + _c.Call.Return(run) + return _c +} + // Exists provides a mock function with given fields: func (_m *Location) Exists() (bool, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Exists") + } + 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) } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -72,10 +159,41 @@ func (_m *Location) Exists() (bool, error) { return r0, r1 } +// Location_Exists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exists' +type Location_Exists_Call struct { + *mock.Call +} + +// Exists is a helper method to define mock.On call +func (_e *Location_Expecter) Exists() *Location_Exists_Call { + return &Location_Exists_Call{Call: _e.mock.On("Exists")} +} + +func (_c *Location_Exists_Call) Run(run func()) *Location_Exists_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_Exists_Call) Return(_a0 bool, _a1 error) *Location_Exists_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Location_Exists_Call) RunAndReturn(run func() (bool, error)) *Location_Exists_Call { + _c.Call.Return(run) + return _c +} + // FileSystem provides a mock function with given fields: func (_m *Location) FileSystem() vfs.FileSystem { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for FileSystem") + } + var r0 vfs.FileSystem if rf, ok := ret.Get(0).(func() vfs.FileSystem); ok { r0 = rf() @@ -88,11 +206,46 @@ func (_m *Location) FileSystem() vfs.FileSystem { return r0 } +// Location_FileSystem_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FileSystem' +type Location_FileSystem_Call struct { + *mock.Call +} + +// FileSystem is a helper method to define mock.On call +func (_e *Location_Expecter) FileSystem() *Location_FileSystem_Call { + return &Location_FileSystem_Call{Call: _e.mock.On("FileSystem")} +} + +func (_c *Location_FileSystem_Call) Run(run func()) *Location_FileSystem_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_FileSystem_Call) Return(_a0 vfs.FileSystem) *Location_FileSystem_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_FileSystem_Call) RunAndReturn(run func() vfs.FileSystem) *Location_FileSystem_Call { + _c.Call.Return(run) + return _c +} + // List provides a mock function with given fields: func (_m *Location) List() ([]string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for List") + } + var r0 []string + var r1 error + if rf, ok := ret.Get(0).(func() ([]string, error)); ok { + return rf() + } if rf, ok := ret.Get(0).(func() []string); ok { r0 = rf() } else { @@ -101,7 +254,6 @@ func (_m *Location) List() ([]string, error) { } } - var r1 error if rf, ok := ret.Get(1).(func() error); ok { r1 = rf() } else { @@ -111,11 +263,46 @@ func (_m *Location) List() ([]string, error) { return r0, r1 } +// Location_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type Location_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +func (_e *Location_Expecter) List() *Location_List_Call { + return &Location_List_Call{Call: _e.mock.On("List")} +} + +func (_c *Location_List_Call) Run(run func()) *Location_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_List_Call) Return(_a0 []string, _a1 error) *Location_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Location_List_Call) RunAndReturn(run func() ([]string, error)) *Location_List_Call { + _c.Call.Return(run) + return _c +} + // ListByPrefix provides a mock function with given fields: prefix func (_m *Location) ListByPrefix(prefix string) ([]string, error) { ret := _m.Called(prefix) + if len(ret) == 0 { + panic("no return value specified for ListByPrefix") + } + var r0 []string + var r1 error + if rf, ok := ret.Get(0).(func(string) ([]string, error)); ok { + return rf(prefix) + } if rf, ok := ret.Get(0).(func(string) []string); ok { r0 = rf(prefix) } else { @@ -124,7 +311,6 @@ func (_m *Location) ListByPrefix(prefix string) ([]string, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(prefix) } else { @@ -134,11 +320,47 @@ func (_m *Location) ListByPrefix(prefix string) ([]string, error) { return r0, r1 } +// Location_ListByPrefix_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByPrefix' +type Location_ListByPrefix_Call struct { + *mock.Call +} + +// ListByPrefix is a helper method to define mock.On call +// - prefix string +func (_e *Location_Expecter) ListByPrefix(prefix interface{}) *Location_ListByPrefix_Call { + return &Location_ListByPrefix_Call{Call: _e.mock.On("ListByPrefix", prefix)} +} + +func (_c *Location_ListByPrefix_Call) Run(run func(prefix string)) *Location_ListByPrefix_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Location_ListByPrefix_Call) Return(_a0 []string, _a1 error) *Location_ListByPrefix_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Location_ListByPrefix_Call) RunAndReturn(run func(string) ([]string, error)) *Location_ListByPrefix_Call { + _c.Call.Return(run) + return _c +} + // ListByRegex provides a mock function with given fields: regex func (_m *Location) ListByRegex(regex *regexp.Regexp) ([]string, error) { ret := _m.Called(regex) + if len(ret) == 0 { + panic("no return value specified for ListByRegex") + } + var r0 []string + var r1 error + if rf, ok := ret.Get(0).(func(*regexp.Regexp) ([]string, error)); ok { + return rf(regex) + } if rf, ok := ret.Get(0).(func(*regexp.Regexp) []string); ok { r0 = rf(regex) } else { @@ -147,7 +369,6 @@ func (_m *Location) ListByRegex(regex *regexp.Regexp) ([]string, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(*regexp.Regexp) error); ok { r1 = rf(regex) } else { @@ -157,11 +378,47 @@ func (_m *Location) ListByRegex(regex *regexp.Regexp) ([]string, error) { return r0, r1 } +// Location_ListByRegex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListByRegex' +type Location_ListByRegex_Call struct { + *mock.Call +} + +// ListByRegex is a helper method to define mock.On call +// - regex *regexp.Regexp +func (_e *Location_Expecter) ListByRegex(regex interface{}) *Location_ListByRegex_Call { + return &Location_ListByRegex_Call{Call: _e.mock.On("ListByRegex", regex)} +} + +func (_c *Location_ListByRegex_Call) Run(run func(regex *regexp.Regexp)) *Location_ListByRegex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*regexp.Regexp)) + }) + return _c +} + +func (_c *Location_ListByRegex_Call) Return(_a0 []string, _a1 error) *Location_ListByRegex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Location_ListByRegex_Call) RunAndReturn(run func(*regexp.Regexp) ([]string, error)) *Location_ListByRegex_Call { + _c.Call.Return(run) + return _c +} + // NewFile provides a mock function with given fields: relFilePath func (_m *Location) NewFile(relFilePath string) (vfs.File, error) { ret := _m.Called(relFilePath) + if len(ret) == 0 { + panic("no return value specified for NewFile") + } + var r0 vfs.File + var r1 error + if rf, ok := ret.Get(0).(func(string) (vfs.File, error)); ok { + return rf(relFilePath) + } if rf, ok := ret.Get(0).(func(string) vfs.File); ok { r0 = rf(relFilePath) } else { @@ -170,7 +427,6 @@ func (_m *Location) NewFile(relFilePath string) (vfs.File, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(relFilePath) } else { @@ -180,11 +436,47 @@ func (_m *Location) NewFile(relFilePath string) (vfs.File, error) { return r0, r1 } +// Location_NewFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewFile' +type Location_NewFile_Call struct { + *mock.Call +} + +// NewFile is a helper method to define mock.On call +// - relFilePath string +func (_e *Location_Expecter) NewFile(relFilePath interface{}) *Location_NewFile_Call { + return &Location_NewFile_Call{Call: _e.mock.On("NewFile", relFilePath)} +} + +func (_c *Location_NewFile_Call) Run(run func(relFilePath string)) *Location_NewFile_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Location_NewFile_Call) Return(_a0 vfs.File, _a1 error) *Location_NewFile_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Location_NewFile_Call) RunAndReturn(run func(string) (vfs.File, error)) *Location_NewFile_Call { + _c.Call.Return(run) + return _c +} + // NewLocation provides a mock function with given fields: relLocPath func (_m *Location) NewLocation(relLocPath string) (vfs.Location, error) { ret := _m.Called(relLocPath) + if len(ret) == 0 { + panic("no return value specified for NewLocation") + } + var r0 vfs.Location + var r1 error + if rf, ok := ret.Get(0).(func(string) (vfs.Location, error)); ok { + return rf(relLocPath) + } if rf, ok := ret.Get(0).(func(string) vfs.Location); ok { r0 = rf(relLocPath) } else { @@ -193,7 +485,6 @@ func (_m *Location) NewLocation(relLocPath string) (vfs.Location, error) { } } - var r1 error if rf, ok := ret.Get(1).(func(string) error); ok { r1 = rf(relLocPath) } else { @@ -203,10 +494,42 @@ func (_m *Location) NewLocation(relLocPath string) (vfs.Location, error) { return r0, r1 } +// Location_NewLocation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewLocation' +type Location_NewLocation_Call struct { + *mock.Call +} + +// NewLocation is a helper method to define mock.On call +// - relLocPath string +func (_e *Location_Expecter) NewLocation(relLocPath interface{}) *Location_NewLocation_Call { + return &Location_NewLocation_Call{Call: _e.mock.On("NewLocation", relLocPath)} +} + +func (_c *Location_NewLocation_Call) Run(run func(relLocPath string)) *Location_NewLocation_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Location_NewLocation_Call) Return(_a0 vfs.Location, _a1 error) *Location_NewLocation_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Location_NewLocation_Call) RunAndReturn(run func(string) (vfs.Location, error)) *Location_NewLocation_Call { + _c.Call.Return(run) + return _c +} + // Path provides a mock function with given fields: func (_m *Location) Path() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Path") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -217,10 +540,41 @@ func (_m *Location) Path() string { return r0 } +// Location_Path_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Path' +type Location_Path_Call struct { + *mock.Call +} + +// Path is a helper method to define mock.On call +func (_e *Location_Expecter) Path() *Location_Path_Call { + return &Location_Path_Call{Call: _e.mock.On("Path")} +} + +func (_c *Location_Path_Call) Run(run func()) *Location_Path_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_Path_Call) Return(_a0 string) *Location_Path_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_Path_Call) RunAndReturn(run func() string) *Location_Path_Call { + _c.Call.Return(run) + return _c +} + // String provides a mock function with given fields: func (_m *Location) String() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for String") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -231,10 +585,41 @@ func (_m *Location) String() string { return r0 } +// Location_String_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'String' +type Location_String_Call struct { + *mock.Call +} + +// String is a helper method to define mock.On call +func (_e *Location_Expecter) String() *Location_String_Call { + return &Location_String_Call{Call: _e.mock.On("String")} +} + +func (_c *Location_String_Call) Run(run func()) *Location_String_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_String_Call) Return(_a0 string) *Location_String_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_String_Call) RunAndReturn(run func() string) *Location_String_Call { + _c.Call.Return(run) + return _c +} + // URI provides a mock function with given fields: func (_m *Location) URI() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for URI") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -245,10 +630,41 @@ func (_m *Location) URI() string { return r0 } +// Location_URI_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'URI' +type Location_URI_Call struct { + *mock.Call +} + +// URI is a helper method to define mock.On call +func (_e *Location_Expecter) URI() *Location_URI_Call { + return &Location_URI_Call{Call: _e.mock.On("URI")} +} + +func (_c *Location_URI_Call) Run(run func()) *Location_URI_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_URI_Call) Return(_a0 string) *Location_URI_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_URI_Call) RunAndReturn(run func() string) *Location_URI_Call { + _c.Call.Return(run) + return _c +} + // Volume provides a mock function with given fields: func (_m *Location) Volume() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Volume") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -259,13 +675,39 @@ func (_m *Location) Volume() string { return r0 } -type NewLocationT interface { - mock.TestingT - Cleanup(func()) +// Location_Volume_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Volume' +type Location_Volume_Call struct { + *mock.Call +} + +// Volume is a helper method to define mock.On call +func (_e *Location_Expecter) Volume() *Location_Volume_Call { + return &Location_Volume_Call{Call: _e.mock.On("Volume")} +} + +func (_c *Location_Volume_Call) Run(run func()) *Location_Volume_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Location_Volume_Call) Return(_a0 string) *Location_Volume_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Location_Volume_Call) RunAndReturn(run func() string) *Location_Volume_Call { + _c.Call.Return(run) + return _c } // NewLocation creates a new instance of Location. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewLocation(t NewLocationT) *Location { +// The first argument is typically a *testing.T value. +func NewLocation(t interface { + mock.TestingT + Cleanup(func()) +}) *Location { mock := &Location{} mock.Mock.Test(t) diff --git a/mocks/Options.go b/mocks/Options.go new file mode 100644 index 00000000..54c5f5f5 --- /dev/null +++ b/mocks/Options.go @@ -0,0 +1,32 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// Options is an autogenerated mock type for the Options type +type Options struct { + mock.Mock +} + +type Options_Expecter struct { + mock *mock.Mock +} + +func (_m *Options) EXPECT() *Options_Expecter { + return &Options_Expecter{mock: &_m.Mock} +} + +// NewOptions creates a new instance of Options. 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 NewOptions(t interface { + mock.TestingT + Cleanup(func()) +}) *Options { + mock := &Options{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/Retry.go b/mocks/Retry.go new file mode 100644 index 00000000..fcbec6e5 --- /dev/null +++ b/mocks/Retry.go @@ -0,0 +1,78 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package mocks + +import mock "github.com/stretchr/testify/mock" + +// Retry is an autogenerated mock type for the Retry type +type Retry struct { + mock.Mock +} + +type Retry_Expecter struct { + mock *mock.Mock +} + +func (_m *Retry) EXPECT() *Retry_Expecter { + return &Retry_Expecter{mock: &_m.Mock} +} + +// Execute provides a mock function with given fields: wrapped +func (_m *Retry) Execute(wrapped func() error) error { + ret := _m.Called(wrapped) + + if len(ret) == 0 { + panic("no return value specified for Execute") + } + + var r0 error + if rf, ok := ret.Get(0).(func(func() error) error); ok { + r0 = rf(wrapped) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Retry_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute' +type Retry_Execute_Call struct { + *mock.Call +} + +// Execute is a helper method to define mock.On call +// - wrapped func() error +func (_e *Retry_Expecter) Execute(wrapped interface{}) *Retry_Execute_Call { + return &Retry_Execute_Call{Call: _e.mock.On("Execute", wrapped)} +} + +func (_c *Retry_Execute_Call) Run(run func(wrapped func() error)) *Retry_Execute_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(func() error)) + }) + return _c +} + +func (_c *Retry_Execute_Call) Return(_a0 error) *Retry_Execute_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Retry_Execute_Call) RunAndReturn(run func(func() error) error) *Retry_Execute_Call { + _c.Call.Return(run) + return _c +} + +// NewRetry creates a new instance of Retry. 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 NewRetry(t interface { + mock.TestingT + Cleanup(func()) +}) *Retry { + mock := &Retry{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}