mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 05:32:32 +08:00

* Use interface for factories * Add most mocks to unit test jobs * Generate more mocks for main jobs package * Interface for parser * Use clients directly without parser * Regenerate mock * Eliminate resource clients from Parser * Interface for folder tree
97 lines
2.6 KiB
Go
97 lines
2.6 KiB
Go
// Code generated by mockery v2.52.4. DO NOT EDIT.
|
|
|
|
package resources
|
|
|
|
import (
|
|
context "context"
|
|
|
|
repository "github.com/grafana/grafana/pkg/registry/apis/provisioning/repository"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockParser is an autogenerated mock type for the Parser type
|
|
type MockParser struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockParser_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockParser) EXPECT() *MockParser_Expecter {
|
|
return &MockParser_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Parse provides a mock function with given fields: ctx, info
|
|
func (_m *MockParser) Parse(ctx context.Context, info *repository.FileInfo) (*ParsedResource, error) {
|
|
ret := _m.Called(ctx, info)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Parse")
|
|
}
|
|
|
|
var r0 *ParsedResource
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *repository.FileInfo) (*ParsedResource, error)); ok {
|
|
return rf(ctx, info)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *repository.FileInfo) *ParsedResource); ok {
|
|
r0 = rf(ctx, info)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*ParsedResource)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *repository.FileInfo) error); ok {
|
|
r1 = rf(ctx, info)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockParser_Parse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Parse'
|
|
type MockParser_Parse_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Parse is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - info *repository.FileInfo
|
|
func (_e *MockParser_Expecter) Parse(ctx interface{}, info interface{}) *MockParser_Parse_Call {
|
|
return &MockParser_Parse_Call{Call: _e.mock.On("Parse", ctx, info)}
|
|
}
|
|
|
|
func (_c *MockParser_Parse_Call) Run(run func(ctx context.Context, info *repository.FileInfo)) *MockParser_Parse_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(*repository.FileInfo))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockParser_Parse_Call) Return(parsed *ParsedResource, err error) *MockParser_Parse_Call {
|
|
_c.Call.Return(parsed, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockParser_Parse_Call) RunAndReturn(run func(context.Context, *repository.FileInfo) (*ParsedResource, error)) *MockParser_Parse_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockParser creates a new instance of MockParser. 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 NewMockParser(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockParser {
|
|
mock := &MockParser{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|