a6a9358d5b
This change implements the `/repositories` subresource endpoint for Connection resources, enabling listing of repositories accessible through a GitHub App connection. Changes: - Add ListRepositories method to Connection interface - Add ListInstallationRepositories to GitHub Client interface - Implement GitHub client method to list installation repositories - Creates installation access token from JWT - Handles pagination up to 1000 repos - Implement ListRepositories in GitHub Connection - Update connectionRepositoriesConnector to use Connection.ListRepositories - Add ConnectionGetter interface and GetConnection method to APIBuilder - Add comprehensive tests for the new functionality
209 lines
6.2 KiB
Go
209 lines
6.2 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}
|
|
}
|
|
|
|
// GetApp provides a mock function with given fields: ctx
|
|
func (_m *MockClient) GetApp(ctx context.Context) (App, error) {
|
|
ret := _m.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetApp")
|
|
}
|
|
|
|
var r0 App
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context) (App, error)); ok {
|
|
return rf(ctx)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context) App); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
r0 = ret.Get(0).(App)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_GetApp_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetApp'
|
|
type MockClient_GetApp_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetApp is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
func (_e *MockClient_Expecter) GetApp(ctx interface{}) *MockClient_GetApp_Call {
|
|
return &MockClient_GetApp_Call{Call: _e.mock.On("GetApp", ctx)}
|
|
}
|
|
|
|
func (_c *MockClient_GetApp_Call) Run(run func(ctx context.Context)) *MockClient_GetApp_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_GetApp_Call) Return(_a0 App, _a1 error) *MockClient_GetApp_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_GetApp_Call) RunAndReturn(run func(context.Context) (App, error)) *MockClient_GetApp_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetAppInstallation provides a mock function with given fields: ctx, installationID
|
|
func (_m *MockClient) GetAppInstallation(ctx context.Context, installationID string) (AppInstallation, error) {
|
|
ret := _m.Called(ctx, installationID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetAppInstallation")
|
|
}
|
|
|
|
var r0 AppInstallation
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (AppInstallation, error)); ok {
|
|
return rf(ctx, installationID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) AppInstallation); ok {
|
|
r0 = rf(ctx, installationID)
|
|
} else {
|
|
r0 = ret.Get(0).(AppInstallation)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, installationID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_GetAppInstallation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAppInstallation'
|
|
type MockClient_GetAppInstallation_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetAppInstallation is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - installationID string
|
|
func (_e *MockClient_Expecter) GetAppInstallation(ctx interface{}, installationID interface{}) *MockClient_GetAppInstallation_Call {
|
|
return &MockClient_GetAppInstallation_Call{Call: _e.mock.On("GetAppInstallation", ctx, installationID)}
|
|
}
|
|
|
|
func (_c *MockClient_GetAppInstallation_Call) Run(run func(ctx context.Context, installationID string)) *MockClient_GetAppInstallation_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_GetAppInstallation_Call) Return(_a0 AppInstallation, _a1 error) *MockClient_GetAppInstallation_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_GetAppInstallation_Call) RunAndReturn(run func(context.Context, string) (AppInstallation, error)) *MockClient_GetAppInstallation_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListInstallationRepositories provides a mock function with given fields: ctx, installationID
|
|
func (_m *MockClient) ListInstallationRepositories(ctx context.Context, installationID string) ([]Repository, error) {
|
|
ret := _m.Called(ctx, installationID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListInstallationRepositories")
|
|
}
|
|
|
|
var r0 []Repository
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ([]Repository, error)); ok {
|
|
return rf(ctx, installationID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) []Repository); ok {
|
|
r0 = rf(ctx, installationID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]Repository)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, installationID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// MockClient_ListInstallationRepositories_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListInstallationRepositories'
|
|
type MockClient_ListInstallationRepositories_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListInstallationRepositories is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - installationID string
|
|
func (_e *MockClient_Expecter) ListInstallationRepositories(ctx interface{}, installationID interface{}) *MockClient_ListInstallationRepositories_Call {
|
|
return &MockClient_ListInstallationRepositories_Call{Call: _e.mock.On("ListInstallationRepositories", ctx, installationID)}
|
|
}
|
|
|
|
func (_c *MockClient_ListInstallationRepositories_Call) Run(run func(ctx context.Context, installationID string)) *MockClient_ListInstallationRepositories_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(string))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_ListInstallationRepositories_Call) Return(_a0 []Repository, _a1 error) *MockClient_ListInstallationRepositories_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockClient_ListInstallationRepositories_Call) RunAndReturn(run func(context.Context, string) ([]Repository, error)) *MockClient_ListInstallationRepositories_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
|
|
}
|