mirror of
https://github.com/harness/drone.git
synced 2025-05-03 13:01:39 +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
309 lines
10 KiB
Go
309 lines
10 KiB
Go
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
|
|
types "github.com/harness/gitness/registry/types"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// CleanupPolicyRepository is an autogenerated mock type for the CleanupPolicyRepository type
|
|
type CleanupPolicyRepository struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type CleanupPolicyRepository_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *CleanupPolicyRepository) EXPECT() *CleanupPolicyRepository_Expecter {
|
|
return &CleanupPolicyRepository_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Create provides a mock function with given fields: ctx, cleanupPolicy
|
|
func (_m *CleanupPolicyRepository) Create(ctx context.Context, cleanupPolicy *types.CleanupPolicy) (int64, error) {
|
|
ret := _m.Called(ctx, cleanupPolicy)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.CleanupPolicy) (int64, error)); ok {
|
|
return rf(ctx, cleanupPolicy)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.CleanupPolicy) int64); ok {
|
|
r0 = rf(ctx, cleanupPolicy)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *types.CleanupPolicy) error); ok {
|
|
r1 = rf(ctx, cleanupPolicy)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CleanupPolicyRepository_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
|
|
type CleanupPolicyRepository_Create_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Create is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - cleanupPolicy *types.CleanupPolicy
|
|
func (_e *CleanupPolicyRepository_Expecter) Create(ctx interface{}, cleanupPolicy interface{}) *CleanupPolicyRepository_Create_Call {
|
|
return &CleanupPolicyRepository_Create_Call{Call: _e.mock.On("Create", ctx, cleanupPolicy)}
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_Create_Call) Run(run func(ctx context.Context, cleanupPolicy *types.CleanupPolicy)) *CleanupPolicyRepository_Create_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(*types.CleanupPolicy))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_Create_Call) Return(id int64, err error) *CleanupPolicyRepository_Create_Call {
|
|
_c.Call.Return(id, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_Create_Call) RunAndReturn(run func(context.Context, *types.CleanupPolicy) (int64, error)) *CleanupPolicyRepository_Create_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, id
|
|
func (_m *CleanupPolicyRepository) Delete(ctx context.Context, id int64) error {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) error); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// CleanupPolicyRepository_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
|
|
type CleanupPolicyRepository_Delete_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Delete is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - id int64
|
|
func (_e *CleanupPolicyRepository_Expecter) Delete(ctx interface{}, id interface{}) *CleanupPolicyRepository_Delete_Call {
|
|
return &CleanupPolicyRepository_Delete_Call{Call: _e.mock.On("Delete", ctx, id)}
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_Delete_Call) Run(run func(ctx context.Context, id int64)) *CleanupPolicyRepository_Delete_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_Delete_Call) Return(err error) *CleanupPolicyRepository_Delete_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_Delete_Call) RunAndReturn(run func(context.Context, int64) error) *CleanupPolicyRepository_Delete_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetByRegistryID provides a mock function with given fields: ctx, id
|
|
func (_m *CleanupPolicyRepository) GetByRegistryID(ctx context.Context, id int64) (*[]types.CleanupPolicy, error) {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetByRegistryID")
|
|
}
|
|
|
|
var r0 *[]types.CleanupPolicy
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) (*[]types.CleanupPolicy, error)); ok {
|
|
return rf(ctx, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *[]types.CleanupPolicy); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*[]types.CleanupPolicy)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CleanupPolicyRepository_GetByRegistryID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByRegistryID'
|
|
type CleanupPolicyRepository_GetByRegistryID_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetByRegistryID is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - id int64
|
|
func (_e *CleanupPolicyRepository_Expecter) GetByRegistryID(ctx interface{}, id interface{}) *CleanupPolicyRepository_GetByRegistryID_Call {
|
|
return &CleanupPolicyRepository_GetByRegistryID_Call{Call: _e.mock.On("GetByRegistryID", ctx, id)}
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_GetByRegistryID_Call) Run(run func(ctx context.Context, id int64)) *CleanupPolicyRepository_GetByRegistryID_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_GetByRegistryID_Call) Return(cleanupPolicies *[]types.CleanupPolicy, err error) *CleanupPolicyRepository_GetByRegistryID_Call {
|
|
_c.Call.Return(cleanupPolicies, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_GetByRegistryID_Call) RunAndReturn(run func(context.Context, int64) (*[]types.CleanupPolicy, error)) *CleanupPolicyRepository_GetByRegistryID_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// GetIDsByRegistryID provides a mock function with given fields: ctx, id
|
|
func (_m *CleanupPolicyRepository) GetIDsByRegistryID(ctx context.Context, id int64) ([]int64, error) {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetIDsByRegistryID")
|
|
}
|
|
|
|
var r0 []int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) ([]int64, error)); ok {
|
|
return rf(ctx, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) []int64); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]int64)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CleanupPolicyRepository_GetIDsByRegistryID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIDsByRegistryID'
|
|
type CleanupPolicyRepository_GetIDsByRegistryID_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// GetIDsByRegistryID is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - id int64
|
|
func (_e *CleanupPolicyRepository_Expecter) GetIDsByRegistryID(ctx interface{}, id interface{}) *CleanupPolicyRepository_GetIDsByRegistryID_Call {
|
|
return &CleanupPolicyRepository_GetIDsByRegistryID_Call{Call: _e.mock.On("GetIDsByRegistryID", ctx, id)}
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_GetIDsByRegistryID_Call) Run(run func(ctx context.Context, id int64)) *CleanupPolicyRepository_GetIDsByRegistryID_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_GetIDsByRegistryID_Call) Return(ids []int64, err error) *CleanupPolicyRepository_GetIDsByRegistryID_Call {
|
|
_c.Call.Return(ids, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_GetIDsByRegistryID_Call) RunAndReturn(run func(context.Context, int64) ([]int64, error)) *CleanupPolicyRepository_GetIDsByRegistryID_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ModifyCleanupPolicies provides a mock function with given fields: ctx, cleanupPolicies, ids
|
|
func (_m *CleanupPolicyRepository) ModifyCleanupPolicies(ctx context.Context, cleanupPolicies *[]types.CleanupPolicy, ids []int64) error {
|
|
ret := _m.Called(ctx, cleanupPolicies, ids)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ModifyCleanupPolicies")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *[]types.CleanupPolicy, []int64) error); ok {
|
|
r0 = rf(ctx, cleanupPolicies, ids)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// CleanupPolicyRepository_ModifyCleanupPolicies_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyCleanupPolicies'
|
|
type CleanupPolicyRepository_ModifyCleanupPolicies_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ModifyCleanupPolicies is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - cleanupPolicies *[]types.CleanupPolicy
|
|
// - ids []int64
|
|
func (_e *CleanupPolicyRepository_Expecter) ModifyCleanupPolicies(ctx interface{}, cleanupPolicies interface{}, ids interface{}) *CleanupPolicyRepository_ModifyCleanupPolicies_Call {
|
|
return &CleanupPolicyRepository_ModifyCleanupPolicies_Call{Call: _e.mock.On("ModifyCleanupPolicies", ctx, cleanupPolicies, ids)}
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_ModifyCleanupPolicies_Call) Run(run func(ctx context.Context, cleanupPolicies *[]types.CleanupPolicy, ids []int64)) *CleanupPolicyRepository_ModifyCleanupPolicies_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(context.Context), args[1].(*[]types.CleanupPolicy), args[2].([]int64))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_ModifyCleanupPolicies_Call) Return(_a0 error) *CleanupPolicyRepository_ModifyCleanupPolicies_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *CleanupPolicyRepository_ModifyCleanupPolicies_Call) RunAndReturn(run func(context.Context, *[]types.CleanupPolicy, []int64) error) *CleanupPolicyRepository_ModifyCleanupPolicies_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewCleanupPolicyRepository creates a new instance of CleanupPolicyRepository. 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 NewCleanupPolicyRepository(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *CleanupPolicyRepository {
|
|
mock := &CleanupPolicyRepository{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|