mirror of
https://github.com/goharbor/harbor
synced 2025-04-12 16:34:03 +00:00

* bump mockery Signed-off-by: wang yan <wangyan@vmware.com> * update mock testing codes Signed-off-by: wang yan <wangyan@vmware.com> --------- Signed-off-by: wang yan <wangyan@vmware.com>
232 lines
5.9 KiB
Go
232 lines
5.9 KiB
Go
// Code generated by mockery v2.51.0. DO NOT EDIT.
|
|
|
|
package rbac
|
|
|
|
import (
|
|
context "context"
|
|
|
|
model "github.com/goharbor/harbor/src/pkg/rbac/model"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
q "github.com/goharbor/harbor/src/lib/q"
|
|
)
|
|
|
|
// Manager is an autogenerated mock type for the Manager type
|
|
type Manager struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// CreatePermission provides a mock function with given fields: ctx, rp
|
|
func (_m *Manager) CreatePermission(ctx context.Context, rp *model.RolePermission) (int64, error) {
|
|
ret := _m.Called(ctx, rp)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreatePermission")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *model.RolePermission) (int64, error)); ok {
|
|
return rf(ctx, rp)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *model.RolePermission) int64); ok {
|
|
r0 = rf(ctx, rp)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *model.RolePermission) error); ok {
|
|
r1 = rf(ctx, rp)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// CreateRbacPolicy provides a mock function with given fields: ctx, pp
|
|
func (_m *Manager) CreateRbacPolicy(ctx context.Context, pp *model.PermissionPolicy) (int64, error) {
|
|
ret := _m.Called(ctx, pp)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreateRbacPolicy")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *model.PermissionPolicy) (int64, error)); ok {
|
|
return rf(ctx, pp)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *model.PermissionPolicy) int64); ok {
|
|
r0 = rf(ctx, pp)
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, *model.PermissionPolicy) error); ok {
|
|
r1 = rf(ctx, pp)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// DeletePermission provides a mock function with given fields: ctx, id
|
|
func (_m *Manager) DeletePermission(ctx context.Context, id int64) error {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeletePermission")
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// DeletePermissionsByRole provides a mock function with given fields: ctx, roleType, roleID
|
|
func (_m *Manager) DeletePermissionsByRole(ctx context.Context, roleType string, roleID int64) error {
|
|
ret := _m.Called(ctx, roleType, roleID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeletePermissionsByRole")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) error); ok {
|
|
r0 = rf(ctx, roleType, roleID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// DeleteRbacPolicy provides a mock function with given fields: ctx, id
|
|
func (_m *Manager) DeleteRbacPolicy(ctx context.Context, id int64) error {
|
|
ret := _m.Called(ctx, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DeleteRbacPolicy")
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// GetPermissionsByRole provides a mock function with given fields: ctx, roleType, roleID
|
|
func (_m *Manager) GetPermissionsByRole(ctx context.Context, roleType string, roleID int64) ([]*model.UniversalRolePermission, error) {
|
|
ret := _m.Called(ctx, roleType, roleID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetPermissionsByRole")
|
|
}
|
|
|
|
var r0 []*model.UniversalRolePermission
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) ([]*model.UniversalRolePermission, error)); ok {
|
|
return rf(ctx, roleType, roleID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, string, int64) []*model.UniversalRolePermission); ok {
|
|
r0 = rf(ctx, roleType, roleID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.UniversalRolePermission)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(context.Context, string, int64) error); ok {
|
|
r1 = rf(ctx, roleType, roleID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// ListPermissions provides a mock function with given fields: ctx, query
|
|
func (_m *Manager) ListPermissions(ctx context.Context, query *q.Query) ([]*model.RolePermission, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListPermissions")
|
|
}
|
|
|
|
var r0 []*model.RolePermission
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) ([]*model.RolePermission, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*model.RolePermission); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.RolePermission)
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// ListRbacPolicies provides a mock function with given fields: ctx, query
|
|
func (_m *Manager) ListRbacPolicies(ctx context.Context, query *q.Query) ([]*model.PermissionPolicy, error) {
|
|
ret := _m.Called(ctx, query)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListRbacPolicies")
|
|
}
|
|
|
|
var r0 []*model.PermissionPolicy
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) ([]*model.PermissionPolicy, error)); ok {
|
|
return rf(ctx, query)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(context.Context, *q.Query) []*model.PermissionPolicy); ok {
|
|
r0 = rf(ctx, query)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.PermissionPolicy)
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|
|
|
|
// NewManager creates a new instance of Manager. 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 NewManager(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *Manager {
|
|
mock := &Manager{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|