mirror of https://github.com/databricks/cli.git
391 lines
10 KiB
Go
391 lines
10 KiB
Go
// Code generated by mockery v2.39.1. DO NOT EDIT.
|
|
|
|
package mockfiler
|
|
|
|
import (
|
|
context "context"
|
|
fs "io/fs"
|
|
|
|
filer "github.com/databricks/cli/libs/filer"
|
|
|
|
io "io"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockFiler is an autogenerated mock type for the Filer type
|
|
type MockFiler struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockFiler_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockFiler) EXPECT() *MockFiler_Expecter {
|
|
return &MockFiler_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, path, mode
|
|
func (_m *MockFiler) Delete(ctx context.Context, path string, mode ...filer.DeleteMode) error {
|
|
_va := make([]any, len(mode))
|
|
for _i := range mode {
|
|
_va[_i] = mode[_i]
|
|
}
|
|
var _ca []any
|
|
_ca = append(_ca, ctx, path)
|
|
_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(context.Context, string, ...filer.DeleteMode) error); ok {
|
|
r0 = rf(ctx, path, mode...)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockFiler_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
|
|
type MockFiler_Delete_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Delete is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - path string
|
|
// - mode ...filer.DeleteMode
|
|
func (_e *MockFiler_Expecter) Delete(ctx any, path any, mode ...any) *MockFiler_Delete_Call {
|
|
return &MockFiler_Delete_Call{Call: _e.mock.On("Delete",
|
|
append([]any{ctx, path}, mode...)...)}
|
|
}
|
|
|
|
func (_c *MockFiler_Delete_Call) Run(run func(ctx context.Context, path string, mode ...filer.DeleteMode)) *MockFiler_Delete_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]filer.DeleteMode, len(args)-2)
|
|
for i, a := range args[2:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(filer.DeleteMode)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(string), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Delete_Call) Return(_a0 error) *MockFiler_Delete_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Delete_Call) RunAndReturn(run func(context.Context, string, ...filer.DeleteMode) error) *MockFiler_Delete_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Mkdir provides a mock function with given fields: ctx, path
|
|
func (_m *MockFiler) Mkdir(ctx context.Context, path string) error {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Mkdir")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockFiler_Mkdir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Mkdir'
|
|
type MockFiler_Mkdir_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Mkdir is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - path string
|
|
func (_e *MockFiler_Expecter) Mkdir(ctx any, path any) *MockFiler_Mkdir_Call {
|
|
return &MockFiler_Mkdir_Call{Call: _e.mock.On("Mkdir", ctx, path)}
|
|
}
|
|
|
|
func (_c *MockFiler_Mkdir_Call) Run(run func(ctx context.Context, path string)) *MockFiler_Mkdir_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Mkdir_Call) Return(_a0 error) *MockFiler_Mkdir_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Mkdir_Call) RunAndReturn(run func(context.Context, string) error) *MockFiler_Mkdir_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Read provides a mock function with given fields: ctx, path
|
|
func (_m *MockFiler) Read(ctx context.Context, path string) (io.ReadCloser, error) {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Read")
|
|
}
|
|
|
|
var r0 io.ReadCloser
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (io.ReadCloser, error)); ok {
|
|
return rf(ctx, path)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) io.ReadCloser); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(io.ReadCloser)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, path)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockFiler_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'
|
|
type MockFiler_Read_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Read is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - path string
|
|
func (_e *MockFiler_Expecter) Read(ctx any, path any) *MockFiler_Read_Call {
|
|
return &MockFiler_Read_Call{Call: _e.mock.On("Read", ctx, path)}
|
|
}
|
|
|
|
func (_c *MockFiler_Read_Call) Run(run func(ctx context.Context, path string)) *MockFiler_Read_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Read_Call) Return(_a0 io.ReadCloser, _a1 error) *MockFiler_Read_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Read_Call) RunAndReturn(run func(context.Context, string) (io.ReadCloser, error)) *MockFiler_Read_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ReadDir provides a mock function with given fields: ctx, path
|
|
func (_m *MockFiler) ReadDir(ctx context.Context, path string) ([]fs.DirEntry, error) {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ReadDir")
|
|
}
|
|
|
|
var r0 []fs.DirEntry
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ([]fs.DirEntry, error)); ok {
|
|
return rf(ctx, path)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) []fs.DirEntry); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]fs.DirEntry)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, path)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockFiler_ReadDir_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadDir'
|
|
type MockFiler_ReadDir_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ReadDir is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - path string
|
|
func (_e *MockFiler_Expecter) ReadDir(ctx any, path any) *MockFiler_ReadDir_Call {
|
|
return &MockFiler_ReadDir_Call{Call: _e.mock.On("ReadDir", ctx, path)}
|
|
}
|
|
|
|
func (_c *MockFiler_ReadDir_Call) Run(run func(ctx context.Context, path string)) *MockFiler_ReadDir_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_ReadDir_Call) Return(_a0 []fs.DirEntry, _a1 error) *MockFiler_ReadDir_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_ReadDir_Call) RunAndReturn(run func(context.Context, string) ([]fs.DirEntry, error)) *MockFiler_ReadDir_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Stat provides a mock function with given fields: ctx, name
|
|
func (_m *MockFiler) Stat(ctx context.Context, name string) (fs.FileInfo, error) {
|
|
ret := _m.Called(ctx, name)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Stat")
|
|
}
|
|
|
|
var r0 fs.FileInfo
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (fs.FileInfo, error)); ok {
|
|
return rf(ctx, name)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) fs.FileInfo); ok {
|
|
r0 = rf(ctx, name)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(fs.FileInfo)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, name)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockFiler_Stat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stat'
|
|
type MockFiler_Stat_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Stat is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - name string
|
|
func (_e *MockFiler_Expecter) Stat(ctx any, name any) *MockFiler_Stat_Call {
|
|
return &MockFiler_Stat_Call{Call: _e.mock.On("Stat", ctx, name)}
|
|
}
|
|
|
|
func (_c *MockFiler_Stat_Call) Run(run func(ctx context.Context, name string)) *MockFiler_Stat_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Stat_Call) Return(_a0 fs.FileInfo, _a1 error) *MockFiler_Stat_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Stat_Call) RunAndReturn(run func(context.Context, string) (fs.FileInfo, error)) *MockFiler_Stat_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Write provides a mock function with given fields: ctx, path, reader, mode
|
|
func (_m *MockFiler) Write(ctx context.Context, path string, reader io.Reader, mode ...filer.WriteMode) error {
|
|
_va := make([]any, len(mode))
|
|
for _i := range mode {
|
|
_va[_i] = mode[_i]
|
|
}
|
|
var _ca []any
|
|
_ca = append(_ca, ctx, path, reader)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Write")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...filer.WriteMode) error); ok {
|
|
r0 = rf(ctx, path, reader, mode...)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockFiler_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
|
|
type MockFiler_Write_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Write is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - path string
|
|
// - reader io.Reader
|
|
// - mode ...filer.WriteMode
|
|
func (_e *MockFiler_Expecter) Write(ctx any, path any, reader any, mode ...any) *MockFiler_Write_Call {
|
|
return &MockFiler_Write_Call{Call: _e.mock.On("Write",
|
|
append([]any{ctx, path, reader}, mode...)...)}
|
|
}
|
|
|
|
func (_c *MockFiler_Write_Call) Run(run func(ctx context.Context, path string, reader io.Reader, mode ...filer.WriteMode)) *MockFiler_Write_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
variadicArgs := make([]filer.WriteMode, len(args)-3)
|
|
for i, a := range args[3:] {
|
|
if a != nil {
|
|
variadicArgs[i] = a.(filer.WriteMode)
|
|
}
|
|
}
|
|
run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Write_Call) Return(_a0 error) *MockFiler_Write_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockFiler_Write_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...filer.WriteMode) error) *MockFiler_Write_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockFiler creates a new instance of MockFiler. 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 NewMockFiler(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockFiler {
|
|
mock := &MockFiler{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|