mirror of https://github.com/goharbor/harbor.git
443 lines
11 KiB
Go
443 lines
11 KiB
Go
// Code generated by mockery v2.42.2. DO NOT EDIT.
|
|
|
|
package blob
|
|
|
|
import (
|
|
context "context"
|
|
|
|
blob "github.com/goharbor/harbor/src/controller/blob"
|
|
|
|
distribution "github.com/docker/distribution"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
models "github.com/goharbor/harbor/src/pkg/blob/models"
|
|
|
|
q "github.com/goharbor/harbor/src/lib/q"
|
|
)
|
|
|
|
// Controller is an autogenerated mock type for the Controller type
|
|
type Controller struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// AssociateWithArtifact provides a mock function with given fields: ctx, blobDigests, artifactDigest
|
|
func (_m *Controller) AssociateWithArtifact(ctx context.Context, blobDigests []string, artifactDigest string) error {
|
|
ret := _m.Called(ctx, blobDigests, artifactDigest)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AssociateWithArtifact")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, []string, string) error); ok {
|
|
r0 = rf(ctx, blobDigests, artifactDigest)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// AssociateWithProjectByDigest provides a mock function with given fields: ctx, blobDigest, projectID
|
|
func (_m *Controller) AssociateWithProjectByDigest(ctx context.Context, blobDigest string, projectID int64) error {
|
|
ret := _m.Called(ctx, blobDigest, projectID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AssociateWithProjectByDigest")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) error); ok {
|
|
r0 = rf(ctx, blobDigest, projectID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// AssociateWithProjectByID provides a mock function with given fields: ctx, blobID, projectID
|
|
func (_m *Controller) AssociateWithProjectByID(ctx context.Context, blobID int64, projectID int64) error {
|
|
ret := _m.Called(ctx, blobID, projectID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for AssociateWithProjectByID")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, int64) error); ok {
|
|
r0 = rf(ctx, blobID, projectID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// CalculateTotalSize provides a mock function with given fields: ctx, excludeForeign
|
|
func (_m *Controller) CalculateTotalSize(ctx context.Context, excludeForeign bool) (int64, error) {
|
|
ret := _m.Called(ctx, excludeForeign)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CalculateTotalSize")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, bool) (int64, error)); ok {
|
|
return rf(ctx, excludeForeign)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, bool) int64); ok {
|
|
r0 = rf(ctx, excludeForeign)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, bool) error); ok {
|
|
r1 = rf(ctx, excludeForeign)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CalculateTotalSizeByProject provides a mock function with given fields: ctx, projectID, excludeForeign
|
|
func (_m *Controller) CalculateTotalSizeByProject(ctx context.Context, projectID int64, excludeForeign bool) (int64, error) {
|
|
ret := _m.Called(ctx, projectID, excludeForeign)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CalculateTotalSizeByProject")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, bool) (int64, error)); ok {
|
|
return rf(ctx, projectID, excludeForeign)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, bool) int64); ok {
|
|
r0 = rf(ctx, projectID, excludeForeign)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, bool) error); ok {
|
|
r1 = rf(ctx, projectID, excludeForeign)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, id
|
|
func (_m *Controller) 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
|
|
}
|
|
|
|
// Ensure provides a mock function with given fields: ctx, digest, contentType, size
|
|
func (_m *Controller) Ensure(ctx context.Context, digest string, contentType string, size int64) (int64, error) {
|
|
ret := _m.Called(ctx, digest, contentType, size)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Ensure")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) (int64, error)); ok {
|
|
return rf(ctx, digest, contentType, size)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string, int64) int64); ok {
|
|
r0 = rf(ctx, digest, contentType, size)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string, int64) error); ok {
|
|
r1 = rf(ctx, digest, contentType, size)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Exist provides a mock function with given fields: ctx, digest, options
|
|
func (_m *Controller) Exist(ctx context.Context, digest string, options ...blob.Option) (bool, error) {
|
|
_va := make([]interface{}, len(options))
|
|
for _i := range options {
|
|
_va[_i] = options[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, digest)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Exist")
|
|
}
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...blob.Option) (bool, error)); ok {
|
|
return rf(ctx, digest, options...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...blob.Option) bool); ok {
|
|
r0 = rf(ctx, digest, options...)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, ...blob.Option) error); ok {
|
|
r1 = rf(ctx, digest, options...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Fail provides a mock function with given fields: ctx, _a1
|
|
func (_m *Controller) Fail(ctx context.Context, _a1 *models.Blob) error {
|
|
ret := _m.Called(ctx, _a1)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Fail")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.Blob) error); ok {
|
|
r0 = rf(ctx, _a1)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// FindMissingAssociationsForProject provides a mock function with given fields: ctx, projectID, blobs
|
|
func (_m *Controller) FindMissingAssociationsForProject(ctx context.Context, projectID int64, blobs []*models.Blob) ([]*models.Blob, error) {
|
|
ret := _m.Called(ctx, projectID, blobs)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FindMissingAssociationsForProject")
|
|
}
|
|
|
|
var r0 []*models.Blob
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []*models.Blob) ([]*models.Blob, error)); ok {
|
|
return rf(ctx, projectID, blobs)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, []*models.Blob) []*models.Blob); ok {
|
|
r0 = rf(ctx, projectID, blobs)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*models.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64, []*models.Blob) error); ok {
|
|
r1 = rf(ctx, projectID, blobs)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Get provides a mock function with given fields: ctx, digest, options
|
|
func (_m *Controller) Get(ctx context.Context, digest string, options ...blob.Option) (*models.Blob, error) {
|
|
_va := make([]interface{}, len(options))
|
|
for _i := range options {
|
|
_va[_i] = options[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, digest)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *models.Blob
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...blob.Option) (*models.Blob, error)); ok {
|
|
return rf(ctx, digest, options...)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, ...blob.Option) *models.Blob); ok {
|
|
r0 = rf(ctx, digest, options...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*models.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, ...blob.Option) error); ok {
|
|
r1 = rf(ctx, digest, options...)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetAcceptedBlobSize provides a mock function with given fields: ctx, sessionID
|
|
func (_m *Controller) GetAcceptedBlobSize(ctx context.Context, sessionID string) (int64, error) {
|
|
ret := _m.Called(ctx, sessionID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetAcceptedBlobSize")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) (int64, error)); ok {
|
|
return rf(ctx, sessionID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) int64); ok {
|
|
r0 = rf(ctx, sessionID)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, sessionID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// List provides a mock function with given fields: ctx, query
|
|
func (_m *Controller) List(ctx context.Context, query *q.Query) ([]*models.Blob, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []*models.Blob
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) ([]*models.Blob, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*models.Blob); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*models.Blob)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *q.Query) error); ok {
|
|
r1 = rf(ctx, query)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SetAcceptedBlobSize provides a mock function with given fields: ctx, sessionID, size
|
|
func (_m *Controller) SetAcceptedBlobSize(ctx context.Context, sessionID string, size int64) error {
|
|
ret := _m.Called(ctx, sessionID, size)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SetAcceptedBlobSize")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) error); ok {
|
|
r0 = rf(ctx, sessionID, size)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Sync provides a mock function with given fields: ctx, references
|
|
func (_m *Controller) Sync(ctx context.Context, references []distribution.Descriptor) error {
|
|
ret := _m.Called(ctx, references)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Sync")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, []distribution.Descriptor) error); ok {
|
|
r0 = rf(ctx, references)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Touch provides a mock function with given fields: ctx, _a1
|
|
func (_m *Controller) Touch(ctx context.Context, _a1 *models.Blob) error {
|
|
ret := _m.Called(ctx, _a1)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Touch")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.Blob) error); ok {
|
|
r0 = rf(ctx, _a1)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Update provides a mock function with given fields: ctx, _a1
|
|
func (_m *Controller) Update(ctx context.Context, _a1 *models.Blob) error {
|
|
ret := _m.Called(ctx, _a1)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Update")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.Blob) error); ok {
|
|
r0 = rf(ctx, _a1)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewController creates a new instance of Controller. 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 NewController(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *Controller {
|
|
mock := &Controller{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|