mirror of
https://github.com/harness/drone.git
synced 2025-05-03 15:12:15 +08:00

* fix merge conflicts * fix merge conflicts * fix review comment * fix review comment * fix review comment * fix: [AH-771]: gitness unit test refactoring * fix: [AH-771]: resolved review comments * fix: [AH-771]: resolved review comments * fix: [AH-771] Registry test refactoring and improvements - Refactored registry metadata test implementations - Improved code organization and readability - Fixed line length issues in test files - Removed unused fields from request.go - Added proper license headers - Fixed linting issues in mock files - Simplified test setup and assertions - Updated wire generation for cmd package - Added nolint:exhaustive directive for package type switch fix: [AH-771] Registry test refactoring and improvements - Refactored registry metadata test implementations - Improved code organization and readability - Fixed line length issues in test files - Removed unused fields from request.go - Added proper license headers - Fixed linting issues in mock files - Simplifi
293 lines
7.5 KiB
Go
293 lines
7.5 KiB
Go
// Code generated by testify. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/harness/gitness/registry/app/store"
|
|
"github.com/harness/gitness/registry/types"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// FetchUpstreamProxyIDs provides a mock function
|
|
func (m *RegistryRepository) FetchUpstreamProxyIDs(ctx context.Context, repokeys []string, parentID int64) ([]int64, error) {
|
|
ret := m.Called(ctx, repokeys, parentID)
|
|
|
|
var r0 []int64
|
|
if rf, ok := ret.Get(0).(func(context.Context, []string, int64) []int64); ok {
|
|
r0 = rf(ctx, repokeys, parentID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]int64)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, []string, int64) error); ok {
|
|
r1 = rf(ctx, repokeys, parentID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RegistryRepository is a mock of RegistryRepository interface.
|
|
type RegistryRepository struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// GetAll provides a mock function
|
|
func (m *RegistryRepository) GetAll(ctx context.Context, parentID int64, packageTypes []string, sortByField string, sortByOrder string, limit int, offset int, search string, repoType string, recursive bool) (*[]store.RegistryMetadata, error) {
|
|
ret := m.Called(ctx, parentID, packageTypes, sortByField, sortByOrder, limit, offset, search, repoType, recursive)
|
|
|
|
var r0 *[]store.RegistryMetadata
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []string, string, string, int, int, string, string, bool) *[]store.RegistryMetadata); ok {
|
|
r0 = rf(ctx, parentID, packageTypes, sortByField, sortByOrder, limit, offset, search, repoType, recursive)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*[]store.RegistryMetadata)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, []string, string, string, int, int, string, string, bool) error); ok {
|
|
r1 = rf(ctx, parentID, packageTypes, sortByField, sortByOrder, limit, offset, search, repoType, recursive)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FetchUpstreamProxyKeys provides a mock function
|
|
func (m *RegistryRepository) FetchUpstreamProxyKeys(ctx context.Context, ids []int64) ([]string, error) {
|
|
ret := m.Called(ctx, ids)
|
|
|
|
var r0 []string
|
|
if rf, ok := ret.Get(0).(func(context.Context, []int64) []string); ok {
|
|
r0 = rf(ctx, ids)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]string)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, []int64) error); ok {
|
|
r1 = rf(ctx, ids)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Get provides a mock function
|
|
func (m *RegistryRepository) Get(ctx context.Context, id int64) (*types.Registry, error) {
|
|
ret := m.Called(ctx, id)
|
|
|
|
var r0 *types.Registry
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *types.Registry); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Registry)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetByIDIn provides a mock function
|
|
func (m *RegistryRepository) GetByIDIn(ctx context.Context, ids []int64) (*[]types.Registry, error) {
|
|
ret := m.Called(ctx, ids)
|
|
|
|
var r0 *[]types.Registry
|
|
if rf, ok := ret.Get(0).(func(context.Context, []int64) *[]types.Registry); ok {
|
|
r0 = rf(ctx, ids)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*[]types.Registry)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, []int64) error); ok {
|
|
r1 = rf(ctx, ids)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetByParentIDAndName provides a mock function
|
|
func (m *RegistryRepository) GetByParentIDAndName(ctx context.Context, parentID int64, name string) (*types.Registry, error) {
|
|
ret := m.Called(ctx, parentID, name)
|
|
|
|
var r0 *types.Registry
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) *types.Registry); ok {
|
|
r0 = rf(ctx, parentID, name)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Registry)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, parentID, name)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetByRootParentIDAndName provides a mock function
|
|
func (m *RegistryRepository) GetByRootParentIDAndName(ctx context.Context, parentID int64, name string) (*types.Registry, error) {
|
|
ret := m.Called(ctx, parentID, name)
|
|
|
|
var r0 *types.Registry
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) *types.Registry); ok {
|
|
r0 = rf(ctx, parentID, name)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.Registry)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, parentID, name)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Create provides a mock function
|
|
func (m *RegistryRepository) Create(ctx context.Context, registry *types.Registry) (int64, error) {
|
|
ret := m.Called(ctx, registry)
|
|
|
|
var r0 int64
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Registry) int64); ok {
|
|
r0 = rf(ctx, registry)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *types.Registry) error); ok {
|
|
r1 = rf(ctx, registry)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Delete provides a mock function
|
|
func (m *RegistryRepository) Delete(ctx context.Context, parentID int64, name string) error {
|
|
ret := m.Called(ctx, parentID, name)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) error); ok {
|
|
r0 = rf(ctx, parentID, name)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Update provides a mock function
|
|
func (m *RegistryRepository) Update(ctx context.Context, registry *types.Registry) error {
|
|
ret := m.Called(ctx, registry)
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.Registry) error); ok {
|
|
r0 = rf(ctx, registry)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// CountAll provides a mock function
|
|
func (m *RegistryRepository) CountAll(ctx context.Context, parentID int64, packageTypes []string, search string, repoType string) (int64, error) {
|
|
ret := m.Called(ctx, parentID, packageTypes, search, repoType)
|
|
|
|
var r0 int64
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []string, string, string) int64); ok {
|
|
r0 = rf(ctx, parentID, packageTypes, search, repoType)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, []string, string, string) error); ok {
|
|
r1 = rf(ctx, parentID, packageTypes, search, repoType)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Count provides a mock function
|
|
func (m *RegistryRepository) Count(ctx context.Context) (int64, error) {
|
|
ret := m.Called(ctx)
|
|
|
|
var r0 int64
|
|
if rf, ok := ret.Get(0).(func(context.Context) int64); ok {
|
|
r0 = rf(ctx)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context) error); ok {
|
|
r1 = rf(ctx)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FetchRegistriesIDByUpstreamProxyID provides a mock function
|
|
func (m *RegistryRepository) FetchRegistriesIDByUpstreamProxyID(ctx context.Context, upstreamProxyID string, rootParentID int64) ([]int64, error) {
|
|
ret := m.Called(ctx, upstreamProxyID, rootParentID)
|
|
|
|
var r0 []int64
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) []int64); ok {
|
|
r0 = rf(ctx, upstreamProxyID, rootParentID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]int64)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok {
|
|
r1 = rf(ctx, upstreamProxyID, rootParentID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|