mirror of
https://github.com/harness/drone.git
synced 2025-05-03 14:22:38 +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
171 lines
4.8 KiB
Go
171 lines
4.8 KiB
Go
// Code generated by testify. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/harness/gitness/types"
|
|
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// WebhooksRepository is a mock of store.WebhooksRepository interface.
|
|
type WebhooksRepository struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Create provides a mock function
|
|
func (m *WebhooksRepository) Create(ctx context.Context, webhook *types.WebhookCore) error {
|
|
ret := m.Called(ctx, webhook)
|
|
return ret.Error(0)
|
|
}
|
|
|
|
// GetByRegistryAndIdentifier provides a mock function
|
|
func (m *WebhooksRepository) GetByRegistryAndIdentifier(ctx context.Context, registryID int64, webhookIdentifier string) (*types.WebhookCore, error) {
|
|
ret := m.Called(ctx, registryID, webhookIdentifier)
|
|
|
|
var r0 *types.WebhookCore
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) *types.WebhookCore); ok {
|
|
r0 = rf(ctx, registryID, webhookIdentifier)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.WebhookCore)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, registryID, webhookIdentifier)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Find provides a mock function
|
|
func (m *WebhooksRepository) Find(ctx context.Context, webhookID int64) (*types.WebhookCore, error) {
|
|
ret := m.Called(ctx, webhookID)
|
|
|
|
var r0 *types.WebhookCore
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *types.WebhookCore); ok {
|
|
r0 = rf(ctx, webhookID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.WebhookCore)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, webhookID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListByRegistry provides a mock function
|
|
func (m *WebhooksRepository) ListByRegistry(ctx context.Context, sortByField string, sortByOrder string, limit int, offset int, search string, registryID int64) ([]*types.WebhookCore, error) {
|
|
ret := m.Called(ctx, sortByField, sortByOrder, limit, offset, search, registryID)
|
|
|
|
var r0 []*types.WebhookCore
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int, int, string, int64) []*types.WebhookCore); ok {
|
|
r0 = rf(ctx, sortByField, sortByOrder, limit, offset, search, registryID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*types.WebhookCore)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, int, int, string, int64) error); ok {
|
|
r1 = rf(ctx, sortByField, sortByOrder, limit, offset, search, registryID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListAllByRegistry provides a mock function
|
|
func (m *WebhooksRepository) ListAllByRegistry(ctx context.Context, parents []types.WebhookParentInfo) ([]*types.WebhookCore, error) {
|
|
ret := m.Called(ctx, parents)
|
|
|
|
var r0 []*types.WebhookCore
|
|
if rf, ok := ret.Get(0).(func(context.Context, []types.WebhookParentInfo) []*types.WebhookCore); ok {
|
|
r0 = rf(ctx, parents)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*types.WebhookCore)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, []types.WebhookParentInfo) error); ok {
|
|
r1 = rf(ctx, parents)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CountAllByRegistry provides a mock function
|
|
func (m *WebhooksRepository) CountAllByRegistry(ctx context.Context, registryID int64, search string) (int64, error) {
|
|
ret := m.Called(ctx, registryID, search)
|
|
|
|
var r0 int64
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string) int64); ok {
|
|
r0 = rf(ctx, registryID, search)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, string) error); ok {
|
|
r1 = rf(ctx, registryID, search)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Update provides a mock function
|
|
func (m *WebhooksRepository) Update(ctx context.Context, webhook *types.WebhookCore) error {
|
|
ret := m.Called(ctx, webhook)
|
|
return ret.Error(0)
|
|
}
|
|
|
|
// DeleteByRegistryAndIdentifier provides a mock function
|
|
func (m *WebhooksRepository) DeleteByRegistryAndIdentifier(ctx context.Context, registryID int64, webhookIdentifier string) error {
|
|
ret := m.Called(ctx, registryID, webhookIdentifier)
|
|
return ret.Error(0)
|
|
}
|
|
|
|
// UpdateOptLock provides a mock function
|
|
func (m *WebhooksRepository) UpdateOptLock(ctx context.Context, hook *types.WebhookCore, fn func(hook *types.WebhookCore) error) (*types.WebhookCore, error) {
|
|
ret := m.Called(ctx, hook, fn)
|
|
|
|
var r0 *types.WebhookCore
|
|
if rf, ok := ret.Get(0).(func(context.Context, *types.WebhookCore, func(*types.WebhookCore) error) *types.WebhookCore); ok {
|
|
r0 = rf(ctx, hook, fn)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*types.WebhookCore)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(context.Context, *types.WebhookCore, func(*types.WebhookCore) error) error); ok {
|
|
r1 = rf(ctx, hook, fn)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|