mirror of
https://github.com/absmach/magistrala.git
synced 2026-06-23 04:10:28 +00:00
61d0427898
Signed-off-by: dusan <borovcanindusan1@gmail.com>
317 lines
9.4 KiB
Go
317 lines
9.4 KiB
Go
// Copyright (c) Abstract Machines
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/absmach/magistrala/auth"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewUserActiveTokensCache creates a new instance of UserActiveTokensCache. 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 NewUserActiveTokensCache(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *UserActiveTokensCache {
|
|
mock := &UserActiveTokensCache{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// UserActiveTokensCache is an autogenerated mock type for the UserActiveTokensCache type
|
|
type UserActiveTokensCache struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type UserActiveTokensCache_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *UserActiveTokensCache) EXPECT() *UserActiveTokensCache_Expecter {
|
|
return &UserActiveTokensCache_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// IsActive provides a mock function for the type UserActiveTokensCache
|
|
func (_mock *UserActiveTokensCache) IsActive(ctx context.Context, tokenID string) (bool, error) {
|
|
ret := _mock.Called(ctx, tokenID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for IsActive")
|
|
}
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bool, error)); ok {
|
|
return returnFunc(ctx, tokenID)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) bool); ok {
|
|
r0 = returnFunc(ctx, tokenID)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = returnFunc(ctx, tokenID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// UserActiveTokensCache_IsActive_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsActive'
|
|
type UserActiveTokensCache_IsActive_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// IsActive is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - tokenID string
|
|
func (_e *UserActiveTokensCache_Expecter) IsActive(ctx interface{}, tokenID interface{}) *UserActiveTokensCache_IsActive_Call {
|
|
return &UserActiveTokensCache_IsActive_Call{Call: _e.mock.On("IsActive", ctx, tokenID)}
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_IsActive_Call) Run(run func(ctx context.Context, tokenID string)) *UserActiveTokensCache_IsActive_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 *UserActiveTokensCache_IsActive_Call) Return(b bool, err error) *UserActiveTokensCache_IsActive_Call {
|
|
_c.Call.Return(b, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_IsActive_Call) RunAndReturn(run func(ctx context.Context, tokenID string) (bool, error)) *UserActiveTokensCache_IsActive_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ListUserTokens provides a mock function for the type UserActiveTokensCache
|
|
func (_mock *UserActiveTokensCache) ListUserTokens(ctx context.Context, userID string) ([]auth.TokenInfo, error) {
|
|
ret := _mock.Called(ctx, userID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ListUserTokens")
|
|
}
|
|
|
|
var r0 []auth.TokenInfo
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]auth.TokenInfo, error)); ok {
|
|
return returnFunc(ctx, userID)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) []auth.TokenInfo); ok {
|
|
r0 = returnFunc(ctx, userID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]auth.TokenInfo)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = returnFunc(ctx, userID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// UserActiveTokensCache_ListUserTokens_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListUserTokens'
|
|
type UserActiveTokensCache_ListUserTokens_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ListUserTokens is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
func (_e *UserActiveTokensCache_Expecter) ListUserTokens(ctx interface{}, userID interface{}) *UserActiveTokensCache_ListUserTokens_Call {
|
|
return &UserActiveTokensCache_ListUserTokens_Call{Call: _e.mock.On("ListUserTokens", ctx, userID)}
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_ListUserTokens_Call) Run(run func(ctx context.Context, userID string)) *UserActiveTokensCache_ListUserTokens_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 *UserActiveTokensCache_ListUserTokens_Call) Return(tokenInfos []auth.TokenInfo, err error) *UserActiveTokensCache_ListUserTokens_Call {
|
|
_c.Call.Return(tokenInfos, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_ListUserTokens_Call) RunAndReturn(run func(ctx context.Context, userID string) ([]auth.TokenInfo, error)) *UserActiveTokensCache_ListUserTokens_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveActive provides a mock function for the type UserActiveTokensCache
|
|
func (_mock *UserActiveTokensCache) RemoveActive(ctx context.Context, userID string, tokenID string) error {
|
|
ret := _mock.Called(ctx, userID, tokenID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveActive")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
|
|
r0 = returnFunc(ctx, userID, tokenID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// UserActiveTokensCache_RemoveActive_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveActive'
|
|
type UserActiveTokensCache_RemoveActive_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveActive is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
// - tokenID string
|
|
func (_e *UserActiveTokensCache_Expecter) RemoveActive(ctx interface{}, userID interface{}, tokenID interface{}) *UserActiveTokensCache_RemoveActive_Call {
|
|
return &UserActiveTokensCache_RemoveActive_Call{Call: _e.mock.On("RemoveActive", ctx, userID, tokenID)}
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_RemoveActive_Call) Run(run func(ctx context.Context, userID string, tokenID string)) *UserActiveTokensCache_RemoveActive_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
|
|
if args[2] != nil {
|
|
arg2 = args[2].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_RemoveActive_Call) Return(err error) *UserActiveTokensCache_RemoveActive_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_RemoveActive_Call) RunAndReturn(run func(ctx context.Context, userID string, tokenID string) error) *UserActiveTokensCache_RemoveActive_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// SaveActive provides a mock function for the type UserActiveTokensCache
|
|
func (_mock *UserActiveTokensCache) SaveActive(ctx context.Context, userID string, tokenID string, description string, expiry time.Time) error {
|
|
ret := _mock.Called(ctx, userID, tokenID, description, expiry)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SaveActive")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, string, time.Time) error); ok {
|
|
r0 = returnFunc(ctx, userID, tokenID, description, expiry)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// UserActiveTokensCache_SaveActive_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveActive'
|
|
type UserActiveTokensCache_SaveActive_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// SaveActive is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
// - tokenID string
|
|
// - description string
|
|
// - expiry time.Time
|
|
func (_e *UserActiveTokensCache_Expecter) SaveActive(ctx interface{}, userID interface{}, tokenID interface{}, description interface{}, expiry interface{}) *UserActiveTokensCache_SaveActive_Call {
|
|
return &UserActiveTokensCache_SaveActive_Call{Call: _e.mock.On("SaveActive", ctx, userID, tokenID, description, expiry)}
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_SaveActive_Call) Run(run func(ctx context.Context, userID string, tokenID string, description string, expiry time.Time)) *UserActiveTokensCache_SaveActive_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
|
|
if args[2] != nil {
|
|
arg2 = args[2].(string)
|
|
}
|
|
var arg3 string
|
|
if args[3] != nil {
|
|
arg3 = args[3].(string)
|
|
}
|
|
var arg4 time.Time
|
|
if args[4] != nil {
|
|
arg4 = args[4].(time.Time)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
arg3,
|
|
arg4,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_SaveActive_Call) Return(err error) *UserActiveTokensCache_SaveActive_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *UserActiveTokensCache_SaveActive_Call) RunAndReturn(run func(ctx context.Context, userID string, tokenID string, description string, expiry time.Time) error) *UserActiveTokensCache_SaveActive_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|