mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-15 15:30:26 +00:00
Enhances authorized integrations (#12261) with a cache of the remote OpenID Connect descriptor file and JSON Web Key Set (JWKS), improving runtime performance and reducing intermittent reliability risks. By default a 10 minute cache is used, configurable through `[authorized_integration].CACHE_TTL`. To mock the cache for testing, mockery code generation is added, and a previous manually generated mock for `AuthorizationReducer` was replaced with the code generation. ## Checklist The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org). ### Tests for Go changes - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I ran... - [x] `make pr-go` before pushing ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. - Authorized integrations are not yet exposed to end-users. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12275 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
1240 lines
32 KiB
Go
1240 lines
32 KiB
Go
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package nosql
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/redis/go-redis/v9"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewMockRedisClient creates a new instance of MockRedisClient. 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 NewMockRedisClient(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
},
|
|
) *MockRedisClient {
|
|
mock := &MockRedisClient{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// MockRedisClient is an autogenerated mock type for the RedisClient type
|
|
type MockRedisClient struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockRedisClient_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockRedisClient) EXPECT() *MockRedisClient_Expecter {
|
|
return &MockRedisClient_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Close provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Close() error {
|
|
ret := _mock.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Close")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func() error); ok {
|
|
r0 = returnFunc()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close'
|
|
type MockRedisClient_Close_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Close is a helper method to define mock.On call
|
|
func (_e *MockRedisClient_Expecter) Close() *MockRedisClient_Close_Call {
|
|
return &MockRedisClient_Close_Call{Call: _e.mock.On("Close")}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Close_Call) Run(run func()) *MockRedisClient_Close_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Close_Call) Return(err error) *MockRedisClient_Close_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Close_Call) RunAndReturn(run func() error) *MockRedisClient_Close_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// DBSize provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) DBSize(ctx context.Context) *redis.IntCmd {
|
|
ret := _mock.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for DBSize")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_DBSize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DBSize'
|
|
type MockRedisClient_DBSize_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// DBSize is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
func (_e *MockRedisClient_Expecter) DBSize(ctx any) *MockRedisClient_DBSize_Call {
|
|
return &MockRedisClient_DBSize_Call{Call: _e.mock.On("DBSize", ctx)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_DBSize_Call) Run(run func(ctx context.Context)) *MockRedisClient_DBSize_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_DBSize_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_DBSize_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_DBSize_Call) RunAndReturn(run func(ctx context.Context) *redis.IntCmd) *MockRedisClient_DBSize_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Decr provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Decr(ctx context.Context, key string) *redis.IntCmd {
|
|
ret := _mock.Called(ctx, key)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Decr")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Decr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Decr'
|
|
type MockRedisClient_Decr_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Decr is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
func (_e *MockRedisClient_Expecter) Decr(ctx, key any) *MockRedisClient_Decr_Call {
|
|
return &MockRedisClient_Decr_Call{Call: _e.mock.On("Decr", ctx, key)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Decr_Call) Run(run func(ctx context.Context, key string)) *MockRedisClient_Decr_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Decr_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_Decr_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Decr_Call) RunAndReturn(run func(ctx context.Context, key string) *redis.IntCmd) *MockRedisClient_Decr_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Del provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Del(ctx context.Context, keys ...string) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(keys) > 0 {
|
|
tmpRet = _mock.Called(ctx, keys)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Del")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, ...string) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, keys...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Del_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Del'
|
|
type MockRedisClient_Del_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Del is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - keys ...string
|
|
func (_e *MockRedisClient_Expecter) Del(ctx any, keys ...any) *MockRedisClient_Del_Call {
|
|
return &MockRedisClient_Del_Call{Call: _e.mock.On("Del",
|
|
append([]any{ctx}, keys...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Del_Call) Run(run func(ctx context.Context, keys ...string)) *MockRedisClient_Del_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 []string
|
|
var variadicArgs []string
|
|
if len(args) > 1 {
|
|
variadicArgs = args[1].([]string)
|
|
}
|
|
arg1 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Del_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_Del_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Del_Call) RunAndReturn(run func(ctx context.Context, keys ...string) *redis.IntCmd) *MockRedisClient_Del_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Exists provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Exists(ctx context.Context, keys ...string) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(keys) > 0 {
|
|
tmpRet = _mock.Called(ctx, keys)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Exists")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, ...string) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, keys...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Exists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Exists'
|
|
type MockRedisClient_Exists_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Exists is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - keys ...string
|
|
func (_e *MockRedisClient_Expecter) Exists(ctx any, keys ...any) *MockRedisClient_Exists_Call {
|
|
return &MockRedisClient_Exists_Call{Call: _e.mock.On("Exists",
|
|
append([]any{ctx}, keys...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Exists_Call) Run(run func(ctx context.Context, keys ...string)) *MockRedisClient_Exists_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 []string
|
|
var variadicArgs []string
|
|
if len(args) > 1 {
|
|
variadicArgs = args[1].([]string)
|
|
}
|
|
arg1 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Exists_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_Exists_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Exists_Call) RunAndReturn(run func(ctx context.Context, keys ...string) *redis.IntCmd) *MockRedisClient_Exists_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// FlushDB provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) FlushDB(ctx context.Context) *redis.StatusCmd {
|
|
ret := _mock.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FlushDB")
|
|
}
|
|
|
|
var r0 *redis.StatusCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context) *redis.StatusCmd); ok {
|
|
r0 = returnFunc(ctx)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.StatusCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_FlushDB_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FlushDB'
|
|
type MockRedisClient_FlushDB_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// FlushDB is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
func (_e *MockRedisClient_Expecter) FlushDB(ctx any) *MockRedisClient_FlushDB_Call {
|
|
return &MockRedisClient_FlushDB_Call{Call: _e.mock.On("FlushDB", ctx)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_FlushDB_Call) Run(run func(ctx context.Context)) *MockRedisClient_FlushDB_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_FlushDB_Call) Return(statusCmd *redis.StatusCmd) *MockRedisClient_FlushDB_Call {
|
|
_c.Call.Return(statusCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_FlushDB_Call) RunAndReturn(run func(ctx context.Context) *redis.StatusCmd) *MockRedisClient_FlushDB_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Get provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Get(ctx context.Context, key string) *redis.StringCmd {
|
|
ret := _mock.Called(ctx, key)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *redis.StringCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) *redis.StringCmd); ok {
|
|
r0 = returnFunc(ctx, key)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.StringCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
|
|
type MockRedisClient_Get_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Get is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
func (_e *MockRedisClient_Expecter) Get(ctx, key any) *MockRedisClient_Get_Call {
|
|
return &MockRedisClient_Get_Call{Call: _e.mock.On("Get", ctx, key)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Get_Call) Run(run func(ctx context.Context, key string)) *MockRedisClient_Get_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Get_Call) Return(stringCmd *redis.StringCmd) *MockRedisClient_Get_Call {
|
|
_c.Call.Return(stringCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Get_Call) RunAndReturn(run func(ctx context.Context, key string) *redis.StringCmd) *MockRedisClient_Get_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// HDel provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) HDel(ctx context.Context, key string, fields ...string) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(fields) > 0 {
|
|
tmpRet = _mock.Called(ctx, key, fields)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx, key)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for HDel")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, ...string) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key, fields...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_HDel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HDel'
|
|
type MockRedisClient_HDel_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// HDel is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - fields ...string
|
|
func (_e *MockRedisClient_Expecter) HDel(ctx, key any, fields ...any) *MockRedisClient_HDel_Call {
|
|
return &MockRedisClient_HDel_Call{Call: _e.mock.On("HDel",
|
|
append([]any{ctx, key}, fields...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_HDel_Call) Run(run func(ctx context.Context, key string, fields ...string)) *MockRedisClient_HDel_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 []string
|
|
var variadicArgs []string
|
|
if len(args) > 2 {
|
|
variadicArgs = args[2].([]string)
|
|
}
|
|
arg2 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_HDel_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_HDel_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_HDel_Call) RunAndReturn(run func(ctx context.Context, key string, fields ...string) *redis.IntCmd) *MockRedisClient_HDel_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// HKeys provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) HKeys(ctx context.Context, key string) *redis.StringSliceCmd {
|
|
ret := _mock.Called(ctx, key)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for HKeys")
|
|
}
|
|
|
|
var r0 *redis.StringSliceCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) *redis.StringSliceCmd); ok {
|
|
r0 = returnFunc(ctx, key)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.StringSliceCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_HKeys_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HKeys'
|
|
type MockRedisClient_HKeys_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// HKeys is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
func (_e *MockRedisClient_Expecter) HKeys(ctx, key any) *MockRedisClient_HKeys_Call {
|
|
return &MockRedisClient_HKeys_Call{Call: _e.mock.On("HKeys", ctx, key)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_HKeys_Call) Run(run func(ctx context.Context, key string)) *MockRedisClient_HKeys_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_HKeys_Call) Return(stringSliceCmd *redis.StringSliceCmd) *MockRedisClient_HKeys_Call {
|
|
_c.Call.Return(stringSliceCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_HKeys_Call) RunAndReturn(run func(ctx context.Context, key string) *redis.StringSliceCmd) *MockRedisClient_HKeys_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// HSet provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) HSet(ctx context.Context, key string, values ...any) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(values) > 0 {
|
|
tmpRet = _mock.Called(ctx, key, values)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx, key)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for HSet")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, ...any) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key, values...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_HSet_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HSet'
|
|
type MockRedisClient_HSet_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// HSet is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - values ...any
|
|
func (_e *MockRedisClient_Expecter) HSet(ctx, key any, values ...any) *MockRedisClient_HSet_Call {
|
|
return &MockRedisClient_HSet_Call{Call: _e.mock.On("HSet",
|
|
append([]any{ctx, key}, values...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_HSet_Call) Run(run func(ctx context.Context, key string, values ...any)) *MockRedisClient_HSet_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 []any
|
|
var variadicArgs []any
|
|
if len(args) > 2 {
|
|
variadicArgs = args[2].([]any)
|
|
}
|
|
arg2 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_HSet_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_HSet_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_HSet_Call) RunAndReturn(run func(ctx context.Context, key string, values ...any) *redis.IntCmd) *MockRedisClient_HSet_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Incr provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Incr(ctx context.Context, key string) *redis.IntCmd {
|
|
ret := _mock.Called(ctx, key)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Incr")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Incr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Incr'
|
|
type MockRedisClient_Incr_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Incr is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
func (_e *MockRedisClient_Expecter) Incr(ctx, key any) *MockRedisClient_Incr_Call {
|
|
return &MockRedisClient_Incr_Call{Call: _e.mock.On("Incr", ctx, key)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Incr_Call) Run(run func(ctx context.Context, key string)) *MockRedisClient_Incr_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Incr_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_Incr_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Incr_Call) RunAndReturn(run func(ctx context.Context, key string) *redis.IntCmd) *MockRedisClient_Incr_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// LLen provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) LLen(ctx context.Context, key string) *redis.IntCmd {
|
|
ret := _mock.Called(ctx, key)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for LLen")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_LLen_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LLen'
|
|
type MockRedisClient_LLen_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// LLen is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
func (_e *MockRedisClient_Expecter) LLen(ctx, key any) *MockRedisClient_LLen_Call {
|
|
return &MockRedisClient_LLen_Call{Call: _e.mock.On("LLen", ctx, key)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_LLen_Call) Run(run func(ctx context.Context, key string)) *MockRedisClient_LLen_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_LLen_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_LLen_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_LLen_Call) RunAndReturn(run func(ctx context.Context, key string) *redis.IntCmd) *MockRedisClient_LLen_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// LPop provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) LPop(ctx context.Context, key string) *redis.StringCmd {
|
|
ret := _mock.Called(ctx, key)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for LPop")
|
|
}
|
|
|
|
var r0 *redis.StringCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) *redis.StringCmd); ok {
|
|
r0 = returnFunc(ctx, key)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.StringCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_LPop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LPop'
|
|
type MockRedisClient_LPop_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// LPop is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
func (_e *MockRedisClient_Expecter) LPop(ctx, key any) *MockRedisClient_LPop_Call {
|
|
return &MockRedisClient_LPop_Call{Call: _e.mock.On("LPop", ctx, key)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_LPop_Call) Run(run func(ctx context.Context, key string)) *MockRedisClient_LPop_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_LPop_Call) Return(stringCmd *redis.StringCmd) *MockRedisClient_LPop_Call {
|
|
_c.Call.Return(stringCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_LPop_Call) RunAndReturn(run func(ctx context.Context, key string) *redis.StringCmd) *MockRedisClient_LPop_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Ping provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Ping(ctx context.Context) *redis.StatusCmd {
|
|
ret := _mock.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Ping")
|
|
}
|
|
|
|
var r0 *redis.StatusCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context) *redis.StatusCmd); ok {
|
|
r0 = returnFunc(ctx)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.StatusCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Ping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ping'
|
|
type MockRedisClient_Ping_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Ping is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
func (_e *MockRedisClient_Expecter) Ping(ctx any) *MockRedisClient_Ping_Call {
|
|
return &MockRedisClient_Ping_Call{Call: _e.mock.On("Ping", ctx)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Ping_Call) Run(run func(ctx context.Context)) *MockRedisClient_Ping_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Ping_Call) Return(statusCmd *redis.StatusCmd) *MockRedisClient_Ping_Call {
|
|
_c.Call.Return(statusCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Ping_Call) RunAndReturn(run func(ctx context.Context) *redis.StatusCmd) *MockRedisClient_Ping_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RPush provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) RPush(ctx context.Context, key string, values ...any) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(values) > 0 {
|
|
tmpRet = _mock.Called(ctx, key, values)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx, key)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RPush")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, ...any) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key, values...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_RPush_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RPush'
|
|
type MockRedisClient_RPush_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RPush is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - values ...any
|
|
func (_e *MockRedisClient_Expecter) RPush(ctx, key any, values ...any) *MockRedisClient_RPush_Call {
|
|
return &MockRedisClient_RPush_Call{Call: _e.mock.On("RPush",
|
|
append([]any{ctx, key}, values...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_RPush_Call) Run(run func(ctx context.Context, key string, values ...any)) *MockRedisClient_RPush_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 []any
|
|
var variadicArgs []any
|
|
if len(args) > 2 {
|
|
variadicArgs = args[2].([]any)
|
|
}
|
|
arg2 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_RPush_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_RPush_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_RPush_Call) RunAndReturn(run func(ctx context.Context, key string, values ...any) *redis.IntCmd) *MockRedisClient_RPush_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// SAdd provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) SAdd(ctx context.Context, key string, members ...any) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(members) > 0 {
|
|
tmpRet = _mock.Called(ctx, key, members)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx, key)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SAdd")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, ...any) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key, members...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_SAdd_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SAdd'
|
|
type MockRedisClient_SAdd_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// SAdd is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - members ...any
|
|
func (_e *MockRedisClient_Expecter) SAdd(ctx, key any, members ...any) *MockRedisClient_SAdd_Call {
|
|
return &MockRedisClient_SAdd_Call{Call: _e.mock.On("SAdd",
|
|
append([]any{ctx, key}, members...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_SAdd_Call) Run(run func(ctx context.Context, key string, members ...any)) *MockRedisClient_SAdd_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 []any
|
|
var variadicArgs []any
|
|
if len(args) > 2 {
|
|
variadicArgs = args[2].([]any)
|
|
}
|
|
arg2 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_SAdd_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_SAdd_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_SAdd_Call) RunAndReturn(run func(ctx context.Context, key string, members ...any) *redis.IntCmd) *MockRedisClient_SAdd_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// SIsMember provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) SIsMember(ctx context.Context, key string, member any) *redis.BoolCmd {
|
|
ret := _mock.Called(ctx, key, member)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SIsMember")
|
|
}
|
|
|
|
var r0 *redis.BoolCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, any) *redis.BoolCmd); ok {
|
|
r0 = returnFunc(ctx, key, member)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.BoolCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_SIsMember_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SIsMember'
|
|
type MockRedisClient_SIsMember_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// SIsMember is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - member any
|
|
func (_e *MockRedisClient_Expecter) SIsMember(ctx, key, member any) *MockRedisClient_SIsMember_Call {
|
|
return &MockRedisClient_SIsMember_Call{Call: _e.mock.On("SIsMember", ctx, key, member)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_SIsMember_Call) Run(run func(ctx context.Context, key string, member any)) *MockRedisClient_SIsMember_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 any
|
|
if args[2] != nil {
|
|
arg2 = args[2].(any)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_SIsMember_Call) Return(boolCmd *redis.BoolCmd) *MockRedisClient_SIsMember_Call {
|
|
_c.Call.Return(boolCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_SIsMember_Call) RunAndReturn(run func(ctx context.Context, key string, member any) *redis.BoolCmd) *MockRedisClient_SIsMember_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// SRem provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) SRem(ctx context.Context, key string, members ...any) *redis.IntCmd {
|
|
var tmpRet mock.Arguments
|
|
if len(members) > 0 {
|
|
tmpRet = _mock.Called(ctx, key, members)
|
|
} else {
|
|
tmpRet = _mock.Called(ctx, key)
|
|
}
|
|
ret := tmpRet
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SRem")
|
|
}
|
|
|
|
var r0 *redis.IntCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, ...any) *redis.IntCmd); ok {
|
|
r0 = returnFunc(ctx, key, members...)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.IntCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_SRem_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SRem'
|
|
type MockRedisClient_SRem_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// SRem is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - members ...any
|
|
func (_e *MockRedisClient_Expecter) SRem(ctx, key any, members ...any) *MockRedisClient_SRem_Call {
|
|
return &MockRedisClient_SRem_Call{Call: _e.mock.On("SRem",
|
|
append([]any{ctx, key}, members...)...)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_SRem_Call) Run(run func(ctx context.Context, key string, members ...any)) *MockRedisClient_SRem_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 []any
|
|
var variadicArgs []any
|
|
if len(args) > 2 {
|
|
variadicArgs = args[2].([]any)
|
|
}
|
|
arg2 = variadicArgs
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2...,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_SRem_Call) Return(intCmd *redis.IntCmd) *MockRedisClient_SRem_Call {
|
|
_c.Call.Return(intCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_SRem_Call) RunAndReturn(run func(ctx context.Context, key string, members ...any) *redis.IntCmd) *MockRedisClient_SRem_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Set provides a mock function for the type MockRedisClient
|
|
func (_mock *MockRedisClient) Set(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd {
|
|
ret := _mock.Called(ctx, key, value, expiration)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Set")
|
|
}
|
|
|
|
var r0 *redis.StatusCmd
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, any, time.Duration) *redis.StatusCmd); ok {
|
|
r0 = returnFunc(ctx, key, value, expiration)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*redis.StatusCmd)
|
|
}
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// MockRedisClient_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'
|
|
type MockRedisClient_Set_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Set is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - key string
|
|
// - value any
|
|
// - expiration time.Duration
|
|
func (_e *MockRedisClient_Expecter) Set(ctx, key, value, expiration any) *MockRedisClient_Set_Call {
|
|
return &MockRedisClient_Set_Call{Call: _e.mock.On("Set", ctx, key, value, expiration)}
|
|
}
|
|
|
|
func (_c *MockRedisClient_Set_Call) Run(run func(ctx context.Context, key string, value any, expiration time.Duration)) *MockRedisClient_Set_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
var arg2 any
|
|
if args[2] != nil {
|
|
arg2 = args[2].(any)
|
|
}
|
|
var arg3 time.Duration
|
|
if args[3] != nil {
|
|
arg3 = args[3].(time.Duration)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
arg3,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Set_Call) Return(statusCmd *redis.StatusCmd) *MockRedisClient_Set_Call {
|
|
_c.Call.Return(statusCmd)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockRedisClient_Set_Call) RunAndReturn(run func(ctx context.Context, key string, value any, expiration time.Duration) *redis.StatusCmd) *MockRedisClient_Set_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|