mirror of
https://github.com/tnb-labs/panel.git
synced 2026-08-29 02:10:58 +08:00
3ce353e8e4
mockery v2 已 EOL,其内嵌的旧版 x/tools 无法解析 Go 1.27 的 export data, 导致 Mockery workflow 在 stable 切到 1.27.0 后持续失败。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
442 lines
12 KiB
Go
442 lines
12 KiB
Go
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package biz
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"github.com/acepanel/panel/v3/internal/biz"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewUserTokenRepo creates a new instance of UserTokenRepo. 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 NewUserTokenRepo(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *UserTokenRepo {
|
|
mock := &UserTokenRepo{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// UserTokenRepo is an autogenerated mock type for the UserTokenRepo type
|
|
type UserTokenRepo struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type UserTokenRepo_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *UserTokenRepo) EXPECT() *UserTokenRepo_Expecter {
|
|
return &UserTokenRepo_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Create provides a mock function for the type UserTokenRepo
|
|
func (_mock *UserTokenRepo) Create(userID uint, ips []string, expired time.Time) (*biz.UserToken, error) {
|
|
ret := _mock.Called(userID, ips, expired)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 *biz.UserToken
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(uint, []string, time.Time) (*biz.UserToken, error)); ok {
|
|
return returnFunc(userID, ips, expired)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(uint, []string, time.Time) *biz.UserToken); ok {
|
|
r0 = returnFunc(userID, ips, expired)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*biz.UserToken)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(uint, []string, time.Time) error); ok {
|
|
r1 = returnFunc(userID, ips, expired)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// UserTokenRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
|
|
type UserTokenRepo_Create_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Create is a helper method to define mock.On call
|
|
// - userID uint
|
|
// - ips []string
|
|
// - expired time.Time
|
|
func (_e *UserTokenRepo_Expecter) Create(userID any, ips any, expired any) *UserTokenRepo_Create_Call {
|
|
return &UserTokenRepo_Create_Call{Call: _e.mock.On("Create", userID, ips, expired)}
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Create_Call) Run(run func(userID uint, ips []string, expired time.Time)) *UserTokenRepo_Create_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 uint
|
|
if args[0] != nil {
|
|
arg0 = args[0].(uint)
|
|
}
|
|
var arg1 []string
|
|
if args[1] != nil {
|
|
arg1 = args[1].([]string)
|
|
}
|
|
var arg2 time.Time
|
|
if args[2] != nil {
|
|
arg2 = args[2].(time.Time)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Create_Call) Return(userToken *biz.UserToken, err error) *UserTokenRepo_Create_Call {
|
|
_c.Call.Return(userToken, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Create_Call) RunAndReturn(run func(userID uint, ips []string, expired time.Time) (*biz.UserToken, error)) *UserTokenRepo_Create_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Delete provides a mock function for the type UserTokenRepo
|
|
func (_mock *UserTokenRepo) Delete(id uint) error {
|
|
ret := _mock.Called(id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(uint) error); ok {
|
|
r0 = returnFunc(id)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// UserTokenRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
|
|
type UserTokenRepo_Delete_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Delete is a helper method to define mock.On call
|
|
// - id uint
|
|
func (_e *UserTokenRepo_Expecter) Delete(id any) *UserTokenRepo_Delete_Call {
|
|
return &UserTokenRepo_Delete_Call{Call: _e.mock.On("Delete", id)}
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Delete_Call) Run(run func(id uint)) *UserTokenRepo_Delete_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 uint
|
|
if args[0] != nil {
|
|
arg0 = args[0].(uint)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Delete_Call) Return(err error) *UserTokenRepo_Delete_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Delete_Call) RunAndReturn(run func(id uint) error) *UserTokenRepo_Delete_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Get provides a mock function for the type UserTokenRepo
|
|
func (_mock *UserTokenRepo) Get(id uint) (*biz.UserToken, error) {
|
|
ret := _mock.Called(id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *biz.UserToken
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(uint) (*biz.UserToken, error)); ok {
|
|
return returnFunc(id)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(uint) *biz.UserToken); ok {
|
|
r0 = returnFunc(id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*biz.UserToken)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(uint) error); ok {
|
|
r1 = returnFunc(id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// UserTokenRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
|
|
type UserTokenRepo_Get_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Get is a helper method to define mock.On call
|
|
// - id uint
|
|
func (_e *UserTokenRepo_Expecter) Get(id any) *UserTokenRepo_Get_Call {
|
|
return &UserTokenRepo_Get_Call{Call: _e.mock.On("Get", id)}
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Get_Call) Run(run func(id uint)) *UserTokenRepo_Get_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 uint
|
|
if args[0] != nil {
|
|
arg0 = args[0].(uint)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Get_Call) Return(userToken *biz.UserToken, err error) *UserTokenRepo_Get_Call {
|
|
_c.Call.Return(userToken, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Get_Call) RunAndReturn(run func(id uint) (*biz.UserToken, error)) *UserTokenRepo_Get_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// List provides a mock function for the type UserTokenRepo
|
|
func (_mock *UserTokenRepo) List(userID uint, page uint, limit uint) ([]*biz.UserToken, int64, error) {
|
|
ret := _mock.Called(userID, page, limit)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []*biz.UserToken
|
|
var r1 int64
|
|
var r2 error
|
|
if returnFunc, ok := ret.Get(0).(func(uint, uint, uint) ([]*biz.UserToken, int64, error)); ok {
|
|
return returnFunc(userID, page, limit)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(uint, uint, uint) []*biz.UserToken); ok {
|
|
r0 = returnFunc(userID, page, limit)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*biz.UserToken)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(uint, uint, uint) int64); ok {
|
|
r1 = returnFunc(userID, page, limit)
|
|
} else {
|
|
r1 = ret.Get(1).(int64)
|
|
}
|
|
if returnFunc, ok := ret.Get(2).(func(uint, uint, uint) error); ok {
|
|
r2 = returnFunc(userID, page, limit)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// UserTokenRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
|
|
type UserTokenRepo_List_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// List is a helper method to define mock.On call
|
|
// - userID uint
|
|
// - page uint
|
|
// - limit uint
|
|
func (_e *UserTokenRepo_Expecter) List(userID any, page any, limit any) *UserTokenRepo_List_Call {
|
|
return &UserTokenRepo_List_Call{Call: _e.mock.On("List", userID, page, limit)}
|
|
}
|
|
|
|
func (_c *UserTokenRepo_List_Call) Run(run func(userID uint, page uint, limit uint)) *UserTokenRepo_List_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 uint
|
|
if args[0] != nil {
|
|
arg0 = args[0].(uint)
|
|
}
|
|
var arg1 uint
|
|
if args[1] != nil {
|
|
arg1 = args[1].(uint)
|
|
}
|
|
var arg2 uint
|
|
if args[2] != nil {
|
|
arg2 = args[2].(uint)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_List_Call) Return(userTokens []*biz.UserToken, n int64, err error) *UserTokenRepo_List_Call {
|
|
_c.Call.Return(userTokens, n, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_List_Call) RunAndReturn(run func(userID uint, page uint, limit uint) ([]*biz.UserToken, int64, error)) *UserTokenRepo_List_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Update provides a mock function for the type UserTokenRepo
|
|
func (_mock *UserTokenRepo) Update(id uint, ips []string, expired time.Time) (*biz.UserToken, error) {
|
|
ret := _mock.Called(id, ips, expired)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Update")
|
|
}
|
|
|
|
var r0 *biz.UserToken
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(uint, []string, time.Time) (*biz.UserToken, error)); ok {
|
|
return returnFunc(id, ips, expired)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(uint, []string, time.Time) *biz.UserToken); ok {
|
|
r0 = returnFunc(id, ips, expired)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*biz.UserToken)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(uint, []string, time.Time) error); ok {
|
|
r1 = returnFunc(id, ips, expired)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// UserTokenRepo_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
|
|
type UserTokenRepo_Update_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Update is a helper method to define mock.On call
|
|
// - id uint
|
|
// - ips []string
|
|
// - expired time.Time
|
|
func (_e *UserTokenRepo_Expecter) Update(id any, ips any, expired any) *UserTokenRepo_Update_Call {
|
|
return &UserTokenRepo_Update_Call{Call: _e.mock.On("Update", id, ips, expired)}
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Update_Call) Run(run func(id uint, ips []string, expired time.Time)) *UserTokenRepo_Update_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 uint
|
|
if args[0] != nil {
|
|
arg0 = args[0].(uint)
|
|
}
|
|
var arg1 []string
|
|
if args[1] != nil {
|
|
arg1 = args[1].([]string)
|
|
}
|
|
var arg2 time.Time
|
|
if args[2] != nil {
|
|
arg2 = args[2].(time.Time)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Update_Call) Return(userToken *biz.UserToken, err error) *UserTokenRepo_Update_Call {
|
|
_c.Call.Return(userToken, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_Update_Call) RunAndReturn(run func(id uint, ips []string, expired time.Time) (*biz.UserToken, error)) *UserTokenRepo_Update_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ValidateReq provides a mock function for the type UserTokenRepo
|
|
func (_mock *UserTokenRepo) ValidateReq(req *http.Request) (uint, error) {
|
|
ret := _mock.Called(req)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ValidateReq")
|
|
}
|
|
|
|
var r0 uint
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(*http.Request) (uint, error)); ok {
|
|
return returnFunc(req)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(*http.Request) uint); ok {
|
|
r0 = returnFunc(req)
|
|
} else {
|
|
r0 = ret.Get(0).(uint)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(*http.Request) error); ok {
|
|
r1 = returnFunc(req)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// UserTokenRepo_ValidateReq_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ValidateReq'
|
|
type UserTokenRepo_ValidateReq_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ValidateReq is a helper method to define mock.On call
|
|
// - req *http.Request
|
|
func (_e *UserTokenRepo_Expecter) ValidateReq(req any) *UserTokenRepo_ValidateReq_Call {
|
|
return &UserTokenRepo_ValidateReq_Call{Call: _e.mock.On("ValidateReq", req)}
|
|
}
|
|
|
|
func (_c *UserTokenRepo_ValidateReq_Call) Run(run func(req *http.Request)) *UserTokenRepo_ValidateReq_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 *http.Request
|
|
if args[0] != nil {
|
|
arg0 = args[0].(*http.Request)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_ValidateReq_Call) Return(v uint, err error) *UserTokenRepo_ValidateReq_Call {
|
|
_c.Call.Return(v, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserTokenRepo_ValidateReq_Call) RunAndReturn(run func(req *http.Request) (uint, error)) *UserTokenRepo_ValidateReq_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|