mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-21 05:11:14 +08:00
生成免登录的临时下载链接,强制设置有效期并支持下载次数限制, 过期分享由定时任务每小时清理,链接可直接用于其他面板的远程下载。 Closes #1641 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
373 lines
9.6 KiB
Go
373 lines
9.6 KiB
Go
// Code generated by mockery. DO NOT EDIT.
|
|
|
|
package biz
|
|
|
|
import (
|
|
biz "github.com/acepanel/panel/v3/internal/biz"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
time "time"
|
|
)
|
|
|
|
// FileShareRepo is an autogenerated mock type for the FileShareRepo type
|
|
type FileShareRepo struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type FileShareRepo_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *FileShareRepo) EXPECT() *FileShareRepo_Expecter {
|
|
return &FileShareRepo_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// ClearExpired provides a mock function with no fields
|
|
func (_m *FileShareRepo) ClearExpired() (int64, error) {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ClearExpired")
|
|
}
|
|
|
|
var r0 int64
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() (int64, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() int64); ok {
|
|
r0 = rf()
|
|
} else {
|
|
r0 = ret.Get(0).(int64)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FileShareRepo_ClearExpired_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ClearExpired'
|
|
type FileShareRepo_ClearExpired_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ClearExpired is a helper method to define mock.On call
|
|
func (_e *FileShareRepo_Expecter) ClearExpired() *FileShareRepo_ClearExpired_Call {
|
|
return &FileShareRepo_ClearExpired_Call{Call: _e.mock.On("ClearExpired")}
|
|
}
|
|
|
|
func (_c *FileShareRepo_ClearExpired_Call) Run(run func()) *FileShareRepo_ClearExpired_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_ClearExpired_Call) Return(_a0 int64, _a1 error) *FileShareRepo_ClearExpired_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_ClearExpired_Call) RunAndReturn(run func() (int64, error)) *FileShareRepo_ClearExpired_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Consume provides a mock function with given fields: token, count
|
|
func (_m *FileShareRepo) Consume(token string, count bool) (*biz.FileShare, error) {
|
|
ret := _m.Called(token, count)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Consume")
|
|
}
|
|
|
|
var r0 *biz.FileShare
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, bool) (*biz.FileShare, error)); ok {
|
|
return rf(token, count)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, bool) *biz.FileShare); ok {
|
|
r0 = rf(token, count)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*biz.FileShare)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, bool) error); ok {
|
|
r1 = rf(token, count)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FileShareRepo_Consume_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Consume'
|
|
type FileShareRepo_Consume_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Consume is a helper method to define mock.On call
|
|
// - token string
|
|
// - count bool
|
|
func (_e *FileShareRepo_Expecter) Consume(token interface{}, count interface{}) *FileShareRepo_Consume_Call {
|
|
return &FileShareRepo_Consume_Call{Call: _e.mock.On("Consume", token, count)}
|
|
}
|
|
|
|
func (_c *FileShareRepo_Consume_Call) Run(run func(token string, count bool)) *FileShareRepo_Consume_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(string), args[1].(bool))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Consume_Call) Return(_a0 *biz.FileShare, _a1 error) *FileShareRepo_Consume_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Consume_Call) RunAndReturn(run func(string, bool) (*biz.FileShare, error)) *FileShareRepo_Consume_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Create provides a mock function with given fields: path, maxDownloads, expiredAt
|
|
func (_m *FileShareRepo) Create(path string, maxDownloads uint, expiredAt time.Time) (*biz.FileShare, error) {
|
|
ret := _m.Called(path, maxDownloads, expiredAt)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Create")
|
|
}
|
|
|
|
var r0 *biz.FileShare
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, uint, time.Time) (*biz.FileShare, error)); ok {
|
|
return rf(path, maxDownloads, expiredAt)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, uint, time.Time) *biz.FileShare); ok {
|
|
r0 = rf(path, maxDownloads, expiredAt)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*biz.FileShare)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, uint, time.Time) error); ok {
|
|
r1 = rf(path, maxDownloads, expiredAt)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FileShareRepo_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create'
|
|
type FileShareRepo_Create_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Create is a helper method to define mock.On call
|
|
// - path string
|
|
// - maxDownloads uint
|
|
// - expiredAt time.Time
|
|
func (_e *FileShareRepo_Expecter) Create(path interface{}, maxDownloads interface{}, expiredAt interface{}) *FileShareRepo_Create_Call {
|
|
return &FileShareRepo_Create_Call{Call: _e.mock.On("Create", path, maxDownloads, expiredAt)}
|
|
}
|
|
|
|
func (_c *FileShareRepo_Create_Call) Run(run func(path string, maxDownloads uint, expiredAt time.Time)) *FileShareRepo_Create_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(string), args[1].(uint), args[2].(time.Time))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Create_Call) Return(_a0 *biz.FileShare, _a1 error) *FileShareRepo_Create_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Create_Call) RunAndReturn(run func(string, uint, time.Time) (*biz.FileShare, error)) *FileShareRepo_Create_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: id
|
|
func (_m *FileShareRepo) Delete(id uint) error {
|
|
ret := _m.Called(id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(uint) error); ok {
|
|
r0 = rf(id)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// FileShareRepo_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'
|
|
type FileShareRepo_Delete_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Delete is a helper method to define mock.On call
|
|
// - id uint
|
|
func (_e *FileShareRepo_Expecter) Delete(id interface{}) *FileShareRepo_Delete_Call {
|
|
return &FileShareRepo_Delete_Call{Call: _e.mock.On("Delete", id)}
|
|
}
|
|
|
|
func (_c *FileShareRepo_Delete_Call) Run(run func(id uint)) *FileShareRepo_Delete_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(uint))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Delete_Call) Return(_a0 error) *FileShareRepo_Delete_Call {
|
|
_c.Call.Return(_a0)
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Delete_Call) RunAndReturn(run func(uint) error) *FileShareRepo_Delete_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Get provides a mock function with given fields: id
|
|
func (_m *FileShareRepo) Get(id uint) (*biz.FileShare, error) {
|
|
ret := _m.Called(id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *biz.FileShare
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(uint) (*biz.FileShare, error)); ok {
|
|
return rf(id)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(uint) *biz.FileShare); ok {
|
|
r0 = rf(id)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*biz.FileShare)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(uint) error); ok {
|
|
r1 = rf(id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FileShareRepo_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
|
|
type FileShareRepo_Get_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Get is a helper method to define mock.On call
|
|
// - id uint
|
|
func (_e *FileShareRepo_Expecter) Get(id interface{}) *FileShareRepo_Get_Call {
|
|
return &FileShareRepo_Get_Call{Call: _e.mock.On("Get", id)}
|
|
}
|
|
|
|
func (_c *FileShareRepo_Get_Call) Run(run func(id uint)) *FileShareRepo_Get_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run(args[0].(uint))
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Get_Call) Return(_a0 *biz.FileShare, _a1 error) *FileShareRepo_Get_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_Get_Call) RunAndReturn(run func(uint) (*biz.FileShare, error)) *FileShareRepo_Get_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// List provides a mock function with no fields
|
|
func (_m *FileShareRepo) List() ([]*biz.FileShare, error) {
|
|
ret := _m.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for List")
|
|
}
|
|
|
|
var r0 []*biz.FileShare
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func() ([]*biz.FileShare, error)); ok {
|
|
return rf()
|
|
}
|
|
if rf, ok := ret.Get(0).(func() []*biz.FileShare); ok {
|
|
r0 = rf()
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*biz.FileShare)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func() error); ok {
|
|
r1 = rf()
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// FileShareRepo_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
|
|
type FileShareRepo_List_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// List is a helper method to define mock.On call
|
|
func (_e *FileShareRepo_Expecter) List() *FileShareRepo_List_Call {
|
|
return &FileShareRepo_List_Call{Call: _e.mock.On("List")}
|
|
}
|
|
|
|
func (_c *FileShareRepo_List_Call) Run(run func()) *FileShareRepo_List_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_List_Call) Return(_a0 []*biz.FileShare, _a1 error) *FileShareRepo_List_Call {
|
|
_c.Call.Return(_a0, _a1)
|
|
return _c
|
|
}
|
|
|
|
func (_c *FileShareRepo_List_Call) RunAndReturn(run func() ([]*biz.FileShare, error)) *FileShareRepo_List_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// NewFileShareRepo creates a new instance of FileShareRepo. 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 NewFileShareRepo(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *FileShareRepo {
|
|
mock := &FileShareRepo{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|