NOISSUE - Simplify Mockery config (#101)

* Fix Mockery config

Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>

* Simplify Mockery config

Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>

---------

Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
This commit is contained in:
Dušan Borovčanin
2025-04-01 12:13:52 +02:00
committed by GitHub
parent 097490ad34
commit b34a6cb457
25 changed files with 1626 additions and 1622 deletions
-1
View File
@@ -44,7 +44,6 @@ jobs:
version: v2.0.2
args: --config ./tools/config/.golangci.yaml
run-tests:
name: Run tests
runs-on: ubuntu-latest
+3 -3
View File
@@ -20,7 +20,7 @@ import (
"github.com/absmach/magistrala/bootstrap"
bsapi "github.com/absmach/magistrala/bootstrap/api"
mocks "github.com/absmach/magistrala/bootstrap/mocks"
"github.com/absmach/magistrala/bootstrap/mocks"
"github.com/absmach/magistrala/internal/testsutil"
apiutil "github.com/absmach/supermq/api/http/util"
smqlog "github.com/absmach/supermq/logger"
@@ -176,9 +176,9 @@ func dec(in []byte) ([]byte, error) {
return in, nil
}
func newBootstrapServer() (*httptest.Server, *mocks.MockService, *authnmocks.Authentication) {
func newBootstrapServer() (*httptest.Server, *mocks.Service, *authnmocks.Authentication) {
logger := smqlog.NewMock()
svc := new(mocks.MockService)
svc := new(mocks.Service)
authn := new(authnmocks.Authentication)
mux := bsapi.MakeHandler(svc, authn, bootstrap.NewConfigReader(encKey), logger, instanceID)
return httptest.NewServer(mux), svc, authn
+3 -3
View File
@@ -13,7 +13,7 @@ import (
"github.com/absmach/magistrala/bootstrap"
"github.com/absmach/magistrala/bootstrap/events/producer"
mocks "github.com/absmach/magistrala/bootstrap/mocks"
"github.com/absmach/magistrala/bootstrap/mocks"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/supermq/pkg/authn"
smqauthn "github.com/absmach/supermq/pkg/authn"
@@ -87,13 +87,13 @@ var (
type testVariable struct {
svc bootstrap.Service
boot *mocks.MockConfigRepository
boot *mocks.ConfigRepository
policies *policymocks.Service
sdk *sdkmocks.SDK
}
func newTestVariable(t *testing.T, redisURL string) testVariable {
boot := new(mocks.MockConfigRepository)
boot := new(mocks.ConfigRepository)
policies := new(policymocks.Service)
sdk := new(sdkmocks.SDK)
idp := uuid.NewMock()
+97
View File
@@ -0,0 +1,97 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"github.com/absmach/magistrala/bootstrap"
mock "github.com/stretchr/testify/mock"
)
// NewConfigReader creates a new instance of ConfigReader. 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 NewConfigReader(t interface {
mock.TestingT
Cleanup(func())
}) *ConfigReader {
mock := &ConfigReader{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// ConfigReader is an autogenerated mock type for the ConfigReader type
type ConfigReader struct {
mock.Mock
}
type ConfigReader_Expecter struct {
mock *mock.Mock
}
func (_m *ConfigReader) EXPECT() *ConfigReader_Expecter {
return &ConfigReader_Expecter{mock: &_m.Mock}
}
// ReadConfig provides a mock function for the type ConfigReader
func (_mock *ConfigReader) ReadConfig(config bootstrap.Config, b bool) (interface{}, error) {
ret := _mock.Called(config, b)
if len(ret) == 0 {
panic("no return value specified for ReadConfig")
}
var r0 interface{}
var r1 error
if returnFunc, ok := ret.Get(0).(func(bootstrap.Config, bool) (interface{}, error)); ok {
return returnFunc(config, b)
}
if returnFunc, ok := ret.Get(0).(func(bootstrap.Config, bool) interface{}); ok {
r0 = returnFunc(config, b)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(interface{})
}
}
if returnFunc, ok := ret.Get(1).(func(bootstrap.Config, bool) error); ok {
r1 = returnFunc(config, b)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfigReader_ReadConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadConfig'
type ConfigReader_ReadConfig_Call struct {
*mock.Call
}
// ReadConfig is a helper method to define mock.On call
// - config
// - b
func (_e *ConfigReader_Expecter) ReadConfig(config interface{}, b interface{}) *ConfigReader_ReadConfig_Call {
return &ConfigReader_ReadConfig_Call{Call: _e.mock.On("ReadConfig", config, b)}
}
func (_c *ConfigReader_ReadConfig_Call) Run(run func(config bootstrap.Config, b bool)) *ConfigReader_ReadConfig_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(bootstrap.Config), args[1].(bool))
})
return _c
}
func (_c *ConfigReader_ReadConfig_Call) Return(ifaceVal interface{}, err error) *ConfigReader_ReadConfig_Call {
_c.Call.Return(ifaceVal, err)
return _c
}
func (_c *ConfigReader_ReadConfig_Call) RunAndReturn(run func(config bootstrap.Config, b bool) (interface{}, error)) *ConfigReader_ReadConfig_Call {
_c.Call.Return(run)
return _c
}
+798
View File
@@ -0,0 +1,798 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"context"
"github.com/absmach/magistrala/bootstrap"
mock "github.com/stretchr/testify/mock"
)
// NewConfigRepository creates a new instance of ConfigRepository. 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 NewConfigRepository(t interface {
mock.TestingT
Cleanup(func())
}) *ConfigRepository {
mock := &ConfigRepository{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// ConfigRepository is an autogenerated mock type for the ConfigRepository type
type ConfigRepository struct {
mock.Mock
}
type ConfigRepository_Expecter struct {
mock *mock.Mock
}
func (_m *ConfigRepository) EXPECT() *ConfigRepository_Expecter {
return &ConfigRepository_Expecter{mock: &_m.Mock}
}
// ChangeState provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) ChangeState(ctx context.Context, domainID string, id string, state bootstrap.State) error {
ret := _mock.Called(ctx, domainID, id, state)
if len(ret) == 0 {
panic("no return value specified for ChangeState")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, bootstrap.State) error); ok {
r0 = returnFunc(ctx, domainID, id, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_ChangeState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeState'
type ConfigRepository_ChangeState_Call struct {
*mock.Call
}
// ChangeState is a helper method to define mock.On call
// - ctx
// - domainID
// - id
// - state
func (_e *ConfigRepository_Expecter) ChangeState(ctx interface{}, domainID interface{}, id interface{}, state interface{}) *ConfigRepository_ChangeState_Call {
return &ConfigRepository_ChangeState_Call{Call: _e.mock.On("ChangeState", ctx, domainID, id, state)}
}
func (_c *ConfigRepository_ChangeState_Call) Run(run func(ctx context.Context, domainID string, id string, state bootstrap.State)) *ConfigRepository_ChangeState_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(bootstrap.State))
})
return _c
}
func (_c *ConfigRepository_ChangeState_Call) Return(err error) *ConfigRepository_ChangeState_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_ChangeState_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string, state bootstrap.State) error) *ConfigRepository_ChangeState_Call {
_c.Call.Return(run)
return _c
}
// ConnectClient provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) ConnectClient(ctx context.Context, channelID string, clientID string) error {
ret := _mock.Called(ctx, channelID, clientID)
if len(ret) == 0 {
panic("no return value specified for ConnectClient")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = returnFunc(ctx, channelID, clientID)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_ConnectClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConnectClient'
type ConfigRepository_ConnectClient_Call struct {
*mock.Call
}
// ConnectClient is a helper method to define mock.On call
// - ctx
// - channelID
// - clientID
func (_e *ConfigRepository_Expecter) ConnectClient(ctx interface{}, channelID interface{}, clientID interface{}) *ConfigRepository_ConnectClient_Call {
return &ConfigRepository_ConnectClient_Call{Call: _e.mock.On("ConnectClient", ctx, channelID, clientID)}
}
func (_c *ConfigRepository_ConnectClient_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *ConfigRepository_ConnectClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *ConfigRepository_ConnectClient_Call) Return(err error) *ConfigRepository_ConnectClient_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_ConnectClient_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *ConfigRepository_ConnectClient_Call {
_c.Call.Return(run)
return _c
}
// DisconnectClient provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) DisconnectClient(ctx context.Context, channelID string, clientID string) error {
ret := _mock.Called(ctx, channelID, clientID)
if len(ret) == 0 {
panic("no return value specified for DisconnectClient")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = returnFunc(ctx, channelID, clientID)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_DisconnectClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisconnectClient'
type ConfigRepository_DisconnectClient_Call struct {
*mock.Call
}
// DisconnectClient is a helper method to define mock.On call
// - ctx
// - channelID
// - clientID
func (_e *ConfigRepository_Expecter) DisconnectClient(ctx interface{}, channelID interface{}, clientID interface{}) *ConfigRepository_DisconnectClient_Call {
return &ConfigRepository_DisconnectClient_Call{Call: _e.mock.On("DisconnectClient", ctx, channelID, clientID)}
}
func (_c *ConfigRepository_DisconnectClient_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *ConfigRepository_DisconnectClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *ConfigRepository_DisconnectClient_Call) Return(err error) *ConfigRepository_DisconnectClient_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_DisconnectClient_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *ConfigRepository_DisconnectClient_Call {
_c.Call.Return(run)
return _c
}
// ListExisting provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) ListExisting(ctx context.Context, domainID string, ids []string) ([]bootstrap.Channel, error) {
ret := _mock.Called(ctx, domainID, ids)
if len(ret) == 0 {
panic("no return value specified for ListExisting")
}
var r0 []bootstrap.Channel
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string) ([]bootstrap.Channel, error)); ok {
return returnFunc(ctx, domainID, ids)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string) []bootstrap.Channel); ok {
r0 = returnFunc(ctx, domainID, ids)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]bootstrap.Channel)
}
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string, []string) error); ok {
r1 = returnFunc(ctx, domainID, ids)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfigRepository_ListExisting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListExisting'
type ConfigRepository_ListExisting_Call struct {
*mock.Call
}
// ListExisting is a helper method to define mock.On call
// - ctx
// - domainID
// - ids
func (_e *ConfigRepository_Expecter) ListExisting(ctx interface{}, domainID interface{}, ids interface{}) *ConfigRepository_ListExisting_Call {
return &ConfigRepository_ListExisting_Call{Call: _e.mock.On("ListExisting", ctx, domainID, ids)}
}
func (_c *ConfigRepository_ListExisting_Call) Run(run func(ctx context.Context, domainID string, ids []string)) *ConfigRepository_ListExisting_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]string))
})
return _c
}
func (_c *ConfigRepository_ListExisting_Call) Return(channels []bootstrap.Channel, err error) *ConfigRepository_ListExisting_Call {
_c.Call.Return(channels, err)
return _c
}
func (_c *ConfigRepository_ListExisting_Call) RunAndReturn(run func(ctx context.Context, domainID string, ids []string) ([]bootstrap.Channel, error)) *ConfigRepository_ListExisting_Call {
_c.Call.Return(run)
return _c
}
// Remove provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) Remove(ctx context.Context, domainID string, id string) error {
ret := _mock.Called(ctx, domainID, id)
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, domainID, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
type ConfigRepository_Remove_Call struct {
*mock.Call
}
// Remove is a helper method to define mock.On call
// - ctx
// - domainID
// - id
func (_e *ConfigRepository_Expecter) Remove(ctx interface{}, domainID interface{}, id interface{}) *ConfigRepository_Remove_Call {
return &ConfigRepository_Remove_Call{Call: _e.mock.On("Remove", ctx, domainID, id)}
}
func (_c *ConfigRepository_Remove_Call) Run(run func(ctx context.Context, domainID string, id string)) *ConfigRepository_Remove_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *ConfigRepository_Remove_Call) Return(err error) *ConfigRepository_Remove_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_Remove_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string) error) *ConfigRepository_Remove_Call {
_c.Call.Return(run)
return _c
}
// RemoveChannel provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) RemoveChannel(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for RemoveChannel")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_RemoveChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveChannel'
type ConfigRepository_RemoveChannel_Call struct {
*mock.Call
}
// RemoveChannel is a helper method to define mock.On call
// - ctx
// - id
func (_e *ConfigRepository_Expecter) RemoveChannel(ctx interface{}, id interface{}) *ConfigRepository_RemoveChannel_Call {
return &ConfigRepository_RemoveChannel_Call{Call: _e.mock.On("RemoveChannel", ctx, id)}
}
func (_c *ConfigRepository_RemoveChannel_Call) Run(run func(ctx context.Context, id string)) *ConfigRepository_RemoveChannel_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *ConfigRepository_RemoveChannel_Call) Return(err error) *ConfigRepository_RemoveChannel_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_RemoveChannel_Call) RunAndReturn(run func(ctx context.Context, id string) error) *ConfigRepository_RemoveChannel_Call {
_c.Call.Return(run)
return _c
}
// RemoveClient provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) RemoveClient(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for RemoveClient")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_RemoveClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveClient'
type ConfigRepository_RemoveClient_Call struct {
*mock.Call
}
// RemoveClient is a helper method to define mock.On call
// - ctx
// - id
func (_e *ConfigRepository_Expecter) RemoveClient(ctx interface{}, id interface{}) *ConfigRepository_RemoveClient_Call {
return &ConfigRepository_RemoveClient_Call{Call: _e.mock.On("RemoveClient", ctx, id)}
}
func (_c *ConfigRepository_RemoveClient_Call) Run(run func(ctx context.Context, id string)) *ConfigRepository_RemoveClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *ConfigRepository_RemoveClient_Call) Return(err error) *ConfigRepository_RemoveClient_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_RemoveClient_Call) RunAndReturn(run func(ctx context.Context, id string) error) *ConfigRepository_RemoveClient_Call {
_c.Call.Return(run)
return _c
}
// RetrieveAll provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) RetrieveAll(ctx context.Context, domainID string, clientIDs []string, filter bootstrap.Filter, offset uint64, limit uint64) bootstrap.ConfigsPage {
ret := _mock.Called(ctx, domainID, clientIDs, filter, offset, limit)
if len(ret) == 0 {
panic("no return value specified for RetrieveAll")
}
var r0 bootstrap.ConfigsPage
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, bootstrap.Filter, uint64, uint64) bootstrap.ConfigsPage); ok {
r0 = returnFunc(ctx, domainID, clientIDs, filter, offset, limit)
} else {
r0 = ret.Get(0).(bootstrap.ConfigsPage)
}
return r0
}
// ConfigRepository_RetrieveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveAll'
type ConfigRepository_RetrieveAll_Call struct {
*mock.Call
}
// RetrieveAll is a helper method to define mock.On call
// - ctx
// - domainID
// - clientIDs
// - filter
// - offset
// - limit
func (_e *ConfigRepository_Expecter) RetrieveAll(ctx interface{}, domainID interface{}, clientIDs interface{}, filter interface{}, offset interface{}, limit interface{}) *ConfigRepository_RetrieveAll_Call {
return &ConfigRepository_RetrieveAll_Call{Call: _e.mock.On("RetrieveAll", ctx, domainID, clientIDs, filter, offset, limit)}
}
func (_c *ConfigRepository_RetrieveAll_Call) Run(run func(ctx context.Context, domainID string, clientIDs []string, filter bootstrap.Filter, offset uint64, limit uint64)) *ConfigRepository_RetrieveAll_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]string), args[3].(bootstrap.Filter), args[4].(uint64), args[5].(uint64))
})
return _c
}
func (_c *ConfigRepository_RetrieveAll_Call) Return(configsPage bootstrap.ConfigsPage) *ConfigRepository_RetrieveAll_Call {
_c.Call.Return(configsPage)
return _c
}
func (_c *ConfigRepository_RetrieveAll_Call) RunAndReturn(run func(ctx context.Context, domainID string, clientIDs []string, filter bootstrap.Filter, offset uint64, limit uint64) bootstrap.ConfigsPage) *ConfigRepository_RetrieveAll_Call {
_c.Call.Return(run)
return _c
}
// RetrieveByExternalID provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) RetrieveByExternalID(ctx context.Context, externalID string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, externalID)
if len(ret) == 0 {
panic("no return value specified for RetrieveByExternalID")
}
var r0 bootstrap.Config
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bootstrap.Config, error)); ok {
return returnFunc(ctx, externalID)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string) bootstrap.Config); ok {
r0 = returnFunc(ctx, externalID)
} else {
r0 = ret.Get(0).(bootstrap.Config)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = returnFunc(ctx, externalID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfigRepository_RetrieveByExternalID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveByExternalID'
type ConfigRepository_RetrieveByExternalID_Call struct {
*mock.Call
}
// RetrieveByExternalID is a helper method to define mock.On call
// - ctx
// - externalID
func (_e *ConfigRepository_Expecter) RetrieveByExternalID(ctx interface{}, externalID interface{}) *ConfigRepository_RetrieveByExternalID_Call {
return &ConfigRepository_RetrieveByExternalID_Call{Call: _e.mock.On("RetrieveByExternalID", ctx, externalID)}
}
func (_c *ConfigRepository_RetrieveByExternalID_Call) Run(run func(ctx context.Context, externalID string)) *ConfigRepository_RetrieveByExternalID_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *ConfigRepository_RetrieveByExternalID_Call) Return(config bootstrap.Config, err error) *ConfigRepository_RetrieveByExternalID_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *ConfigRepository_RetrieveByExternalID_Call) RunAndReturn(run func(ctx context.Context, externalID string) (bootstrap.Config, error)) *ConfigRepository_RetrieveByExternalID_Call {
_c.Call.Return(run)
return _c
}
// RetrieveByID provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) RetrieveByID(ctx context.Context, domainID string, id string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, domainID, id)
if len(ret) == 0 {
panic("no return value specified for RetrieveByID")
}
var r0 bootstrap.Config
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (bootstrap.Config, error)); ok {
return returnFunc(ctx, domainID, id)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) bootstrap.Config); ok {
r0 = returnFunc(ctx, domainID, id)
} else {
r0 = ret.Get(0).(bootstrap.Config)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = returnFunc(ctx, domainID, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfigRepository_RetrieveByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveByID'
type ConfigRepository_RetrieveByID_Call struct {
*mock.Call
}
// RetrieveByID is a helper method to define mock.On call
// - ctx
// - domainID
// - id
func (_e *ConfigRepository_Expecter) RetrieveByID(ctx interface{}, domainID interface{}, id interface{}) *ConfigRepository_RetrieveByID_Call {
return &ConfigRepository_RetrieveByID_Call{Call: _e.mock.On("RetrieveByID", ctx, domainID, id)}
}
func (_c *ConfigRepository_RetrieveByID_Call) Run(run func(ctx context.Context, domainID string, id string)) *ConfigRepository_RetrieveByID_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *ConfigRepository_RetrieveByID_Call) Return(config bootstrap.Config, err error) *ConfigRepository_RetrieveByID_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *ConfigRepository_RetrieveByID_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string) (bootstrap.Config, error)) *ConfigRepository_RetrieveByID_Call {
_c.Call.Return(run)
return _c
}
// Save provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) Save(ctx context.Context, cfg bootstrap.Config, chsConnIDs []string) (string, error) {
ret := _mock.Called(ctx, cfg, chsConnIDs)
if len(ret) == 0 {
panic("no return value specified for Save")
}
var r0 string
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Config, []string) (string, error)); ok {
return returnFunc(ctx, cfg, chsConnIDs)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Config, []string) string); ok {
r0 = returnFunc(ctx, cfg, chsConnIDs)
} else {
r0 = ret.Get(0).(string)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, bootstrap.Config, []string) error); ok {
r1 = returnFunc(ctx, cfg, chsConnIDs)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfigRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
type ConfigRepository_Save_Call struct {
*mock.Call
}
// Save is a helper method to define mock.On call
// - ctx
// - cfg
// - chsConnIDs
func (_e *ConfigRepository_Expecter) Save(ctx interface{}, cfg interface{}, chsConnIDs interface{}) *ConfigRepository_Save_Call {
return &ConfigRepository_Save_Call{Call: _e.mock.On("Save", ctx, cfg, chsConnIDs)}
}
func (_c *ConfigRepository_Save_Call) Run(run func(ctx context.Context, cfg bootstrap.Config, chsConnIDs []string)) *ConfigRepository_Save_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Config), args[2].([]string))
})
return _c
}
func (_c *ConfigRepository_Save_Call) Return(s string, err error) *ConfigRepository_Save_Call {
_c.Call.Return(s, err)
return _c
}
func (_c *ConfigRepository_Save_Call) RunAndReturn(run func(ctx context.Context, cfg bootstrap.Config, chsConnIDs []string) (string, error)) *ConfigRepository_Save_Call {
_c.Call.Return(run)
return _c
}
// Update provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) Update(ctx context.Context, cfg bootstrap.Config) error {
ret := _mock.Called(ctx, cfg)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Config) error); ok {
r0 = returnFunc(ctx, cfg)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type ConfigRepository_Update_Call struct {
*mock.Call
}
// Update is a helper method to define mock.On call
// - ctx
// - cfg
func (_e *ConfigRepository_Expecter) Update(ctx interface{}, cfg interface{}) *ConfigRepository_Update_Call {
return &ConfigRepository_Update_Call{Call: _e.mock.On("Update", ctx, cfg)}
}
func (_c *ConfigRepository_Update_Call) Run(run func(ctx context.Context, cfg bootstrap.Config)) *ConfigRepository_Update_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Config))
})
return _c
}
func (_c *ConfigRepository_Update_Call) Return(err error) *ConfigRepository_Update_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_Update_Call) RunAndReturn(run func(ctx context.Context, cfg bootstrap.Config) error) *ConfigRepository_Update_Call {
_c.Call.Return(run)
return _c
}
// UpdateCert provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) UpdateCert(ctx context.Context, domainID string, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, domainID, clientID, clientCert, clientKey, caCert)
if len(ret) == 0 {
panic("no return value specified for UpdateCert")
}
var r0 bootstrap.Config
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) (bootstrap.Config, error)); ok {
return returnFunc(ctx, domainID, clientID, clientCert, clientKey, caCert)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) bootstrap.Config); ok {
r0 = returnFunc(ctx, domainID, clientID, clientCert, clientKey, caCert)
} else {
r0 = ret.Get(0).(bootstrap.Config)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, string, string, string) error); ok {
r1 = returnFunc(ctx, domainID, clientID, clientCert, clientKey, caCert)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ConfigRepository_UpdateCert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCert'
type ConfigRepository_UpdateCert_Call struct {
*mock.Call
}
// UpdateCert is a helper method to define mock.On call
// - ctx
// - domainID
// - clientID
// - clientCert
// - clientKey
// - caCert
func (_e *ConfigRepository_Expecter) UpdateCert(ctx interface{}, domainID interface{}, clientID interface{}, clientCert interface{}, clientKey interface{}, caCert interface{}) *ConfigRepository_UpdateCert_Call {
return &ConfigRepository_UpdateCert_Call{Call: _e.mock.On("UpdateCert", ctx, domainID, clientID, clientCert, clientKey, caCert)}
}
func (_c *ConfigRepository_UpdateCert_Call) Run(run func(ctx context.Context, domainID string, clientID string, clientCert string, clientKey string, caCert string)) *ConfigRepository_UpdateCert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string), args[4].(string), args[5].(string))
})
return _c
}
func (_c *ConfigRepository_UpdateCert_Call) Return(config bootstrap.Config, err error) *ConfigRepository_UpdateCert_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *ConfigRepository_UpdateCert_Call) RunAndReturn(run func(ctx context.Context, domainID string, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error)) *ConfigRepository_UpdateCert_Call {
_c.Call.Return(run)
return _c
}
// UpdateChannel provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) UpdateChannel(ctx context.Context, c bootstrap.Channel) error {
ret := _mock.Called(ctx, c)
if len(ret) == 0 {
panic("no return value specified for UpdateChannel")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Channel) error); ok {
r0 = returnFunc(ctx, c)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_UpdateChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateChannel'
type ConfigRepository_UpdateChannel_Call struct {
*mock.Call
}
// UpdateChannel is a helper method to define mock.On call
// - ctx
// - c
func (_e *ConfigRepository_Expecter) UpdateChannel(ctx interface{}, c interface{}) *ConfigRepository_UpdateChannel_Call {
return &ConfigRepository_UpdateChannel_Call{Call: _e.mock.On("UpdateChannel", ctx, c)}
}
func (_c *ConfigRepository_UpdateChannel_Call) Run(run func(ctx context.Context, c bootstrap.Channel)) *ConfigRepository_UpdateChannel_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Channel))
})
return _c
}
func (_c *ConfigRepository_UpdateChannel_Call) Return(err error) *ConfigRepository_UpdateChannel_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_UpdateChannel_Call) RunAndReturn(run func(ctx context.Context, c bootstrap.Channel) error) *ConfigRepository_UpdateChannel_Call {
_c.Call.Return(run)
return _c
}
// UpdateConnections provides a mock function for the type ConfigRepository
func (_mock *ConfigRepository) UpdateConnections(ctx context.Context, domainID string, id string, channels []bootstrap.Channel, connections []string) error {
ret := _mock.Called(ctx, domainID, id, channels, connections)
if len(ret) == 0 {
panic("no return value specified for UpdateConnections")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, []bootstrap.Channel, []string) error); ok {
r0 = returnFunc(ctx, domainID, id, channels, connections)
} else {
r0 = ret.Error(0)
}
return r0
}
// ConfigRepository_UpdateConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateConnections'
type ConfigRepository_UpdateConnections_Call struct {
*mock.Call
}
// UpdateConnections is a helper method to define mock.On call
// - ctx
// - domainID
// - id
// - channels
// - connections
func (_e *ConfigRepository_Expecter) UpdateConnections(ctx interface{}, domainID interface{}, id interface{}, channels interface{}, connections interface{}) *ConfigRepository_UpdateConnections_Call {
return &ConfigRepository_UpdateConnections_Call{Call: _e.mock.On("UpdateConnections", ctx, domainID, id, channels, connections)}
}
func (_c *ConfigRepository_UpdateConnections_Call) Run(run func(ctx context.Context, domainID string, id string, channels []bootstrap.Channel, connections []string)) *ConfigRepository_UpdateConnections_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].([]bootstrap.Channel), args[4].([]string))
})
return _c
}
func (_c *ConfigRepository_UpdateConnections_Call) Return(err error) *ConfigRepository_UpdateConnections_Call {
_c.Call.Return(err)
return _c
}
func (_c *ConfigRepository_UpdateConnections_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string, channels []bootstrap.Channel, connections []string) error) *ConfigRepository_UpdateConnections_Call {
_c.Call.Return(run)
return _c
}
-94
View File
@@ -1,94 +0,0 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package bootstrap
import (
"github.com/absmach/magistrala/bootstrap"
mock "github.com/stretchr/testify/mock"
)
// NewMockConfigReader creates a new instance of MockConfigReader. 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 NewMockConfigReader(t interface {
mock.TestingT
Cleanup(func())
}) *MockConfigReader {
mock := &MockConfigReader{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockConfigReader is an autogenerated mock type for the ConfigReader type
type MockConfigReader struct {
mock.Mock
}
type MockConfigReader_Expecter struct {
mock *mock.Mock
}
func (_m *MockConfigReader) EXPECT() *MockConfigReader_Expecter {
return &MockConfigReader_Expecter{mock: &_m.Mock}
}
// ReadConfig provides a mock function for the type MockConfigReader
func (_mock *MockConfigReader) ReadConfig(config bootstrap.Config, b bool) (interface{}, error) {
ret := _mock.Called(config, b)
if len(ret) == 0 {
panic("no return value specified for ReadConfig")
}
var r0 interface{}
var r1 error
if returnFunc, ok := ret.Get(0).(func(bootstrap.Config, bool) (interface{}, error)); ok {
return returnFunc(config, b)
}
if returnFunc, ok := ret.Get(0).(func(bootstrap.Config, bool) interface{}); ok {
r0 = returnFunc(config, b)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(interface{})
}
}
if returnFunc, ok := ret.Get(1).(func(bootstrap.Config, bool) error); ok {
r1 = returnFunc(config, b)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConfigReader_ReadConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadConfig'
type MockConfigReader_ReadConfig_Call struct {
*mock.Call
}
// ReadConfig is a helper method to define mock.On call
// - config
// - b
func (_e *MockConfigReader_Expecter) ReadConfig(config interface{}, b interface{}) *MockConfigReader_ReadConfig_Call {
return &MockConfigReader_ReadConfig_Call{Call: _e.mock.On("ReadConfig", config, b)}
}
func (_c *MockConfigReader_ReadConfig_Call) Run(run func(config bootstrap.Config, b bool)) *MockConfigReader_ReadConfig_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(bootstrap.Config), args[1].(bool))
})
return _c
}
func (_c *MockConfigReader_ReadConfig_Call) Return(ifaceVal interface{}, err error) *MockConfigReader_ReadConfig_Call {
_c.Call.Return(ifaceVal, err)
return _c
}
func (_c *MockConfigReader_ReadConfig_Call) RunAndReturn(run func(config bootstrap.Config, b bool) (interface{}, error)) *MockConfigReader_ReadConfig_Call {
_c.Call.Return(run)
return _c
}
-795
View File
@@ -1,795 +0,0 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package bootstrap
import (
"context"
"github.com/absmach/magistrala/bootstrap"
mock "github.com/stretchr/testify/mock"
)
// NewMockConfigRepository creates a new instance of MockConfigRepository. 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 NewMockConfigRepository(t interface {
mock.TestingT
Cleanup(func())
}) *MockConfigRepository {
mock := &MockConfigRepository{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockConfigRepository is an autogenerated mock type for the ConfigRepository type
type MockConfigRepository struct {
mock.Mock
}
type MockConfigRepository_Expecter struct {
mock *mock.Mock
}
func (_m *MockConfigRepository) EXPECT() *MockConfigRepository_Expecter {
return &MockConfigRepository_Expecter{mock: &_m.Mock}
}
// ChangeState provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) ChangeState(ctx context.Context, domainID string, id string, state bootstrap.State) error {
ret := _mock.Called(ctx, domainID, id, state)
if len(ret) == 0 {
panic("no return value specified for ChangeState")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, bootstrap.State) error); ok {
r0 = returnFunc(ctx, domainID, id, state)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_ChangeState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeState'
type MockConfigRepository_ChangeState_Call struct {
*mock.Call
}
// ChangeState is a helper method to define mock.On call
// - ctx
// - domainID
// - id
// - state
func (_e *MockConfigRepository_Expecter) ChangeState(ctx interface{}, domainID interface{}, id interface{}, state interface{}) *MockConfigRepository_ChangeState_Call {
return &MockConfigRepository_ChangeState_Call{Call: _e.mock.On("ChangeState", ctx, domainID, id, state)}
}
func (_c *MockConfigRepository_ChangeState_Call) Run(run func(ctx context.Context, domainID string, id string, state bootstrap.State)) *MockConfigRepository_ChangeState_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(bootstrap.State))
})
return _c
}
func (_c *MockConfigRepository_ChangeState_Call) Return(err error) *MockConfigRepository_ChangeState_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_ChangeState_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string, state bootstrap.State) error) *MockConfigRepository_ChangeState_Call {
_c.Call.Return(run)
return _c
}
// ConnectClient provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) ConnectClient(ctx context.Context, channelID string, clientID string) error {
ret := _mock.Called(ctx, channelID, clientID)
if len(ret) == 0 {
panic("no return value specified for ConnectClient")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = returnFunc(ctx, channelID, clientID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_ConnectClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConnectClient'
type MockConfigRepository_ConnectClient_Call struct {
*mock.Call
}
// ConnectClient is a helper method to define mock.On call
// - ctx
// - channelID
// - clientID
func (_e *MockConfigRepository_Expecter) ConnectClient(ctx interface{}, channelID interface{}, clientID interface{}) *MockConfigRepository_ConnectClient_Call {
return &MockConfigRepository_ConnectClient_Call{Call: _e.mock.On("ConnectClient", ctx, channelID, clientID)}
}
func (_c *MockConfigRepository_ConnectClient_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *MockConfigRepository_ConnectClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockConfigRepository_ConnectClient_Call) Return(err error) *MockConfigRepository_ConnectClient_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_ConnectClient_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *MockConfigRepository_ConnectClient_Call {
_c.Call.Return(run)
return _c
}
// DisconnectClient provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) DisconnectClient(ctx context.Context, channelID string, clientID string) error {
ret := _mock.Called(ctx, channelID, clientID)
if len(ret) == 0 {
panic("no return value specified for DisconnectClient")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
r0 = returnFunc(ctx, channelID, clientID)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_DisconnectClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisconnectClient'
type MockConfigRepository_DisconnectClient_Call struct {
*mock.Call
}
// DisconnectClient is a helper method to define mock.On call
// - ctx
// - channelID
// - clientID
func (_e *MockConfigRepository_Expecter) DisconnectClient(ctx interface{}, channelID interface{}, clientID interface{}) *MockConfigRepository_DisconnectClient_Call {
return &MockConfigRepository_DisconnectClient_Call{Call: _e.mock.On("DisconnectClient", ctx, channelID, clientID)}
}
func (_c *MockConfigRepository_DisconnectClient_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *MockConfigRepository_DisconnectClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockConfigRepository_DisconnectClient_Call) Return(err error) *MockConfigRepository_DisconnectClient_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_DisconnectClient_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *MockConfigRepository_DisconnectClient_Call {
_c.Call.Return(run)
return _c
}
// ListExisting provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) ListExisting(ctx context.Context, domainID string, ids []string) ([]bootstrap.Channel, error) {
ret := _mock.Called(ctx, domainID, ids)
if len(ret) == 0 {
panic("no return value specified for ListExisting")
}
var r0 []bootstrap.Channel
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string) ([]bootstrap.Channel, error)); ok {
return returnFunc(ctx, domainID, ids)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string) []bootstrap.Channel); ok {
r0 = returnFunc(ctx, domainID, ids)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]bootstrap.Channel)
}
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string, []string) error); ok {
r1 = returnFunc(ctx, domainID, ids)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConfigRepository_ListExisting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListExisting'
type MockConfigRepository_ListExisting_Call struct {
*mock.Call
}
// ListExisting is a helper method to define mock.On call
// - ctx
// - domainID
// - ids
func (_e *MockConfigRepository_Expecter) ListExisting(ctx interface{}, domainID interface{}, ids interface{}) *MockConfigRepository_ListExisting_Call {
return &MockConfigRepository_ListExisting_Call{Call: _e.mock.On("ListExisting", ctx, domainID, ids)}
}
func (_c *MockConfigRepository_ListExisting_Call) Run(run func(ctx context.Context, domainID string, ids []string)) *MockConfigRepository_ListExisting_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]string))
})
return _c
}
func (_c *MockConfigRepository_ListExisting_Call) Return(channels []bootstrap.Channel, err error) *MockConfigRepository_ListExisting_Call {
_c.Call.Return(channels, err)
return _c
}
func (_c *MockConfigRepository_ListExisting_Call) RunAndReturn(run func(ctx context.Context, domainID string, ids []string) ([]bootstrap.Channel, error)) *MockConfigRepository_ListExisting_Call {
_c.Call.Return(run)
return _c
}
// Remove provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) Remove(ctx context.Context, domainID string, id string) error {
ret := _mock.Called(ctx, domainID, id)
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, domainID, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
type MockConfigRepository_Remove_Call struct {
*mock.Call
}
// Remove is a helper method to define mock.On call
// - ctx
// - domainID
// - id
func (_e *MockConfigRepository_Expecter) Remove(ctx interface{}, domainID interface{}, id interface{}) *MockConfigRepository_Remove_Call {
return &MockConfigRepository_Remove_Call{Call: _e.mock.On("Remove", ctx, domainID, id)}
}
func (_c *MockConfigRepository_Remove_Call) Run(run func(ctx context.Context, domainID string, id string)) *MockConfigRepository_Remove_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockConfigRepository_Remove_Call) Return(err error) *MockConfigRepository_Remove_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_Remove_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string) error) *MockConfigRepository_Remove_Call {
_c.Call.Return(run)
return _c
}
// RemoveChannel provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) RemoveChannel(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for RemoveChannel")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_RemoveChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveChannel'
type MockConfigRepository_RemoveChannel_Call struct {
*mock.Call
}
// RemoveChannel is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockConfigRepository_Expecter) RemoveChannel(ctx interface{}, id interface{}) *MockConfigRepository_RemoveChannel_Call {
return &MockConfigRepository_RemoveChannel_Call{Call: _e.mock.On("RemoveChannel", ctx, id)}
}
func (_c *MockConfigRepository_RemoveChannel_Call) Run(run func(ctx context.Context, id string)) *MockConfigRepository_RemoveChannel_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockConfigRepository_RemoveChannel_Call) Return(err error) *MockConfigRepository_RemoveChannel_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_RemoveChannel_Call) RunAndReturn(run func(ctx context.Context, id string) error) *MockConfigRepository_RemoveChannel_Call {
_c.Call.Return(run)
return _c
}
// RemoveClient provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) RemoveClient(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for RemoveClient")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_RemoveClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveClient'
type MockConfigRepository_RemoveClient_Call struct {
*mock.Call
}
// RemoveClient is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockConfigRepository_Expecter) RemoveClient(ctx interface{}, id interface{}) *MockConfigRepository_RemoveClient_Call {
return &MockConfigRepository_RemoveClient_Call{Call: _e.mock.On("RemoveClient", ctx, id)}
}
func (_c *MockConfigRepository_RemoveClient_Call) Run(run func(ctx context.Context, id string)) *MockConfigRepository_RemoveClient_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockConfigRepository_RemoveClient_Call) Return(err error) *MockConfigRepository_RemoveClient_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_RemoveClient_Call) RunAndReturn(run func(ctx context.Context, id string) error) *MockConfigRepository_RemoveClient_Call {
_c.Call.Return(run)
return _c
}
// RetrieveAll provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) RetrieveAll(ctx context.Context, domainID string, clientIDs []string, filter bootstrap.Filter, offset uint64, limit uint64) bootstrap.ConfigsPage {
ret := _mock.Called(ctx, domainID, clientIDs, filter, offset, limit)
if len(ret) == 0 {
panic("no return value specified for RetrieveAll")
}
var r0 bootstrap.ConfigsPage
if returnFunc, ok := ret.Get(0).(func(context.Context, string, []string, bootstrap.Filter, uint64, uint64) bootstrap.ConfigsPage); ok {
r0 = returnFunc(ctx, domainID, clientIDs, filter, offset, limit)
} else {
r0 = ret.Get(0).(bootstrap.ConfigsPage)
}
return r0
}
// MockConfigRepository_RetrieveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveAll'
type MockConfigRepository_RetrieveAll_Call struct {
*mock.Call
}
// RetrieveAll is a helper method to define mock.On call
// - ctx
// - domainID
// - clientIDs
// - filter
// - offset
// - limit
func (_e *MockConfigRepository_Expecter) RetrieveAll(ctx interface{}, domainID interface{}, clientIDs interface{}, filter interface{}, offset interface{}, limit interface{}) *MockConfigRepository_RetrieveAll_Call {
return &MockConfigRepository_RetrieveAll_Call{Call: _e.mock.On("RetrieveAll", ctx, domainID, clientIDs, filter, offset, limit)}
}
func (_c *MockConfigRepository_RetrieveAll_Call) Run(run func(ctx context.Context, domainID string, clientIDs []string, filter bootstrap.Filter, offset uint64, limit uint64)) *MockConfigRepository_RetrieveAll_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].([]string), args[3].(bootstrap.Filter), args[4].(uint64), args[5].(uint64))
})
return _c
}
func (_c *MockConfigRepository_RetrieveAll_Call) Return(configsPage bootstrap.ConfigsPage) *MockConfigRepository_RetrieveAll_Call {
_c.Call.Return(configsPage)
return _c
}
func (_c *MockConfigRepository_RetrieveAll_Call) RunAndReturn(run func(ctx context.Context, domainID string, clientIDs []string, filter bootstrap.Filter, offset uint64, limit uint64) bootstrap.ConfigsPage) *MockConfigRepository_RetrieveAll_Call {
_c.Call.Return(run)
return _c
}
// RetrieveByExternalID provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) RetrieveByExternalID(ctx context.Context, externalID string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, externalID)
if len(ret) == 0 {
panic("no return value specified for RetrieveByExternalID")
}
var r0 bootstrap.Config
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) (bootstrap.Config, error)); ok {
return returnFunc(ctx, externalID)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string) bootstrap.Config); ok {
r0 = returnFunc(ctx, externalID)
} else {
r0 = ret.Get(0).(bootstrap.Config)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = returnFunc(ctx, externalID)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConfigRepository_RetrieveByExternalID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveByExternalID'
type MockConfigRepository_RetrieveByExternalID_Call struct {
*mock.Call
}
// RetrieveByExternalID is a helper method to define mock.On call
// - ctx
// - externalID
func (_e *MockConfigRepository_Expecter) RetrieveByExternalID(ctx interface{}, externalID interface{}) *MockConfigRepository_RetrieveByExternalID_Call {
return &MockConfigRepository_RetrieveByExternalID_Call{Call: _e.mock.On("RetrieveByExternalID", ctx, externalID)}
}
func (_c *MockConfigRepository_RetrieveByExternalID_Call) Run(run func(ctx context.Context, externalID string)) *MockConfigRepository_RetrieveByExternalID_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockConfigRepository_RetrieveByExternalID_Call) Return(config bootstrap.Config, err error) *MockConfigRepository_RetrieveByExternalID_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockConfigRepository_RetrieveByExternalID_Call) RunAndReturn(run func(ctx context.Context, externalID string) (bootstrap.Config, error)) *MockConfigRepository_RetrieveByExternalID_Call {
_c.Call.Return(run)
return _c
}
// RetrieveByID provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) RetrieveByID(ctx context.Context, domainID string, id string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, domainID, id)
if len(ret) == 0 {
panic("no return value specified for RetrieveByID")
}
var r0 bootstrap.Config
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) (bootstrap.Config, error)); ok {
return returnFunc(ctx, domainID, id)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string) bootstrap.Config); ok {
r0 = returnFunc(ctx, domainID, id)
} else {
r0 = ret.Get(0).(bootstrap.Config)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
r1 = returnFunc(ctx, domainID, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConfigRepository_RetrieveByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveByID'
type MockConfigRepository_RetrieveByID_Call struct {
*mock.Call
}
// RetrieveByID is a helper method to define mock.On call
// - ctx
// - domainID
// - id
func (_e *MockConfigRepository_Expecter) RetrieveByID(ctx interface{}, domainID interface{}, id interface{}) *MockConfigRepository_RetrieveByID_Call {
return &MockConfigRepository_RetrieveByID_Call{Call: _e.mock.On("RetrieveByID", ctx, domainID, id)}
}
func (_c *MockConfigRepository_RetrieveByID_Call) Run(run func(ctx context.Context, domainID string, id string)) *MockConfigRepository_RetrieveByID_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockConfigRepository_RetrieveByID_Call) Return(config bootstrap.Config, err error) *MockConfigRepository_RetrieveByID_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockConfigRepository_RetrieveByID_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string) (bootstrap.Config, error)) *MockConfigRepository_RetrieveByID_Call {
_c.Call.Return(run)
return _c
}
// Save provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) Save(ctx context.Context, cfg bootstrap.Config, chsConnIDs []string) (string, error) {
ret := _mock.Called(ctx, cfg, chsConnIDs)
if len(ret) == 0 {
panic("no return value specified for Save")
}
var r0 string
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Config, []string) (string, error)); ok {
return returnFunc(ctx, cfg, chsConnIDs)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Config, []string) string); ok {
r0 = returnFunc(ctx, cfg, chsConnIDs)
} else {
r0 = ret.Get(0).(string)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, bootstrap.Config, []string) error); ok {
r1 = returnFunc(ctx, cfg, chsConnIDs)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConfigRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
type MockConfigRepository_Save_Call struct {
*mock.Call
}
// Save is a helper method to define mock.On call
// - ctx
// - cfg
// - chsConnIDs
func (_e *MockConfigRepository_Expecter) Save(ctx interface{}, cfg interface{}, chsConnIDs interface{}) *MockConfigRepository_Save_Call {
return &MockConfigRepository_Save_Call{Call: _e.mock.On("Save", ctx, cfg, chsConnIDs)}
}
func (_c *MockConfigRepository_Save_Call) Run(run func(ctx context.Context, cfg bootstrap.Config, chsConnIDs []string)) *MockConfigRepository_Save_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Config), args[2].([]string))
})
return _c
}
func (_c *MockConfigRepository_Save_Call) Return(s string, err error) *MockConfigRepository_Save_Call {
_c.Call.Return(s, err)
return _c
}
func (_c *MockConfigRepository_Save_Call) RunAndReturn(run func(ctx context.Context, cfg bootstrap.Config, chsConnIDs []string) (string, error)) *MockConfigRepository_Save_Call {
_c.Call.Return(run)
return _c
}
// Update provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) Update(ctx context.Context, cfg bootstrap.Config) error {
ret := _mock.Called(ctx, cfg)
if len(ret) == 0 {
panic("no return value specified for Update")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Config) error); ok {
r0 = returnFunc(ctx, cfg)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type MockConfigRepository_Update_Call struct {
*mock.Call
}
// Update is a helper method to define mock.On call
// - ctx
// - cfg
func (_e *MockConfigRepository_Expecter) Update(ctx interface{}, cfg interface{}) *MockConfigRepository_Update_Call {
return &MockConfigRepository_Update_Call{Call: _e.mock.On("Update", ctx, cfg)}
}
func (_c *MockConfigRepository_Update_Call) Run(run func(ctx context.Context, cfg bootstrap.Config)) *MockConfigRepository_Update_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Config))
})
return _c
}
func (_c *MockConfigRepository_Update_Call) Return(err error) *MockConfigRepository_Update_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_Update_Call) RunAndReturn(run func(ctx context.Context, cfg bootstrap.Config) error) *MockConfigRepository_Update_Call {
_c.Call.Return(run)
return _c
}
// UpdateCert provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) UpdateCert(ctx context.Context, domainID string, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, domainID, clientID, clientCert, clientKey, caCert)
if len(ret) == 0 {
panic("no return value specified for UpdateCert")
}
var r0 bootstrap.Config
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) (bootstrap.Config, error)); ok {
return returnFunc(ctx, domainID, clientID, clientCert, clientKey, caCert)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, string, string, string) bootstrap.Config); ok {
r0 = returnFunc(ctx, domainID, clientID, clientCert, clientKey, caCert)
} else {
r0 = ret.Get(0).(bootstrap.Config)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string, string, string, string, string) error); ok {
r1 = returnFunc(ctx, domainID, clientID, clientCert, clientKey, caCert)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockConfigRepository_UpdateCert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCert'
type MockConfigRepository_UpdateCert_Call struct {
*mock.Call
}
// UpdateCert is a helper method to define mock.On call
// - ctx
// - domainID
// - clientID
// - clientCert
// - clientKey
// - caCert
func (_e *MockConfigRepository_Expecter) UpdateCert(ctx interface{}, domainID interface{}, clientID interface{}, clientCert interface{}, clientKey interface{}, caCert interface{}) *MockConfigRepository_UpdateCert_Call {
return &MockConfigRepository_UpdateCert_Call{Call: _e.mock.On("UpdateCert", ctx, domainID, clientID, clientCert, clientKey, caCert)}
}
func (_c *MockConfigRepository_UpdateCert_Call) Run(run func(ctx context.Context, domainID string, clientID string, clientCert string, clientKey string, caCert string)) *MockConfigRepository_UpdateCert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(string), args[4].(string), args[5].(string))
})
return _c
}
func (_c *MockConfigRepository_UpdateCert_Call) Return(config bootstrap.Config, err error) *MockConfigRepository_UpdateCert_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockConfigRepository_UpdateCert_Call) RunAndReturn(run func(ctx context.Context, domainID string, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error)) *MockConfigRepository_UpdateCert_Call {
_c.Call.Return(run)
return _c
}
// UpdateChannel provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) UpdateChannel(ctx context.Context, c bootstrap.Channel) error {
ret := _mock.Called(ctx, c)
if len(ret) == 0 {
panic("no return value specified for UpdateChannel")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, bootstrap.Channel) error); ok {
r0 = returnFunc(ctx, c)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_UpdateChannel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateChannel'
type MockConfigRepository_UpdateChannel_Call struct {
*mock.Call
}
// UpdateChannel is a helper method to define mock.On call
// - ctx
// - c
func (_e *MockConfigRepository_Expecter) UpdateChannel(ctx interface{}, c interface{}) *MockConfigRepository_UpdateChannel_Call {
return &MockConfigRepository_UpdateChannel_Call{Call: _e.mock.On("UpdateChannel", ctx, c)}
}
func (_c *MockConfigRepository_UpdateChannel_Call) Run(run func(ctx context.Context, c bootstrap.Channel)) *MockConfigRepository_UpdateChannel_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Channel))
})
return _c
}
func (_c *MockConfigRepository_UpdateChannel_Call) Return(err error) *MockConfigRepository_UpdateChannel_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_UpdateChannel_Call) RunAndReturn(run func(ctx context.Context, c bootstrap.Channel) error) *MockConfigRepository_UpdateChannel_Call {
_c.Call.Return(run)
return _c
}
// UpdateConnections provides a mock function for the type MockConfigRepository
func (_mock *MockConfigRepository) UpdateConnections(ctx context.Context, domainID string, id string, channels []bootstrap.Channel, connections []string) error {
ret := _mock.Called(ctx, domainID, id, channels, connections)
if len(ret) == 0 {
panic("no return value specified for UpdateConnections")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string, string, []bootstrap.Channel, []string) error); ok {
r0 = returnFunc(ctx, domainID, id, channels, connections)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockConfigRepository_UpdateConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateConnections'
type MockConfigRepository_UpdateConnections_Call struct {
*mock.Call
}
// UpdateConnections is a helper method to define mock.On call
// - ctx
// - domainID
// - id
// - channels
// - connections
func (_e *MockConfigRepository_Expecter) UpdateConnections(ctx interface{}, domainID interface{}, id interface{}, channels interface{}, connections interface{}) *MockConfigRepository_UpdateConnections_Call {
return &MockConfigRepository_UpdateConnections_Call{Call: _e.mock.On("UpdateConnections", ctx, domainID, id, channels, connections)}
}
func (_c *MockConfigRepository_UpdateConnections_Call) Run(run func(ctx context.Context, domainID string, id string, channels []bootstrap.Channel, connections []string)) *MockConfigRepository_UpdateConnections_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].([]bootstrap.Channel), args[4].([]string))
})
return _c
}
func (_c *MockConfigRepository_UpdateConnections_Call) Return(err error) *MockConfigRepository_UpdateConnections_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockConfigRepository_UpdateConnections_Call) RunAndReturn(run func(ctx context.Context, domainID string, id string, channels []bootstrap.Channel, connections []string) error) *MockConfigRepository_UpdateConnections_Call {
_c.Call.Return(run)
return _c
}
+139 -136
View File
@@ -1,8 +1,11 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package bootstrap
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"context"
@@ -12,13 +15,13 @@ import (
mock "github.com/stretchr/testify/mock"
)
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// NewService creates a new instance of Service. 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 NewMockService(t interface {
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
@@ -26,21 +29,21 @@ func NewMockService(t interface {
return mock
}
// MockService is an autogenerated mock type for the Service type
type MockService struct {
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
type MockService_Expecter struct {
type Service_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
func (_m *Service) EXPECT() *Service_Expecter {
return &Service_Expecter{mock: &_m.Mock}
}
// Add provides a mock function for the type MockService
func (_mock *MockService) Add(ctx context.Context, session authn.Session, token string, cfg bootstrap.Config) (bootstrap.Config, error) {
// Add provides a mock function for the type Service
func (_mock *Service) Add(ctx context.Context, session authn.Session, token string, cfg bootstrap.Config) (bootstrap.Config, error) {
ret := _mock.Called(ctx, session, token, cfg)
if len(ret) == 0 {
@@ -65,8 +68,8 @@ func (_mock *MockService) Add(ctx context.Context, session authn.Session, token
return r0, r1
}
// MockService_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add'
type MockService_Add_Call struct {
// Service_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add'
type Service_Add_Call struct {
*mock.Call
}
@@ -75,29 +78,29 @@ type MockService_Add_Call struct {
// - session
// - token
// - cfg
func (_e *MockService_Expecter) Add(ctx interface{}, session interface{}, token interface{}, cfg interface{}) *MockService_Add_Call {
return &MockService_Add_Call{Call: _e.mock.On("Add", ctx, session, token, cfg)}
func (_e *Service_Expecter) Add(ctx interface{}, session interface{}, token interface{}, cfg interface{}) *Service_Add_Call {
return &Service_Add_Call{Call: _e.mock.On("Add", ctx, session, token, cfg)}
}
func (_c *MockService_Add_Call) Run(run func(ctx context.Context, session authn.Session, token string, cfg bootstrap.Config)) *MockService_Add_Call {
func (_c *Service_Add_Call) Run(run func(ctx context.Context, session authn.Session, token string, cfg bootstrap.Config)) *Service_Add_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string), args[3].(bootstrap.Config))
})
return _c
}
func (_c *MockService_Add_Call) Return(config bootstrap.Config, err error) *MockService_Add_Call {
func (_c *Service_Add_Call) Return(config bootstrap.Config, err error) *Service_Add_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockService_Add_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, token string, cfg bootstrap.Config) (bootstrap.Config, error)) *MockService_Add_Call {
func (_c *Service_Add_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, token string, cfg bootstrap.Config) (bootstrap.Config, error)) *Service_Add_Call {
_c.Call.Return(run)
return _c
}
// Bootstrap provides a mock function for the type MockService
func (_mock *MockService) Bootstrap(ctx context.Context, externalKey string, externalID string, secure bool) (bootstrap.Config, error) {
// Bootstrap provides a mock function for the type Service
func (_mock *Service) Bootstrap(ctx context.Context, externalKey string, externalID string, secure bool) (bootstrap.Config, error) {
ret := _mock.Called(ctx, externalKey, externalID, secure)
if len(ret) == 0 {
@@ -122,8 +125,8 @@ func (_mock *MockService) Bootstrap(ctx context.Context, externalKey string, ext
return r0, r1
}
// MockService_Bootstrap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bootstrap'
type MockService_Bootstrap_Call struct {
// Service_Bootstrap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bootstrap'
type Service_Bootstrap_Call struct {
*mock.Call
}
@@ -132,29 +135,29 @@ type MockService_Bootstrap_Call struct {
// - externalKey
// - externalID
// - secure
func (_e *MockService_Expecter) Bootstrap(ctx interface{}, externalKey interface{}, externalID interface{}, secure interface{}) *MockService_Bootstrap_Call {
return &MockService_Bootstrap_Call{Call: _e.mock.On("Bootstrap", ctx, externalKey, externalID, secure)}
func (_e *Service_Expecter) Bootstrap(ctx interface{}, externalKey interface{}, externalID interface{}, secure interface{}) *Service_Bootstrap_Call {
return &Service_Bootstrap_Call{Call: _e.mock.On("Bootstrap", ctx, externalKey, externalID, secure)}
}
func (_c *MockService_Bootstrap_Call) Run(run func(ctx context.Context, externalKey string, externalID string, secure bool)) *MockService_Bootstrap_Call {
func (_c *Service_Bootstrap_Call) Run(run func(ctx context.Context, externalKey string, externalID string, secure bool)) *Service_Bootstrap_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(bool))
})
return _c
}
func (_c *MockService_Bootstrap_Call) Return(config bootstrap.Config, err error) *MockService_Bootstrap_Call {
func (_c *Service_Bootstrap_Call) Return(config bootstrap.Config, err error) *Service_Bootstrap_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockService_Bootstrap_Call) RunAndReturn(run func(ctx context.Context, externalKey string, externalID string, secure bool) (bootstrap.Config, error)) *MockService_Bootstrap_Call {
func (_c *Service_Bootstrap_Call) RunAndReturn(run func(ctx context.Context, externalKey string, externalID string, secure bool) (bootstrap.Config, error)) *Service_Bootstrap_Call {
_c.Call.Return(run)
return _c
}
// ChangeState provides a mock function for the type MockService
func (_mock *MockService) ChangeState(ctx context.Context, session authn.Session, token string, id string, state bootstrap.State) error {
// ChangeState provides a mock function for the type Service
func (_mock *Service) ChangeState(ctx context.Context, session authn.Session, token string, id string, state bootstrap.State) error {
ret := _mock.Called(ctx, session, token, id, state)
if len(ret) == 0 {
@@ -170,8 +173,8 @@ func (_mock *MockService) ChangeState(ctx context.Context, session authn.Session
return r0
}
// MockService_ChangeState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeState'
type MockService_ChangeState_Call struct {
// Service_ChangeState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeState'
type Service_ChangeState_Call struct {
*mock.Call
}
@@ -181,29 +184,29 @@ type MockService_ChangeState_Call struct {
// - token
// - id
// - state
func (_e *MockService_Expecter) ChangeState(ctx interface{}, session interface{}, token interface{}, id interface{}, state interface{}) *MockService_ChangeState_Call {
return &MockService_ChangeState_Call{Call: _e.mock.On("ChangeState", ctx, session, token, id, state)}
func (_e *Service_Expecter) ChangeState(ctx interface{}, session interface{}, token interface{}, id interface{}, state interface{}) *Service_ChangeState_Call {
return &Service_ChangeState_Call{Call: _e.mock.On("ChangeState", ctx, session, token, id, state)}
}
func (_c *MockService_ChangeState_Call) Run(run func(ctx context.Context, session authn.Session, token string, id string, state bootstrap.State)) *MockService_ChangeState_Call {
func (_c *Service_ChangeState_Call) Run(run func(ctx context.Context, session authn.Session, token string, id string, state bootstrap.State)) *Service_ChangeState_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string), args[3].(string), args[4].(bootstrap.State))
})
return _c
}
func (_c *MockService_ChangeState_Call) Return(err error) *MockService_ChangeState_Call {
func (_c *Service_ChangeState_Call) Return(err error) *Service_ChangeState_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_ChangeState_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, token string, id string, state bootstrap.State) error) *MockService_ChangeState_Call {
func (_c *Service_ChangeState_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, token string, id string, state bootstrap.State) error) *Service_ChangeState_Call {
_c.Call.Return(run)
return _c
}
// ConnectClientHandler provides a mock function for the type MockService
func (_mock *MockService) ConnectClientHandler(ctx context.Context, channelID string, clientID string) error {
// ConnectClientHandler provides a mock function for the type Service
func (_mock *Service) ConnectClientHandler(ctx context.Context, channelID string, clientID string) error {
ret := _mock.Called(ctx, channelID, clientID)
if len(ret) == 0 {
@@ -219,8 +222,8 @@ func (_mock *MockService) ConnectClientHandler(ctx context.Context, channelID st
return r0
}
// MockService_ConnectClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConnectClientHandler'
type MockService_ConnectClientHandler_Call struct {
// Service_ConnectClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConnectClientHandler'
type Service_ConnectClientHandler_Call struct {
*mock.Call
}
@@ -228,29 +231,29 @@ type MockService_ConnectClientHandler_Call struct {
// - ctx
// - channelID
// - clientID
func (_e *MockService_Expecter) ConnectClientHandler(ctx interface{}, channelID interface{}, clientID interface{}) *MockService_ConnectClientHandler_Call {
return &MockService_ConnectClientHandler_Call{Call: _e.mock.On("ConnectClientHandler", ctx, channelID, clientID)}
func (_e *Service_Expecter) ConnectClientHandler(ctx interface{}, channelID interface{}, clientID interface{}) *Service_ConnectClientHandler_Call {
return &Service_ConnectClientHandler_Call{Call: _e.mock.On("ConnectClientHandler", ctx, channelID, clientID)}
}
func (_c *MockService_ConnectClientHandler_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *MockService_ConnectClientHandler_Call {
func (_c *Service_ConnectClientHandler_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *Service_ConnectClientHandler_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockService_ConnectClientHandler_Call) Return(err error) *MockService_ConnectClientHandler_Call {
func (_c *Service_ConnectClientHandler_Call) Return(err error) *Service_ConnectClientHandler_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_ConnectClientHandler_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *MockService_ConnectClientHandler_Call {
func (_c *Service_ConnectClientHandler_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *Service_ConnectClientHandler_Call {
_c.Call.Return(run)
return _c
}
// DisconnectClientHandler provides a mock function for the type MockService
func (_mock *MockService) DisconnectClientHandler(ctx context.Context, channelID string, clientID string) error {
// DisconnectClientHandler provides a mock function for the type Service
func (_mock *Service) DisconnectClientHandler(ctx context.Context, channelID string, clientID string) error {
ret := _mock.Called(ctx, channelID, clientID)
if len(ret) == 0 {
@@ -266,8 +269,8 @@ func (_mock *MockService) DisconnectClientHandler(ctx context.Context, channelID
return r0
}
// MockService_DisconnectClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisconnectClientHandler'
type MockService_DisconnectClientHandler_Call struct {
// Service_DisconnectClientHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisconnectClientHandler'
type Service_DisconnectClientHandler_Call struct {
*mock.Call
}
@@ -275,29 +278,29 @@ type MockService_DisconnectClientHandler_Call struct {
// - ctx
// - channelID
// - clientID
func (_e *MockService_Expecter) DisconnectClientHandler(ctx interface{}, channelID interface{}, clientID interface{}) *MockService_DisconnectClientHandler_Call {
return &MockService_DisconnectClientHandler_Call{Call: _e.mock.On("DisconnectClientHandler", ctx, channelID, clientID)}
func (_e *Service_Expecter) DisconnectClientHandler(ctx interface{}, channelID interface{}, clientID interface{}) *Service_DisconnectClientHandler_Call {
return &Service_DisconnectClientHandler_Call{Call: _e.mock.On("DisconnectClientHandler", ctx, channelID, clientID)}
}
func (_c *MockService_DisconnectClientHandler_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *MockService_DisconnectClientHandler_Call {
func (_c *Service_DisconnectClientHandler_Call) Run(run func(ctx context.Context, channelID string, clientID string)) *Service_DisconnectClientHandler_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockService_DisconnectClientHandler_Call) Return(err error) *MockService_DisconnectClientHandler_Call {
func (_c *Service_DisconnectClientHandler_Call) Return(err error) *Service_DisconnectClientHandler_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_DisconnectClientHandler_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *MockService_DisconnectClientHandler_Call {
func (_c *Service_DisconnectClientHandler_Call) RunAndReturn(run func(ctx context.Context, channelID string, clientID string) error) *Service_DisconnectClientHandler_Call {
_c.Call.Return(run)
return _c
}
// List provides a mock function for the type MockService
func (_mock *MockService) List(ctx context.Context, session authn.Session, filter bootstrap.Filter, offset uint64, limit uint64) (bootstrap.ConfigsPage, error) {
// List provides a mock function for the type Service
func (_mock *Service) List(ctx context.Context, session authn.Session, filter bootstrap.Filter, offset uint64, limit uint64) (bootstrap.ConfigsPage, error) {
ret := _mock.Called(ctx, session, filter, offset, limit)
if len(ret) == 0 {
@@ -322,8 +325,8 @@ func (_mock *MockService) List(ctx context.Context, session authn.Session, filte
return r0, r1
}
// MockService_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type MockService_List_Call struct {
// Service_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List'
type Service_List_Call struct {
*mock.Call
}
@@ -333,29 +336,29 @@ type MockService_List_Call struct {
// - filter
// - offset
// - limit
func (_e *MockService_Expecter) List(ctx interface{}, session interface{}, filter interface{}, offset interface{}, limit interface{}) *MockService_List_Call {
return &MockService_List_Call{Call: _e.mock.On("List", ctx, session, filter, offset, limit)}
func (_e *Service_Expecter) List(ctx interface{}, session interface{}, filter interface{}, offset interface{}, limit interface{}) *Service_List_Call {
return &Service_List_Call{Call: _e.mock.On("List", ctx, session, filter, offset, limit)}
}
func (_c *MockService_List_Call) Run(run func(ctx context.Context, session authn.Session, filter bootstrap.Filter, offset uint64, limit uint64)) *MockService_List_Call {
func (_c *Service_List_Call) Run(run func(ctx context.Context, session authn.Session, filter bootstrap.Filter, offset uint64, limit uint64)) *Service_List_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(bootstrap.Filter), args[3].(uint64), args[4].(uint64))
})
return _c
}
func (_c *MockService_List_Call) Return(configsPage bootstrap.ConfigsPage, err error) *MockService_List_Call {
func (_c *Service_List_Call) Return(configsPage bootstrap.ConfigsPage, err error) *Service_List_Call {
_c.Call.Return(configsPage, err)
return _c
}
func (_c *MockService_List_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, filter bootstrap.Filter, offset uint64, limit uint64) (bootstrap.ConfigsPage, error)) *MockService_List_Call {
func (_c *Service_List_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, filter bootstrap.Filter, offset uint64, limit uint64) (bootstrap.ConfigsPage, error)) *Service_List_Call {
_c.Call.Return(run)
return _c
}
// Remove provides a mock function for the type MockService
func (_mock *MockService) Remove(ctx context.Context, session authn.Session, id string) error {
// Remove provides a mock function for the type Service
func (_mock *Service) Remove(ctx context.Context, session authn.Session, id string) error {
ret := _mock.Called(ctx, session, id)
if len(ret) == 0 {
@@ -371,8 +374,8 @@ func (_mock *MockService) Remove(ctx context.Context, session authn.Session, id
return r0
}
// MockService_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
type MockService_Remove_Call struct {
// Service_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
type Service_Remove_Call struct {
*mock.Call
}
@@ -380,29 +383,29 @@ type MockService_Remove_Call struct {
// - ctx
// - session
// - id
func (_e *MockService_Expecter) Remove(ctx interface{}, session interface{}, id interface{}) *MockService_Remove_Call {
return &MockService_Remove_Call{Call: _e.mock.On("Remove", ctx, session, id)}
func (_e *Service_Expecter) Remove(ctx interface{}, session interface{}, id interface{}) *Service_Remove_Call {
return &Service_Remove_Call{Call: _e.mock.On("Remove", ctx, session, id)}
}
func (_c *MockService_Remove_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *MockService_Remove_Call {
func (_c *Service_Remove_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *Service_Remove_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string))
})
return _c
}
func (_c *MockService_Remove_Call) Return(err error) *MockService_Remove_Call {
func (_c *Service_Remove_Call) Return(err error) *Service_Remove_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_Remove_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) error) *MockService_Remove_Call {
func (_c *Service_Remove_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) error) *Service_Remove_Call {
_c.Call.Return(run)
return _c
}
// RemoveChannelHandler provides a mock function for the type MockService
func (_mock *MockService) RemoveChannelHandler(ctx context.Context, id string) error {
// RemoveChannelHandler provides a mock function for the type Service
func (_mock *Service) RemoveChannelHandler(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
@@ -418,37 +421,37 @@ func (_mock *MockService) RemoveChannelHandler(ctx context.Context, id string) e
return r0
}
// MockService_RemoveChannelHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveChannelHandler'
type MockService_RemoveChannelHandler_Call struct {
// Service_RemoveChannelHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveChannelHandler'
type Service_RemoveChannelHandler_Call struct {
*mock.Call
}
// RemoveChannelHandler is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockService_Expecter) RemoveChannelHandler(ctx interface{}, id interface{}) *MockService_RemoveChannelHandler_Call {
return &MockService_RemoveChannelHandler_Call{Call: _e.mock.On("RemoveChannelHandler", ctx, id)}
func (_e *Service_Expecter) RemoveChannelHandler(ctx interface{}, id interface{}) *Service_RemoveChannelHandler_Call {
return &Service_RemoveChannelHandler_Call{Call: _e.mock.On("RemoveChannelHandler", ctx, id)}
}
func (_c *MockService_RemoveChannelHandler_Call) Run(run func(ctx context.Context, id string)) *MockService_RemoveChannelHandler_Call {
func (_c *Service_RemoveChannelHandler_Call) Run(run func(ctx context.Context, id string)) *Service_RemoveChannelHandler_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockService_RemoveChannelHandler_Call) Return(err error) *MockService_RemoveChannelHandler_Call {
func (_c *Service_RemoveChannelHandler_Call) Return(err error) *Service_RemoveChannelHandler_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_RemoveChannelHandler_Call) RunAndReturn(run func(ctx context.Context, id string) error) *MockService_RemoveChannelHandler_Call {
func (_c *Service_RemoveChannelHandler_Call) RunAndReturn(run func(ctx context.Context, id string) error) *Service_RemoveChannelHandler_Call {
_c.Call.Return(run)
return _c
}
// RemoveConfigHandler provides a mock function for the type MockService
func (_mock *MockService) RemoveConfigHandler(ctx context.Context, id string) error {
// RemoveConfigHandler provides a mock function for the type Service
func (_mock *Service) RemoveConfigHandler(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
@@ -464,37 +467,37 @@ func (_mock *MockService) RemoveConfigHandler(ctx context.Context, id string) er
return r0
}
// MockService_RemoveConfigHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveConfigHandler'
type MockService_RemoveConfigHandler_Call struct {
// Service_RemoveConfigHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveConfigHandler'
type Service_RemoveConfigHandler_Call struct {
*mock.Call
}
// RemoveConfigHandler is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockService_Expecter) RemoveConfigHandler(ctx interface{}, id interface{}) *MockService_RemoveConfigHandler_Call {
return &MockService_RemoveConfigHandler_Call{Call: _e.mock.On("RemoveConfigHandler", ctx, id)}
func (_e *Service_Expecter) RemoveConfigHandler(ctx interface{}, id interface{}) *Service_RemoveConfigHandler_Call {
return &Service_RemoveConfigHandler_Call{Call: _e.mock.On("RemoveConfigHandler", ctx, id)}
}
func (_c *MockService_RemoveConfigHandler_Call) Run(run func(ctx context.Context, id string)) *MockService_RemoveConfigHandler_Call {
func (_c *Service_RemoveConfigHandler_Call) Run(run func(ctx context.Context, id string)) *Service_RemoveConfigHandler_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockService_RemoveConfigHandler_Call) Return(err error) *MockService_RemoveConfigHandler_Call {
func (_c *Service_RemoveConfigHandler_Call) Return(err error) *Service_RemoveConfigHandler_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_RemoveConfigHandler_Call) RunAndReturn(run func(ctx context.Context, id string) error) *MockService_RemoveConfigHandler_Call {
func (_c *Service_RemoveConfigHandler_Call) RunAndReturn(run func(ctx context.Context, id string) error) *Service_RemoveConfigHandler_Call {
_c.Call.Return(run)
return _c
}
// Update provides a mock function for the type MockService
func (_mock *MockService) Update(ctx context.Context, session authn.Session, cfg bootstrap.Config) error {
// Update provides a mock function for the type Service
func (_mock *Service) Update(ctx context.Context, session authn.Session, cfg bootstrap.Config) error {
ret := _mock.Called(ctx, session, cfg)
if len(ret) == 0 {
@@ -510,8 +513,8 @@ func (_mock *MockService) Update(ctx context.Context, session authn.Session, cfg
return r0
}
// MockService_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type MockService_Update_Call struct {
// Service_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update'
type Service_Update_Call struct {
*mock.Call
}
@@ -519,29 +522,29 @@ type MockService_Update_Call struct {
// - ctx
// - session
// - cfg
func (_e *MockService_Expecter) Update(ctx interface{}, session interface{}, cfg interface{}) *MockService_Update_Call {
return &MockService_Update_Call{Call: _e.mock.On("Update", ctx, session, cfg)}
func (_e *Service_Expecter) Update(ctx interface{}, session interface{}, cfg interface{}) *Service_Update_Call {
return &Service_Update_Call{Call: _e.mock.On("Update", ctx, session, cfg)}
}
func (_c *MockService_Update_Call) Run(run func(ctx context.Context, session authn.Session, cfg bootstrap.Config)) *MockService_Update_Call {
func (_c *Service_Update_Call) Run(run func(ctx context.Context, session authn.Session, cfg bootstrap.Config)) *Service_Update_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(bootstrap.Config))
})
return _c
}
func (_c *MockService_Update_Call) Return(err error) *MockService_Update_Call {
func (_c *Service_Update_Call) Return(err error) *Service_Update_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_Update_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, cfg bootstrap.Config) error) *MockService_Update_Call {
func (_c *Service_Update_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, cfg bootstrap.Config) error) *Service_Update_Call {
_c.Call.Return(run)
return _c
}
// UpdateCert provides a mock function for the type MockService
func (_mock *MockService) UpdateCert(ctx context.Context, session authn.Session, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error) {
// UpdateCert provides a mock function for the type Service
func (_mock *Service) UpdateCert(ctx context.Context, session authn.Session, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, session, clientID, clientCert, clientKey, caCert)
if len(ret) == 0 {
@@ -566,8 +569,8 @@ func (_mock *MockService) UpdateCert(ctx context.Context, session authn.Session,
return r0, r1
}
// MockService_UpdateCert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCert'
type MockService_UpdateCert_Call struct {
// Service_UpdateCert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateCert'
type Service_UpdateCert_Call struct {
*mock.Call
}
@@ -578,29 +581,29 @@ type MockService_UpdateCert_Call struct {
// - clientCert
// - clientKey
// - caCert
func (_e *MockService_Expecter) UpdateCert(ctx interface{}, session interface{}, clientID interface{}, clientCert interface{}, clientKey interface{}, caCert interface{}) *MockService_UpdateCert_Call {
return &MockService_UpdateCert_Call{Call: _e.mock.On("UpdateCert", ctx, session, clientID, clientCert, clientKey, caCert)}
func (_e *Service_Expecter) UpdateCert(ctx interface{}, session interface{}, clientID interface{}, clientCert interface{}, clientKey interface{}, caCert interface{}) *Service_UpdateCert_Call {
return &Service_UpdateCert_Call{Call: _e.mock.On("UpdateCert", ctx, session, clientID, clientCert, clientKey, caCert)}
}
func (_c *MockService_UpdateCert_Call) Run(run func(ctx context.Context, session authn.Session, clientID string, clientCert string, clientKey string, caCert string)) *MockService_UpdateCert_Call {
func (_c *Service_UpdateCert_Call) Run(run func(ctx context.Context, session authn.Session, clientID string, clientCert string, clientKey string, caCert string)) *Service_UpdateCert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string), args[3].(string), args[4].(string), args[5].(string))
})
return _c
}
func (_c *MockService_UpdateCert_Call) Return(config bootstrap.Config, err error) *MockService_UpdateCert_Call {
func (_c *Service_UpdateCert_Call) Return(config bootstrap.Config, err error) *Service_UpdateCert_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockService_UpdateCert_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error)) *MockService_UpdateCert_Call {
func (_c *Service_UpdateCert_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, clientID string, clientCert string, clientKey string, caCert string) (bootstrap.Config, error)) *Service_UpdateCert_Call {
_c.Call.Return(run)
return _c
}
// UpdateChannelHandler provides a mock function for the type MockService
func (_mock *MockService) UpdateChannelHandler(ctx context.Context, channel bootstrap.Channel) error {
// UpdateChannelHandler provides a mock function for the type Service
func (_mock *Service) UpdateChannelHandler(ctx context.Context, channel bootstrap.Channel) error {
ret := _mock.Called(ctx, channel)
if len(ret) == 0 {
@@ -616,37 +619,37 @@ func (_mock *MockService) UpdateChannelHandler(ctx context.Context, channel boot
return r0
}
// MockService_UpdateChannelHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateChannelHandler'
type MockService_UpdateChannelHandler_Call struct {
// Service_UpdateChannelHandler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateChannelHandler'
type Service_UpdateChannelHandler_Call struct {
*mock.Call
}
// UpdateChannelHandler is a helper method to define mock.On call
// - ctx
// - channel
func (_e *MockService_Expecter) UpdateChannelHandler(ctx interface{}, channel interface{}) *MockService_UpdateChannelHandler_Call {
return &MockService_UpdateChannelHandler_Call{Call: _e.mock.On("UpdateChannelHandler", ctx, channel)}
func (_e *Service_Expecter) UpdateChannelHandler(ctx interface{}, channel interface{}) *Service_UpdateChannelHandler_Call {
return &Service_UpdateChannelHandler_Call{Call: _e.mock.On("UpdateChannelHandler", ctx, channel)}
}
func (_c *MockService_UpdateChannelHandler_Call) Run(run func(ctx context.Context, channel bootstrap.Channel)) *MockService_UpdateChannelHandler_Call {
func (_c *Service_UpdateChannelHandler_Call) Run(run func(ctx context.Context, channel bootstrap.Channel)) *Service_UpdateChannelHandler_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(bootstrap.Channel))
})
return _c
}
func (_c *MockService_UpdateChannelHandler_Call) Return(err error) *MockService_UpdateChannelHandler_Call {
func (_c *Service_UpdateChannelHandler_Call) Return(err error) *Service_UpdateChannelHandler_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_UpdateChannelHandler_Call) RunAndReturn(run func(ctx context.Context, channel bootstrap.Channel) error) *MockService_UpdateChannelHandler_Call {
func (_c *Service_UpdateChannelHandler_Call) RunAndReturn(run func(ctx context.Context, channel bootstrap.Channel) error) *Service_UpdateChannelHandler_Call {
_c.Call.Return(run)
return _c
}
// UpdateConnections provides a mock function for the type MockService
func (_mock *MockService) UpdateConnections(ctx context.Context, session authn.Session, token string, id string, connections []string) error {
// UpdateConnections provides a mock function for the type Service
func (_mock *Service) UpdateConnections(ctx context.Context, session authn.Session, token string, id string, connections []string) error {
ret := _mock.Called(ctx, session, token, id, connections)
if len(ret) == 0 {
@@ -662,8 +665,8 @@ func (_mock *MockService) UpdateConnections(ctx context.Context, session authn.S
return r0
}
// MockService_UpdateConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateConnections'
type MockService_UpdateConnections_Call struct {
// Service_UpdateConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateConnections'
type Service_UpdateConnections_Call struct {
*mock.Call
}
@@ -673,29 +676,29 @@ type MockService_UpdateConnections_Call struct {
// - token
// - id
// - connections
func (_e *MockService_Expecter) UpdateConnections(ctx interface{}, session interface{}, token interface{}, id interface{}, connections interface{}) *MockService_UpdateConnections_Call {
return &MockService_UpdateConnections_Call{Call: _e.mock.On("UpdateConnections", ctx, session, token, id, connections)}
func (_e *Service_Expecter) UpdateConnections(ctx interface{}, session interface{}, token interface{}, id interface{}, connections interface{}) *Service_UpdateConnections_Call {
return &Service_UpdateConnections_Call{Call: _e.mock.On("UpdateConnections", ctx, session, token, id, connections)}
}
func (_c *MockService_UpdateConnections_Call) Run(run func(ctx context.Context, session authn.Session, token string, id string, connections []string)) *MockService_UpdateConnections_Call {
func (_c *Service_UpdateConnections_Call) Run(run func(ctx context.Context, session authn.Session, token string, id string, connections []string)) *Service_UpdateConnections_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string), args[3].(string), args[4].([]string))
})
return _c
}
func (_c *MockService_UpdateConnections_Call) Return(err error) *MockService_UpdateConnections_Call {
func (_c *Service_UpdateConnections_Call) Return(err error) *Service_UpdateConnections_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_UpdateConnections_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, token string, id string, connections []string) error) *MockService_UpdateConnections_Call {
func (_c *Service_UpdateConnections_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, token string, id string, connections []string) error) *Service_UpdateConnections_Call {
_c.Call.Return(run)
return _c
}
// View provides a mock function for the type MockService
func (_mock *MockService) View(ctx context.Context, session authn.Session, id string) (bootstrap.Config, error) {
// View provides a mock function for the type Service
func (_mock *Service) View(ctx context.Context, session authn.Session, id string) (bootstrap.Config, error) {
ret := _mock.Called(ctx, session, id)
if len(ret) == 0 {
@@ -720,8 +723,8 @@ func (_mock *MockService) View(ctx context.Context, session authn.Session, id st
return r0, r1
}
// MockService_View_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'View'
type MockService_View_Call struct {
// Service_View_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'View'
type Service_View_Call struct {
*mock.Call
}
@@ -729,23 +732,23 @@ type MockService_View_Call struct {
// - ctx
// - session
// - id
func (_e *MockService_Expecter) View(ctx interface{}, session interface{}, id interface{}) *MockService_View_Call {
return &MockService_View_Call{Call: _e.mock.On("View", ctx, session, id)}
func (_e *Service_Expecter) View(ctx interface{}, session interface{}, id interface{}) *Service_View_Call {
return &Service_View_Call{Call: _e.mock.On("View", ctx, session, id)}
}
func (_c *MockService_View_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *MockService_View_Call {
func (_c *Service_View_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *Service_View_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string))
})
return _c
}
func (_c *MockService_View_Call) Return(config bootstrap.Config, err error) *MockService_View_Call {
func (_c *Service_View_Call) Return(config bootstrap.Config, err error) *Service_View_Call {
_c.Call.Return(config, err)
return _c
}
func (_c *MockService_View_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (bootstrap.Config, error)) *MockService_View_Call {
func (_c *Service_View_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (bootstrap.Config, error)) *Service_View_Call {
_c.Call.Return(run)
return _c
}
+2 -2
View File
@@ -60,13 +60,13 @@ var (
)
var (
boot *mocks.MockConfigRepository
boot *mocks.ConfigRepository
policies *policymocks.Service
sdk *sdkmocks.SDK
)
func newService() bootstrap.Service {
boot = new(mocks.MockConfigRepository)
boot = new(mocks.ConfigRepository)
policies = new(policymocks.Service)
sdk = new(sdkmocks.SDK)
idp := uuid.NewMock()
+3 -3
View File
@@ -15,7 +15,7 @@ import (
"github.com/absmach/magistrala/consumers/notifiers"
"github.com/absmach/magistrala/consumers/notifiers/api"
mocks "github.com/absmach/magistrala/consumers/notifiers/mocks"
"github.com/absmach/magistrala/consumers/notifiers/mocks"
"github.com/absmach/magistrala/internal/testsutil"
apiutil "github.com/absmach/supermq/api/http/util"
smqlog "github.com/absmach/supermq/logger"
@@ -67,9 +67,9 @@ func (tr testRequest) make() (*http.Response, error) {
return tr.client.Do(req)
}
func newServer() (*httptest.Server, *mocks.MockService) {
func newServer() (*httptest.Server, *mocks.Service) {
logger := smqlog.NewMock()
svc := new(mocks.MockService)
svc := new(mocks.Service)
mux := api.MakeHandler(svc, logger, instanceID)
return httptest.NewServer(mux), svc
}
-250
View File
@@ -1,250 +0,0 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
package notifiers
import (
"context"
"github.com/absmach/magistrala/consumers/notifiers"
mock "github.com/stretchr/testify/mock"
)
// NewMockSubscriptionsRepository creates a new instance of MockSubscriptionsRepository. 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 NewMockSubscriptionsRepository(t interface {
mock.TestingT
Cleanup(func())
}) *MockSubscriptionsRepository {
mock := &MockSubscriptionsRepository{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// MockSubscriptionsRepository is an autogenerated mock type for the SubscriptionsRepository type
type MockSubscriptionsRepository struct {
mock.Mock
}
type MockSubscriptionsRepository_Expecter struct {
mock *mock.Mock
}
func (_m *MockSubscriptionsRepository) EXPECT() *MockSubscriptionsRepository_Expecter {
return &MockSubscriptionsRepository_Expecter{mock: &_m.Mock}
}
// Remove provides a mock function for the type MockSubscriptionsRepository
func (_mock *MockSubscriptionsRepository) Remove(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for Remove")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// MockSubscriptionsRepository_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
type MockSubscriptionsRepository_Remove_Call struct {
*mock.Call
}
// Remove is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockSubscriptionsRepository_Expecter) Remove(ctx interface{}, id interface{}) *MockSubscriptionsRepository_Remove_Call {
return &MockSubscriptionsRepository_Remove_Call{Call: _e.mock.On("Remove", ctx, id)}
}
func (_c *MockSubscriptionsRepository_Remove_Call) Run(run func(ctx context.Context, id string)) *MockSubscriptionsRepository_Remove_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockSubscriptionsRepository_Remove_Call) Return(err error) *MockSubscriptionsRepository_Remove_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockSubscriptionsRepository_Remove_Call) RunAndReturn(run func(ctx context.Context, id string) error) *MockSubscriptionsRepository_Remove_Call {
_c.Call.Return(run)
return _c
}
// Retrieve provides a mock function for the type MockSubscriptionsRepository
func (_mock *MockSubscriptionsRepository) Retrieve(ctx context.Context, id string) (notifiers.Subscription, error) {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for Retrieve")
}
var r0 notifiers.Subscription
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) (notifiers.Subscription, error)); ok {
return returnFunc(ctx, id)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string) notifiers.Subscription); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Get(0).(notifiers.Subscription)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = returnFunc(ctx, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSubscriptionsRepository_Retrieve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Retrieve'
type MockSubscriptionsRepository_Retrieve_Call struct {
*mock.Call
}
// Retrieve is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockSubscriptionsRepository_Expecter) Retrieve(ctx interface{}, id interface{}) *MockSubscriptionsRepository_Retrieve_Call {
return &MockSubscriptionsRepository_Retrieve_Call{Call: _e.mock.On("Retrieve", ctx, id)}
}
func (_c *MockSubscriptionsRepository_Retrieve_Call) Run(run func(ctx context.Context, id string)) *MockSubscriptionsRepository_Retrieve_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockSubscriptionsRepository_Retrieve_Call) Return(subscription notifiers.Subscription, err error) *MockSubscriptionsRepository_Retrieve_Call {
_c.Call.Return(subscription, err)
return _c
}
func (_c *MockSubscriptionsRepository_Retrieve_Call) RunAndReturn(run func(ctx context.Context, id string) (notifiers.Subscription, error)) *MockSubscriptionsRepository_Retrieve_Call {
_c.Call.Return(run)
return _c
}
// RetrieveAll provides a mock function for the type MockSubscriptionsRepository
func (_mock *MockSubscriptionsRepository) RetrieveAll(ctx context.Context, pm notifiers.PageMetadata) (notifiers.Page, error) {
ret := _mock.Called(ctx, pm)
if len(ret) == 0 {
panic("no return value specified for RetrieveAll")
}
var r0 notifiers.Page
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.PageMetadata) (notifiers.Page, error)); ok {
return returnFunc(ctx, pm)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.PageMetadata) notifiers.Page); ok {
r0 = returnFunc(ctx, pm)
} else {
r0 = ret.Get(0).(notifiers.Page)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, notifiers.PageMetadata) error); ok {
r1 = returnFunc(ctx, pm)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSubscriptionsRepository_RetrieveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveAll'
type MockSubscriptionsRepository_RetrieveAll_Call struct {
*mock.Call
}
// RetrieveAll is a helper method to define mock.On call
// - ctx
// - pm
func (_e *MockSubscriptionsRepository_Expecter) RetrieveAll(ctx interface{}, pm interface{}) *MockSubscriptionsRepository_RetrieveAll_Call {
return &MockSubscriptionsRepository_RetrieveAll_Call{Call: _e.mock.On("RetrieveAll", ctx, pm)}
}
func (_c *MockSubscriptionsRepository_RetrieveAll_Call) Run(run func(ctx context.Context, pm notifiers.PageMetadata)) *MockSubscriptionsRepository_RetrieveAll_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(notifiers.PageMetadata))
})
return _c
}
func (_c *MockSubscriptionsRepository_RetrieveAll_Call) Return(page notifiers.Page, err error) *MockSubscriptionsRepository_RetrieveAll_Call {
_c.Call.Return(page, err)
return _c
}
func (_c *MockSubscriptionsRepository_RetrieveAll_Call) RunAndReturn(run func(ctx context.Context, pm notifiers.PageMetadata) (notifiers.Page, error)) *MockSubscriptionsRepository_RetrieveAll_Call {
_c.Call.Return(run)
return _c
}
// Save provides a mock function for the type MockSubscriptionsRepository
func (_mock *MockSubscriptionsRepository) Save(ctx context.Context, sub notifiers.Subscription) (string, error) {
ret := _mock.Called(ctx, sub)
if len(ret) == 0 {
panic("no return value specified for Save")
}
var r0 string
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.Subscription) (string, error)); ok {
return returnFunc(ctx, sub)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.Subscription) string); ok {
r0 = returnFunc(ctx, sub)
} else {
r0 = ret.Get(0).(string)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, notifiers.Subscription) error); ok {
r1 = returnFunc(ctx, sub)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MockSubscriptionsRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
type MockSubscriptionsRepository_Save_Call struct {
*mock.Call
}
// Save is a helper method to define mock.On call
// - ctx
// - sub
func (_e *MockSubscriptionsRepository_Expecter) Save(ctx interface{}, sub interface{}) *MockSubscriptionsRepository_Save_Call {
return &MockSubscriptionsRepository_Save_Call{Call: _e.mock.On("Save", ctx, sub)}
}
func (_c *MockSubscriptionsRepository_Save_Call) Run(run func(ctx context.Context, sub notifiers.Subscription)) *MockSubscriptionsRepository_Save_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(notifiers.Subscription))
})
return _c
}
func (_c *MockSubscriptionsRepository_Save_Call) Return(s string, err error) *MockSubscriptionsRepository_Save_Call {
_c.Call.Return(s, err)
return _c
}
func (_c *MockSubscriptionsRepository_Save_Call) RunAndReturn(run func(ctx context.Context, sub notifiers.Subscription) (string, error)) *MockSubscriptionsRepository_Save_Call {
_c.Call.Return(run)
return _c
}
+58 -55
View File
@@ -1,8 +1,11 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package notifiers
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"context"
@@ -11,13 +14,13 @@ import (
mock "github.com/stretchr/testify/mock"
)
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// NewService creates a new instance of Service. 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 NewMockService(t interface {
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
@@ -25,21 +28,21 @@ func NewMockService(t interface {
return mock
}
// MockService is an autogenerated mock type for the Service type
type MockService struct {
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
type MockService_Expecter struct {
type Service_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
func (_m *Service) EXPECT() *Service_Expecter {
return &Service_Expecter{mock: &_m.Mock}
}
// ConsumeBlocking provides a mock function for the type MockService
func (_mock *MockService) ConsumeBlocking(ctx context.Context, messages interface{}) error {
// ConsumeBlocking provides a mock function for the type Service
func (_mock *Service) ConsumeBlocking(ctx context.Context, messages interface{}) error {
ret := _mock.Called(ctx, messages)
if len(ret) == 0 {
@@ -55,37 +58,37 @@ func (_mock *MockService) ConsumeBlocking(ctx context.Context, messages interfac
return r0
}
// MockService_ConsumeBlocking_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConsumeBlocking'
type MockService_ConsumeBlocking_Call struct {
// Service_ConsumeBlocking_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConsumeBlocking'
type Service_ConsumeBlocking_Call struct {
*mock.Call
}
// ConsumeBlocking is a helper method to define mock.On call
// - ctx
// - messages
func (_e *MockService_Expecter) ConsumeBlocking(ctx interface{}, messages interface{}) *MockService_ConsumeBlocking_Call {
return &MockService_ConsumeBlocking_Call{Call: _e.mock.On("ConsumeBlocking", ctx, messages)}
func (_e *Service_Expecter) ConsumeBlocking(ctx interface{}, messages interface{}) *Service_ConsumeBlocking_Call {
return &Service_ConsumeBlocking_Call{Call: _e.mock.On("ConsumeBlocking", ctx, messages)}
}
func (_c *MockService_ConsumeBlocking_Call) Run(run func(ctx context.Context, messages interface{})) *MockService_ConsumeBlocking_Call {
func (_c *Service_ConsumeBlocking_Call) Run(run func(ctx context.Context, messages interface{})) *Service_ConsumeBlocking_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(interface{}))
})
return _c
}
func (_c *MockService_ConsumeBlocking_Call) Return(err error) *MockService_ConsumeBlocking_Call {
func (_c *Service_ConsumeBlocking_Call) Return(err error) *Service_ConsumeBlocking_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_ConsumeBlocking_Call) RunAndReturn(run func(ctx context.Context, messages interface{}) error) *MockService_ConsumeBlocking_Call {
func (_c *Service_ConsumeBlocking_Call) RunAndReturn(run func(ctx context.Context, messages interface{}) error) *Service_ConsumeBlocking_Call {
_c.Call.Return(run)
return _c
}
// CreateSubscription provides a mock function for the type MockService
func (_mock *MockService) CreateSubscription(ctx context.Context, token string, sub notifiers.Subscription) (string, error) {
// CreateSubscription provides a mock function for the type Service
func (_mock *Service) CreateSubscription(ctx context.Context, token string, sub notifiers.Subscription) (string, error) {
ret := _mock.Called(ctx, token, sub)
if len(ret) == 0 {
@@ -110,8 +113,8 @@ func (_mock *MockService) CreateSubscription(ctx context.Context, token string,
return r0, r1
}
// MockService_CreateSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSubscription'
type MockService_CreateSubscription_Call struct {
// Service_CreateSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateSubscription'
type Service_CreateSubscription_Call struct {
*mock.Call
}
@@ -119,29 +122,29 @@ type MockService_CreateSubscription_Call struct {
// - ctx
// - token
// - sub
func (_e *MockService_Expecter) CreateSubscription(ctx interface{}, token interface{}, sub interface{}) *MockService_CreateSubscription_Call {
return &MockService_CreateSubscription_Call{Call: _e.mock.On("CreateSubscription", ctx, token, sub)}
func (_e *Service_Expecter) CreateSubscription(ctx interface{}, token interface{}, sub interface{}) *Service_CreateSubscription_Call {
return &Service_CreateSubscription_Call{Call: _e.mock.On("CreateSubscription", ctx, token, sub)}
}
func (_c *MockService_CreateSubscription_Call) Run(run func(ctx context.Context, token string, sub notifiers.Subscription)) *MockService_CreateSubscription_Call {
func (_c *Service_CreateSubscription_Call) Run(run func(ctx context.Context, token string, sub notifiers.Subscription)) *Service_CreateSubscription_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(notifiers.Subscription))
})
return _c
}
func (_c *MockService_CreateSubscription_Call) Return(s string, err error) *MockService_CreateSubscription_Call {
func (_c *Service_CreateSubscription_Call) Return(s string, err error) *Service_CreateSubscription_Call {
_c.Call.Return(s, err)
return _c
}
func (_c *MockService_CreateSubscription_Call) RunAndReturn(run func(ctx context.Context, token string, sub notifiers.Subscription) (string, error)) *MockService_CreateSubscription_Call {
func (_c *Service_CreateSubscription_Call) RunAndReturn(run func(ctx context.Context, token string, sub notifiers.Subscription) (string, error)) *Service_CreateSubscription_Call {
_c.Call.Return(run)
return _c
}
// ListSubscriptions provides a mock function for the type MockService
func (_mock *MockService) ListSubscriptions(ctx context.Context, token string, pm notifiers.PageMetadata) (notifiers.Page, error) {
// ListSubscriptions provides a mock function for the type Service
func (_mock *Service) ListSubscriptions(ctx context.Context, token string, pm notifiers.PageMetadata) (notifiers.Page, error) {
ret := _mock.Called(ctx, token, pm)
if len(ret) == 0 {
@@ -166,8 +169,8 @@ func (_mock *MockService) ListSubscriptions(ctx context.Context, token string, p
return r0, r1
}
// MockService_ListSubscriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubscriptions'
type MockService_ListSubscriptions_Call struct {
// Service_ListSubscriptions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListSubscriptions'
type Service_ListSubscriptions_Call struct {
*mock.Call
}
@@ -175,29 +178,29 @@ type MockService_ListSubscriptions_Call struct {
// - ctx
// - token
// - pm
func (_e *MockService_Expecter) ListSubscriptions(ctx interface{}, token interface{}, pm interface{}) *MockService_ListSubscriptions_Call {
return &MockService_ListSubscriptions_Call{Call: _e.mock.On("ListSubscriptions", ctx, token, pm)}
func (_e *Service_Expecter) ListSubscriptions(ctx interface{}, token interface{}, pm interface{}) *Service_ListSubscriptions_Call {
return &Service_ListSubscriptions_Call{Call: _e.mock.On("ListSubscriptions", ctx, token, pm)}
}
func (_c *MockService_ListSubscriptions_Call) Run(run func(ctx context.Context, token string, pm notifiers.PageMetadata)) *MockService_ListSubscriptions_Call {
func (_c *Service_ListSubscriptions_Call) Run(run func(ctx context.Context, token string, pm notifiers.PageMetadata)) *Service_ListSubscriptions_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(notifiers.PageMetadata))
})
return _c
}
func (_c *MockService_ListSubscriptions_Call) Return(page notifiers.Page, err error) *MockService_ListSubscriptions_Call {
func (_c *Service_ListSubscriptions_Call) Return(page notifiers.Page, err error) *Service_ListSubscriptions_Call {
_c.Call.Return(page, err)
return _c
}
func (_c *MockService_ListSubscriptions_Call) RunAndReturn(run func(ctx context.Context, token string, pm notifiers.PageMetadata) (notifiers.Page, error)) *MockService_ListSubscriptions_Call {
func (_c *Service_ListSubscriptions_Call) RunAndReturn(run func(ctx context.Context, token string, pm notifiers.PageMetadata) (notifiers.Page, error)) *Service_ListSubscriptions_Call {
_c.Call.Return(run)
return _c
}
// RemoveSubscription provides a mock function for the type MockService
func (_mock *MockService) RemoveSubscription(ctx context.Context, token string, id string) error {
// RemoveSubscription provides a mock function for the type Service
func (_mock *Service) RemoveSubscription(ctx context.Context, token string, id string) error {
ret := _mock.Called(ctx, token, id)
if len(ret) == 0 {
@@ -213,8 +216,8 @@ func (_mock *MockService) RemoveSubscription(ctx context.Context, token string,
return r0
}
// MockService_RemoveSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveSubscription'
type MockService_RemoveSubscription_Call struct {
// Service_RemoveSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveSubscription'
type Service_RemoveSubscription_Call struct {
*mock.Call
}
@@ -222,29 +225,29 @@ type MockService_RemoveSubscription_Call struct {
// - ctx
// - token
// - id
func (_e *MockService_Expecter) RemoveSubscription(ctx interface{}, token interface{}, id interface{}) *MockService_RemoveSubscription_Call {
return &MockService_RemoveSubscription_Call{Call: _e.mock.On("RemoveSubscription", ctx, token, id)}
func (_e *Service_Expecter) RemoveSubscription(ctx interface{}, token interface{}, id interface{}) *Service_RemoveSubscription_Call {
return &Service_RemoveSubscription_Call{Call: _e.mock.On("RemoveSubscription", ctx, token, id)}
}
func (_c *MockService_RemoveSubscription_Call) Run(run func(ctx context.Context, token string, id string)) *MockService_RemoveSubscription_Call {
func (_c *Service_RemoveSubscription_Call) Run(run func(ctx context.Context, token string, id string)) *Service_RemoveSubscription_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockService_RemoveSubscription_Call) Return(err error) *MockService_RemoveSubscription_Call {
func (_c *Service_RemoveSubscription_Call) Return(err error) *Service_RemoveSubscription_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_RemoveSubscription_Call) RunAndReturn(run func(ctx context.Context, token string, id string) error) *MockService_RemoveSubscription_Call {
func (_c *Service_RemoveSubscription_Call) RunAndReturn(run func(ctx context.Context, token string, id string) error) *Service_RemoveSubscription_Call {
_c.Call.Return(run)
return _c
}
// ViewSubscription provides a mock function for the type MockService
func (_mock *MockService) ViewSubscription(ctx context.Context, token string, id string) (notifiers.Subscription, error) {
// ViewSubscription provides a mock function for the type Service
func (_mock *Service) ViewSubscription(ctx context.Context, token string, id string) (notifiers.Subscription, error) {
ret := _mock.Called(ctx, token, id)
if len(ret) == 0 {
@@ -269,8 +272,8 @@ func (_mock *MockService) ViewSubscription(ctx context.Context, token string, id
return r0, r1
}
// MockService_ViewSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ViewSubscription'
type MockService_ViewSubscription_Call struct {
// Service_ViewSubscription_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ViewSubscription'
type Service_ViewSubscription_Call struct {
*mock.Call
}
@@ -278,23 +281,23 @@ type MockService_ViewSubscription_Call struct {
// - ctx
// - token
// - id
func (_e *MockService_Expecter) ViewSubscription(ctx interface{}, token interface{}, id interface{}) *MockService_ViewSubscription_Call {
return &MockService_ViewSubscription_Call{Call: _e.mock.On("ViewSubscription", ctx, token, id)}
func (_e *Service_Expecter) ViewSubscription(ctx interface{}, token interface{}, id interface{}) *Service_ViewSubscription_Call {
return &Service_ViewSubscription_Call{Call: _e.mock.On("ViewSubscription", ctx, token, id)}
}
func (_c *MockService_ViewSubscription_Call) Run(run func(ctx context.Context, token string, id string)) *MockService_ViewSubscription_Call {
func (_c *Service_ViewSubscription_Call) Run(run func(ctx context.Context, token string, id string)) *Service_ViewSubscription_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(string))
})
return _c
}
func (_c *MockService_ViewSubscription_Call) Return(subscription notifiers.Subscription, err error) *MockService_ViewSubscription_Call {
func (_c *Service_ViewSubscription_Call) Return(subscription notifiers.Subscription, err error) *Service_ViewSubscription_Call {
_c.Call.Return(subscription, err)
return _c
}
func (_c *MockService_ViewSubscription_Call) RunAndReturn(run func(ctx context.Context, token string, id string) (notifiers.Subscription, error)) *MockService_ViewSubscription_Call {
func (_c *Service_ViewSubscription_Call) RunAndReturn(run func(ctx context.Context, token string, id string) (notifiers.Subscription, error)) *Service_ViewSubscription_Call {
_c.Call.Return(run)
return _c
}
@@ -0,0 +1,253 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"context"
"github.com/absmach/magistrala/consumers/notifiers"
mock "github.com/stretchr/testify/mock"
)
// NewSubscriptionsRepository creates a new instance of SubscriptionsRepository. 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 NewSubscriptionsRepository(t interface {
mock.TestingT
Cleanup(func())
}) *SubscriptionsRepository {
mock := &SubscriptionsRepository{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}
// SubscriptionsRepository is an autogenerated mock type for the SubscriptionsRepository type
type SubscriptionsRepository struct {
mock.Mock
}
type SubscriptionsRepository_Expecter struct {
mock *mock.Mock
}
func (_m *SubscriptionsRepository) EXPECT() *SubscriptionsRepository_Expecter {
return &SubscriptionsRepository_Expecter{mock: &_m.Mock}
}
// Remove provides a mock function for the type SubscriptionsRepository
func (_mock *SubscriptionsRepository) Remove(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for Remove")
}
var r0 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Error(0)
}
return r0
}
// SubscriptionsRepository_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove'
type SubscriptionsRepository_Remove_Call struct {
*mock.Call
}
// Remove is a helper method to define mock.On call
// - ctx
// - id
func (_e *SubscriptionsRepository_Expecter) Remove(ctx interface{}, id interface{}) *SubscriptionsRepository_Remove_Call {
return &SubscriptionsRepository_Remove_Call{Call: _e.mock.On("Remove", ctx, id)}
}
func (_c *SubscriptionsRepository_Remove_Call) Run(run func(ctx context.Context, id string)) *SubscriptionsRepository_Remove_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *SubscriptionsRepository_Remove_Call) Return(err error) *SubscriptionsRepository_Remove_Call {
_c.Call.Return(err)
return _c
}
func (_c *SubscriptionsRepository_Remove_Call) RunAndReturn(run func(ctx context.Context, id string) error) *SubscriptionsRepository_Remove_Call {
_c.Call.Return(run)
return _c
}
// Retrieve provides a mock function for the type SubscriptionsRepository
func (_mock *SubscriptionsRepository) Retrieve(ctx context.Context, id string) (notifiers.Subscription, error) {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
panic("no return value specified for Retrieve")
}
var r0 notifiers.Subscription
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, string) (notifiers.Subscription, error)); ok {
return returnFunc(ctx, id)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, string) notifiers.Subscription); ok {
r0 = returnFunc(ctx, id)
} else {
r0 = ret.Get(0).(notifiers.Subscription)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
r1 = returnFunc(ctx, id)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SubscriptionsRepository_Retrieve_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Retrieve'
type SubscriptionsRepository_Retrieve_Call struct {
*mock.Call
}
// Retrieve is a helper method to define mock.On call
// - ctx
// - id
func (_e *SubscriptionsRepository_Expecter) Retrieve(ctx interface{}, id interface{}) *SubscriptionsRepository_Retrieve_Call {
return &SubscriptionsRepository_Retrieve_Call{Call: _e.mock.On("Retrieve", ctx, id)}
}
func (_c *SubscriptionsRepository_Retrieve_Call) Run(run func(ctx context.Context, id string)) *SubscriptionsRepository_Retrieve_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *SubscriptionsRepository_Retrieve_Call) Return(subscription notifiers.Subscription, err error) *SubscriptionsRepository_Retrieve_Call {
_c.Call.Return(subscription, err)
return _c
}
func (_c *SubscriptionsRepository_Retrieve_Call) RunAndReturn(run func(ctx context.Context, id string) (notifiers.Subscription, error)) *SubscriptionsRepository_Retrieve_Call {
_c.Call.Return(run)
return _c
}
// RetrieveAll provides a mock function for the type SubscriptionsRepository
func (_mock *SubscriptionsRepository) RetrieveAll(ctx context.Context, pm notifiers.PageMetadata) (notifiers.Page, error) {
ret := _mock.Called(ctx, pm)
if len(ret) == 0 {
panic("no return value specified for RetrieveAll")
}
var r0 notifiers.Page
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.PageMetadata) (notifiers.Page, error)); ok {
return returnFunc(ctx, pm)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.PageMetadata) notifiers.Page); ok {
r0 = returnFunc(ctx, pm)
} else {
r0 = ret.Get(0).(notifiers.Page)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, notifiers.PageMetadata) error); ok {
r1 = returnFunc(ctx, pm)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SubscriptionsRepository_RetrieveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveAll'
type SubscriptionsRepository_RetrieveAll_Call struct {
*mock.Call
}
// RetrieveAll is a helper method to define mock.On call
// - ctx
// - pm
func (_e *SubscriptionsRepository_Expecter) RetrieveAll(ctx interface{}, pm interface{}) *SubscriptionsRepository_RetrieveAll_Call {
return &SubscriptionsRepository_RetrieveAll_Call{Call: _e.mock.On("RetrieveAll", ctx, pm)}
}
func (_c *SubscriptionsRepository_RetrieveAll_Call) Run(run func(ctx context.Context, pm notifiers.PageMetadata)) *SubscriptionsRepository_RetrieveAll_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(notifiers.PageMetadata))
})
return _c
}
func (_c *SubscriptionsRepository_RetrieveAll_Call) Return(page notifiers.Page, err error) *SubscriptionsRepository_RetrieveAll_Call {
_c.Call.Return(page, err)
return _c
}
func (_c *SubscriptionsRepository_RetrieveAll_Call) RunAndReturn(run func(ctx context.Context, pm notifiers.PageMetadata) (notifiers.Page, error)) *SubscriptionsRepository_RetrieveAll_Call {
_c.Call.Return(run)
return _c
}
// Save provides a mock function for the type SubscriptionsRepository
func (_mock *SubscriptionsRepository) Save(ctx context.Context, sub notifiers.Subscription) (string, error) {
ret := _mock.Called(ctx, sub)
if len(ret) == 0 {
panic("no return value specified for Save")
}
var r0 string
var r1 error
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.Subscription) (string, error)); ok {
return returnFunc(ctx, sub)
}
if returnFunc, ok := ret.Get(0).(func(context.Context, notifiers.Subscription) string); ok {
r0 = returnFunc(ctx, sub)
} else {
r0 = ret.Get(0).(string)
}
if returnFunc, ok := ret.Get(1).(func(context.Context, notifiers.Subscription) error); ok {
r1 = returnFunc(ctx, sub)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SubscriptionsRepository_Save_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Save'
type SubscriptionsRepository_Save_Call struct {
*mock.Call
}
// Save is a helper method to define mock.On call
// - ctx
// - sub
func (_e *SubscriptionsRepository_Expecter) Save(ctx interface{}, sub interface{}) *SubscriptionsRepository_Save_Call {
return &SubscriptionsRepository_Save_Call{Call: _e.mock.On("Save", ctx, sub)}
}
func (_c *SubscriptionsRepository_Save_Call) Run(run func(ctx context.Context, sub notifiers.Subscription)) *SubscriptionsRepository_Save_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(notifiers.Subscription))
})
return _c
}
func (_c *SubscriptionsRepository_Save_Call) Return(s string, err error) *SubscriptionsRepository_Save_Call {
_c.Call.Return(s, err)
return _c
}
func (_c *SubscriptionsRepository_Save_Call) RunAndReturn(run func(ctx context.Context, sub notifiers.Subscription) (string, error)) *SubscriptionsRepository_Save_Call {
_c.Call.Return(run)
return _c
}
+3 -3
View File
@@ -9,7 +9,7 @@ import (
"testing"
"github.com/absmach/magistrala/consumers/notifiers"
mocks "github.com/absmach/magistrala/consumers/notifiers/mocks"
"github.com/absmach/magistrala/consumers/notifiers/mocks"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/supermq/consumers"
smqmocks "github.com/absmach/supermq/consumers/mocks"
@@ -31,8 +31,8 @@ const (
validID = "d4ebb847-5d0e-4e46-bdd9-b6aceaaa3a22"
)
func newService() (notifiers.Service, *authnmocks.Authentication, *mocks.MockSubscriptionsRepository) {
repo := new(mocks.MockSubscriptionsRepository)
func newService() (notifiers.Service, *authnmocks.Authentication, *mocks.SubscriptionsRepository) {
repo := new(mocks.SubscriptionsRepository)
auth := new(authnmocks.Authentication)
notifier := new(smqmocks.Notifier)
idp := uuid.NewMock()
+3 -3
View File
@@ -132,9 +132,9 @@ type readerChannelRes struct {
Metadata interface{} `json:"metadata,omitempty"`
}
func setupBootstrap() (*httptest.Server, *bmocks.MockService, *bmocks.MockConfigReader, *authnmocks.Authentication) {
bsvc := new(bmocks.MockService)
reader := new(bmocks.MockConfigReader)
func setupBootstrap() (*httptest.Server, *bmocks.Service, *bmocks.ConfigReader, *authnmocks.Authentication) {
bsvc := new(bmocks.Service)
reader := new(bmocks.ConfigReader)
logger := smqlog.NewMock()
authn := new(authnmocks.Authentication)
mux := api.MakeHandler(bsvc, authn, reader, logger, "")
+2 -2
View File
@@ -51,8 +51,8 @@ var (
contentType = supermqSDK.CTJSON
)
func setupSubscriptions() (*httptest.Server, *notmocks.MockService) {
nsvc := new(notmocks.MockService)
func setupSubscriptions() (*httptest.Server, *notmocks.Service) {
nsvc := new(notmocks.Service)
logger := smqlog.NewMock()
mux := httpapi.MakeHandler(nsvc, logger, instanceID)
+4 -1
View File
@@ -1,8 +1,11 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package sdk
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"time"
+2 -2
View File
@@ -53,8 +53,8 @@ func (tr testRequest) make() (*http.Response, error) {
return tr.client.Do(req)
}
func newProvisionServer() (*httptest.Server, *mocks.MockService) {
svc := new(mocks.MockService)
func newProvisionServer() (*httptest.Server, *mocks.Service) {
svc := new(mocks.Service)
logger := smqlog.NewMock()
mux := api.MakeHandler(svc, logger, "test")
+40 -37
View File
@@ -1,21 +1,24 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package provision
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"github.com/absmach/magistrala/provision"
mock "github.com/stretchr/testify/mock"
)
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// NewService creates a new instance of Service. 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 NewMockService(t interface {
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
@@ -23,21 +26,21 @@ func NewMockService(t interface {
return mock
}
// MockService is an autogenerated mock type for the Service type
type MockService struct {
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
type MockService_Expecter struct {
type Service_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
func (_m *Service) EXPECT() *Service_Expecter {
return &Service_Expecter{mock: &_m.Mock}
}
// Cert provides a mock function for the type MockService
func (_mock *MockService) Cert(domainID string, token string, clientID string, duration string) (string, string, error) {
// Cert provides a mock function for the type Service
func (_mock *Service) Cert(domainID string, token string, clientID string, duration string) (string, string, error) {
ret := _mock.Called(domainID, token, clientID, duration)
if len(ret) == 0 {
@@ -68,8 +71,8 @@ func (_mock *MockService) Cert(domainID string, token string, clientID string, d
return r0, r1, r2
}
// MockService_Cert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cert'
type MockService_Cert_Call struct {
// Service_Cert_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Cert'
type Service_Cert_Call struct {
*mock.Call
}
@@ -78,29 +81,29 @@ type MockService_Cert_Call struct {
// - token
// - clientID
// - duration
func (_e *MockService_Expecter) Cert(domainID interface{}, token interface{}, clientID interface{}, duration interface{}) *MockService_Cert_Call {
return &MockService_Cert_Call{Call: _e.mock.On("Cert", domainID, token, clientID, duration)}
func (_e *Service_Expecter) Cert(domainID interface{}, token interface{}, clientID interface{}, duration interface{}) *Service_Cert_Call {
return &Service_Cert_Call{Call: _e.mock.On("Cert", domainID, token, clientID, duration)}
}
func (_c *MockService_Cert_Call) Run(run func(domainID string, token string, clientID string, duration string)) *MockService_Cert_Call {
func (_c *Service_Cert_Call) Run(run func(domainID string, token string, clientID string, duration string)) *Service_Cert_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(string), args[3].(string))
})
return _c
}
func (_c *MockService_Cert_Call) Return(s string, s1 string, err error) *MockService_Cert_Call {
func (_c *Service_Cert_Call) Return(s string, s1 string, err error) *Service_Cert_Call {
_c.Call.Return(s, s1, err)
return _c
}
func (_c *MockService_Cert_Call) RunAndReturn(run func(domainID string, token string, clientID string, duration string) (string, string, error)) *MockService_Cert_Call {
func (_c *Service_Cert_Call) RunAndReturn(run func(domainID string, token string, clientID string, duration string) (string, string, error)) *Service_Cert_Call {
_c.Call.Return(run)
return _c
}
// Mapping provides a mock function for the type MockService
func (_mock *MockService) Mapping(token string) (map[string]interface{}, error) {
// Mapping provides a mock function for the type Service
func (_mock *Service) Mapping(token string) (map[string]interface{}, error) {
ret := _mock.Called(token)
if len(ret) == 0 {
@@ -127,36 +130,36 @@ func (_mock *MockService) Mapping(token string) (map[string]interface{}, error)
return r0, r1
}
// MockService_Mapping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Mapping'
type MockService_Mapping_Call struct {
// Service_Mapping_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Mapping'
type Service_Mapping_Call struct {
*mock.Call
}
// Mapping is a helper method to define mock.On call
// - token
func (_e *MockService_Expecter) Mapping(token interface{}) *MockService_Mapping_Call {
return &MockService_Mapping_Call{Call: _e.mock.On("Mapping", token)}
func (_e *Service_Expecter) Mapping(token interface{}) *Service_Mapping_Call {
return &Service_Mapping_Call{Call: _e.mock.On("Mapping", token)}
}
func (_c *MockService_Mapping_Call) Run(run func(token string)) *MockService_Mapping_Call {
func (_c *Service_Mapping_Call) Run(run func(token string)) *Service_Mapping_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string))
})
return _c
}
func (_c *MockService_Mapping_Call) Return(stringToIfaceVal map[string]interface{}, err error) *MockService_Mapping_Call {
func (_c *Service_Mapping_Call) Return(stringToIfaceVal map[string]interface{}, err error) *Service_Mapping_Call {
_c.Call.Return(stringToIfaceVal, err)
return _c
}
func (_c *MockService_Mapping_Call) RunAndReturn(run func(token string) (map[string]interface{}, error)) *MockService_Mapping_Call {
func (_c *Service_Mapping_Call) RunAndReturn(run func(token string) (map[string]interface{}, error)) *Service_Mapping_Call {
_c.Call.Return(run)
return _c
}
// Provision provides a mock function for the type MockService
func (_mock *MockService) Provision(domainID string, token string, name string, externalID string, externalKey string) (provision.Result, error) {
// Provision provides a mock function for the type Service
func (_mock *Service) Provision(domainID string, token string, name string, externalID string, externalKey string) (provision.Result, error) {
ret := _mock.Called(domainID, token, name, externalID, externalKey)
if len(ret) == 0 {
@@ -181,8 +184,8 @@ func (_mock *MockService) Provision(domainID string, token string, name string,
return r0, r1
}
// MockService_Provision_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Provision'
type MockService_Provision_Call struct {
// Service_Provision_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Provision'
type Service_Provision_Call struct {
*mock.Call
}
@@ -192,23 +195,23 @@ type MockService_Provision_Call struct {
// - name
// - externalID
// - externalKey
func (_e *MockService_Expecter) Provision(domainID interface{}, token interface{}, name interface{}, externalID interface{}, externalKey interface{}) *MockService_Provision_Call {
return &MockService_Provision_Call{Call: _e.mock.On("Provision", domainID, token, name, externalID, externalKey)}
func (_e *Service_Expecter) Provision(domainID interface{}, token interface{}, name interface{}, externalID interface{}, externalKey interface{}) *Service_Provision_Call {
return &Service_Provision_Call{Call: _e.mock.On("Provision", domainID, token, name, externalID, externalKey)}
}
func (_c *MockService_Provision_Call) Run(run func(domainID string, token string, name string, externalID string, externalKey string)) *MockService_Provision_Call {
func (_c *Service_Provision_Call) Run(run func(domainID string, token string, name string, externalID string, externalKey string)) *Service_Provision_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(string), args[1].(string), args[2].(string), args[3].(string), args[4].(string))
})
return _c
}
func (_c *MockService_Provision_Call) Return(result provision.Result, err error) *MockService_Provision_Call {
func (_c *Service_Provision_Call) Return(result provision.Result, err error) *Service_Provision_Call {
_c.Call.Return(result, err)
return _c
}
func (_c *MockService_Provision_Call) RunAndReturn(run func(domainID string, token string, name string, externalID string, externalKey string) (provision.Result, error)) *MockService_Provision_Call {
func (_c *Service_Provision_Call) RunAndReturn(run func(domainID string, token string, name string, externalID string, externalKey string) (provision.Result, error)) *Service_Provision_Call {
_c.Call.Return(run)
return _c
}
+3 -3
View File
@@ -18,7 +18,7 @@ import (
"github.com/absmach/magistrala/pkg/errors"
"github.com/absmach/magistrala/re"
"github.com/absmach/magistrala/re/api"
mocks "github.com/absmach/magistrala/re/mocks"
"github.com/absmach/magistrala/re/mocks"
apiutil "github.com/absmach/supermq/api/http/util"
"github.com/absmach/supermq/auth"
smqlog "github.com/absmach/supermq/logger"
@@ -85,8 +85,8 @@ func (tr testRequest) make() (*http.Response, error) {
return tr.client.Do(req)
}
func newRuleEngineServer() (*httptest.Server, *mocks.MockService, *authnmocks.Authentication) {
svc := new(mocks.MockService)
func newRuleEngineServer() (*httptest.Server, *mocks.Service, *authnmocks.Authentication) {
svc := new(mocks.Service)
authn := new(authnmocks.Authentication)
logger := smqlog.NewMock()
+67 -64
View File
@@ -1,8 +1,11 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package re
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"context"
@@ -11,13 +14,13 @@ import (
mock "github.com/stretchr/testify/mock"
)
// NewMockRepository creates a new instance of MockRepository. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// NewRepository creates a new instance of Repository. 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 NewMockRepository(t interface {
func NewRepository(t interface {
mock.TestingT
Cleanup(func())
}) *MockRepository {
mock := &MockRepository{}
}) *Repository {
mock := &Repository{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
@@ -25,21 +28,21 @@ func NewMockRepository(t interface {
return mock
}
// MockRepository is an autogenerated mock type for the Repository type
type MockRepository struct {
// Repository is an autogenerated mock type for the Repository type
type Repository struct {
mock.Mock
}
type MockRepository_Expecter struct {
type Repository_Expecter struct {
mock *mock.Mock
}
func (_m *MockRepository) EXPECT() *MockRepository_Expecter {
return &MockRepository_Expecter{mock: &_m.Mock}
func (_m *Repository) EXPECT() *Repository_Expecter {
return &Repository_Expecter{mock: &_m.Mock}
}
// AddRule provides a mock function for the type MockRepository
func (_mock *MockRepository) AddRule(ctx context.Context, r re.Rule) (re.Rule, error) {
// AddRule provides a mock function for the type Repository
func (_mock *Repository) AddRule(ctx context.Context, r re.Rule) (re.Rule, error) {
ret := _mock.Called(ctx, r)
if len(ret) == 0 {
@@ -64,37 +67,37 @@ func (_mock *MockRepository) AddRule(ctx context.Context, r re.Rule) (re.Rule, e
return r0, r1
}
// MockRepository_AddRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRule'
type MockRepository_AddRule_Call struct {
// Repository_AddRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRule'
type Repository_AddRule_Call struct {
*mock.Call
}
// AddRule is a helper method to define mock.On call
// - ctx
// - r
func (_e *MockRepository_Expecter) AddRule(ctx interface{}, r interface{}) *MockRepository_AddRule_Call {
return &MockRepository_AddRule_Call{Call: _e.mock.On("AddRule", ctx, r)}
func (_e *Repository_Expecter) AddRule(ctx interface{}, r interface{}) *Repository_AddRule_Call {
return &Repository_AddRule_Call{Call: _e.mock.On("AddRule", ctx, r)}
}
func (_c *MockRepository_AddRule_Call) Run(run func(ctx context.Context, r re.Rule)) *MockRepository_AddRule_Call {
func (_c *Repository_AddRule_Call) Run(run func(ctx context.Context, r re.Rule)) *Repository_AddRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(re.Rule))
})
return _c
}
func (_c *MockRepository_AddRule_Call) Return(rule re.Rule, err error) *MockRepository_AddRule_Call {
func (_c *Repository_AddRule_Call) Return(rule re.Rule, err error) *Repository_AddRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockRepository_AddRule_Call) RunAndReturn(run func(ctx context.Context, r re.Rule) (re.Rule, error)) *MockRepository_AddRule_Call {
func (_c *Repository_AddRule_Call) RunAndReturn(run func(ctx context.Context, r re.Rule) (re.Rule, error)) *Repository_AddRule_Call {
_c.Call.Return(run)
return _c
}
// ListRules provides a mock function for the type MockRepository
func (_mock *MockRepository) ListRules(ctx context.Context, pm re.PageMeta) (re.Page, error) {
// ListRules provides a mock function for the type Repository
func (_mock *Repository) ListRules(ctx context.Context, pm re.PageMeta) (re.Page, error) {
ret := _mock.Called(ctx, pm)
if len(ret) == 0 {
@@ -119,37 +122,37 @@ func (_mock *MockRepository) ListRules(ctx context.Context, pm re.PageMeta) (re.
return r0, r1
}
// MockRepository_ListRules_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRules'
type MockRepository_ListRules_Call struct {
// Repository_ListRules_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRules'
type Repository_ListRules_Call struct {
*mock.Call
}
// ListRules is a helper method to define mock.On call
// - ctx
// - pm
func (_e *MockRepository_Expecter) ListRules(ctx interface{}, pm interface{}) *MockRepository_ListRules_Call {
return &MockRepository_ListRules_Call{Call: _e.mock.On("ListRules", ctx, pm)}
func (_e *Repository_Expecter) ListRules(ctx interface{}, pm interface{}) *Repository_ListRules_Call {
return &Repository_ListRules_Call{Call: _e.mock.On("ListRules", ctx, pm)}
}
func (_c *MockRepository_ListRules_Call) Run(run func(ctx context.Context, pm re.PageMeta)) *MockRepository_ListRules_Call {
func (_c *Repository_ListRules_Call) Run(run func(ctx context.Context, pm re.PageMeta)) *Repository_ListRules_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(re.PageMeta))
})
return _c
}
func (_c *MockRepository_ListRules_Call) Return(page re.Page, err error) *MockRepository_ListRules_Call {
func (_c *Repository_ListRules_Call) Return(page re.Page, err error) *Repository_ListRules_Call {
_c.Call.Return(page, err)
return _c
}
func (_c *MockRepository_ListRules_Call) RunAndReturn(run func(ctx context.Context, pm re.PageMeta) (re.Page, error)) *MockRepository_ListRules_Call {
func (_c *Repository_ListRules_Call) RunAndReturn(run func(ctx context.Context, pm re.PageMeta) (re.Page, error)) *Repository_ListRules_Call {
_c.Call.Return(run)
return _c
}
// RemoveRule provides a mock function for the type MockRepository
func (_mock *MockRepository) RemoveRule(ctx context.Context, id string) error {
// RemoveRule provides a mock function for the type Repository
func (_mock *Repository) RemoveRule(ctx context.Context, id string) error {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
@@ -165,37 +168,37 @@ func (_mock *MockRepository) RemoveRule(ctx context.Context, id string) error {
return r0
}
// MockRepository_RemoveRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRule'
type MockRepository_RemoveRule_Call struct {
// Repository_RemoveRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRule'
type Repository_RemoveRule_Call struct {
*mock.Call
}
// RemoveRule is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockRepository_Expecter) RemoveRule(ctx interface{}, id interface{}) *MockRepository_RemoveRule_Call {
return &MockRepository_RemoveRule_Call{Call: _e.mock.On("RemoveRule", ctx, id)}
func (_e *Repository_Expecter) RemoveRule(ctx interface{}, id interface{}) *Repository_RemoveRule_Call {
return &Repository_RemoveRule_Call{Call: _e.mock.On("RemoveRule", ctx, id)}
}
func (_c *MockRepository_RemoveRule_Call) Run(run func(ctx context.Context, id string)) *MockRepository_RemoveRule_Call {
func (_c *Repository_RemoveRule_Call) Run(run func(ctx context.Context, id string)) *Repository_RemoveRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockRepository_RemoveRule_Call) Return(err error) *MockRepository_RemoveRule_Call {
func (_c *Repository_RemoveRule_Call) Return(err error) *Repository_RemoveRule_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockRepository_RemoveRule_Call) RunAndReturn(run func(ctx context.Context, id string) error) *MockRepository_RemoveRule_Call {
func (_c *Repository_RemoveRule_Call) RunAndReturn(run func(ctx context.Context, id string) error) *Repository_RemoveRule_Call {
_c.Call.Return(run)
return _c
}
// UpdateRule provides a mock function for the type MockRepository
func (_mock *MockRepository) UpdateRule(ctx context.Context, r re.Rule) (re.Rule, error) {
// UpdateRule provides a mock function for the type Repository
func (_mock *Repository) UpdateRule(ctx context.Context, r re.Rule) (re.Rule, error) {
ret := _mock.Called(ctx, r)
if len(ret) == 0 {
@@ -220,37 +223,37 @@ func (_mock *MockRepository) UpdateRule(ctx context.Context, r re.Rule) (re.Rule
return r0, r1
}
// MockRepository_UpdateRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRule'
type MockRepository_UpdateRule_Call struct {
// Repository_UpdateRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRule'
type Repository_UpdateRule_Call struct {
*mock.Call
}
// UpdateRule is a helper method to define mock.On call
// - ctx
// - r
func (_e *MockRepository_Expecter) UpdateRule(ctx interface{}, r interface{}) *MockRepository_UpdateRule_Call {
return &MockRepository_UpdateRule_Call{Call: _e.mock.On("UpdateRule", ctx, r)}
func (_e *Repository_Expecter) UpdateRule(ctx interface{}, r interface{}) *Repository_UpdateRule_Call {
return &Repository_UpdateRule_Call{Call: _e.mock.On("UpdateRule", ctx, r)}
}
func (_c *MockRepository_UpdateRule_Call) Run(run func(ctx context.Context, r re.Rule)) *MockRepository_UpdateRule_Call {
func (_c *Repository_UpdateRule_Call) Run(run func(ctx context.Context, r re.Rule)) *Repository_UpdateRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(re.Rule))
})
return _c
}
func (_c *MockRepository_UpdateRule_Call) Return(rule re.Rule, err error) *MockRepository_UpdateRule_Call {
func (_c *Repository_UpdateRule_Call) Return(rule re.Rule, err error) *Repository_UpdateRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockRepository_UpdateRule_Call) RunAndReturn(run func(ctx context.Context, r re.Rule) (re.Rule, error)) *MockRepository_UpdateRule_Call {
func (_c *Repository_UpdateRule_Call) RunAndReturn(run func(ctx context.Context, r re.Rule) (re.Rule, error)) *Repository_UpdateRule_Call {
_c.Call.Return(run)
return _c
}
// UpdateRuleStatus provides a mock function for the type MockRepository
func (_mock *MockRepository) UpdateRuleStatus(ctx context.Context, id string, status re.Status) (re.Rule, error) {
// UpdateRuleStatus provides a mock function for the type Repository
func (_mock *Repository) UpdateRuleStatus(ctx context.Context, id string, status re.Status) (re.Rule, error) {
ret := _mock.Called(ctx, id, status)
if len(ret) == 0 {
@@ -275,8 +278,8 @@ func (_mock *MockRepository) UpdateRuleStatus(ctx context.Context, id string, st
return r0, r1
}
// MockRepository_UpdateRuleStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRuleStatus'
type MockRepository_UpdateRuleStatus_Call struct {
// Repository_UpdateRuleStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRuleStatus'
type Repository_UpdateRuleStatus_Call struct {
*mock.Call
}
@@ -284,29 +287,29 @@ type MockRepository_UpdateRuleStatus_Call struct {
// - ctx
// - id
// - status
func (_e *MockRepository_Expecter) UpdateRuleStatus(ctx interface{}, id interface{}, status interface{}) *MockRepository_UpdateRuleStatus_Call {
return &MockRepository_UpdateRuleStatus_Call{Call: _e.mock.On("UpdateRuleStatus", ctx, id, status)}
func (_e *Repository_Expecter) UpdateRuleStatus(ctx interface{}, id interface{}, status interface{}) *Repository_UpdateRuleStatus_Call {
return &Repository_UpdateRuleStatus_Call{Call: _e.mock.On("UpdateRuleStatus", ctx, id, status)}
}
func (_c *MockRepository_UpdateRuleStatus_Call) Run(run func(ctx context.Context, id string, status re.Status)) *MockRepository_UpdateRuleStatus_Call {
func (_c *Repository_UpdateRuleStatus_Call) Run(run func(ctx context.Context, id string, status re.Status)) *Repository_UpdateRuleStatus_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string), args[2].(re.Status))
})
return _c
}
func (_c *MockRepository_UpdateRuleStatus_Call) Return(rule re.Rule, err error) *MockRepository_UpdateRuleStatus_Call {
func (_c *Repository_UpdateRuleStatus_Call) Return(rule re.Rule, err error) *Repository_UpdateRuleStatus_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockRepository_UpdateRuleStatus_Call) RunAndReturn(run func(ctx context.Context, id string, status re.Status) (re.Rule, error)) *MockRepository_UpdateRuleStatus_Call {
func (_c *Repository_UpdateRuleStatus_Call) RunAndReturn(run func(ctx context.Context, id string, status re.Status) (re.Rule, error)) *Repository_UpdateRuleStatus_Call {
_c.Call.Return(run)
return _c
}
// ViewRule provides a mock function for the type MockRepository
func (_mock *MockRepository) ViewRule(ctx context.Context, id string) (re.Rule, error) {
// ViewRule provides a mock function for the type Repository
func (_mock *Repository) ViewRule(ctx context.Context, id string) (re.Rule, error) {
ret := _mock.Called(ctx, id)
if len(ret) == 0 {
@@ -331,31 +334,31 @@ func (_mock *MockRepository) ViewRule(ctx context.Context, id string) (re.Rule,
return r0, r1
}
// MockRepository_ViewRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ViewRule'
type MockRepository_ViewRule_Call struct {
// Repository_ViewRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ViewRule'
type Repository_ViewRule_Call struct {
*mock.Call
}
// ViewRule is a helper method to define mock.On call
// - ctx
// - id
func (_e *MockRepository_Expecter) ViewRule(ctx interface{}, id interface{}) *MockRepository_ViewRule_Call {
return &MockRepository_ViewRule_Call{Call: _e.mock.On("ViewRule", ctx, id)}
func (_e *Repository_Expecter) ViewRule(ctx interface{}, id interface{}) *Repository_ViewRule_Call {
return &Repository_ViewRule_Call{Call: _e.mock.On("ViewRule", ctx, id)}
}
func (_c *MockRepository_ViewRule_Call) Run(run func(ctx context.Context, id string)) *MockRepository_ViewRule_Call {
func (_c *Repository_ViewRule_Call) Run(run func(ctx context.Context, id string)) *Repository_ViewRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(string))
})
return _c
}
func (_c *MockRepository_ViewRule_Call) Return(rule re.Rule, err error) *MockRepository_ViewRule_Call {
func (_c *Repository_ViewRule_Call) Return(rule re.Rule, err error) *Repository_ViewRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockRepository_ViewRule_Call) RunAndReturn(run func(ctx context.Context, id string) (re.Rule, error)) *MockRepository_ViewRule_Call {
func (_c *Repository_ViewRule_Call) RunAndReturn(run func(ctx context.Context, id string) (re.Rule, error)) *Repository_ViewRule_Call {
_c.Call.Return(run)
return _c
}
+103 -100
View File
@@ -1,8 +1,11 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package re
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"context"
@@ -12,13 +15,13 @@ import (
mock "github.com/stretchr/testify/mock"
)
// NewMockService creates a new instance of MockService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// NewService creates a new instance of Service. 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 NewMockService(t interface {
func NewService(t interface {
mock.TestingT
Cleanup(func())
}) *MockService {
mock := &MockService{}
}) *Service {
mock := &Service{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
@@ -26,21 +29,21 @@ func NewMockService(t interface {
return mock
}
// MockService is an autogenerated mock type for the Service type
type MockService struct {
// Service is an autogenerated mock type for the Service type
type Service struct {
mock.Mock
}
type MockService_Expecter struct {
type Service_Expecter struct {
mock *mock.Mock
}
func (_m *MockService) EXPECT() *MockService_Expecter {
return &MockService_Expecter{mock: &_m.Mock}
func (_m *Service) EXPECT() *Service_Expecter {
return &Service_Expecter{mock: &_m.Mock}
}
// AddRule provides a mock function for the type MockService
func (_mock *MockService) AddRule(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error) {
// AddRule provides a mock function for the type Service
func (_mock *Service) AddRule(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error) {
ret := _mock.Called(ctx, session, r)
if len(ret) == 0 {
@@ -65,8 +68,8 @@ func (_mock *MockService) AddRule(ctx context.Context, session authn.Session, r
return r0, r1
}
// MockService_AddRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRule'
type MockService_AddRule_Call struct {
// Service_AddRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddRule'
type Service_AddRule_Call struct {
*mock.Call
}
@@ -74,64 +77,64 @@ type MockService_AddRule_Call struct {
// - ctx
// - session
// - r
func (_e *MockService_Expecter) AddRule(ctx interface{}, session interface{}, r interface{}) *MockService_AddRule_Call {
return &MockService_AddRule_Call{Call: _e.mock.On("AddRule", ctx, session, r)}
func (_e *Service_Expecter) AddRule(ctx interface{}, session interface{}, r interface{}) *Service_AddRule_Call {
return &Service_AddRule_Call{Call: _e.mock.On("AddRule", ctx, session, r)}
}
func (_c *MockService_AddRule_Call) Run(run func(ctx context.Context, session authn.Session, r re.Rule)) *MockService_AddRule_Call {
func (_c *Service_AddRule_Call) Run(run func(ctx context.Context, session authn.Session, r re.Rule)) *Service_AddRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(re.Rule))
})
return _c
}
func (_c *MockService_AddRule_Call) Return(rule re.Rule, err error) *MockService_AddRule_Call {
func (_c *Service_AddRule_Call) Return(rule re.Rule, err error) *Service_AddRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockService_AddRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error)) *MockService_AddRule_Call {
func (_c *Service_AddRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error)) *Service_AddRule_Call {
_c.Call.Return(run)
return _c
}
// ConsumeAsync provides a mock function for the type MockService
func (_mock *MockService) ConsumeAsync(ctx context.Context, messages interface{}) {
// ConsumeAsync provides a mock function for the type Service
func (_mock *Service) ConsumeAsync(ctx context.Context, messages interface{}) {
_mock.Called(ctx, messages)
return
}
// MockService_ConsumeAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConsumeAsync'
type MockService_ConsumeAsync_Call struct {
// Service_ConsumeAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ConsumeAsync'
type Service_ConsumeAsync_Call struct {
*mock.Call
}
// ConsumeAsync is a helper method to define mock.On call
// - ctx
// - messages
func (_e *MockService_Expecter) ConsumeAsync(ctx interface{}, messages interface{}) *MockService_ConsumeAsync_Call {
return &MockService_ConsumeAsync_Call{Call: _e.mock.On("ConsumeAsync", ctx, messages)}
func (_e *Service_Expecter) ConsumeAsync(ctx interface{}, messages interface{}) *Service_ConsumeAsync_Call {
return &Service_ConsumeAsync_Call{Call: _e.mock.On("ConsumeAsync", ctx, messages)}
}
func (_c *MockService_ConsumeAsync_Call) Run(run func(ctx context.Context, messages interface{})) *MockService_ConsumeAsync_Call {
func (_c *Service_ConsumeAsync_Call) Run(run func(ctx context.Context, messages interface{})) *Service_ConsumeAsync_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(interface{}))
})
return _c
}
func (_c *MockService_ConsumeAsync_Call) Return() *MockService_ConsumeAsync_Call {
func (_c *Service_ConsumeAsync_Call) Return() *Service_ConsumeAsync_Call {
_c.Call.Return()
return _c
}
func (_c *MockService_ConsumeAsync_Call) RunAndReturn(run func(ctx context.Context, messages interface{})) *MockService_ConsumeAsync_Call {
func (_c *Service_ConsumeAsync_Call) RunAndReturn(run func(ctx context.Context, messages interface{})) *Service_ConsumeAsync_Call {
_c.Run(run)
return _c
}
// DisableRule provides a mock function for the type MockService
func (_mock *MockService) DisableRule(ctx context.Context, session authn.Session, id string) (re.Rule, error) {
// DisableRule provides a mock function for the type Service
func (_mock *Service) DisableRule(ctx context.Context, session authn.Session, id string) (re.Rule, error) {
ret := _mock.Called(ctx, session, id)
if len(ret) == 0 {
@@ -156,8 +159,8 @@ func (_mock *MockService) DisableRule(ctx context.Context, session authn.Session
return r0, r1
}
// MockService_DisableRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableRule'
type MockService_DisableRule_Call struct {
// Service_DisableRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableRule'
type Service_DisableRule_Call struct {
*mock.Call
}
@@ -165,29 +168,29 @@ type MockService_DisableRule_Call struct {
// - ctx
// - session
// - id
func (_e *MockService_Expecter) DisableRule(ctx interface{}, session interface{}, id interface{}) *MockService_DisableRule_Call {
return &MockService_DisableRule_Call{Call: _e.mock.On("DisableRule", ctx, session, id)}
func (_e *Service_Expecter) DisableRule(ctx interface{}, session interface{}, id interface{}) *Service_DisableRule_Call {
return &Service_DisableRule_Call{Call: _e.mock.On("DisableRule", ctx, session, id)}
}
func (_c *MockService_DisableRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *MockService_DisableRule_Call {
func (_c *Service_DisableRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *Service_DisableRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string))
})
return _c
}
func (_c *MockService_DisableRule_Call) Return(rule re.Rule, err error) *MockService_DisableRule_Call {
func (_c *Service_DisableRule_Call) Return(rule re.Rule, err error) *Service_DisableRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockService_DisableRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (re.Rule, error)) *MockService_DisableRule_Call {
func (_c *Service_DisableRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (re.Rule, error)) *Service_DisableRule_Call {
_c.Call.Return(run)
return _c
}
// EnableRule provides a mock function for the type MockService
func (_mock *MockService) EnableRule(ctx context.Context, session authn.Session, id string) (re.Rule, error) {
// EnableRule provides a mock function for the type Service
func (_mock *Service) EnableRule(ctx context.Context, session authn.Session, id string) (re.Rule, error) {
ret := _mock.Called(ctx, session, id)
if len(ret) == 0 {
@@ -212,8 +215,8 @@ func (_mock *MockService) EnableRule(ctx context.Context, session authn.Session,
return r0, r1
}
// MockService_EnableRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableRule'
type MockService_EnableRule_Call struct {
// Service_EnableRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableRule'
type Service_EnableRule_Call struct {
*mock.Call
}
@@ -221,29 +224,29 @@ type MockService_EnableRule_Call struct {
// - ctx
// - session
// - id
func (_e *MockService_Expecter) EnableRule(ctx interface{}, session interface{}, id interface{}) *MockService_EnableRule_Call {
return &MockService_EnableRule_Call{Call: _e.mock.On("EnableRule", ctx, session, id)}
func (_e *Service_Expecter) EnableRule(ctx interface{}, session interface{}, id interface{}) *Service_EnableRule_Call {
return &Service_EnableRule_Call{Call: _e.mock.On("EnableRule", ctx, session, id)}
}
func (_c *MockService_EnableRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *MockService_EnableRule_Call {
func (_c *Service_EnableRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *Service_EnableRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string))
})
return _c
}
func (_c *MockService_EnableRule_Call) Return(rule re.Rule, err error) *MockService_EnableRule_Call {
func (_c *Service_EnableRule_Call) Return(rule re.Rule, err error) *Service_EnableRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockService_EnableRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (re.Rule, error)) *MockService_EnableRule_Call {
func (_c *Service_EnableRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (re.Rule, error)) *Service_EnableRule_Call {
_c.Call.Return(run)
return _c
}
// Errors provides a mock function for the type MockService
func (_mock *MockService) Errors() <-chan error {
// Errors provides a mock function for the type Service
func (_mock *Service) Errors() <-chan error {
ret := _mock.Called()
if len(ret) == 0 {
@@ -261,35 +264,35 @@ func (_mock *MockService) Errors() <-chan error {
return r0
}
// MockService_Errors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Errors'
type MockService_Errors_Call struct {
// Service_Errors_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Errors'
type Service_Errors_Call struct {
*mock.Call
}
// Errors is a helper method to define mock.On call
func (_e *MockService_Expecter) Errors() *MockService_Errors_Call {
return &MockService_Errors_Call{Call: _e.mock.On("Errors")}
func (_e *Service_Expecter) Errors() *Service_Errors_Call {
return &Service_Errors_Call{Call: _e.mock.On("Errors")}
}
func (_c *MockService_Errors_Call) Run(run func()) *MockService_Errors_Call {
func (_c *Service_Errors_Call) Run(run func()) *Service_Errors_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockService_Errors_Call) Return(errCh <-chan error) *MockService_Errors_Call {
func (_c *Service_Errors_Call) Return(errCh <-chan error) *Service_Errors_Call {
_c.Call.Return(errCh)
return _c
}
func (_c *MockService_Errors_Call) RunAndReturn(run func() <-chan error) *MockService_Errors_Call {
func (_c *Service_Errors_Call) RunAndReturn(run func() <-chan error) *Service_Errors_Call {
_c.Call.Return(run)
return _c
}
// ListRules provides a mock function for the type MockService
func (_mock *MockService) ListRules(ctx context.Context, session authn.Session, pm re.PageMeta) (re.Page, error) {
// ListRules provides a mock function for the type Service
func (_mock *Service) ListRules(ctx context.Context, session authn.Session, pm re.PageMeta) (re.Page, error) {
ret := _mock.Called(ctx, session, pm)
if len(ret) == 0 {
@@ -314,8 +317,8 @@ func (_mock *MockService) ListRules(ctx context.Context, session authn.Session,
return r0, r1
}
// MockService_ListRules_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRules'
type MockService_ListRules_Call struct {
// Service_ListRules_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRules'
type Service_ListRules_Call struct {
*mock.Call
}
@@ -323,29 +326,29 @@ type MockService_ListRules_Call struct {
// - ctx
// - session
// - pm
func (_e *MockService_Expecter) ListRules(ctx interface{}, session interface{}, pm interface{}) *MockService_ListRules_Call {
return &MockService_ListRules_Call{Call: _e.mock.On("ListRules", ctx, session, pm)}
func (_e *Service_Expecter) ListRules(ctx interface{}, session interface{}, pm interface{}) *Service_ListRules_Call {
return &Service_ListRules_Call{Call: _e.mock.On("ListRules", ctx, session, pm)}
}
func (_c *MockService_ListRules_Call) Run(run func(ctx context.Context, session authn.Session, pm re.PageMeta)) *MockService_ListRules_Call {
func (_c *Service_ListRules_Call) Run(run func(ctx context.Context, session authn.Session, pm re.PageMeta)) *Service_ListRules_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(re.PageMeta))
})
return _c
}
func (_c *MockService_ListRules_Call) Return(page re.Page, err error) *MockService_ListRules_Call {
func (_c *Service_ListRules_Call) Return(page re.Page, err error) *Service_ListRules_Call {
_c.Call.Return(page, err)
return _c
}
func (_c *MockService_ListRules_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, pm re.PageMeta) (re.Page, error)) *MockService_ListRules_Call {
func (_c *Service_ListRules_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, pm re.PageMeta) (re.Page, error)) *Service_ListRules_Call {
_c.Call.Return(run)
return _c
}
// RemoveRule provides a mock function for the type MockService
func (_mock *MockService) RemoveRule(ctx context.Context, session authn.Session, id string) error {
// RemoveRule provides a mock function for the type Service
func (_mock *Service) RemoveRule(ctx context.Context, session authn.Session, id string) error {
ret := _mock.Called(ctx, session, id)
if len(ret) == 0 {
@@ -361,8 +364,8 @@ func (_mock *MockService) RemoveRule(ctx context.Context, session authn.Session,
return r0
}
// MockService_RemoveRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRule'
type MockService_RemoveRule_Call struct {
// Service_RemoveRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRule'
type Service_RemoveRule_Call struct {
*mock.Call
}
@@ -370,29 +373,29 @@ type MockService_RemoveRule_Call struct {
// - ctx
// - session
// - id
func (_e *MockService_Expecter) RemoveRule(ctx interface{}, session interface{}, id interface{}) *MockService_RemoveRule_Call {
return &MockService_RemoveRule_Call{Call: _e.mock.On("RemoveRule", ctx, session, id)}
func (_e *Service_Expecter) RemoveRule(ctx interface{}, session interface{}, id interface{}) *Service_RemoveRule_Call {
return &Service_RemoveRule_Call{Call: _e.mock.On("RemoveRule", ctx, session, id)}
}
func (_c *MockService_RemoveRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *MockService_RemoveRule_Call {
func (_c *Service_RemoveRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *Service_RemoveRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string))
})
return _c
}
func (_c *MockService_RemoveRule_Call) Return(err error) *MockService_RemoveRule_Call {
func (_c *Service_RemoveRule_Call) Return(err error) *Service_RemoveRule_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_RemoveRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) error) *MockService_RemoveRule_Call {
func (_c *Service_RemoveRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) error) *Service_RemoveRule_Call {
_c.Call.Return(run)
return _c
}
// StartScheduler provides a mock function for the type MockService
func (_mock *MockService) StartScheduler(ctx context.Context) error {
// StartScheduler provides a mock function for the type Service
func (_mock *Service) StartScheduler(ctx context.Context) error {
ret := _mock.Called(ctx)
if len(ret) == 0 {
@@ -408,36 +411,36 @@ func (_mock *MockService) StartScheduler(ctx context.Context) error {
return r0
}
// MockService_StartScheduler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartScheduler'
type MockService_StartScheduler_Call struct {
// Service_StartScheduler_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartScheduler'
type Service_StartScheduler_Call struct {
*mock.Call
}
// StartScheduler is a helper method to define mock.On call
// - ctx
func (_e *MockService_Expecter) StartScheduler(ctx interface{}) *MockService_StartScheduler_Call {
return &MockService_StartScheduler_Call{Call: _e.mock.On("StartScheduler", ctx)}
func (_e *Service_Expecter) StartScheduler(ctx interface{}) *Service_StartScheduler_Call {
return &Service_StartScheduler_Call{Call: _e.mock.On("StartScheduler", ctx)}
}
func (_c *MockService_StartScheduler_Call) Run(run func(ctx context.Context)) *MockService_StartScheduler_Call {
func (_c *Service_StartScheduler_Call) Run(run func(ctx context.Context)) *Service_StartScheduler_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context))
})
return _c
}
func (_c *MockService_StartScheduler_Call) Return(err error) *MockService_StartScheduler_Call {
func (_c *Service_StartScheduler_Call) Return(err error) *Service_StartScheduler_Call {
_c.Call.Return(err)
return _c
}
func (_c *MockService_StartScheduler_Call) RunAndReturn(run func(ctx context.Context) error) *MockService_StartScheduler_Call {
func (_c *Service_StartScheduler_Call) RunAndReturn(run func(ctx context.Context) error) *Service_StartScheduler_Call {
_c.Call.Return(run)
return _c
}
// UpdateRule provides a mock function for the type MockService
func (_mock *MockService) UpdateRule(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error) {
// UpdateRule provides a mock function for the type Service
func (_mock *Service) UpdateRule(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error) {
ret := _mock.Called(ctx, session, r)
if len(ret) == 0 {
@@ -462,8 +465,8 @@ func (_mock *MockService) UpdateRule(ctx context.Context, session authn.Session,
return r0, r1
}
// MockService_UpdateRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRule'
type MockService_UpdateRule_Call struct {
// Service_UpdateRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateRule'
type Service_UpdateRule_Call struct {
*mock.Call
}
@@ -471,29 +474,29 @@ type MockService_UpdateRule_Call struct {
// - ctx
// - session
// - r
func (_e *MockService_Expecter) UpdateRule(ctx interface{}, session interface{}, r interface{}) *MockService_UpdateRule_Call {
return &MockService_UpdateRule_Call{Call: _e.mock.On("UpdateRule", ctx, session, r)}
func (_e *Service_Expecter) UpdateRule(ctx interface{}, session interface{}, r interface{}) *Service_UpdateRule_Call {
return &Service_UpdateRule_Call{Call: _e.mock.On("UpdateRule", ctx, session, r)}
}
func (_c *MockService_UpdateRule_Call) Run(run func(ctx context.Context, session authn.Session, r re.Rule)) *MockService_UpdateRule_Call {
func (_c *Service_UpdateRule_Call) Run(run func(ctx context.Context, session authn.Session, r re.Rule)) *Service_UpdateRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(re.Rule))
})
return _c
}
func (_c *MockService_UpdateRule_Call) Return(rule re.Rule, err error) *MockService_UpdateRule_Call {
func (_c *Service_UpdateRule_Call) Return(rule re.Rule, err error) *Service_UpdateRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockService_UpdateRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error)) *MockService_UpdateRule_Call {
func (_c *Service_UpdateRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, r re.Rule) (re.Rule, error)) *Service_UpdateRule_Call {
_c.Call.Return(run)
return _c
}
// ViewRule provides a mock function for the type MockService
func (_mock *MockService) ViewRule(ctx context.Context, session authn.Session, id string) (re.Rule, error) {
// ViewRule provides a mock function for the type Service
func (_mock *Service) ViewRule(ctx context.Context, session authn.Session, id string) (re.Rule, error) {
ret := _mock.Called(ctx, session, id)
if len(ret) == 0 {
@@ -518,8 +521,8 @@ func (_mock *MockService) ViewRule(ctx context.Context, session authn.Session, i
return r0, r1
}
// MockService_ViewRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ViewRule'
type MockService_ViewRule_Call struct {
// Service_ViewRule_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ViewRule'
type Service_ViewRule_Call struct {
*mock.Call
}
@@ -527,23 +530,23 @@ type MockService_ViewRule_Call struct {
// - ctx
// - session
// - id
func (_e *MockService_Expecter) ViewRule(ctx interface{}, session interface{}, id interface{}) *MockService_ViewRule_Call {
return &MockService_ViewRule_Call{Call: _e.mock.On("ViewRule", ctx, session, id)}
func (_e *Service_Expecter) ViewRule(ctx interface{}, session interface{}, id interface{}) *Service_ViewRule_Call {
return &Service_ViewRule_Call{Call: _e.mock.On("ViewRule", ctx, session, id)}
}
func (_c *MockService_ViewRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *MockService_ViewRule_Call {
func (_c *Service_ViewRule_Call) Run(run func(ctx context.Context, session authn.Session, id string)) *Service_ViewRule_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(authn.Session), args[2].(string))
})
return _c
}
func (_c *MockService_ViewRule_Call) Return(rule re.Rule, err error) *MockService_ViewRule_Call {
func (_c *Service_ViewRule_Call) Return(rule re.Rule, err error) *Service_ViewRule_Call {
_c.Call.Return(rule, err)
return _c
}
func (_c *MockService_ViewRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (re.Rule, error)) *MockService_ViewRule_Call {
func (_c *Service_ViewRule_Call) RunAndReturn(run func(ctx context.Context, session authn.Session, id string) (re.Rule, error)) *Service_ViewRule_Call {
_c.Call.Return(run)
return _c
}
+31 -28
View File
@@ -1,8 +1,11 @@
// Code generated by mockery; DO NOT EDIT.
// github.com/vektra/mockery
// template: testify
// Copyright (c) Abstract Machines
package re
// SPDX-License-Identifier: Apache-2.0
package mocks
import (
"time"
@@ -10,13 +13,13 @@ import (
mock "github.com/stretchr/testify/mock"
)
// NewMockTicker creates a new instance of MockTicker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// NewTicker creates a new instance of Ticker. 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 NewMockTicker(t interface {
func NewTicker(t interface {
mock.TestingT
Cleanup(func())
}) *MockTicker {
mock := &MockTicker{}
}) *Ticker {
mock := &Ticker{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
@@ -24,54 +27,54 @@ func NewMockTicker(t interface {
return mock
}
// MockTicker is an autogenerated mock type for the Ticker type
type MockTicker struct {
// Ticker is an autogenerated mock type for the Ticker type
type Ticker struct {
mock.Mock
}
type MockTicker_Expecter struct {
type Ticker_Expecter struct {
mock *mock.Mock
}
func (_m *MockTicker) EXPECT() *MockTicker_Expecter {
return &MockTicker_Expecter{mock: &_m.Mock}
func (_m *Ticker) EXPECT() *Ticker_Expecter {
return &Ticker_Expecter{mock: &_m.Mock}
}
// Stop provides a mock function for the type MockTicker
func (_mock *MockTicker) Stop() {
// Stop provides a mock function for the type Ticker
func (_mock *Ticker) Stop() {
_mock.Called()
return
}
// MockTicker_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
type MockTicker_Stop_Call struct {
// Ticker_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
type Ticker_Stop_Call struct {
*mock.Call
}
// Stop is a helper method to define mock.On call
func (_e *MockTicker_Expecter) Stop() *MockTicker_Stop_Call {
return &MockTicker_Stop_Call{Call: _e.mock.On("Stop")}
func (_e *Ticker_Expecter) Stop() *Ticker_Stop_Call {
return &Ticker_Stop_Call{Call: _e.mock.On("Stop")}
}
func (_c *MockTicker_Stop_Call) Run(run func()) *MockTicker_Stop_Call {
func (_c *Ticker_Stop_Call) Run(run func()) *Ticker_Stop_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockTicker_Stop_Call) Return() *MockTicker_Stop_Call {
func (_c *Ticker_Stop_Call) Return() *Ticker_Stop_Call {
_c.Call.Return()
return _c
}
func (_c *MockTicker_Stop_Call) RunAndReturn(run func()) *MockTicker_Stop_Call {
func (_c *Ticker_Stop_Call) RunAndReturn(run func()) *Ticker_Stop_Call {
_c.Run(run)
return _c
}
// Tick provides a mock function for the type MockTicker
func (_mock *MockTicker) Tick() <-chan time.Time {
// Tick provides a mock function for the type Ticker
func (_mock *Ticker) Tick() <-chan time.Time {
ret := _mock.Called()
if len(ret) == 0 {
@@ -89,29 +92,29 @@ func (_mock *MockTicker) Tick() <-chan time.Time {
return r0
}
// MockTicker_Tick_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tick'
type MockTicker_Tick_Call struct {
// Ticker_Tick_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Tick'
type Ticker_Tick_Call struct {
*mock.Call
}
// Tick is a helper method to define mock.On call
func (_e *MockTicker_Expecter) Tick() *MockTicker_Tick_Call {
return &MockTicker_Tick_Call{Call: _e.mock.On("Tick")}
func (_e *Ticker_Expecter) Tick() *Ticker_Tick_Call {
return &Ticker_Tick_Call{Call: _e.mock.On("Tick")}
}
func (_c *MockTicker_Tick_Call) Run(run func()) *MockTicker_Tick_Call {
func (_c *Ticker_Tick_Call) Run(run func()) *Ticker_Tick_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *MockTicker_Tick_Call) Return(timeCh <-chan time.Time) *MockTicker_Tick_Call {
func (_c *Ticker_Tick_Call) Return(timeCh <-chan time.Time) *Ticker_Tick_Call {
_c.Call.Return(timeCh)
return _c
}
func (_c *MockTicker_Tick_Call) RunAndReturn(run func() <-chan time.Time) *MockTicker_Tick_Call {
func (_c *Ticker_Tick_Call) RunAndReturn(run func() <-chan time.Time) *Ticker_Tick_Call {
_c.Call.Return(run)
return _c
}
+4 -4
View File
@@ -12,7 +12,7 @@ import (
"github.com/0x6flab/namegenerator"
"github.com/absmach/magistrala/internal/testsutil"
"github.com/absmach/magistrala/re"
mocks "github.com/absmach/magistrala/re/mocks"
"github.com/absmach/magistrala/re/mocks"
"github.com/absmach/supermq/pkg/authn"
"github.com/absmach/supermq/pkg/errors"
repoerr "github.com/absmach/supermq/pkg/errors/repository"
@@ -57,9 +57,9 @@ var (
}
)
func newService(t *testing.T) (re.Service, *mocks.MockRepository, *pubsubmocks.PubSub, *mocks.MockTicker) {
repo := new(mocks.MockRepository)
mockTicker := new(mocks.MockTicker)
func newService(t *testing.T) (re.Service, *mocks.Repository, *pubsubmocks.PubSub, *mocks.Ticker) {
repo := new(mocks.Repository)
mockTicker := new(mocks.Ticker)
idProvider := uuid.NewMock()
pubsub := pubsubmocks.NewPubSub(t)
return re.NewService(repo, idProvider, pubsub, mockTicker), repo, pubsub, mockTicker
+8 -33
View File
@@ -1,59 +1,34 @@
# Copyright (c) Abstract Machines
# SPDX-License-Identifier: Apache-2.0
with-expecter: true
filename: "{{.InterfaceName}}.go"
outpkg: "mocks"
boilerplate-file: "./tools/config/boilerplate.txt"
pkgname: mocks
template: testify
mockname: "{{.InterfaceName}}"
filename: "{{snakecase .InterfaceName}}.go"
dir: "{{.InterfaceDirRelative}}/mocks"
template-data:
boilerplate-file: ./tools/config/boilerplate.txt
with-expecter: true
packages:
github.com/absmach/magistrala/pkg/sdk:
interfaces:
SDK:
config:
dir: "./pkg/sdk/mocks"
mockname: "SDK"
filename: "sdk.go"
github.com/absmach/magistrala/re:
interfaces:
Repository:
config:
dir: "./re/mocks"
filename: "repository.go"
Service:
config:
dir: "./re/mocks"
filename: "service.go"
Ticker:
config:
dir: "./re/mocks"
filename: "ticker.go"
github.com/absmach/magistrala/bootstrap:
interfaces:
ConfigRepository:
config:
dir: "./bootstrap/mocks"
filename: "repository.go"
ConfigReader:
config:
dir: "./bootstrap/mocks"
filename: "reader.go"
Service:
config:
dir: "./bootstrap/mocks"
filename: "service.go"
github.com/absmach/magistrala/consumers/notifiers:
interfaces:
Service:
config:
dir: "./consumers/notifiers/mocks"
filename: "service.go"
SubscriptionsRepository:
config:
dir: "./consumers/notifiers/mocks"
filename: "repository.go"
github.com/absmach/magistrala/provision:
interfaces:
Service:
config:
dir: "./provision/mocks"
filename: "service.go"