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>
377 lines
10 KiB
Go
377 lines
10 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"
|
|
|
|
"github.com/absmach/magistrala/auth"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewCache creates a new instance of Cache. 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 NewCache(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *Cache {
|
|
mock := &Cache{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// Cache is an autogenerated mock type for the Cache type
|
|
type Cache struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type Cache_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *Cache) EXPECT() *Cache_Expecter {
|
|
return &Cache_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// CheckScope provides a mock function for the type Cache
|
|
func (_mock *Cache) CheckScope(ctx context.Context, userID string, patID string, optionalDomainID string, entityType auth.EntityType, operation string, entityID string) bool {
|
|
ret := _mock.Called(ctx, userID, patID, optionalDomainID, entityType, operation, entityID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CheckScope")
|
|
}
|
|
|
|
var r0 bool
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, string, auth.EntityType, string, string) bool); ok {
|
|
r0 = returnFunc(ctx, userID, patID, optionalDomainID, entityType, operation, entityID)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Cache_CheckScope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckScope'
|
|
type Cache_CheckScope_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// CheckScope is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
// - patID string
|
|
// - optionalDomainID string
|
|
// - entityType auth.EntityType
|
|
// - operation string
|
|
// - entityID string
|
|
func (_e *Cache_Expecter) CheckScope(ctx interface{}, userID interface{}, patID interface{}, optionalDomainID interface{}, entityType interface{}, operation interface{}, entityID interface{}) *Cache_CheckScope_Call {
|
|
return &Cache_CheckScope_Call{Call: _e.mock.On("CheckScope", ctx, userID, patID, optionalDomainID, entityType, operation, entityID)}
|
|
}
|
|
|
|
func (_c *Cache_CheckScope_Call) Run(run func(ctx context.Context, userID string, patID string, optionalDomainID string, entityType auth.EntityType, operation string, entityID string)) *Cache_CheckScope_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 auth.EntityType
|
|
if args[4] != nil {
|
|
arg4 = args[4].(auth.EntityType)
|
|
}
|
|
var arg5 string
|
|
if args[5] != nil {
|
|
arg5 = args[5].(string)
|
|
}
|
|
var arg6 string
|
|
if args[6] != nil {
|
|
arg6 = args[6].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
arg3,
|
|
arg4,
|
|
arg5,
|
|
arg6,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_CheckScope_Call) Return(b bool) *Cache_CheckScope_Call {
|
|
_c.Call.Return(b)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_CheckScope_Call) RunAndReturn(run func(ctx context.Context, userID string, patID string, optionalDomainID string, entityType auth.EntityType, operation string, entityID string) bool) *Cache_CheckScope_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Remove provides a mock function for the type Cache
|
|
func (_mock *Cache) Remove(ctx context.Context, userID string, scopesID []string) error {
|
|
ret := _mock.Called(ctx, userID, scopesID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Remove")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string) error); ok {
|
|
r0 = returnFunc(ctx, userID, scopesID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Cache_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
|
|
type Cache_Remove_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Remove is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
// - scopesID []string
|
|
func (_e *Cache_Expecter) Remove(ctx interface{}, userID interface{}, scopesID interface{}) *Cache_Remove_Call {
|
|
return &Cache_Remove_Call{Call: _e.mock.On("Remove", ctx, userID, scopesID)}
|
|
}
|
|
|
|
func (_c *Cache_Remove_Call) Run(run func(ctx context.Context, userID string, scopesID []string)) *Cache_Remove_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 *Cache_Remove_Call) Return(err error) *Cache_Remove_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_Remove_Call) RunAndReturn(run func(ctx context.Context, userID string, scopesID []string) error) *Cache_Remove_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveAllScope provides a mock function for the type Cache
|
|
func (_mock *Cache) RemoveAllScope(ctx context.Context, userID string, patID string) error {
|
|
ret := _mock.Called(ctx, userID, patID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveAllScope")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
|
|
r0 = returnFunc(ctx, userID, patID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Cache_RemoveAllScope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAllScope'
|
|
type Cache_RemoveAllScope_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveAllScope is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
// - patID string
|
|
func (_e *Cache_Expecter) RemoveAllScope(ctx interface{}, userID interface{}, patID interface{}) *Cache_RemoveAllScope_Call {
|
|
return &Cache_RemoveAllScope_Call{Call: _e.mock.On("RemoveAllScope", ctx, userID, patID)}
|
|
}
|
|
|
|
func (_c *Cache_RemoveAllScope_Call) Run(run func(ctx context.Context, userID string, patID string)) *Cache_RemoveAllScope_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 *Cache_RemoveAllScope_Call) Return(err error) *Cache_RemoveAllScope_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_RemoveAllScope_Call) RunAndReturn(run func(ctx context.Context, userID string, patID string) error) *Cache_RemoveAllScope_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveUserAllScope provides a mock function for the type Cache
|
|
func (_mock *Cache) RemoveUserAllScope(ctx context.Context, userID string) error {
|
|
ret := _mock.Called(ctx, userID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveUserAllScope")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
|
|
r0 = returnFunc(ctx, userID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Cache_RemoveUserAllScope_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveUserAllScope'
|
|
type Cache_RemoveUserAllScope_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveUserAllScope is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
func (_e *Cache_Expecter) RemoveUserAllScope(ctx interface{}, userID interface{}) *Cache_RemoveUserAllScope_Call {
|
|
return &Cache_RemoveUserAllScope_Call{Call: _e.mock.On("RemoveUserAllScope", ctx, userID)}
|
|
}
|
|
|
|
func (_c *Cache_RemoveUserAllScope_Call) Run(run func(ctx context.Context, userID string)) *Cache_RemoveUserAllScope_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 *Cache_RemoveUserAllScope_Call) Return(err error) *Cache_RemoveUserAllScope_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_RemoveUserAllScope_Call) RunAndReturn(run func(ctx context.Context, userID string) error) *Cache_RemoveUserAllScope_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Save provides a mock function for the type Cache
|
|
func (_mock *Cache) Save(ctx context.Context, userID string, scopes []auth.Scope) error {
|
|
ret := _mock.Called(ctx, userID, scopes)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Save")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []auth.Scope) error); ok {
|
|
r0 = returnFunc(ctx, userID, scopes)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Cache_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
|
|
type Cache_Save_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Save is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - userID string
|
|
// - scopes []auth.Scope
|
|
func (_e *Cache_Expecter) Save(ctx interface{}, userID interface{}, scopes interface{}) *Cache_Save_Call {
|
|
return &Cache_Save_Call{Call: _e.mock.On("Save", ctx, userID, scopes)}
|
|
}
|
|
|
|
func (_c *Cache_Save_Call) Run(run func(ctx context.Context, userID string, scopes []auth.Scope)) *Cache_Save_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 []auth.Scope
|
|
if args[2] != nil {
|
|
arg2 = args[2].([]auth.Scope)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_Save_Call) Return(err error) *Cache_Save_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Cache_Save_Call) RunAndReturn(run func(ctx context.Context, userID string, scopes []auth.Scope) error) *Cache_Save_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|