mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 05:42:31 +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.8 KiB
Go
97 lines
2.8 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"
|
|
)
|
|
|
|
// MockParserFactory is an autogenerated mock type for the ParserFactory type
|
|
type MockParserFactory struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockParserFactory_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockParserFactory) EXPECT() *MockParserFactory_Expecter {
|
|
return &MockParserFactory_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// GetParser provides a mock function with given fields: ctx, repo
|
|
func (_m *MockParserFactory) GetParser(ctx context.Context, repo repository.Reader) (Parser, error) {
|
|
ret := _m.Called(ctx, repo)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetParser")
|
|
}
|
|
|
|
var r0 Parser
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, repository.Reader) (Parser, error)); ok {
|
|
return rf(ctx, repo)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, repository.Reader) Parser); ok {
|
|
r0 = rf(ctx, repo)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(Parser)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, repository.Reader) error); ok {
|
|
r1 = rf(ctx, repo)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockParserFactory_GetParser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetParser'
|
|
type MockParserFactory_GetParser_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetParser is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - repo repository.Reader
|
|
func (_e *MockParserFactory_Expecter) GetParser(ctx interface{}, repo interface{}) *MockParserFactory_GetParser_Call {
|
|
return &MockParserFactory_GetParser_Call{Call: _e.mock.On("GetParser", ctx, repo)}
|
|
}
|
|
|
|
func (_c *MockParserFactory_GetParser_Call) Run(run func(ctx context.Context, repo repository.Reader)) *MockParserFactory_GetParser_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(repository.Reader))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockParserFactory_GetParser_Call) Return(_a0 Parser, _a1 error) *MockParserFactory_GetParser_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockParserFactory_GetParser_Call) RunAndReturn(run func(context.Context, repository.Reader) (Parser, error)) *MockParserFactory_GetParser_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockParserFactory creates a new instance of MockParserFactory. 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 NewMockParserFactory(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockParserFactory {
|
|
mock := &MockParserFactory{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|