* Move repository package to apps
* Move operators to grafana/grafana
* Go mod tidy
* Own package by git sync team for now
* Merged
* Do not use settings in local extra
* Remove dependency on webhook extra
* Hack to work around issue with secure contracts
* Sync Go modules
* Revert "Move operators to grafana/grafana"
This reverts commit 9f19b30a2e.
486 lines
17 KiB
Go
486 lines
17 KiB
Go
// Code generated by mockery v2.53.4. DO NOT EDIT.
|
|
|
|
package github
|
|
|
|
import (
|
|
context "context"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// MockClient is an autogenerated mock type for the Client type
|
|
type MockClient struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockClient_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockClient) EXPECT() *MockClient_Expecter {
|
|
return &MockClient_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Commits provides a mock function with given fields: ctx, owner, repository, path, branch
|
|
func (_m *MockClient) Commits(ctx context.Context, owner string, repository string, path string, branch string) ([]Commit, error) {
|
|
ret := _m.Called(ctx, owner, repository, path, branch)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Commits")
|
|
}
|
|
|
|
var r0 []Commit
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) ([]Commit, error)); ok {
|
|
return rf(ctx, owner, repository, path, branch)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, string, string) []Commit); ok {
|
|
r0 = rf(ctx, owner, repository, path, branch)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]Commit)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, string, string) error); ok {
|
|
r1 = rf(ctx, owner, repository, path, branch)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_Commits_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Commits'
|
|
type MockClient_Commits_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Commits is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - path string
|
|
// - branch string
|
|
func (_e *MockClient_Expecter) Commits(ctx interface{}, owner interface{}, repository interface{}, path interface{}, branch interface{}) *MockClient_Commits_Call {
|
|
return &MockClient_Commits_Call{Call: _e.mock.On("Commits", ctx, owner, repository, path, branch)}
|
|
}
|
|
|
|
func (_c *MockClient_Commits_Call) Run(run func(ctx context.Context, owner string, repository string, path string, branch string)) *MockClient_Commits_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 *MockClient_Commits_Call) Return(_a0 []Commit, _a1 error) *MockClient_Commits_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_Commits_Call) RunAndReturn(run func(context.Context, string, string, string, string) ([]Commit, error)) *MockClient_Commits_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// CreatePullRequestComment provides a mock function with given fields: ctx, owner, repository, number, body
|
|
func (_m *MockClient) CreatePullRequestComment(ctx context.Context, owner string, repository string, number int, body string) error {
|
|
ret := _m.Called(ctx, owner, repository, number, body)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreatePullRequestComment")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int, string) error); ok {
|
|
r0 = rf(ctx, owner, repository, number, body)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockClient_CreatePullRequestComment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreatePullRequestComment'
|
|
type MockClient_CreatePullRequestComment_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// CreatePullRequestComment is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - number int
|
|
// - body string
|
|
func (_e *MockClient_Expecter) CreatePullRequestComment(ctx interface{}, owner interface{}, repository interface{}, number interface{}, body interface{}) *MockClient_CreatePullRequestComment_Call {
|
|
return &MockClient_CreatePullRequestComment_Call{Call: _e.mock.On("CreatePullRequestComment", ctx, owner, repository, number, body)}
|
|
}
|
|
|
|
func (_c *MockClient_CreatePullRequestComment_Call) Run(run func(ctx context.Context, owner string, repository string, number int, body string)) *MockClient_CreatePullRequestComment_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int), args[4].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_CreatePullRequestComment_Call) Return(_a0 error) *MockClient_CreatePullRequestComment_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_CreatePullRequestComment_Call) RunAndReturn(run func(context.Context, string, string, int, string) error) *MockClient_CreatePullRequestComment_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// CreateWebhook provides a mock function with given fields: ctx, owner, repository, cfg
|
|
func (_m *MockClient) CreateWebhook(ctx context.Context, owner string, repository string, cfg WebhookConfig) (WebhookConfig, error) {
|
|
ret := _m.Called(ctx, owner, repository, cfg)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreateWebhook")
|
|
}
|
|
|
|
var r0 WebhookConfig
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, WebhookConfig) (WebhookConfig, error)); ok {
|
|
return rf(ctx, owner, repository, cfg)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, WebhookConfig) WebhookConfig); ok {
|
|
r0 = rf(ctx, owner, repository, cfg)
|
|
} else {
|
|
r0 = ret.Get(0).(WebhookConfig)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, WebhookConfig) error); ok {
|
|
r1 = rf(ctx, owner, repository, cfg)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_CreateWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateWebhook'
|
|
type MockClient_CreateWebhook_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// CreateWebhook is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - cfg WebhookConfig
|
|
func (_e *MockClient_Expecter) CreateWebhook(ctx interface{}, owner interface{}, repository interface{}, cfg interface{}) *MockClient_CreateWebhook_Call {
|
|
return &MockClient_CreateWebhook_Call{Call: _e.mock.On("CreateWebhook", ctx, owner, repository, cfg)}
|
|
}
|
|
|
|
func (_c *MockClient_CreateWebhook_Call) Run(run func(ctx context.Context, owner string, repository string, cfg WebhookConfig)) *MockClient_CreateWebhook_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(WebhookConfig))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_CreateWebhook_Call) Return(_a0 WebhookConfig, _a1 error) *MockClient_CreateWebhook_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_CreateWebhook_Call) RunAndReturn(run func(context.Context, string, string, WebhookConfig) (WebhookConfig, error)) *MockClient_CreateWebhook_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// DeleteWebhook provides a mock function with given fields: ctx, owner, repository, webhookID
|
|
func (_m *MockClient) DeleteWebhook(ctx context.Context, owner string, repository string, webhookID int64) error {
|
|
ret := _m.Called(ctx, owner, repository, webhookID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteWebhook")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) error); ok {
|
|
r0 = rf(ctx, owner, repository, webhookID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockClient_DeleteWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteWebhook'
|
|
type MockClient_DeleteWebhook_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DeleteWebhook is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - webhookID int64
|
|
func (_e *MockClient_Expecter) DeleteWebhook(ctx interface{}, owner interface{}, repository interface{}, webhookID interface{}) *MockClient_DeleteWebhook_Call {
|
|
return &MockClient_DeleteWebhook_Call{Call: _e.mock.On("DeleteWebhook", ctx, owner, repository, webhookID)}
|
|
}
|
|
|
|
func (_c *MockClient_DeleteWebhook_Call) Run(run func(ctx context.Context, owner string, repository string, webhookID int64)) *MockClient_DeleteWebhook_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_DeleteWebhook_Call) Return(_a0 error) *MockClient_DeleteWebhook_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_DeleteWebhook_Call) RunAndReturn(run func(context.Context, string, string, int64) error) *MockClient_DeleteWebhook_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// EditWebhook provides a mock function with given fields: ctx, owner, repository, cfg
|
|
func (_m *MockClient) EditWebhook(ctx context.Context, owner string, repository string, cfg WebhookConfig) error {
|
|
ret := _m.Called(ctx, owner, repository, cfg)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for EditWebhook")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, WebhookConfig) error); ok {
|
|
r0 = rf(ctx, owner, repository, cfg)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// MockClient_EditWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EditWebhook'
|
|
type MockClient_EditWebhook_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// EditWebhook is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - cfg WebhookConfig
|
|
func (_e *MockClient_Expecter) EditWebhook(ctx interface{}, owner interface{}, repository interface{}, cfg interface{}) *MockClient_EditWebhook_Call {
|
|
return &MockClient_EditWebhook_Call{Call: _e.mock.On("EditWebhook", ctx, owner, repository, cfg)}
|
|
}
|
|
|
|
func (_c *MockClient_EditWebhook_Call) Run(run func(ctx context.Context, owner string, repository string, cfg WebhookConfig)) *MockClient_EditWebhook_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(WebhookConfig))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_EditWebhook_Call) Return(_a0 error) *MockClient_EditWebhook_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_EditWebhook_Call) RunAndReturn(run func(context.Context, string, string, WebhookConfig) error) *MockClient_EditWebhook_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetWebhook provides a mock function with given fields: ctx, owner, repository, webhookID
|
|
func (_m *MockClient) GetWebhook(ctx context.Context, owner string, repository string, webhookID int64) (WebhookConfig, error) {
|
|
ret := _m.Called(ctx, owner, repository, webhookID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetWebhook")
|
|
}
|
|
|
|
var r0 WebhookConfig
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (WebhookConfig, error)); ok {
|
|
return rf(ctx, owner, repository, webhookID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) WebhookConfig); ok {
|
|
r0 = rf(ctx, owner, repository, webhookID)
|
|
} else {
|
|
r0 = ret.Get(0).(WebhookConfig)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok {
|
|
r1 = rf(ctx, owner, repository, webhookID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_GetWebhook_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetWebhook'
|
|
type MockClient_GetWebhook_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetWebhook is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - webhookID int64
|
|
func (_e *MockClient_Expecter) GetWebhook(ctx interface{}, owner interface{}, repository interface{}, webhookID interface{}) *MockClient_GetWebhook_Call {
|
|
return &MockClient_GetWebhook_Call{Call: _e.mock.On("GetWebhook", ctx, owner, repository, webhookID)}
|
|
}
|
|
|
|
func (_c *MockClient_GetWebhook_Call) Run(run func(ctx context.Context, owner string, repository string, webhookID int64)) *MockClient_GetWebhook_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_GetWebhook_Call) Return(_a0 WebhookConfig, _a1 error) *MockClient_GetWebhook_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_GetWebhook_Call) RunAndReturn(run func(context.Context, string, string, int64) (WebhookConfig, error)) *MockClient_GetWebhook_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListPullRequestFiles provides a mock function with given fields: ctx, owner, repository, number
|
|
func (_m *MockClient) ListPullRequestFiles(ctx context.Context, owner string, repository string, number int) ([]CommitFile, error) {
|
|
ret := _m.Called(ctx, owner, repository, number)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListPullRequestFiles")
|
|
}
|
|
|
|
var r0 []CommitFile
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int) ([]CommitFile, error)); ok {
|
|
return rf(ctx, owner, repository, number)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int) []CommitFile); ok {
|
|
r0 = rf(ctx, owner, repository, number)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]CommitFile)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, int) error); ok {
|
|
r1 = rf(ctx, owner, repository, number)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_ListPullRequestFiles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPullRequestFiles'
|
|
type MockClient_ListPullRequestFiles_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListPullRequestFiles is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
// - number int
|
|
func (_e *MockClient_Expecter) ListPullRequestFiles(ctx interface{}, owner interface{}, repository interface{}, number interface{}) *MockClient_ListPullRequestFiles_Call {
|
|
return &MockClient_ListPullRequestFiles_Call{Call: _e.mock.On("ListPullRequestFiles", ctx, owner, repository, number)}
|
|
}
|
|
|
|
func (_c *MockClient_ListPullRequestFiles_Call) Run(run func(ctx context.Context, owner string, repository string, number int)) *MockClient_ListPullRequestFiles_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(int))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_ListPullRequestFiles_Call) Return(_a0 []CommitFile, _a1 error) *MockClient_ListPullRequestFiles_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_ListPullRequestFiles_Call) RunAndReturn(run func(context.Context, string, string, int) ([]CommitFile, error)) *MockClient_ListPullRequestFiles_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListWebhooks provides a mock function with given fields: ctx, owner, repository
|
|
func (_m *MockClient) ListWebhooks(ctx context.Context, owner string, repository string) ([]WebhookConfig, error) {
|
|
ret := _m.Called(ctx, owner, repository)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListWebhooks")
|
|
}
|
|
|
|
var r0 []WebhookConfig
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) ([]WebhookConfig, error)); ok {
|
|
return rf(ctx, owner, repository)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) []WebhookConfig); ok {
|
|
r0 = rf(ctx, owner, repository)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]WebhookConfig)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
|
|
r1 = rf(ctx, owner, repository)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_ListWebhooks_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListWebhooks'
|
|
type MockClient_ListWebhooks_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListWebhooks is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - owner string
|
|
// - repository string
|
|
func (_e *MockClient_Expecter) ListWebhooks(ctx interface{}, owner interface{}, repository interface{}) *MockClient_ListWebhooks_Call {
|
|
return &MockClient_ListWebhooks_Call{Call: _e.mock.On("ListWebhooks", ctx, owner, repository)}
|
|
}
|
|
|
|
func (_c *MockClient_ListWebhooks_Call) Run(run func(ctx context.Context, owner string, repository string)) *MockClient_ListWebhooks_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string), args[2].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_ListWebhooks_Call) Return(_a0 []WebhookConfig, _a1 error) *MockClient_ListWebhooks_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_ListWebhooks_Call) RunAndReturn(run func(context.Context, string, string) ([]WebhookConfig, error)) *MockClient_ListWebhooks_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewMockClient creates a new instance of MockClient. 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 NewMockClient(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockClient {
|
|
mock := &MockClient{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|