mirror of
https://github.com/grafana/grafana.git
synced 2025-07-30 05:53:15 +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
96 lines
2.7 KiB
Go
96 lines
2.7 KiB
Go
// Code generated by mockery v2.52.4. DO NOT EDIT.
|
|
|
|
package resources
|
|
|
|
import (
|
|
context "context"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockClientFactory is an autogenerated mock type for the ClientFactory type
|
|
type MockClientFactory struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockClientFactory_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockClientFactory) EXPECT() *MockClientFactory_Expecter {
|
|
return &MockClientFactory_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Clients provides a mock function with given fields: ctx, namespace
|
|
func (_m *MockClientFactory) Clients(ctx context.Context, namespace string) (ResourceClients, error) {
|
|
ret := _m.Called(ctx, namespace)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Clients")
|
|
}
|
|
|
|
var r0 ResourceClients
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (ResourceClients, error)); ok {
|
|
return rf(ctx, namespace)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ResourceClients); ok {
|
|
r0 = rf(ctx, namespace)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(ResourceClients)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, namespace)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClientFactory_Clients_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Clients'
|
|
type MockClientFactory_Clients_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Clients is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - namespace string
|
|
func (_e *MockClientFactory_Expecter) Clients(ctx interface{}, namespace interface{}) *MockClientFactory_Clients_Call {
|
|
return &MockClientFactory_Clients_Call{Call: _e.mock.On("Clients", ctx, namespace)}
|
|
}
|
|
|
|
func (_c *MockClientFactory_Clients_Call) Run(run func(ctx context.Context, namespace string)) *MockClientFactory_Clients_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClientFactory_Clients_Call) Return(_a0 ResourceClients, _a1 error) *MockClientFactory_Clients_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClientFactory_Clients_Call) RunAndReturn(run func(context.Context, string) (ResourceClients, error)) *MockClientFactory_Clients_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockClientFactory creates a new instance of MockClientFactory. 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 NewMockClientFactory(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockClientFactory {
|
|
mock := &MockClientFactory{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|