mirror of https://github.com/goharbor/harbor.git
347 lines
8.5 KiB
Go
347 lines
8.5 KiB
Go
// Code generated by mockery v2.42.2. DO NOT EDIT.
|
|
|
|
package task
|
|
|
|
import (
|
|
context "context"
|
|
|
|
dao "github.com/goharbor/harbor/src/pkg/task/dao"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
q "github.com/goharbor/harbor/src/lib/q"
|
|
|
|
time "time"
|
|
)
|
|
|
|
// mockTaskDAO is an autogenerated mock type for the TaskDAO type
|
|
type mockTaskDAO struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Count provides a mock function with given fields: ctx, query
|
|
func (_m *mockTaskDAO) Count(ctx context.Context, query *q.Query) (int64, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Count")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) (int64, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) int64); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// Create provides a mock function with given fields: ctx, _a1
|
|
func (_m *mockTaskDAO) Create(ctx context.Context, _a1 *dao.Task) (int64, error) {
|
|
ret := _m.Called(ctx, _a1)
|
|
|
|
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, *dao.Task) (int64, error)); ok {
|
|
return rf(ctx, _a1)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *dao.Task) int64); ok {
|
|
r0 = rf(ctx, _a1)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *dao.Task) error); ok {
|
|
r1 = rf(ctx, _a1)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, id
|
|
func (_m *mockTaskDAO) 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
|
|
}
|
|
|
|
// ExecutionIDsByVendorAndStatus provides a mock function with given fields: ctx, vendorType, status
|
|
func (_m *mockTaskDAO) ExecutionIDsByVendorAndStatus(ctx context.Context, vendorType string, status string) ([]int64, error) {
|
|
ret := _m.Called(ctx, vendorType, status)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ExecutionIDsByVendorAndStatus")
|
|
}
|
|
|
|
var r0 []int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) ([]int64, error)); ok {
|
|
return rf(ctx, vendorType, status)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, string) []int64); ok {
|
|
r0 = rf(ctx, vendorType, status)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]int64)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
|
|
r1 = rf(ctx, vendorType, status)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Get provides a mock function with given fields: ctx, id
|
|
func (_m *mockTaskDAO) Get(ctx context.Context, id int64) (*dao.Task, error) {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *dao.Task
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) (*dao.Task, error)); ok {
|
|
return rf(ctx, id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) *dao.Task); ok {
|
|
r0 = rf(ctx, id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*dao.Task)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetMaxEndTime provides a mock function with given fields: ctx, executionID
|
|
func (_m *mockTaskDAO) GetMaxEndTime(ctx context.Context, executionID int64) (time.Time, error) {
|
|
ret := _m.Called(ctx, executionID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetMaxEndTime")
|
|
}
|
|
|
|
var r0 time.Time
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) (time.Time, error)); ok {
|
|
return rf(ctx, executionID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) time.Time); ok {
|
|
r0 = rf(ctx, executionID)
|
|
} else {
|
|
r0 = ret.Get(0).(time.Time)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, executionID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// List provides a mock function with given fields: ctx, query
|
|
func (_m *mockTaskDAO) List(ctx context.Context, query *q.Query) ([]*dao.Task, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []*dao.Task
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) ([]*dao.Task, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*dao.Task); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*dao.Task)
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// ListScanTasksByReportUUID provides a mock function with given fields: ctx, uuid
|
|
func (_m *mockTaskDAO) ListScanTasksByReportUUID(ctx context.Context, uuid string) ([]*dao.Task, error) {
|
|
ret := _m.Called(ctx, uuid)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListScanTasksByReportUUID")
|
|
}
|
|
|
|
var r0 []*dao.Task
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) ([]*dao.Task, error)); ok {
|
|
return rf(ctx, uuid)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string) []*dao.Task); ok {
|
|
r0 = rf(ctx, uuid)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*dao.Task)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = rf(ctx, uuid)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListStatusCount provides a mock function with given fields: ctx, executionID
|
|
func (_m *mockTaskDAO) ListStatusCount(ctx context.Context, executionID int64) ([]*dao.StatusCount, error) {
|
|
ret := _m.Called(ctx, executionID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListStatusCount")
|
|
}
|
|
|
|
var r0 []*dao.StatusCount
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) ([]*dao.StatusCount, error)); ok {
|
|
return rf(ctx, executionID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64) []*dao.StatusCount); ok {
|
|
r0 = rf(ctx, executionID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*dao.StatusCount)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {
|
|
r1 = rf(ctx, executionID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Update provides a mock function with given fields: ctx, _a1, props
|
|
func (_m *mockTaskDAO) Update(ctx context.Context, _a1 *dao.Task, props ...string) error {
|
|
_va := make([]interface{}, len(props))
|
|
for _i := range props {
|
|
_va[_i] = props[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, _a1)
|
|
_ca = append(_ca, _va...)
|
|
ret := _m.Called(_ca...)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Update")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *dao.Task, ...string) error); ok {
|
|
r0 = rf(ctx, _a1, props...)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateStatus provides a mock function with given fields: ctx, id, status, statusRevision
|
|
func (_m *mockTaskDAO) UpdateStatus(ctx context.Context, id int64, status string, statusRevision int64) error {
|
|
ret := _m.Called(ctx, id, status, statusRevision)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateStatus")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int64, string, int64) error); ok {
|
|
r0 = rf(ctx, id, status, statusRevision)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// UpdateStatusInBatch provides a mock function with given fields: ctx, jobIDs, status, batchSize
|
|
func (_m *mockTaskDAO) UpdateStatusInBatch(ctx context.Context, jobIDs []string, status string, batchSize int) error {
|
|
ret := _m.Called(ctx, jobIDs, status, batchSize)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateStatusInBatch")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, []string, string, int) error); ok {
|
|
r0 = rf(ctx, jobIDs, status, batchSize)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// newMockTaskDAO creates a new instance of mockTaskDAO. 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 newMockTaskDAO(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *mockTaskDAO {
|
|
mock := &mockTaskDAO{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|