Files
grafana/pkg/registry/apis/provisioning/resources/repository_resources_mock.go

601 lines
22 KiB
Go

// Code generated by mockery v2.52.4. DO NOT EDIT.
package resources
import (
context "context"
mock "github.com/stretchr/testify/mock"
schema "k8s.io/apimachinery/pkg/runtime/schema"
unstructured "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
v0alpha1 "github.com/grafana/grafana/pkg/apis/provisioning/v0alpha1"
)
// MockRepositoryResources is an autogenerated mock type for the RepositoryResources type
type MockRepositoryResources struct {
mock.Mock
}
type MockRepositoryResources_Expecter struct {
mock *mock.Mock
}
func (_m *MockRepositoryResources) EXPECT() *MockRepositoryResources_Expecter {
return &MockRepositoryResources_Expecter{mock: &_m.Mock}
}
// WriteResourceFileFromObject provides a mock function with given fields: ctx, obj, options
func (_m *MockRepositoryResources) WriteResourceFileFromObject(ctx context.Context, obj *unstructured.Unstructured, options WriteOptions) (string, error) {
ret := _m.Called(ctx, obj, options)
if len(ret) == 0 {
panic("no return value specified for WriteResourceFileFromObject")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *unstructured.Unstructured, WriteOptions) (string, error)); ok {
return rf(ctx, obj, options)
}
if rf, ok := ret.Get(0).(func(context.Context, *unstructured.Unstructured, WriteOptions) string); ok {
r0 = rf(ctx, obj, options)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, *unstructured.Unstructured, WriteOptions) error); ok {
r1 = rf(ctx, obj, options)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRepositoryResources_WriteResourceFileFromObject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteResourceFileFromObject'
type MockRepositoryResources_WriteResourceFileFromObject_Call struct {
*mock.Call
}
// WriteResourceFileFromObject is a helper method to define mock.On call
// - ctx context.Context
// - obj *unstructured.Unstructured
// - options WriteOptions
func (_e *MockRepositoryResources_Expecter) WriteResourceFileFromObject(ctx interface{}, obj interface{}, options interface{}) *MockRepositoryResources_WriteResourceFileFromObject_Call {
return &MockRepositoryResources_WriteResourceFileFromObject_Call{Call: _e.mock.On("WriteResourceFileFromObject", ctx, obj, options)}
}
func (_c *MockRepositoryResources_WriteResourceFileFromObject_Call) Run(run func(ctx context.Context, obj *unstructured.Unstructured, options WriteOptions)) *MockRepositoryResources_WriteResourceFileFromObject_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*unstructured.Unstructured), args[2].(WriteOptions))
})
return _c
}
func (_c *MockRepositoryResources_WriteResourceFileFromObject_Call) Return(_a0 string, _a1 error) *MockRepositoryResources_WriteResourceFileFromObject_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockRepositoryResources_WriteResourceFileFromObject_Call) RunAndReturn(run func(context.Context, *unstructured.Unstructured, WriteOptions) (string, error)) *MockRepositoryResources_WriteResourceFileFromObject_Call {
_c.Call.Return(run)
return _c
}
// EnsureFolderExists provides a mock function with given fields: ctx, folder, parentID
func (_m *MockRepositoryResources) EnsureFolderExists(ctx context.Context, folder Folder, parentID string) error {
ret := _m.Called(ctx, folder, parentID)
if len(ret) == 0 {
panic("no return value specified for EnsureFolderExists")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, Folder, string) error); ok {
r0 = rf(ctx, folder, parentID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRepositoryResources_EnsureFolderExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnsureFolderExists'
type MockRepositoryResources_EnsureFolderExists_Call struct {
*mock.Call
}
// EnsureFolderExists is a helper method to define mock.On call
// - ctx context.Context
// - folder Folder
// - parentID string
func (_e *MockRepositoryResources_Expecter) EnsureFolderExists(ctx interface{}, folder interface{}, parentID interface{}) *MockRepositoryResources_EnsureFolderExists_Call {
return &MockRepositoryResources_EnsureFolderExists_Call{Call: _e.mock.On("EnsureFolderExists", ctx, folder, parentID)}
}
func (_c *MockRepositoryResources_EnsureFolderExists_Call) Run(run func(ctx context.Context, folder Folder, parentID string)) *MockRepositoryResources_EnsureFolderExists_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(Folder), args[2].(string))
})
return _c
}
func (_c *MockRepositoryResources_EnsureFolderExists_Call) Return(_a0 error) *MockRepositoryResources_EnsureFolderExists_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockRepositoryResources_EnsureFolderExists_Call) RunAndReturn(run func(context.Context, Folder, string) error) *MockRepositoryResources_EnsureFolderExists_Call {
_c.Call.Return(run)
return _c
}
// EnsureFolderPathExist provides a mock function with given fields: ctx, filePath
func (_m *MockRepositoryResources) EnsureFolderPathExist(ctx context.Context, filePath string) (string, error) {
ret := _m.Called(ctx, filePath)
if len(ret) == 0 {
panic("no return value specified for EnsureFolderPathExist")
}
var r0 string
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string) (string, error)); ok {
return rf(ctx, filePath)
}
if rf, ok := ret.Get(0).(func(context.Context, string) string); ok {
r0 = rf(ctx, filePath)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = rf(ctx, filePath)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRepositoryResources_EnsureFolderPathExist_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnsureFolderPathExist'
type MockRepositoryResources_EnsureFolderPathExist_Call struct {
*mock.Call
}
// EnsureFolderPathExist is a helper method to define mock.On call
// - ctx context.Context
// - filePath string
func (_e *MockRepositoryResources_Expecter) EnsureFolderPathExist(ctx interface{}, filePath interface{}) *MockRepositoryResources_EnsureFolderPathExist_Call {
return &MockRepositoryResources_EnsureFolderPathExist_Call{Call: _e.mock.On("EnsureFolderPathExist", ctx, filePath)}
}
func (_c *MockRepositoryResources_EnsureFolderPathExist_Call) Run(run func(ctx context.Context, filePath string)) *MockRepositoryResources_EnsureFolderPathExist_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockRepositoryResources_EnsureFolderPathExist_Call) Return(parent string, err error) *MockRepositoryResources_EnsureFolderPathExist_Call {
_c.Call.Return(parent, err)
return _c
}
func (_c *MockRepositoryResources_EnsureFolderPathExist_Call) RunAndReturn(run func(context.Context, string) (string, error)) *MockRepositoryResources_EnsureFolderPathExist_Call {
_c.Call.Return(run)
return _c
}
// EnsureFolderTreeExists provides a mock function with given fields: ctx, ref, path, tree, fn
func (_m *MockRepositoryResources) EnsureFolderTreeExists(ctx context.Context, ref string, path string, tree FolderTree, fn func(Folder, bool, error) error) error {
ret := _m.Called(ctx, ref, path, tree, fn)
if len(ret) == 0 {
panic("no return value specified for EnsureFolderTreeExists")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, FolderTree, func(Folder, bool, error) error) error); ok {
r0 = rf(ctx, ref, path, tree, fn)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockRepositoryResources_EnsureFolderTreeExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnsureFolderTreeExists'
type MockRepositoryResources_EnsureFolderTreeExists_Call struct {
*mock.Call
}
// EnsureFolderTreeExists is a helper method to define mock.On call
// - ctx context.Context
// - ref string
// - path string
// - tree FolderTree
// - fn func(Folder , bool , error) error
func (_e *MockRepositoryResources_Expecter) EnsureFolderTreeExists(ctx interface{}, ref interface{}, path interface{}, tree interface{}, fn interface{}) *MockRepositoryResources_EnsureFolderTreeExists_Call {
return &MockRepositoryResources_EnsureFolderTreeExists_Call{Call: _e.mock.On("EnsureFolderTreeExists", ctx, ref, path, tree, fn)}
}
func (_c *MockRepositoryResources_EnsureFolderTreeExists_Call) Run(run func(ctx context.Context, ref string, path string, tree FolderTree, fn func(Folder, bool, error) error)) *MockRepositoryResources_EnsureFolderTreeExists_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(FolderTree), args[4].(func(Folder, bool, error) error))
})
return _c
}
func (_c *MockRepositoryResources_EnsureFolderTreeExists_Call) Return(_a0 error) *MockRepositoryResources_EnsureFolderTreeExists_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *MockRepositoryResources_EnsureFolderTreeExists_Call) RunAndReturn(run func(context.Context, string, string, FolderTree, func(Folder, bool, error) error) error) *MockRepositoryResources_EnsureFolderTreeExists_Call {
_c.Call.Return(run)
return _c
}
// List provides a mock function with given fields: ctx
func (_m *MockRepositoryResources) List(ctx context.Context) (*v0alpha1.ResourceList, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for List")
}
var r0 *v0alpha1.ResourceList
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*v0alpha1.ResourceList, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *v0alpha1.ResourceList); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0alpha1.ResourceList)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRepositoryResources_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type MockRepositoryResources_List_Call struct {
*mock.Call
}
// List is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockRepositoryResources_Expecter) List(ctx interface{}) *MockRepositoryResources_List_Call {
return &MockRepositoryResources_List_Call{Call: _e.mock.On("List", ctx)}
}
func (_c *MockRepositoryResources_List_Call) Run(run func(ctx context.Context)) *MockRepositoryResources_List_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockRepositoryResources_List_Call) Return(_a0 *v0alpha1.ResourceList, _a1 error) *MockRepositoryResources_List_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockRepositoryResources_List_Call) RunAndReturn(run func(context.Context) (*v0alpha1.ResourceList, error)) *MockRepositoryResources_List_Call {
_c.Call.Return(run)
return _c
}
// RemoveResourceFromFile provides a mock function with given fields: ctx, path, ref
func (_m *MockRepositoryResources) RemoveResourceFromFile(ctx context.Context, path string, ref string) (string, schema.GroupVersionKind, error) {
ret := _m.Called(ctx, path, ref)
if len(ret) == 0 {
panic("no return value specified for RemoveResourceFromFile")
}
var r0 string
var r1 schema.GroupVersionKind
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (string, schema.GroupVersionKind, error)); ok {
return rf(ctx, path, ref)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
r0 = rf(ctx, path, ref)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) schema.GroupVersionKind); ok {
r1 = rf(ctx, path, ref)
} else {
r1 = ret.Get(1).(schema.GroupVersionKind)
}
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(ctx, path, ref)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// MockRepositoryResources_RemoveResourceFromFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveResourceFromFile'
type MockRepositoryResources_RemoveResourceFromFile_Call struct {
*mock.Call
}
// RemoveResourceFromFile is a helper method to define mock.On call
// - ctx context.Context
// - path string
// - ref string
func (_e *MockRepositoryResources_Expecter) RemoveResourceFromFile(ctx interface{}, path interface{}, ref interface{}) *MockRepositoryResources_RemoveResourceFromFile_Call {
return &MockRepositoryResources_RemoveResourceFromFile_Call{Call: _e.mock.On("RemoveResourceFromFile", ctx, path, ref)}
}
func (_c *MockRepositoryResources_RemoveResourceFromFile_Call) Run(run func(ctx context.Context, path string, ref string)) *MockRepositoryResources_RemoveResourceFromFile_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockRepositoryResources_RemoveResourceFromFile_Call) Return(_a0 string, _a1 schema.GroupVersionKind, _a2 error) *MockRepositoryResources_RemoveResourceFromFile_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *MockRepositoryResources_RemoveResourceFromFile_Call) RunAndReturn(run func(context.Context, string, string) (string, schema.GroupVersionKind, error)) *MockRepositoryResources_RemoveResourceFromFile_Call {
_c.Call.Return(run)
return _c
}
// RenameResourceFile provides a mock function with given fields: ctx, path, previousRef, newPath, newRef
func (_m *MockRepositoryResources) RenameResourceFile(ctx context.Context, path string, previousRef string, newPath string, newRef string) (string, schema.GroupVersionKind, error) {
ret := _m.Called(ctx, path, previousRef, newPath, newRef)
if len(ret) == 0 {
panic("no return value specified for RenameResourceFile")
}
var r0 string
var r1 schema.GroupVersionKind
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) (string, schema.GroupVersionKind, error)); ok {
return rf(ctx, path, previousRef, newPath, newRef)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) string); ok {
r0 = rf(ctx, path, previousRef, newPath, newRef)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string) schema.GroupVersionKind); ok {
r1 = rf(ctx, path, previousRef, newPath, newRef)
} else {
r1 = ret.Get(1).(schema.GroupVersionKind)
}
if rf, ok := ret.Get(2).(func(context.Context, string, string, string, string) error); ok {
r2 = rf(ctx, path, previousRef, newPath, newRef)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// MockRepositoryResources_RenameResourceFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameResourceFile'
type MockRepositoryResources_RenameResourceFile_Call struct {
*mock.Call
}
// RenameResourceFile is a helper method to define mock.On call
// - ctx context.Context
// - path string
// - previousRef string
// - newPath string
// - newRef string
func (_e *MockRepositoryResources_Expecter) RenameResourceFile(ctx interface{}, path interface{}, previousRef interface{}, newPath interface{}, newRef interface{}) *MockRepositoryResources_RenameResourceFile_Call {
return &MockRepositoryResources_RenameResourceFile_Call{Call: _e.mock.On("RenameResourceFile", ctx, path, previousRef, newPath, newRef)}
}
func (_c *MockRepositoryResources_RenameResourceFile_Call) Run(run func(ctx context.Context, path string, previousRef string, newPath string, newRef string)) *MockRepositoryResources_RenameResourceFile_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string), args[4].(string))
})
return _c
}
func (_c *MockRepositoryResources_RenameResourceFile_Call) Return(_a0 string, _a1 schema.GroupVersionKind, _a2 error) *MockRepositoryResources_RenameResourceFile_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *MockRepositoryResources_RenameResourceFile_Call) RunAndReturn(run func(context.Context, string, string, string, string) (string, schema.GroupVersionKind, error)) *MockRepositoryResources_RenameResourceFile_Call {
_c.Call.Return(run)
return _c
}
// SetTree provides a mock function with given fields: tree
func (_m *MockRepositoryResources) SetTree(tree FolderTree) {
_m.Called(tree)
}
// MockRepositoryResources_SetTree_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTree'
type MockRepositoryResources_SetTree_Call struct {
*mock.Call
}
// SetTree is a helper method to define mock.On call
// - tree FolderTree
func (_e *MockRepositoryResources_Expecter) SetTree(tree interface{}) *MockRepositoryResources_SetTree_Call {
return &MockRepositoryResources_SetTree_Call{Call: _e.mock.On("SetTree", tree)}
}
func (_c *MockRepositoryResources_SetTree_Call) Run(run func(tree FolderTree)) *MockRepositoryResources_SetTree_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(FolderTree))
})
return _c
}
func (_c *MockRepositoryResources_SetTree_Call) Return() *MockRepositoryResources_SetTree_Call {
_c.Call.Return()
return _c
}
func (_c *MockRepositoryResources_SetTree_Call) RunAndReturn(run func(FolderTree)) *MockRepositoryResources_SetTree_Call {
_c.Run(run)
return _c
}
// Stats provides a mock function with given fields: ctx
func (_m *MockRepositoryResources) Stats(ctx context.Context) (*v0alpha1.ResourceStats, error) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for Stats")
}
var r0 *v0alpha1.ResourceStats
var r1 error
if rf, ok := ret.Get(0).(func(context.Context) (*v0alpha1.ResourceStats, error)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) *v0alpha1.ResourceStats); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*v0alpha1.ResourceStats)
}
}
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
r1 = rf(ctx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockRepositoryResources_Stats_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stats'
type MockRepositoryResources_Stats_Call struct {
*mock.Call
}
// Stats is a helper method to define mock.On call
// - ctx context.Context
func (_e *MockRepositoryResources_Expecter) Stats(ctx interface{}) *MockRepositoryResources_Stats_Call {
return &MockRepositoryResources_Stats_Call{Call: _e.mock.On("Stats", ctx)}
}
func (_c *MockRepositoryResources_Stats_Call) Run(run func(ctx context.Context)) *MockRepositoryResources_Stats_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockRepositoryResources_Stats_Call) Return(_a0 *v0alpha1.ResourceStats, _a1 error) *MockRepositoryResources_Stats_Call {
_c.Call.Return(_a0, _a1)
return _c
}
func (_c *MockRepositoryResources_Stats_Call) RunAndReturn(run func(context.Context) (*v0alpha1.ResourceStats, error)) *MockRepositoryResources_Stats_Call {
_c.Call.Return(run)
return _c
}
// WriteResourceFromFile provides a mock function with given fields: ctx, path, ref
func (_m *MockRepositoryResources) WriteResourceFromFile(ctx context.Context, path string, ref string) (string, schema.GroupVersionKind, error) {
ret := _m.Called(ctx, path, ref)
if len(ret) == 0 {
panic("no return value specified for WriteResourceFromFile")
}
var r0 string
var r1 schema.GroupVersionKind
var r2 error
if rf, ok := ret.Get(0).(func(context.Context, string, string) (string, schema.GroupVersionKind, error)); ok {
return rf(ctx, path, ref)
}
if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
r0 = rf(ctx, path, ref)
} else {
r0 = ret.Get(0).(string)
}
if rf, ok := ret.Get(1).(func(context.Context, string, string) schema.GroupVersionKind); ok {
r1 = rf(ctx, path, ref)
} else {
r1 = ret.Get(1).(schema.GroupVersionKind)
}
if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok {
r2 = rf(ctx, path, ref)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// MockRepositoryResources_WriteResourceFromFile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteResourceFromFile'
type MockRepositoryResources_WriteResourceFromFile_Call struct {
*mock.Call
}
// WriteResourceFromFile is a helper method to define mock.On call
// - ctx context.Context
// - path string
// - ref string
func (_e *MockRepositoryResources_Expecter) WriteResourceFromFile(ctx interface{}, path interface{}, ref interface{}) *MockRepositoryResources_WriteResourceFromFile_Call {
return &MockRepositoryResources_WriteResourceFromFile_Call{Call: _e.mock.On("WriteResourceFromFile", ctx, path, ref)}
}
func (_c *MockRepositoryResources_WriteResourceFromFile_Call) Run(run func(ctx context.Context, path string, ref string)) *MockRepositoryResources_WriteResourceFromFile_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockRepositoryResources_WriteResourceFromFile_Call) Return(_a0 string, _a1 schema.GroupVersionKind, _a2 error) *MockRepositoryResources_WriteResourceFromFile_Call {
_c.Call.Return(_a0, _a1, _a2)
return _c
}
func (_c *MockRepositoryResources_WriteResourceFromFile_Call) RunAndReturn(run func(context.Context, string, string) (string, schema.GroupVersionKind, error)) *MockRepositoryResources_WriteResourceFromFile_Call {
_c.Call.Return(run)
return _c
}
// NewMockRepositoryResources creates a new instance of MockRepositoryResources. 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 NewMockRepositoryResources(t interface {
mock.TestingT
Cleanup(func())
}) *MockRepositoryResources {
mock := &MockRepositoryResources{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}