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>
108 lines
2.7 KiB
Go
108 lines
2.7 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"
|
|
"github.com/absmach/magistrala/pkg/policies"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewAuthz creates a new instance of Authz. 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 NewAuthz(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *Authz {
|
|
mock := &Authz{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// Authz is an autogenerated mock type for the Authz type
|
|
type Authz struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type Authz_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *Authz) EXPECT() *Authz_Expecter {
|
|
return &Authz_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Authorize provides a mock function for the type Authz
|
|
func (_mock *Authz) Authorize(ctx context.Context, pr policies.Policy, patAuthz *auth.PATAuthz) error {
|
|
ret := _mock.Called(ctx, pr, patAuthz)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Authorize")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, policies.Policy, *auth.PATAuthz) error); ok {
|
|
r0 = returnFunc(ctx, pr, patAuthz)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Authz_Authorize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authorize'
|
|
type Authz_Authorize_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Authorize is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - pr policies.Policy
|
|
// - patAuthz *auth.PATAuthz
|
|
func (_e *Authz_Expecter) Authorize(ctx interface{}, pr interface{}, patAuthz interface{}) *Authz_Authorize_Call {
|
|
return &Authz_Authorize_Call{Call: _e.mock.On("Authorize", ctx, pr, patAuthz)}
|
|
}
|
|
|
|
func (_c *Authz_Authorize_Call) Run(run func(ctx context.Context, pr policies.Policy, patAuthz *auth.PATAuthz)) *Authz_Authorize_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 policies.Policy
|
|
if args[1] != nil {
|
|
arg1 = args[1].(policies.Policy)
|
|
}
|
|
var arg2 *auth.PATAuthz
|
|
if args[2] != nil {
|
|
arg2 = args[2].(*auth.PATAuthz)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Authz_Authorize_Call) Return(err error) *Authz_Authorize_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Authz_Authorize_Call) RunAndReturn(run func(ctx context.Context, pr policies.Policy, patAuthz *auth.PATAuthz) error) *Authz_Authorize_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|