mirror of
https://github.com/harness/drone.git
synced 2025-05-03 14:40:53 +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
307 lines
7.3 KiB
Go
307 lines
7.3 KiB
Go
// Code generated by mockery v2.53.3. DO NOT EDIT.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
context "context"
|
|
io "io"
|
|
|
|
driver "github.com/harness/gitness/registry/app/driver"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// StorageDriver is an autogenerated mock type for the StorageDriver type
|
|
type StorageDriver struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, path
|
|
func (_m *StorageDriver) Delete(ctx context.Context, path string) error {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// GetContent provides a mock function with given fields: ctx, path
|
|
func (_m *StorageDriver) GetContent(ctx context.Context, path string) ([]byte, error) {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetContent")
|
|
}
|
|
|
|
var r0 []byte
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok {
|
|
return rf(ctx, path)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) []byte); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]byte)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, path)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// List provides a mock function with given fields: ctx, path
|
|
func (_m *StorageDriver) List(ctx context.Context, path string) ([]string, error) {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ([]string, error)); ok {
|
|
return rf(ctx, path)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) []string); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]string)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, path)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Move provides a mock function with given fields: ctx, sourcePath, destPath
|
|
func (_m *StorageDriver) Move(ctx context.Context, sourcePath string, destPath string) error {
|
|
ret := _m.Called(ctx, sourcePath, destPath)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Move")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
|
|
r0 = rf(ctx, sourcePath, destPath)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Name provides a mock function with no fields
|
|
func (_m *StorageDriver) Name() string {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Name")
|
|
}
|
|
|
|
var r0 string
|
|
if rf, ok := ret.Get(0).(func() string); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// PutContent provides a mock function with given fields: ctx, path, content
|
|
func (_m *StorageDriver) PutContent(ctx context.Context, path string, content []byte) error {
|
|
ret := _m.Called(ctx, path, content)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for PutContent")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, []byte) error); ok {
|
|
r0 = rf(ctx, path, content)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Reader provides a mock function with given fields: ctx, path, offset
|
|
func (_m *StorageDriver) Reader(ctx context.Context, path string, offset int64) (io.ReadCloser, error) {
|
|
ret := _m.Called(ctx, path, offset)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Reader")
|
|
}
|
|
|
|
var r0 io.ReadCloser
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) (io.ReadCloser, error)); ok {
|
|
return rf(ctx, path, offset)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) io.ReadCloser); ok {
|
|
r0 = rf(ctx, path, offset)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(io.ReadCloser)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok {
|
|
r1 = rf(ctx, path, offset)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// RedirectURL provides a mock function with given fields: ctx, method, path
|
|
func (_m *StorageDriver) RedirectURL(ctx context.Context, method string, path string) (string, error) {
|
|
ret := _m.Called(ctx, method, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RedirectURL")
|
|
}
|
|
|
|
var r0 string
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) (string, error)); ok {
|
|
return rf(ctx, method, path)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) string); ok {
|
|
r0 = rf(ctx, method, path)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
|
|
r1 = rf(ctx, method, path)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Stat provides a mock function with given fields: ctx, path
|
|
func (_m *StorageDriver) Stat(ctx context.Context, path string) (driver.FileInfo, error) {
|
|
ret := _m.Called(ctx, path)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Stat")
|
|
}
|
|
|
|
var r0 driver.FileInfo
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (driver.FileInfo, error)); ok {
|
|
return rf(ctx, path)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) driver.FileInfo); ok {
|
|
r0 = rf(ctx, path)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(driver.FileInfo)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, path)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Walk provides a mock function with given fields: ctx, path, f, options
|
|
func (_m *StorageDriver) Walk(ctx context.Context, path string, f driver.WalkFn, options ...func(*driver.WalkOptions)) error {
|
|
_va := make([]interface{}, len(options))
|
|
for _i := range options {
|
|
_va[_i] = options[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, path, f)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Walk")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, driver.WalkFn, ...func(*driver.WalkOptions)) error); ok {
|
|
r0 = rf(ctx, path, f, options...)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Writer provides a mock function with given fields: ctx, path, a
|
|
func (_m *StorageDriver) Writer(ctx context.Context, path string, a bool) (driver.FileWriter, error) {
|
|
ret := _m.Called(ctx, path, a)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Writer")
|
|
}
|
|
|
|
var r0 driver.FileWriter
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, bool) (driver.FileWriter, error)); ok {
|
|
return rf(ctx, path, a)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, bool) driver.FileWriter); ok {
|
|
r0 = rf(ctx, path, a)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(driver.FileWriter)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, bool) error); ok {
|
|
r1 = rf(ctx, path, a)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewStorageDriver creates a new instance of StorageDriver. 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 NewStorageDriver(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *StorageDriver {
|
|
mock := &StorageDriver{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|