mirror of
https://github.com/goharbor/harbor
synced 2025-04-15 05:57:10 +00:00
162 lines
3.6 KiB
Go
162 lines
3.6 KiB
Go
// Code generated by mockery v2.42.2. DO NOT EDIT.
|
|
|
|
package dao
|
|
|
|
import (
|
|
context "context"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
models "github.com/goharbor/harbor/src/common/models"
|
|
|
|
q "github.com/goharbor/harbor/src/lib/q"
|
|
)
|
|
|
|
// DAO is an autogenerated mock type for the DAO type
|
|
type DAO struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Count provides a mock function with given fields: ctx, query
|
|
func (_m *DAO) 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, user
|
|
func (_m *DAO) Create(ctx context.Context, user *models.User) (int, error) {
|
|
ret := _m.Called(ctx, user)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 int
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.User) (int, error)); ok {
|
|
return rf(ctx, user)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *models.User) int); ok {
|
|
r0 = rf(ctx, user)
|
|
} else {
|
|
r0 = ret.Get(0).(int)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *models.User) error); ok {
|
|
r1 = rf(ctx, user)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: ctx, userID
|
|
func (_m *DAO) Delete(ctx context.Context, userID int) error {
|
|
ret := _m.Called(ctx, userID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, int) error); ok {
|
|
r0 = rf(ctx, userID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// List provides a mock function with given fields: ctx, query
|
|
func (_m *DAO) List(ctx context.Context, query *q.Query) ([]*models.User, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []*models.User
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) ([]*models.User, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*models.User); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*models.User)
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// Update provides a mock function with given fields: ctx, user, props
|
|
func (_m *DAO) Update(ctx context.Context, user *models.User, props ...string) error {
|
|
_va := make([]interface{}, len(props))
|
|
for _i := range props {
|
|
_va[_i] = props[_i]
|
|
}
|
|
var _ca []interface{}
|
|
_ca = append(_ca, ctx, user)
|
|
_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, *models.User, ...string) error); ok {
|
|
r0 = rf(ctx, user, props...)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// NewDAO creates a new instance of DAO. 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 NewDAO(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *DAO {
|
|
mock := &DAO{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|