From 07860ef8e777e9a1096f5e3c8bb581cfec5f0993 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Thu, 1 Feb 2024 21:09:01 +0100 Subject: [PATCH] Fix some fallout of recent mockery changes (#8341) * Fix mockery setup for graph service Add missing interfaces to .mockery.yaml. Use existing mocks from protogen where possible. Remove remaining //go:generate call. * Add mockery config for settings service * Add mockery config for proxy service --- services/graph/.mockery.yaml | 10 +- services/graph/mocks/ldapclient.go | 1322 ----------------- services/graph/mocks/value_service.go | 336 ----- .../pkg/identity/ldap_education_class_test.go | 2 +- .../identity/ldap_education_school_test.go | 2 +- .../pkg/identity/ldap_education_user_test.go | 2 +- .../graph/pkg/identity/ldap_group_test.go | 2 +- services/graph/pkg/identity/ldap_test.go | 2 +- services/graph/pkg/service/v0/graph.go | 2 - .../graph/pkg/service/v0/password_test.go | 7 +- services/graph/pkg/service/v0/users_test.go | 5 +- services/proxy/.mockery.yaml | 15 + services/proxy/Makefile | 3 +- .../pkg/user/backend/mocks/UserBackend.go | 113 -- .../pkg/user/backend/mocks/user_backend.go | 230 +++ .../pkg/userroles/mocks/UserRoleAssigner.go | 77 - .../pkg/userroles/mocks/user_role_assigner.go | 157 ++ services/settings/.mockery.yaml | 10 + services/settings/Makefile | 3 +- .../settings/pkg/settings/mocks/Manager.go | 379 ----- .../settings/pkg/settings/mocks/manager.go | 949 ++++++++++++ 21 files changed, 1386 insertions(+), 2242 deletions(-) delete mode 100644 services/graph/mocks/ldapclient.go delete mode 100644 services/graph/mocks/value_service.go create mode 100644 services/proxy/.mockery.yaml delete mode 100644 services/proxy/pkg/user/backend/mocks/UserBackend.go create mode 100644 services/proxy/pkg/user/backend/mocks/user_backend.go delete mode 100644 services/proxy/pkg/userroles/mocks/UserRoleAssigner.go create mode 100644 services/proxy/pkg/userroles/mocks/user_role_assigner.go create mode 100644 services/settings/.mockery.yaml delete mode 100644 services/settings/pkg/settings/mocks/Manager.go create mode 100644 services/settings/pkg/settings/mocks/manager.go diff --git a/services/graph/.mockery.yaml b/services/graph/.mockery.yaml index ccf44b596..9ccccd542 100644 --- a/services/graph/.mockery.yaml +++ b/services/graph/.mockery.yaml @@ -3,6 +3,14 @@ filename: "{{.InterfaceName | snakecase }}.go" mockname: "{{.InterfaceName}}" outpkg: "mocks" packages: + github.com/owncloud/ocis/v2/services/graph/pkg/service/v0: + config: + dir: "mocks" + interfaces: + HTTPClient: + Permissions: + Publisher: + RoleService: github.com/owncloud/ocis/v2/services/graph/pkg/identity: config: dir: "pkg/identity/mocks" @@ -15,4 +23,4 @@ packages: interfaces: Client: config: - filename: "ldapclient.go" \ No newline at end of file + filename: "ldapclient.go" diff --git a/services/graph/mocks/ldapclient.go b/services/graph/mocks/ldapclient.go deleted file mode 100644 index f9f1e15b6..000000000 --- a/services/graph/mocks/ldapclient.go +++ /dev/null @@ -1,1322 +0,0 @@ -// Code generated by mockery v2.40.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - ldap "github.com/go-ldap/ldap/v3" - mock "github.com/stretchr/testify/mock" - - time "time" - - tls "crypto/tls" -) - -// Client is an autogenerated mock type for the Client type -type Client struct { - mock.Mock -} - -type Client_Expecter struct { - mock *mock.Mock -} - -func (_m *Client) EXPECT() *Client_Expecter { - return &Client_Expecter{mock: &_m.Mock} -} - -// Add provides a mock function with given fields: _a0 -func (_m *Client) Add(_a0 *ldap.AddRequest) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for Add") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*ldap.AddRequest) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add' -type Client_Add_Call struct { - *mock.Call -} - -// Add is a helper method to define mock.On call -// - _a0 *ldap.AddRequest -func (_e *Client_Expecter) Add(_a0 interface{}) *Client_Add_Call { - return &Client_Add_Call{Call: _e.mock.On("Add", _a0)} -} - -func (_c *Client_Add_Call) Run(run func(_a0 *ldap.AddRequest)) *Client_Add_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.AddRequest)) - }) - return _c -} - -func (_c *Client_Add_Call) Return(_a0 error) *Client_Add_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Add_Call) RunAndReturn(run func(*ldap.AddRequest) error) *Client_Add_Call { - _c.Call.Return(run) - return _c -} - -// Bind provides a mock function with given fields: username, password -func (_m *Client) Bind(username string, password string) error { - ret := _m.Called(username, password) - - if len(ret) == 0 { - panic("no return value specified for Bind") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(username, password) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_Bind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Bind' -type Client_Bind_Call struct { - *mock.Call -} - -// Bind is a helper method to define mock.On call -// - username string -// - password string -func (_e *Client_Expecter) Bind(username interface{}, password interface{}) *Client_Bind_Call { - return &Client_Bind_Call{Call: _e.mock.On("Bind", username, password)} -} - -func (_c *Client_Bind_Call) Run(run func(username string, password string)) *Client_Bind_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string)) - }) - return _c -} - -func (_c *Client_Bind_Call) Return(_a0 error) *Client_Bind_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Bind_Call) RunAndReturn(run func(string, string) error) *Client_Bind_Call { - _c.Call.Return(run) - return _c -} - -// Close provides a mock function with given fields: -func (_m *Client) Close() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Close") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' -type Client_Close_Call struct { - *mock.Call -} - -// Close is a helper method to define mock.On call -func (_e *Client_Expecter) Close() *Client_Close_Call { - return &Client_Close_Call{Call: _e.mock.On("Close")} -} - -func (_c *Client_Close_Call) Run(run func()) *Client_Close_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_Close_Call) Return(_a0 error) *Client_Close_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Close_Call) RunAndReturn(run func() error) *Client_Close_Call { - _c.Call.Return(run) - return _c -} - -// Compare provides a mock function with given fields: dn, attribute, value -func (_m *Client) Compare(dn string, attribute string, value string) (bool, error) { - ret := _m.Called(dn, attribute, value) - - if len(ret) == 0 { - panic("no return value specified for Compare") - } - - var r0 bool - var r1 error - if rf, ok := ret.Get(0).(func(string, string, string) (bool, error)); ok { - return rf(dn, attribute, value) - } - if rf, ok := ret.Get(0).(func(string, string, string) bool); ok { - r0 = rf(dn, attribute, value) - } else { - r0 = ret.Get(0).(bool) - } - - if rf, ok := ret.Get(1).(func(string, string, string) error); ok { - r1 = rf(dn, attribute, value) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_Compare_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Compare' -type Client_Compare_Call struct { - *mock.Call -} - -// Compare is a helper method to define mock.On call -// - dn string -// - attribute string -// - value string -func (_e *Client_Expecter) Compare(dn interface{}, attribute interface{}, value interface{}) *Client_Compare_Call { - return &Client_Compare_Call{Call: _e.mock.On("Compare", dn, attribute, value)} -} - -func (_c *Client_Compare_Call) Run(run func(dn string, attribute string, value string)) *Client_Compare_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string), args[2].(string)) - }) - return _c -} - -func (_c *Client_Compare_Call) Return(_a0 bool, _a1 error) *Client_Compare_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_Compare_Call) RunAndReturn(run func(string, string, string) (bool, error)) *Client_Compare_Call { - _c.Call.Return(run) - return _c -} - -// Del provides a mock function with given fields: _a0 -func (_m *Client) Del(_a0 *ldap.DelRequest) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for Del") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*ldap.DelRequest) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_Del_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Del' -type Client_Del_Call struct { - *mock.Call -} - -// Del is a helper method to define mock.On call -// - _a0 *ldap.DelRequest -func (_e *Client_Expecter) Del(_a0 interface{}) *Client_Del_Call { - return &Client_Del_Call{Call: _e.mock.On("Del", _a0)} -} - -func (_c *Client_Del_Call) Run(run func(_a0 *ldap.DelRequest)) *Client_Del_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.DelRequest)) - }) - return _c -} - -func (_c *Client_Del_Call) Return(_a0 error) *Client_Del_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Del_Call) RunAndReturn(run func(*ldap.DelRequest) error) *Client_Del_Call { - _c.Call.Return(run) - return _c -} - -// DirSync provides a mock function with given fields: searchRequest, flags, maxAttrCount, cookie -func (_m *Client) DirSync(searchRequest *ldap.SearchRequest, flags int64, maxAttrCount int64, cookie []byte) (*ldap.SearchResult, error) { - ret := _m.Called(searchRequest, flags, maxAttrCount, cookie) - - if len(ret) == 0 { - panic("no return value specified for DirSync") - } - - var r0 *ldap.SearchResult - var r1 error - if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)); ok { - return rf(searchRequest, flags, maxAttrCount, cookie) - } - if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, int64, int64, []byte) *ldap.SearchResult); ok { - r0 = rf(searchRequest, flags, maxAttrCount, cookie) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ldap.SearchResult) - } - } - - if rf, ok := ret.Get(1).(func(*ldap.SearchRequest, int64, int64, []byte) error); ok { - r1 = rf(searchRequest, flags, maxAttrCount, cookie) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_DirSync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DirSync' -type Client_DirSync_Call struct { - *mock.Call -} - -// DirSync is a helper method to define mock.On call -// - searchRequest *ldap.SearchRequest -// - flags int64 -// - maxAttrCount int64 -// - cookie []byte -func (_e *Client_Expecter) DirSync(searchRequest interface{}, flags interface{}, maxAttrCount interface{}, cookie interface{}) *Client_DirSync_Call { - return &Client_DirSync_Call{Call: _e.mock.On("DirSync", searchRequest, flags, maxAttrCount, cookie)} -} - -func (_c *Client_DirSync_Call) Run(run func(searchRequest *ldap.SearchRequest, flags int64, maxAttrCount int64, cookie []byte)) *Client_DirSync_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.SearchRequest), args[1].(int64), args[2].(int64), args[3].([]byte)) - }) - return _c -} - -func (_c *Client_DirSync_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_DirSync_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_DirSync_Call) RunAndReturn(run func(*ldap.SearchRequest, int64, int64, []byte) (*ldap.SearchResult, error)) *Client_DirSync_Call { - _c.Call.Return(run) - return _c -} - -// DirSyncAsync provides a mock function with given fields: ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie -func (_m *Client) DirSyncAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte) ldap.Response { - ret := _m.Called(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie) - - if len(ret) == 0 { - panic("no return value specified for DirSyncAsync") - } - - var r0 ldap.Response - if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response); ok { - r0 = rf(ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(ldap.Response) - } - } - - return r0 -} - -// Client_DirSyncAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DirSyncAsync' -type Client_DirSyncAsync_Call struct { - *mock.Call -} - -// DirSyncAsync is a helper method to define mock.On call -// - ctx context.Context -// - searchRequest *ldap.SearchRequest -// - bufferSize int -// - flags int64 -// - maxAttrCount int64 -// - cookie []byte -func (_e *Client_Expecter) DirSyncAsync(ctx interface{}, searchRequest interface{}, bufferSize interface{}, flags interface{}, maxAttrCount interface{}, cookie interface{}) *Client_DirSyncAsync_Call { - return &Client_DirSyncAsync_Call{Call: _e.mock.On("DirSyncAsync", ctx, searchRequest, bufferSize, flags, maxAttrCount, cookie)} -} - -func (_c *Client_DirSyncAsync_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, flags int64, maxAttrCount int64, cookie []byte)) *Client_DirSyncAsync_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int), args[3].(int64), args[4].(int64), args[5].([]byte)) - }) - return _c -} - -func (_c *Client_DirSyncAsync_Call) Return(_a0 ldap.Response) *Client_DirSyncAsync_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_DirSyncAsync_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int, int64, int64, []byte) ldap.Response) *Client_DirSyncAsync_Call { - _c.Call.Return(run) - return _c -} - -// ExternalBind provides a mock function with given fields: -func (_m *Client) ExternalBind() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for ExternalBind") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_ExternalBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExternalBind' -type Client_ExternalBind_Call struct { - *mock.Call -} - -// ExternalBind is a helper method to define mock.On call -func (_e *Client_Expecter) ExternalBind() *Client_ExternalBind_Call { - return &Client_ExternalBind_Call{Call: _e.mock.On("ExternalBind")} -} - -func (_c *Client_ExternalBind_Call) Run(run func()) *Client_ExternalBind_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_ExternalBind_Call) Return(_a0 error) *Client_ExternalBind_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_ExternalBind_Call) RunAndReturn(run func() error) *Client_ExternalBind_Call { - _c.Call.Return(run) - return _c -} - -// GetLastError provides a mock function with given fields: -func (_m *Client) GetLastError() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for GetLastError") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_GetLastError_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastError' -type Client_GetLastError_Call struct { - *mock.Call -} - -// GetLastError is a helper method to define mock.On call -func (_e *Client_Expecter) GetLastError() *Client_GetLastError_Call { - return &Client_GetLastError_Call{Call: _e.mock.On("GetLastError")} -} - -func (_c *Client_GetLastError_Call) Run(run func()) *Client_GetLastError_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_GetLastError_Call) Return(_a0 error) *Client_GetLastError_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_GetLastError_Call) RunAndReturn(run func() error) *Client_GetLastError_Call { - _c.Call.Return(run) - return _c -} - -// IsClosing provides a mock function with given fields: -func (_m *Client) IsClosing() bool { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for IsClosing") - } - - var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// Client_IsClosing_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsClosing' -type Client_IsClosing_Call struct { - *mock.Call -} - -// IsClosing is a helper method to define mock.On call -func (_e *Client_Expecter) IsClosing() *Client_IsClosing_Call { - return &Client_IsClosing_Call{Call: _e.mock.On("IsClosing")} -} - -func (_c *Client_IsClosing_Call) Run(run func()) *Client_IsClosing_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_IsClosing_Call) Return(_a0 bool) *Client_IsClosing_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_IsClosing_Call) RunAndReturn(run func() bool) *Client_IsClosing_Call { - _c.Call.Return(run) - return _c -} - -// Modify provides a mock function with given fields: _a0 -func (_m *Client) Modify(_a0 *ldap.ModifyRequest) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for Modify") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_Modify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Modify' -type Client_Modify_Call struct { - *mock.Call -} - -// Modify is a helper method to define mock.On call -// - _a0 *ldap.ModifyRequest -func (_e *Client_Expecter) Modify(_a0 interface{}) *Client_Modify_Call { - return &Client_Modify_Call{Call: _e.mock.On("Modify", _a0)} -} - -func (_c *Client_Modify_Call) Run(run func(_a0 *ldap.ModifyRequest)) *Client_Modify_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.ModifyRequest)) - }) - return _c -} - -func (_c *Client_Modify_Call) Return(_a0 error) *Client_Modify_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Modify_Call) RunAndReturn(run func(*ldap.ModifyRequest) error) *Client_Modify_Call { - _c.Call.Return(run) - return _c -} - -// ModifyDN provides a mock function with given fields: _a0 -func (_m *Client) ModifyDN(_a0 *ldap.ModifyDNRequest) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for ModifyDN") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*ldap.ModifyDNRequest) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_ModifyDN_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyDN' -type Client_ModifyDN_Call struct { - *mock.Call -} - -// ModifyDN is a helper method to define mock.On call -// - _a0 *ldap.ModifyDNRequest -func (_e *Client_Expecter) ModifyDN(_a0 interface{}) *Client_ModifyDN_Call { - return &Client_ModifyDN_Call{Call: _e.mock.On("ModifyDN", _a0)} -} - -func (_c *Client_ModifyDN_Call) Run(run func(_a0 *ldap.ModifyDNRequest)) *Client_ModifyDN_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.ModifyDNRequest)) - }) - return _c -} - -func (_c *Client_ModifyDN_Call) Return(_a0 error) *Client_ModifyDN_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_ModifyDN_Call) RunAndReturn(run func(*ldap.ModifyDNRequest) error) *Client_ModifyDN_Call { - _c.Call.Return(run) - return _c -} - -// ModifyWithResult provides a mock function with given fields: _a0 -func (_m *Client) ModifyWithResult(_a0 *ldap.ModifyRequest) (*ldap.ModifyResult, error) { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for ModifyWithResult") - } - - var r0 *ldap.ModifyResult - var r1 error - if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)); ok { - return rf(_a0) - } - if rf, ok := ret.Get(0).(func(*ldap.ModifyRequest) *ldap.ModifyResult); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ldap.ModifyResult) - } - } - - if rf, ok := ret.Get(1).(func(*ldap.ModifyRequest) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_ModifyWithResult_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ModifyWithResult' -type Client_ModifyWithResult_Call struct { - *mock.Call -} - -// ModifyWithResult is a helper method to define mock.On call -// - _a0 *ldap.ModifyRequest -func (_e *Client_Expecter) ModifyWithResult(_a0 interface{}) *Client_ModifyWithResult_Call { - return &Client_ModifyWithResult_Call{Call: _e.mock.On("ModifyWithResult", _a0)} -} - -func (_c *Client_ModifyWithResult_Call) Run(run func(_a0 *ldap.ModifyRequest)) *Client_ModifyWithResult_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.ModifyRequest)) - }) - return _c -} - -func (_c *Client_ModifyWithResult_Call) Return(_a0 *ldap.ModifyResult, _a1 error) *Client_ModifyWithResult_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_ModifyWithResult_Call) RunAndReturn(run func(*ldap.ModifyRequest) (*ldap.ModifyResult, error)) *Client_ModifyWithResult_Call { - _c.Call.Return(run) - return _c -} - -// NTLMUnauthenticatedBind provides a mock function with given fields: domain, username -func (_m *Client) NTLMUnauthenticatedBind(domain string, username string) error { - ret := _m.Called(domain, username) - - if len(ret) == 0 { - panic("no return value specified for NTLMUnauthenticatedBind") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(domain, username) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_NTLMUnauthenticatedBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NTLMUnauthenticatedBind' -type Client_NTLMUnauthenticatedBind_Call struct { - *mock.Call -} - -// NTLMUnauthenticatedBind is a helper method to define mock.On call -// - domain string -// - username string -func (_e *Client_Expecter) NTLMUnauthenticatedBind(domain interface{}, username interface{}) *Client_NTLMUnauthenticatedBind_Call { - return &Client_NTLMUnauthenticatedBind_Call{Call: _e.mock.On("NTLMUnauthenticatedBind", domain, username)} -} - -func (_c *Client_NTLMUnauthenticatedBind_Call) Run(run func(domain string, username string)) *Client_NTLMUnauthenticatedBind_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string)) - }) - return _c -} - -func (_c *Client_NTLMUnauthenticatedBind_Call) Return(_a0 error) *Client_NTLMUnauthenticatedBind_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_NTLMUnauthenticatedBind_Call) RunAndReturn(run func(string, string) error) *Client_NTLMUnauthenticatedBind_Call { - _c.Call.Return(run) - return _c -} - -// PasswordModify provides a mock function with given fields: _a0 -func (_m *Client) PasswordModify(_a0 *ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error) { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for PasswordModify") - } - - var r0 *ldap.PasswordModifyResult - var r1 error - if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)); ok { - return rf(_a0) - } - if rf, ok := ret.Get(0).(func(*ldap.PasswordModifyRequest) *ldap.PasswordModifyResult); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ldap.PasswordModifyResult) - } - } - - if rf, ok := ret.Get(1).(func(*ldap.PasswordModifyRequest) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_PasswordModify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PasswordModify' -type Client_PasswordModify_Call struct { - *mock.Call -} - -// PasswordModify is a helper method to define mock.On call -// - _a0 *ldap.PasswordModifyRequest -func (_e *Client_Expecter) PasswordModify(_a0 interface{}) *Client_PasswordModify_Call { - return &Client_PasswordModify_Call{Call: _e.mock.On("PasswordModify", _a0)} -} - -func (_c *Client_PasswordModify_Call) Run(run func(_a0 *ldap.PasswordModifyRequest)) *Client_PasswordModify_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.PasswordModifyRequest)) - }) - return _c -} - -func (_c *Client_PasswordModify_Call) Return(_a0 *ldap.PasswordModifyResult, _a1 error) *Client_PasswordModify_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_PasswordModify_Call) RunAndReturn(run func(*ldap.PasswordModifyRequest) (*ldap.PasswordModifyResult, error)) *Client_PasswordModify_Call { - _c.Call.Return(run) - return _c -} - -// Search provides a mock function with given fields: _a0 -func (_m *Client) Search(_a0 *ldap.SearchRequest) (*ldap.SearchResult, error) { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for Search") - } - - var r0 *ldap.SearchResult - var r1 error - if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) (*ldap.SearchResult, error)); ok { - return rf(_a0) - } - if rf, ok := ret.Get(0).(func(*ldap.SearchRequest) *ldap.SearchResult); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ldap.SearchResult) - } - } - - if rf, ok := ret.Get(1).(func(*ldap.SearchRequest) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_Search_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Search' -type Client_Search_Call struct { - *mock.Call -} - -// Search is a helper method to define mock.On call -// - _a0 *ldap.SearchRequest -func (_e *Client_Expecter) Search(_a0 interface{}) *Client_Search_Call { - return &Client_Search_Call{Call: _e.mock.On("Search", _a0)} -} - -func (_c *Client_Search_Call) Run(run func(_a0 *ldap.SearchRequest)) *Client_Search_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.SearchRequest)) - }) - return _c -} - -func (_c *Client_Search_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_Search_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_Search_Call) RunAndReturn(run func(*ldap.SearchRequest) (*ldap.SearchResult, error)) *Client_Search_Call { - _c.Call.Return(run) - return _c -} - -// SearchAsync provides a mock function with given fields: ctx, searchRequest, bufferSize -func (_m *Client) SearchAsync(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int) ldap.Response { - ret := _m.Called(ctx, searchRequest, bufferSize) - - if len(ret) == 0 { - panic("no return value specified for SearchAsync") - } - - var r0 ldap.Response - if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int) ldap.Response); ok { - r0 = rf(ctx, searchRequest, bufferSize) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(ldap.Response) - } - } - - return r0 -} - -// Client_SearchAsync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchAsync' -type Client_SearchAsync_Call struct { - *mock.Call -} - -// SearchAsync is a helper method to define mock.On call -// - ctx context.Context -// - searchRequest *ldap.SearchRequest -// - bufferSize int -func (_e *Client_Expecter) SearchAsync(ctx interface{}, searchRequest interface{}, bufferSize interface{}) *Client_SearchAsync_Call { - return &Client_SearchAsync_Call{Call: _e.mock.On("SearchAsync", ctx, searchRequest, bufferSize)} -} - -func (_c *Client_SearchAsync_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int)) *Client_SearchAsync_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int)) - }) - return _c -} - -func (_c *Client_SearchAsync_Call) Return(_a0 ldap.Response) *Client_SearchAsync_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_SearchAsync_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int) ldap.Response) *Client_SearchAsync_Call { - _c.Call.Return(run) - return _c -} - -// SearchWithPaging provides a mock function with given fields: searchRequest, pagingSize -func (_m *Client) SearchWithPaging(searchRequest *ldap.SearchRequest, pagingSize uint32) (*ldap.SearchResult, error) { - ret := _m.Called(searchRequest, pagingSize) - - if len(ret) == 0 { - panic("no return value specified for SearchWithPaging") - } - - var r0 *ldap.SearchResult - var r1 error - if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)); ok { - return rf(searchRequest, pagingSize) - } - if rf, ok := ret.Get(0).(func(*ldap.SearchRequest, uint32) *ldap.SearchResult); ok { - r0 = rf(searchRequest, pagingSize) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ldap.SearchResult) - } - } - - if rf, ok := ret.Get(1).(func(*ldap.SearchRequest, uint32) error); ok { - r1 = rf(searchRequest, pagingSize) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_SearchWithPaging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SearchWithPaging' -type Client_SearchWithPaging_Call struct { - *mock.Call -} - -// SearchWithPaging is a helper method to define mock.On call -// - searchRequest *ldap.SearchRequest -// - pagingSize uint32 -func (_e *Client_Expecter) SearchWithPaging(searchRequest interface{}, pagingSize interface{}) *Client_SearchWithPaging_Call { - return &Client_SearchWithPaging_Call{Call: _e.mock.On("SearchWithPaging", searchRequest, pagingSize)} -} - -func (_c *Client_SearchWithPaging_Call) Run(run func(searchRequest *ldap.SearchRequest, pagingSize uint32)) *Client_SearchWithPaging_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.SearchRequest), args[1].(uint32)) - }) - return _c -} - -func (_c *Client_SearchWithPaging_Call) Return(_a0 *ldap.SearchResult, _a1 error) *Client_SearchWithPaging_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_SearchWithPaging_Call) RunAndReturn(run func(*ldap.SearchRequest, uint32) (*ldap.SearchResult, error)) *Client_SearchWithPaging_Call { - _c.Call.Return(run) - return _c -} - -// SetTimeout provides a mock function with given fields: _a0 -func (_m *Client) SetTimeout(_a0 time.Duration) { - _m.Called(_a0) -} - -// Client_SetTimeout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTimeout' -type Client_SetTimeout_Call struct { - *mock.Call -} - -// SetTimeout is a helper method to define mock.On call -// - _a0 time.Duration -func (_e *Client_Expecter) SetTimeout(_a0 interface{}) *Client_SetTimeout_Call { - return &Client_SetTimeout_Call{Call: _e.mock.On("SetTimeout", _a0)} -} - -func (_c *Client_SetTimeout_Call) Run(run func(_a0 time.Duration)) *Client_SetTimeout_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(time.Duration)) - }) - return _c -} - -func (_c *Client_SetTimeout_Call) Return() *Client_SetTimeout_Call { - _c.Call.Return() - return _c -} - -func (_c *Client_SetTimeout_Call) RunAndReturn(run func(time.Duration)) *Client_SetTimeout_Call { - _c.Call.Return(run) - return _c -} - -// SimpleBind provides a mock function with given fields: _a0 -func (_m *Client) SimpleBind(_a0 *ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error) { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for SimpleBind") - } - - var r0 *ldap.SimpleBindResult - var r1 error - if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)); ok { - return rf(_a0) - } - if rf, ok := ret.Get(0).(func(*ldap.SimpleBindRequest) *ldap.SimpleBindResult); ok { - r0 = rf(_a0) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*ldap.SimpleBindResult) - } - } - - if rf, ok := ret.Get(1).(func(*ldap.SimpleBindRequest) error); ok { - r1 = rf(_a0) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Client_SimpleBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SimpleBind' -type Client_SimpleBind_Call struct { - *mock.Call -} - -// SimpleBind is a helper method to define mock.On call -// - _a0 *ldap.SimpleBindRequest -func (_e *Client_Expecter) SimpleBind(_a0 interface{}) *Client_SimpleBind_Call { - return &Client_SimpleBind_Call{Call: _e.mock.On("SimpleBind", _a0)} -} - -func (_c *Client_SimpleBind_Call) Run(run func(_a0 *ldap.SimpleBindRequest)) *Client_SimpleBind_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*ldap.SimpleBindRequest)) - }) - return _c -} - -func (_c *Client_SimpleBind_Call) Return(_a0 *ldap.SimpleBindResult, _a1 error) *Client_SimpleBind_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_SimpleBind_Call) RunAndReturn(run func(*ldap.SimpleBindRequest) (*ldap.SimpleBindResult, error)) *Client_SimpleBind_Call { - _c.Call.Return(run) - return _c -} - -// Start provides a mock function with given fields: -func (_m *Client) Start() { - _m.Called() -} - -// Client_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' -type Client_Start_Call struct { - *mock.Call -} - -// Start is a helper method to define mock.On call -func (_e *Client_Expecter) Start() *Client_Start_Call { - return &Client_Start_Call{Call: _e.mock.On("Start")} -} - -func (_c *Client_Start_Call) Run(run func()) *Client_Start_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_Start_Call) Return() *Client_Start_Call { - _c.Call.Return() - return _c -} - -func (_c *Client_Start_Call) RunAndReturn(run func()) *Client_Start_Call { - _c.Call.Return(run) - return _c -} - -// StartTLS provides a mock function with given fields: _a0 -func (_m *Client) StartTLS(_a0 *tls.Config) error { - ret := _m.Called(_a0) - - if len(ret) == 0 { - panic("no return value specified for StartTLS") - } - - var r0 error - if rf, ok := ret.Get(0).(func(*tls.Config) error); ok { - r0 = rf(_a0) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_StartTLS_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartTLS' -type Client_StartTLS_Call struct { - *mock.Call -} - -// StartTLS is a helper method to define mock.On call -// - _a0 *tls.Config -func (_e *Client_Expecter) StartTLS(_a0 interface{}) *Client_StartTLS_Call { - return &Client_StartTLS_Call{Call: _e.mock.On("StartTLS", _a0)} -} - -func (_c *Client_StartTLS_Call) Run(run func(_a0 *tls.Config)) *Client_StartTLS_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(*tls.Config)) - }) - return _c -} - -func (_c *Client_StartTLS_Call) Return(_a0 error) *Client_StartTLS_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_StartTLS_Call) RunAndReturn(run func(*tls.Config) error) *Client_StartTLS_Call { - _c.Call.Return(run) - return _c -} - -// Syncrepl provides a mock function with given fields: ctx, searchRequest, bufferSize, mode, cookie, reloadHint -func (_m *Client) Syncrepl(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool) ldap.Response { - ret := _m.Called(ctx, searchRequest, bufferSize, mode, cookie, reloadHint) - - if len(ret) == 0 { - panic("no return value specified for Syncrepl") - } - - var r0 ldap.Response - if rf, ok := ret.Get(0).(func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response); ok { - r0 = rf(ctx, searchRequest, bufferSize, mode, cookie, reloadHint) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(ldap.Response) - } - } - - return r0 -} - -// Client_Syncrepl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Syncrepl' -type Client_Syncrepl_Call struct { - *mock.Call -} - -// Syncrepl is a helper method to define mock.On call -// - ctx context.Context -// - searchRequest *ldap.SearchRequest -// - bufferSize int -// - mode ldap.ControlSyncRequestMode -// - cookie []byte -// - reloadHint bool -func (_e *Client_Expecter) Syncrepl(ctx interface{}, searchRequest interface{}, bufferSize interface{}, mode interface{}, cookie interface{}, reloadHint interface{}) *Client_Syncrepl_Call { - return &Client_Syncrepl_Call{Call: _e.mock.On("Syncrepl", ctx, searchRequest, bufferSize, mode, cookie, reloadHint)} -} - -func (_c *Client_Syncrepl_Call) Run(run func(ctx context.Context, searchRequest *ldap.SearchRequest, bufferSize int, mode ldap.ControlSyncRequestMode, cookie []byte, reloadHint bool)) *Client_Syncrepl_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(*ldap.SearchRequest), args[2].(int), args[3].(ldap.ControlSyncRequestMode), args[4].([]byte), args[5].(bool)) - }) - return _c -} - -func (_c *Client_Syncrepl_Call) Return(_a0 ldap.Response) *Client_Syncrepl_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Syncrepl_Call) RunAndReturn(run func(context.Context, *ldap.SearchRequest, int, ldap.ControlSyncRequestMode, []byte, bool) ldap.Response) *Client_Syncrepl_Call { - _c.Call.Return(run) - return _c -} - -// TLSConnectionState provides a mock function with given fields: -func (_m *Client) TLSConnectionState() (tls.ConnectionState, bool) { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for TLSConnectionState") - } - - var r0 tls.ConnectionState - var r1 bool - if rf, ok := ret.Get(0).(func() (tls.ConnectionState, bool)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() tls.ConnectionState); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(tls.ConnectionState) - } - - if rf, ok := ret.Get(1).(func() bool); ok { - r1 = rf() - } else { - r1 = ret.Get(1).(bool) - } - - return r0, r1 -} - -// Client_TLSConnectionState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TLSConnectionState' -type Client_TLSConnectionState_Call struct { - *mock.Call -} - -// TLSConnectionState is a helper method to define mock.On call -func (_e *Client_Expecter) TLSConnectionState() *Client_TLSConnectionState_Call { - return &Client_TLSConnectionState_Call{Call: _e.mock.On("TLSConnectionState")} -} - -func (_c *Client_TLSConnectionState_Call) Run(run func()) *Client_TLSConnectionState_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_TLSConnectionState_Call) Return(_a0 tls.ConnectionState, _a1 bool) *Client_TLSConnectionState_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Client_TLSConnectionState_Call) RunAndReturn(run func() (tls.ConnectionState, bool)) *Client_TLSConnectionState_Call { - _c.Call.Return(run) - return _c -} - -// UnauthenticatedBind provides a mock function with given fields: username -func (_m *Client) UnauthenticatedBind(username string) error { - ret := _m.Called(username) - - if len(ret) == 0 { - panic("no return value specified for UnauthenticatedBind") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(username) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_UnauthenticatedBind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnauthenticatedBind' -type Client_UnauthenticatedBind_Call struct { - *mock.Call -} - -// UnauthenticatedBind is a helper method to define mock.On call -// - username string -func (_e *Client_Expecter) UnauthenticatedBind(username interface{}) *Client_UnauthenticatedBind_Call { - return &Client_UnauthenticatedBind_Call{Call: _e.mock.On("UnauthenticatedBind", username)} -} - -func (_c *Client_UnauthenticatedBind_Call) Run(run func(username string)) *Client_UnauthenticatedBind_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *Client_UnauthenticatedBind_Call) Return(_a0 error) *Client_UnauthenticatedBind_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_UnauthenticatedBind_Call) RunAndReturn(run func(string) error) *Client_UnauthenticatedBind_Call { - _c.Call.Return(run) - return _c -} - -// Unbind provides a mock function with given fields: -func (_m *Client) Unbind() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Unbind") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Client_Unbind_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Unbind' -type Client_Unbind_Call struct { - *mock.Call -} - -// Unbind is a helper method to define mock.On call -func (_e *Client_Expecter) Unbind() *Client_Unbind_Call { - return &Client_Unbind_Call{Call: _e.mock.On("Unbind")} -} - -func (_c *Client_Unbind_Call) Run(run func()) *Client_Unbind_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *Client_Unbind_Call) Return(_a0 error) *Client_Unbind_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Client_Unbind_Call) RunAndReturn(run func() error) *Client_Unbind_Call { - _c.Call.Return(run) - return _c -} - -// NewClient creates a new instance of Client. 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 NewClient(t interface { - mock.TestingT - Cleanup(func()) -}) *Client { - mock := &Client{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/services/graph/mocks/value_service.go b/services/graph/mocks/value_service.go deleted file mode 100644 index 8a099b699..000000000 --- a/services/graph/mocks/value_service.go +++ /dev/null @@ -1,336 +0,0 @@ -// Code generated by mockery v2.40.1. DO NOT EDIT. - -package mocks - -import ( - context "context" - - client "go-micro.dev/v4/client" - - mock "github.com/stretchr/testify/mock" - - v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" -) - -// ValueService is an autogenerated mock type for the ValueService type -type ValueService struct { - mock.Mock -} - -type ValueService_Expecter struct { - mock *mock.Mock -} - -func (_m *ValueService) EXPECT() *ValueService_Expecter { - return &ValueService_Expecter{mock: &_m.Mock} -} - -// GetValue provides a mock function with given fields: ctx, in, opts -func (_m *ValueService) GetValue(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, in) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetValue") - } - - var r0 *v0.GetValueResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) *v0.GetValueResponse); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.GetValueResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v0.GetValueRequest, ...client.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ValueService_GetValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValue' -type ValueService_GetValue_Call struct { - *mock.Call -} - -// GetValue is a helper method to define mock.On call -// - ctx context.Context -// - in *v0.GetValueRequest -// - opts ...client.CallOption -func (_e *ValueService_Expecter) GetValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValue_Call { - return &ValueService_GetValue_Call{Call: _e.mock.On("GetValue", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ValueService_GetValue_Call) Run(run func(ctx context.Context, in *v0.GetValueRequest, opts ...client.CallOption)) *ValueService_GetValue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]client.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(client.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v0.GetValueRequest), variadicArgs...) - }) - return _c -} - -func (_c *ValueService_GetValue_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ValueService_GetValue_Call) RunAndReturn(run func(context.Context, *v0.GetValueRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValue_Call { - _c.Call.Return(run) - return _c -} - -// GetValueByUniqueIdentifiers provides a mock function with given fields: ctx, in, opts -func (_m *ValueService) GetValueByUniqueIdentifiers(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*v0.GetValueResponse, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, in) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetValueByUniqueIdentifiers") - } - - var r0 *v0.GetValueResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) *v0.GetValueResponse); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.GetValueResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ValueService_GetValueByUniqueIdentifiers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetValueByUniqueIdentifiers' -type ValueService_GetValueByUniqueIdentifiers_Call struct { - *mock.Call -} - -// GetValueByUniqueIdentifiers is a helper method to define mock.On call -// - ctx context.Context -// - in *v0.GetValueByUniqueIdentifiersRequest -// - opts ...client.CallOption -func (_e *ValueService_Expecter) GetValueByUniqueIdentifiers(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_GetValueByUniqueIdentifiers_Call { - return &ValueService_GetValueByUniqueIdentifiers_Call{Call: _e.mock.On("GetValueByUniqueIdentifiers", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Run(run func(ctx context.Context, in *v0.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption)) *ValueService_GetValueByUniqueIdentifiers_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]client.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(client.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v0.GetValueByUniqueIdentifiersRequest), variadicArgs...) - }) - return _c -} - -func (_c *ValueService_GetValueByUniqueIdentifiers_Call) Return(_a0 *v0.GetValueResponse, _a1 error) *ValueService_GetValueByUniqueIdentifiers_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ValueService_GetValueByUniqueIdentifiers_Call) RunAndReturn(run func(context.Context, *v0.GetValueByUniqueIdentifiersRequest, ...client.CallOption) (*v0.GetValueResponse, error)) *ValueService_GetValueByUniqueIdentifiers_Call { - _c.Call.Return(run) - return _c -} - -// ListValues provides a mock function with given fields: ctx, in, opts -func (_m *ValueService) ListValues(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption) (*v0.ListValuesResponse, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, in) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListValues") - } - - var r0 *v0.ListValuesResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) *v0.ListValuesResponse); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.ListValuesResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v0.ListValuesRequest, ...client.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ValueService_ListValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListValues' -type ValueService_ListValues_Call struct { - *mock.Call -} - -// ListValues is a helper method to define mock.On call -// - ctx context.Context -// - in *v0.ListValuesRequest -// - opts ...client.CallOption -func (_e *ValueService_Expecter) ListValues(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_ListValues_Call { - return &ValueService_ListValues_Call{Call: _e.mock.On("ListValues", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ValueService_ListValues_Call) Run(run func(ctx context.Context, in *v0.ListValuesRequest, opts ...client.CallOption)) *ValueService_ListValues_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]client.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(client.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v0.ListValuesRequest), variadicArgs...) - }) - return _c -} - -func (_c *ValueService_ListValues_Call) Return(_a0 *v0.ListValuesResponse, _a1 error) *ValueService_ListValues_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ValueService_ListValues_Call) RunAndReturn(run func(context.Context, *v0.ListValuesRequest, ...client.CallOption) (*v0.ListValuesResponse, error)) *ValueService_ListValues_Call { - _c.Call.Return(run) - return _c -} - -// SaveValue provides a mock function with given fields: ctx, in, opts -func (_m *ValueService) SaveValue(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption) (*v0.SaveValueResponse, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, in) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SaveValue") - } - - var r0 *v0.SaveValueResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) *v0.SaveValueResponse); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.SaveValueResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v0.SaveValueRequest, ...client.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ValueService_SaveValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveValue' -type ValueService_SaveValue_Call struct { - *mock.Call -} - -// SaveValue is a helper method to define mock.On call -// - ctx context.Context -// - in *v0.SaveValueRequest -// - opts ...client.CallOption -func (_e *ValueService_Expecter) SaveValue(ctx interface{}, in interface{}, opts ...interface{}) *ValueService_SaveValue_Call { - return &ValueService_SaveValue_Call{Call: _e.mock.On("SaveValue", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ValueService_SaveValue_Call) Run(run func(ctx context.Context, in *v0.SaveValueRequest, opts ...client.CallOption)) *ValueService_SaveValue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]client.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(client.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v0.SaveValueRequest), variadicArgs...) - }) - return _c -} - -func (_c *ValueService_SaveValue_Call) Return(_a0 *v0.SaveValueResponse, _a1 error) *ValueService_SaveValue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ValueService_SaveValue_Call) RunAndReturn(run func(context.Context, *v0.SaveValueRequest, ...client.CallOption) (*v0.SaveValueResponse, error)) *ValueService_SaveValue_Call { - _c.Call.Return(run) - return _c -} - -// NewValueService creates a new instance of ValueService. 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 NewValueService(t interface { - mock.TestingT - Cleanup(func()) -}) *ValueService { - mock := &ValueService{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/services/graph/pkg/identity/ldap_education_class_test.go b/services/graph/pkg/identity/ldap_education_class_test.go index b6f34cc8a..f579b0b41 100644 --- a/services/graph/pkg/identity/ldap_education_class_test.go +++ b/services/graph/pkg/identity/ldap_education_class_test.go @@ -7,7 +7,7 @@ import ( "github.com/go-ldap/ldap/v3" libregraph "github.com/owncloud/libre-graph-api-go" - "github.com/owncloud/ocis/v2/services/graph/mocks" + "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/services/graph/pkg/identity/ldap_education_school_test.go b/services/graph/pkg/identity/ldap_education_school_test.go index 336b310ad..b5efbf10b 100644 --- a/services/graph/pkg/identity/ldap_education_school_test.go +++ b/services/graph/pkg/identity/ldap_education_school_test.go @@ -8,9 +8,9 @@ import ( "github.com/go-ldap/ldap/v3" libregraph "github.com/owncloud/libre-graph-api-go" - "github.com/owncloud/ocis/v2/services/graph/mocks" "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/errorcode" + "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/services/graph/pkg/identity/ldap_education_user_test.go b/services/graph/pkg/identity/ldap_education_user_test.go index 763f27b4f..3662f8919 100644 --- a/services/graph/pkg/identity/ldap_education_user_test.go +++ b/services/graph/pkg/identity/ldap_education_user_test.go @@ -6,7 +6,7 @@ import ( "github.com/go-ldap/ldap/v3" libregraph "github.com/owncloud/libre-graph-api-go" - "github.com/owncloud/ocis/v2/services/graph/mocks" + "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/services/graph/pkg/identity/ldap_group_test.go b/services/graph/pkg/identity/ldap_group_test.go index bb7adfa9f..beb66d901 100644 --- a/services/graph/pkg/identity/ldap_group_test.go +++ b/services/graph/pkg/identity/ldap_group_test.go @@ -8,7 +8,7 @@ import ( "github.com/CiscoM31/godata" "github.com/go-ldap/ldap/v3" - "github.com/owncloud/ocis/v2/services/graph/mocks" + "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/services/graph/pkg/identity/ldap_test.go b/services/graph/pkg/identity/ldap_test.go index 3d9579542..a936a7190 100644 --- a/services/graph/pkg/identity/ldap_test.go +++ b/services/graph/pkg/identity/ldap_test.go @@ -11,8 +11,8 @@ import ( "github.com/go-ldap/ldap/v3" libregraph "github.com/owncloud/libre-graph-api-go" "github.com/owncloud/ocis/v2/ocis-pkg/log" - "github.com/owncloud/ocis/v2/services/graph/mocks" "github.com/owncloud/ocis/v2/services/graph/pkg/config" + "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" ) diff --git a/services/graph/pkg/service/v0/graph.go b/services/graph/pkg/service/v0/graph.go index 92edfcb2b..33893e18e 100644 --- a/services/graph/pkg/service/v0/graph.go +++ b/services/graph/pkg/service/v0/graph.go @@ -31,8 +31,6 @@ import ( "github.com/owncloud/ocis/v2/services/graph/pkg/identity" ) -//go:generate make -C ../../.. generate - // Publisher is the interface for events publisher type Publisher interface { Publish(string, interface{}, ...mevents.PublishOption) error diff --git a/services/graph/pkg/service/v0/password_test.go b/services/graph/pkg/service/v0/password_test.go index cb54ab6e5..e25bfea3a 100644 --- a/services/graph/pkg/service/v0/password_test.go +++ b/services/graph/pkg/service/v0/password_test.go @@ -24,6 +24,7 @@ import ( "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults" "github.com/owncloud/ocis/v2/services/graph/pkg/identity" + identitymocks "github.com/owncloud/ocis/v2/services/graph/pkg/identity/mocks" service "github.com/owncloud/ocis/v2/services/graph/pkg/service/v0" "github.com/stretchr/testify/mock" "google.golang.org/grpc" @@ -34,7 +35,7 @@ var _ = Describe("Users changing their own password", func() { svc service.Service gatewayClient *cs3mocks.GatewayAPIClient gatewaySelector pool.Selectable[gateway.GatewayAPIClient] - ldapClient *mocks.Client + ldapClient *identitymocks.Client ldapConfig config.LDAP identityBackend identity.Backend eventsPublisher mocks.Publisher @@ -135,8 +136,8 @@ var _ = Describe("Users changing their own password", func() { ) }) -func mockedLDAPClient() *mocks.Client { - lm := &mocks.Client{} +func mockedLDAPClient() *identitymocks.Client { + lm := &identitymocks.Client{} userEntry := ldap.NewEntry("uid=test", map[string][]string{ "uid": {"test"}, diff --git a/services/graph/pkg/service/v0/users_test.go b/services/graph/pkg/service/v0/users_test.go index 20bc10aa5..80698251f 100644 --- a/services/graph/pkg/service/v0/users_test.go +++ b/services/graph/pkg/service/v0/users_test.go @@ -28,6 +28,7 @@ import ( "github.com/owncloud/ocis/v2/ocis-pkg/shared" settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" settings "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0" + settingsmocks "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0/mocks" "github.com/owncloud/ocis/v2/services/graph/mocks" "github.com/owncloud/ocis/v2/services/graph/pkg/config" "github.com/owncloud/ocis/v2/services/graph/pkg/config/defaults" @@ -48,7 +49,7 @@ var _ = Describe("Users", func() { gatewaySelector pool.Selectable[gateway.GatewayAPIClient] eventsPublisher mocks.Publisher roleService *mocks.RoleService - valueService *mocks.ValueService + valueService *settingsmocks.ValueService permissionService *mocks.Permissions identityBackend *identitymocks.Backend @@ -76,7 +77,7 @@ var _ = Describe("Users", func() { identityBackend = &identitymocks.Backend{} roleService = &mocks.RoleService{} - valueService = &mocks.ValueService{} + valueService = &settingsmocks.ValueService{} permissionService = &mocks.Permissions{} rr = httptest.NewRecorder() diff --git a/services/proxy/.mockery.yaml b/services/proxy/.mockery.yaml new file mode 100644 index 000000000..fe7d02d78 --- /dev/null +++ b/services/proxy/.mockery.yaml @@ -0,0 +1,15 @@ +with-expecter: true +filename: "{{.InterfaceName | snakecase }}.go" +mockname: "{{.InterfaceName}}" +outpkg: "mocks" +packages: + github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend: + config: + dir: "pkg/user/backend/mocks" + interfaces: + UserBackend: + github.com/owncloud/ocis/v2/services/proxy/pkg/userroles: + config: + dir: "pkg/userroles/mocks" + interfaces: + UserRoleAssigner: diff --git a/services/proxy/Makefile b/services/proxy/Makefile index 44e10f95e..7aa5c0a96 100644 --- a/services/proxy/Makefile +++ b/services/proxy/Makefile @@ -24,7 +24,8 @@ docs-generate: config-docs-generate include ../../.make/generate.mk .PHONY: ci-go-generate -ci-go-generate: # CI runs ci-node-generate automatically before this target +ci-go-generate: $(MOCKERY) # CI runs ci-node-generate automatically before this target + $(MOCKERY) .PHONY: ci-node-generate ci-node-generate: diff --git a/services/proxy/pkg/user/backend/mocks/UserBackend.go b/services/proxy/pkg/user/backend/mocks/UserBackend.go deleted file mode 100644 index 76fe443c0..000000000 --- a/services/proxy/pkg/user/backend/mocks/UserBackend.go +++ /dev/null @@ -1,113 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" - mock "github.com/stretchr/testify/mock" -) - -// UserBackend is an autogenerated mock type for the UserBackend type -type UserBackend struct { - mock.Mock -} - -// Authenticate provides a mock function with given fields: ctx, username, password -func (_m *UserBackend) Authenticate(ctx context.Context, username string, password string) (*userv1beta1.User, string, error) { - ret := _m.Called(ctx, username, password) - - var r0 *userv1beta1.User - if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok { - r0 = rf(ctx, username, password) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*userv1beta1.User) - } - } - - var r1 string - if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok { - r1 = rf(ctx, username, password) - } else { - r1 = ret.Get(1).(string) - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(ctx, username, password) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// CreateUserFromClaims provides a mock function with given fields: ctx, claims -func (_m *UserBackend) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error) { - ret := _m.Called(ctx, claims) - - var r0 *userv1beta1.User - if rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) *userv1beta1.User); ok { - r0 = rf(ctx, claims) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*userv1beta1.User) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, map[string]interface{}) error); ok { - r1 = rf(ctx, claims) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GetUserByClaims provides a mock function with given fields: ctx, claim, value -func (_m *UserBackend) GetUserByClaims(ctx context.Context, claim string, value string) (*userv1beta1.User, string, error) { - ret := _m.Called(ctx, claim, value) - - var r0 *userv1beta1.User - if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok { - r0 = rf(ctx, claim, value) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*userv1beta1.User) - } - } - - var r1 string - if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok { - r1 = rf(ctx, claim, value) - } else { - r1 = ret.Get(1).(string) - } - - var r2 error - if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { - r2 = rf(ctx, claim, value) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -type mockConstructorTestingTNewUserBackend interface { - mock.TestingT - Cleanup(func()) -} - -// NewUserBackend creates a new instance of UserBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewUserBackend(t mockConstructorTestingTNewUserBackend) *UserBackend { - mock := &UserBackend{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/services/proxy/pkg/user/backend/mocks/user_backend.go b/services/proxy/pkg/user/backend/mocks/user_backend.go new file mode 100644 index 000000000..c625438af --- /dev/null +++ b/services/proxy/pkg/user/backend/mocks/user_backend.go @@ -0,0 +1,230 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" + mock "github.com/stretchr/testify/mock" +) + +// UserBackend is an autogenerated mock type for the UserBackend type +type UserBackend struct { + mock.Mock +} + +type UserBackend_Expecter struct { + mock *mock.Mock +} + +func (_m *UserBackend) EXPECT() *UserBackend_Expecter { + return &UserBackend_Expecter{mock: &_m.Mock} +} + +// Authenticate provides a mock function with given fields: ctx, username, password +func (_m *UserBackend) Authenticate(ctx context.Context, username string, password string) (*userv1beta1.User, string, error) { + ret := _m.Called(ctx, username, password) + + if len(ret) == 0 { + panic("no return value specified for Authenticate") + } + + var r0 *userv1beta1.User + var r1 string + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*userv1beta1.User, string, error)); ok { + return rf(ctx, username, password) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok { + r0 = rf(ctx, username, password) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*userv1beta1.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok { + r1 = rf(ctx, username, password) + } else { + r1 = ret.Get(1).(string) + } + + if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { + r2 = rf(ctx, username, password) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// UserBackend_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate' +type UserBackend_Authenticate_Call struct { + *mock.Call +} + +// Authenticate is a helper method to define mock.On call +// - ctx context.Context +// - username string +// - password string +func (_e *UserBackend_Expecter) Authenticate(ctx interface{}, username interface{}, password interface{}) *UserBackend_Authenticate_Call { + return &UserBackend_Authenticate_Call{Call: _e.mock.On("Authenticate", ctx, username, password)} +} + +func (_c *UserBackend_Authenticate_Call) Run(run func(ctx context.Context, username string, password string)) *UserBackend_Authenticate_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *UserBackend_Authenticate_Call) Return(_a0 *userv1beta1.User, _a1 string, _a2 error) *UserBackend_Authenticate_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *UserBackend_Authenticate_Call) RunAndReturn(run func(context.Context, string, string) (*userv1beta1.User, string, error)) *UserBackend_Authenticate_Call { + _c.Call.Return(run) + return _c +} + +// CreateUserFromClaims provides a mock function with given fields: ctx, claims +func (_m *UserBackend) CreateUserFromClaims(ctx context.Context, claims map[string]interface{}) (*userv1beta1.User, error) { + ret := _m.Called(ctx, claims) + + if len(ret) == 0 { + panic("no return value specified for CreateUserFromClaims") + } + + var r0 *userv1beta1.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) (*userv1beta1.User, error)); ok { + return rf(ctx, claims) + } + if rf, ok := ret.Get(0).(func(context.Context, map[string]interface{}) *userv1beta1.User); ok { + r0 = rf(ctx, claims) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*userv1beta1.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, map[string]interface{}) error); ok { + r1 = rf(ctx, claims) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserBackend_CreateUserFromClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateUserFromClaims' +type UserBackend_CreateUserFromClaims_Call struct { + *mock.Call +} + +// CreateUserFromClaims is a helper method to define mock.On call +// - ctx context.Context +// - claims map[string]interface{} +func (_e *UserBackend_Expecter) CreateUserFromClaims(ctx interface{}, claims interface{}) *UserBackend_CreateUserFromClaims_Call { + return &UserBackend_CreateUserFromClaims_Call{Call: _e.mock.On("CreateUserFromClaims", ctx, claims)} +} + +func (_c *UserBackend_CreateUserFromClaims_Call) Run(run func(ctx context.Context, claims map[string]interface{})) *UserBackend_CreateUserFromClaims_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(map[string]interface{})) + }) + return _c +} + +func (_c *UserBackend_CreateUserFromClaims_Call) Return(_a0 *userv1beta1.User, _a1 error) *UserBackend_CreateUserFromClaims_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserBackend_CreateUserFromClaims_Call) RunAndReturn(run func(context.Context, map[string]interface{}) (*userv1beta1.User, error)) *UserBackend_CreateUserFromClaims_Call { + _c.Call.Return(run) + return _c +} + +// GetUserByClaims provides a mock function with given fields: ctx, claim, value +func (_m *UserBackend) GetUserByClaims(ctx context.Context, claim string, value string) (*userv1beta1.User, string, error) { + ret := _m.Called(ctx, claim, value) + + if len(ret) == 0 { + panic("no return value specified for GetUserByClaims") + } + + var r0 *userv1beta1.User + var r1 string + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string, string) (*userv1beta1.User, string, error)); ok { + return rf(ctx, claim, value) + } + if rf, ok := ret.Get(0).(func(context.Context, string, string) *userv1beta1.User); ok { + r0 = rf(ctx, claim, value) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*userv1beta1.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string, string) string); ok { + r1 = rf(ctx, claim, value) + } else { + r1 = ret.Get(1).(string) + } + + if rf, ok := ret.Get(2).(func(context.Context, string, string) error); ok { + r2 = rf(ctx, claim, value) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// UserBackend_GetUserByClaims_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetUserByClaims' +type UserBackend_GetUserByClaims_Call struct { + *mock.Call +} + +// GetUserByClaims is a helper method to define mock.On call +// - ctx context.Context +// - claim string +// - value string +func (_e *UserBackend_Expecter) GetUserByClaims(ctx interface{}, claim interface{}, value interface{}) *UserBackend_GetUserByClaims_Call { + return &UserBackend_GetUserByClaims_Call{Call: _e.mock.On("GetUserByClaims", ctx, claim, value)} +} + +func (_c *UserBackend_GetUserByClaims_Call) Run(run func(ctx context.Context, claim string, value string)) *UserBackend_GetUserByClaims_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string)) + }) + return _c +} + +func (_c *UserBackend_GetUserByClaims_Call) Return(_a0 *userv1beta1.User, _a1 string, _a2 error) *UserBackend_GetUserByClaims_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *UserBackend_GetUserByClaims_Call) RunAndReturn(run func(context.Context, string, string) (*userv1beta1.User, string, error)) *UserBackend_GetUserByClaims_Call { + _c.Call.Return(run) + return _c +} + +// NewUserBackend creates a new instance of UserBackend. 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 NewUserBackend(t interface { + mock.TestingT + Cleanup(func()) +}) *UserBackend { + mock := &UserBackend{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/services/proxy/pkg/userroles/mocks/UserRoleAssigner.go b/services/proxy/pkg/userroles/mocks/UserRoleAssigner.go deleted file mode 100644 index 39282c5b9..000000000 --- a/services/proxy/pkg/userroles/mocks/UserRoleAssigner.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" -) - -// UserRoleAssigner is an autogenerated mock type for the UserRoleAssigner type -type UserRoleAssigner struct { - mock.Mock -} - -// ApplyUserRole provides a mock function with given fields: ctx, user -func (_m *UserRoleAssigner) ApplyUserRole(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) { - ret := _m.Called(ctx, user) - - var r0 *userv1beta1.User - if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User) *userv1beta1.User); ok { - r0 = rf(ctx, user) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*userv1beta1.User) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User) error); ok { - r1 = rf(ctx, user) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// UpdateUserRoleAssignment provides a mock function with given fields: ctx, user, claims -func (_m *UserRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) (*userv1beta1.User, error) { - ret := _m.Called(ctx, user, claims) - - var r0 *userv1beta1.User - if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) *userv1beta1.User); ok { - r0 = rf(ctx, user, claims) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*userv1beta1.User) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User, map[string]interface{}) error); ok { - r1 = rf(ctx, user, claims) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -type mockConstructorTestingTNewUserRoleAssigner interface { - mock.TestingT - Cleanup(func()) -} - -// NewUserRoleAssigner creates a new instance of UserRoleAssigner. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewUserRoleAssigner(t mockConstructorTestingTNewUserRoleAssigner) *UserRoleAssigner { - mock := &UserRoleAssigner{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/services/proxy/pkg/userroles/mocks/user_role_assigner.go b/services/proxy/pkg/userroles/mocks/user_role_assigner.go new file mode 100644 index 000000000..3a601b6aa --- /dev/null +++ b/services/proxy/pkg/userroles/mocks/user_role_assigner.go @@ -0,0 +1,157 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + + userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1" +) + +// UserRoleAssigner is an autogenerated mock type for the UserRoleAssigner type +type UserRoleAssigner struct { + mock.Mock +} + +type UserRoleAssigner_Expecter struct { + mock *mock.Mock +} + +func (_m *UserRoleAssigner) EXPECT() *UserRoleAssigner_Expecter { + return &UserRoleAssigner_Expecter{mock: &_m.Mock} +} + +// ApplyUserRole provides a mock function with given fields: ctx, user +func (_m *UserRoleAssigner) ApplyUserRole(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) { + ret := _m.Called(ctx, user) + + if len(ret) == 0 { + panic("no return value specified for ApplyUserRole") + } + + var r0 *userv1beta1.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User) (*userv1beta1.User, error)); ok { + return rf(ctx, user) + } + if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User) *userv1beta1.User); ok { + r0 = rf(ctx, user) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*userv1beta1.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User) error); ok { + r1 = rf(ctx, user) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserRoleAssigner_ApplyUserRole_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyUserRole' +type UserRoleAssigner_ApplyUserRole_Call struct { + *mock.Call +} + +// ApplyUserRole is a helper method to define mock.On call +// - ctx context.Context +// - user *userv1beta1.User +func (_e *UserRoleAssigner_Expecter) ApplyUserRole(ctx interface{}, user interface{}) *UserRoleAssigner_ApplyUserRole_Call { + return &UserRoleAssigner_ApplyUserRole_Call{Call: _e.mock.On("ApplyUserRole", ctx, user)} +} + +func (_c *UserRoleAssigner_ApplyUserRole_Call) Run(run func(ctx context.Context, user *userv1beta1.User)) *UserRoleAssigner_ApplyUserRole_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*userv1beta1.User)) + }) + return _c +} + +func (_c *UserRoleAssigner_ApplyUserRole_Call) Return(_a0 *userv1beta1.User, _a1 error) *UserRoleAssigner_ApplyUserRole_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserRoleAssigner_ApplyUserRole_Call) RunAndReturn(run func(context.Context, *userv1beta1.User) (*userv1beta1.User, error)) *UserRoleAssigner_ApplyUserRole_Call { + _c.Call.Return(run) + return _c +} + +// UpdateUserRoleAssignment provides a mock function with given fields: ctx, user, claims +func (_m *UserRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user *userv1beta1.User, claims map[string]interface{}) (*userv1beta1.User, error) { + ret := _m.Called(ctx, user, claims) + + if len(ret) == 0 { + panic("no return value specified for UpdateUserRoleAssignment") + } + + var r0 *userv1beta1.User + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) (*userv1beta1.User, error)); ok { + return rf(ctx, user, claims) + } + if rf, ok := ret.Get(0).(func(context.Context, *userv1beta1.User, map[string]interface{}) *userv1beta1.User); ok { + r0 = rf(ctx, user, claims) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*userv1beta1.User) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *userv1beta1.User, map[string]interface{}) error); ok { + r1 = rf(ctx, user, claims) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// UserRoleAssigner_UpdateUserRoleAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateUserRoleAssignment' +type UserRoleAssigner_UpdateUserRoleAssignment_Call struct { + *mock.Call +} + +// UpdateUserRoleAssignment is a helper method to define mock.On call +// - ctx context.Context +// - user *userv1beta1.User +// - claims map[string]interface{} +func (_e *UserRoleAssigner_Expecter) UpdateUserRoleAssignment(ctx interface{}, user interface{}, claims interface{}) *UserRoleAssigner_UpdateUserRoleAssignment_Call { + return &UserRoleAssigner_UpdateUserRoleAssignment_Call{Call: _e.mock.On("UpdateUserRoleAssignment", ctx, user, claims)} +} + +func (_c *UserRoleAssigner_UpdateUserRoleAssignment_Call) Run(run func(ctx context.Context, user *userv1beta1.User, claims map[string]interface{})) *UserRoleAssigner_UpdateUserRoleAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*userv1beta1.User), args[2].(map[string]interface{})) + }) + return _c +} + +func (_c *UserRoleAssigner_UpdateUserRoleAssignment_Call) Return(_a0 *userv1beta1.User, _a1 error) *UserRoleAssigner_UpdateUserRoleAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *UserRoleAssigner_UpdateUserRoleAssignment_Call) RunAndReturn(run func(context.Context, *userv1beta1.User, map[string]interface{}) (*userv1beta1.User, error)) *UserRoleAssigner_UpdateUserRoleAssignment_Call { + _c.Call.Return(run) + return _c +} + +// NewUserRoleAssigner creates a new instance of UserRoleAssigner. 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 NewUserRoleAssigner(t interface { + mock.TestingT + Cleanup(func()) +}) *UserRoleAssigner { + mock := &UserRoleAssigner{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/services/settings/.mockery.yaml b/services/settings/.mockery.yaml new file mode 100644 index 000000000..ba758a5bb --- /dev/null +++ b/services/settings/.mockery.yaml @@ -0,0 +1,10 @@ +with-expecter: true +filename: "{{.InterfaceName | snakecase }}.go" +mockname: "{{.InterfaceName}}" +outpkg: "mocks" +packages: + github.com/owncloud/ocis/v2/services/settings/pkg/settings: + config: + dir: "pkg/settings/mocks" + interfaces: + Manager: diff --git a/services/settings/Makefile b/services/settings/Makefile index 05982ea70..f426f34a6 100644 --- a/services/settings/Makefile +++ b/services/settings/Makefile @@ -26,7 +26,8 @@ docs-generate: config-docs-generate \ include ../../.make/generate.mk .PHONY: ci-go-generate -ci-go-generate: protobuf # CI runs ci-node-generate automatically before this target +ci-go-generate: $(MOCKERY) protobuf # CI runs ci-node-generate automatically before this target + $(MOCKERY) .PHONY: ci-node-generate ci-node-generate: diff --git a/services/settings/pkg/settings/mocks/Manager.go b/services/settings/pkg/settings/mocks/Manager.go deleted file mode 100644 index c5542f3ed..000000000 --- a/services/settings/pkg/settings/mocks/Manager.go +++ /dev/null @@ -1,379 +0,0 @@ -// Code generated by mockery v2.14.0. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - - v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" -) - -// Manager is an autogenerated mock type for the Manager type -type Manager struct { - mock.Mock -} - -// AddSettingToBundle provides a mock function with given fields: bundleID, setting -func (_m *Manager) AddSettingToBundle(bundleID string, setting *v0.Setting) (*v0.Setting, error) { - ret := _m.Called(bundleID, setting) - - var r0 *v0.Setting - if rf, ok := ret.Get(0).(func(string, *v0.Setting) *v0.Setting); ok { - r0 = rf(bundleID, setting) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Setting) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, *v0.Setting) error); ok { - r1 = rf(bundleID, setting) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListBundles provides a mock function with given fields: bundleType, bundleIDs -func (_m *Manager) ListBundles(bundleType v0.Bundle_Type, bundleIDs []string) ([]*v0.Bundle, error) { - ret := _m.Called(bundleType, bundleIDs) - - var r0 []*v0.Bundle - if rf, ok := ret.Get(0).(func(v0.Bundle_Type, []string) []*v0.Bundle); ok { - r0 = rf(bundleType, bundleIDs) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*v0.Bundle) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(v0.Bundle_Type, []string) error); ok { - r1 = rf(bundleType, bundleIDs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListPermissionsByResource provides a mock function with given fields: resource, roleIDs -func (_m *Manager) ListPermissionsByResource(resource *v0.Resource, roleIDs []string) ([]*v0.Permission, error) { - ret := _m.Called(resource, roleIDs) - - var r0 []*v0.Permission - if rf, ok := ret.Get(0).(func(*v0.Resource, []string) []*v0.Permission); ok { - r0 = rf(resource, roleIDs) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*v0.Permission) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*v0.Resource, []string) error); ok { - r1 = rf(resource, roleIDs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListRoleAssignments provides a mock function with given fields: accountUUID -func (_m *Manager) ListRoleAssignments(accountUUID string) ([]*v0.UserRoleAssignment, error) { - ret := _m.Called(accountUUID) - - var r0 []*v0.UserRoleAssignment - if rf, ok := ret.Get(0).(func(string) []*v0.UserRoleAssignment); ok { - r0 = rf(accountUUID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*v0.UserRoleAssignment) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(accountUUID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ListValues provides a mock function with given fields: bundleID, accountUUID -func (_m *Manager) ListValues(bundleID string, accountUUID string) ([]*v0.Value, error) { - ret := _m.Called(bundleID, accountUUID) - - var r0 []*v0.Value - if rf, ok := ret.Get(0).(func(string, string) []*v0.Value); ok { - r0 = rf(bundleID, accountUUID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]*v0.Value) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(bundleID, accountUUID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadBundle provides a mock function with given fields: bundleID -func (_m *Manager) ReadBundle(bundleID string) (*v0.Bundle, error) { - ret := _m.Called(bundleID) - - var r0 *v0.Bundle - if rf, ok := ret.Get(0).(func(string) *v0.Bundle); ok { - r0 = rf(bundleID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Bundle) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(bundleID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadPermissionByID provides a mock function with given fields: permissionID, roleIDs -func (_m *Manager) ReadPermissionByID(permissionID string, roleIDs []string) (*v0.Permission, error) { - ret := _m.Called(permissionID, roleIDs) - - var r0 *v0.Permission - if rf, ok := ret.Get(0).(func(string, []string) *v0.Permission); ok { - r0 = rf(permissionID, roleIDs) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Permission) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, []string) error); ok { - r1 = rf(permissionID, roleIDs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadPermissionByName provides a mock function with given fields: name, roleIDs -func (_m *Manager) ReadPermissionByName(name string, roleIDs []string) (*v0.Permission, error) { - ret := _m.Called(name, roleIDs) - - var r0 *v0.Permission - if rf, ok := ret.Get(0).(func(string, []string) *v0.Permission); ok { - r0 = rf(name, roleIDs) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Permission) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, []string) error); ok { - r1 = rf(name, roleIDs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadSetting provides a mock function with given fields: settingID -func (_m *Manager) ReadSetting(settingID string) (*v0.Setting, error) { - ret := _m.Called(settingID) - - var r0 *v0.Setting - if rf, ok := ret.Get(0).(func(string) *v0.Setting); ok { - r0 = rf(settingID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Setting) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(settingID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadValue provides a mock function with given fields: valueID -func (_m *Manager) ReadValue(valueID string) (*v0.Value, error) { - ret := _m.Called(valueID) - - var r0 *v0.Value - if rf, ok := ret.Get(0).(func(string) *v0.Value); ok { - r0 = rf(valueID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Value) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(valueID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ReadValueByUniqueIdentifiers provides a mock function with given fields: accountUUID, settingID -func (_m *Manager) ReadValueByUniqueIdentifiers(accountUUID string, settingID string) (*v0.Value, error) { - ret := _m.Called(accountUUID, settingID) - - var r0 *v0.Value - if rf, ok := ret.Get(0).(func(string, string) *v0.Value); ok { - r0 = rf(accountUUID, settingID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Value) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(accountUUID, settingID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// RemoveRoleAssignment provides a mock function with given fields: assignmentID -func (_m *Manager) RemoveRoleAssignment(assignmentID string) error { - ret := _m.Called(assignmentID) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(assignmentID) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// RemoveSettingFromBundle provides a mock function with given fields: bundleID, settingID -func (_m *Manager) RemoveSettingFromBundle(bundleID string, settingID string) error { - ret := _m.Called(bundleID, settingID) - - var r0 error - if rf, ok := ret.Get(0).(func(string, string) error); ok { - r0 = rf(bundleID, settingID) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// WriteBundle provides a mock function with given fields: bundle -func (_m *Manager) WriteBundle(bundle *v0.Bundle) (*v0.Bundle, error) { - ret := _m.Called(bundle) - - var r0 *v0.Bundle - if rf, ok := ret.Get(0).(func(*v0.Bundle) *v0.Bundle); ok { - r0 = rf(bundle) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Bundle) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*v0.Bundle) error); ok { - r1 = rf(bundle) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WriteRoleAssignment provides a mock function with given fields: accountUUID, roleID -func (_m *Manager) WriteRoleAssignment(accountUUID string, roleID string) (*v0.UserRoleAssignment, error) { - ret := _m.Called(accountUUID, roleID) - - var r0 *v0.UserRoleAssignment - if rf, ok := ret.Get(0).(func(string, string) *v0.UserRoleAssignment); ok { - r0 = rf(accountUUID, roleID) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.UserRoleAssignment) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(string, string) error); ok { - r1 = rf(accountUUID, roleID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// WriteValue provides a mock function with given fields: value -func (_m *Manager) WriteValue(value *v0.Value) (*v0.Value, error) { - ret := _m.Called(value) - - var r0 *v0.Value - if rf, ok := ret.Get(0).(func(*v0.Value) *v0.Value); ok { - r0 = rf(value) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v0.Value) - } - } - - var r1 error - if rf, ok := ret.Get(1).(func(*v0.Value) error); ok { - r1 = rf(value) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -type mockConstructorTestingTNewManager interface { - mock.TestingT - Cleanup(func()) -} - -// NewManager creates a new instance of Manager. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewManager(t mockConstructorTestingTNewManager) *Manager { - mock := &Manager{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/services/settings/pkg/settings/mocks/manager.go b/services/settings/pkg/settings/mocks/manager.go new file mode 100644 index 000000000..687d16888 --- /dev/null +++ b/services/settings/pkg/settings/mocks/manager.go @@ -0,0 +1,949 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + + v0 "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0" +) + +// Manager is an autogenerated mock type for the Manager type +type Manager struct { + mock.Mock +} + +type Manager_Expecter struct { + mock *mock.Mock +} + +func (_m *Manager) EXPECT() *Manager_Expecter { + return &Manager_Expecter{mock: &_m.Mock} +} + +// AddSettingToBundle provides a mock function with given fields: bundleID, setting +func (_m *Manager) AddSettingToBundle(bundleID string, setting *v0.Setting) (*v0.Setting, error) { + ret := _m.Called(bundleID, setting) + + if len(ret) == 0 { + panic("no return value specified for AddSettingToBundle") + } + + var r0 *v0.Setting + var r1 error + if rf, ok := ret.Get(0).(func(string, *v0.Setting) (*v0.Setting, error)); ok { + return rf(bundleID, setting) + } + if rf, ok := ret.Get(0).(func(string, *v0.Setting) *v0.Setting); ok { + r0 = rf(bundleID, setting) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Setting) + } + } + + if rf, ok := ret.Get(1).(func(string, *v0.Setting) error); ok { + r1 = rf(bundleID, setting) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_AddSettingToBundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddSettingToBundle' +type Manager_AddSettingToBundle_Call struct { + *mock.Call +} + +// AddSettingToBundle is a helper method to define mock.On call +// - bundleID string +// - setting *v0.Setting +func (_e *Manager_Expecter) AddSettingToBundle(bundleID interface{}, setting interface{}) *Manager_AddSettingToBundle_Call { + return &Manager_AddSettingToBundle_Call{Call: _e.mock.On("AddSettingToBundle", bundleID, setting)} +} + +func (_c *Manager_AddSettingToBundle_Call) Run(run func(bundleID string, setting *v0.Setting)) *Manager_AddSettingToBundle_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(*v0.Setting)) + }) + return _c +} + +func (_c *Manager_AddSettingToBundle_Call) Return(_a0 *v0.Setting, _a1 error) *Manager_AddSettingToBundle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_AddSettingToBundle_Call) RunAndReturn(run func(string, *v0.Setting) (*v0.Setting, error)) *Manager_AddSettingToBundle_Call { + _c.Call.Return(run) + return _c +} + +// ListBundles provides a mock function with given fields: bundleType, bundleIDs +func (_m *Manager) ListBundles(bundleType v0.Bundle_Type, bundleIDs []string) ([]*v0.Bundle, error) { + ret := _m.Called(bundleType, bundleIDs) + + if len(ret) == 0 { + panic("no return value specified for ListBundles") + } + + var r0 []*v0.Bundle + var r1 error + if rf, ok := ret.Get(0).(func(v0.Bundle_Type, []string) ([]*v0.Bundle, error)); ok { + return rf(bundleType, bundleIDs) + } + if rf, ok := ret.Get(0).(func(v0.Bundle_Type, []string) []*v0.Bundle); ok { + r0 = rf(bundleType, bundleIDs) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*v0.Bundle) + } + } + + if rf, ok := ret.Get(1).(func(v0.Bundle_Type, []string) error); ok { + r1 = rf(bundleType, bundleIDs) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ListBundles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBundles' +type Manager_ListBundles_Call struct { + *mock.Call +} + +// ListBundles is a helper method to define mock.On call +// - bundleType v0.Bundle_Type +// - bundleIDs []string +func (_e *Manager_Expecter) ListBundles(bundleType interface{}, bundleIDs interface{}) *Manager_ListBundles_Call { + return &Manager_ListBundles_Call{Call: _e.mock.On("ListBundles", bundleType, bundleIDs)} +} + +func (_c *Manager_ListBundles_Call) Run(run func(bundleType v0.Bundle_Type, bundleIDs []string)) *Manager_ListBundles_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(v0.Bundle_Type), args[1].([]string)) + }) + return _c +} + +func (_c *Manager_ListBundles_Call) Return(_a0 []*v0.Bundle, _a1 error) *Manager_ListBundles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ListBundles_Call) RunAndReturn(run func(v0.Bundle_Type, []string) ([]*v0.Bundle, error)) *Manager_ListBundles_Call { + _c.Call.Return(run) + return _c +} + +// ListPermissionsByResource provides a mock function with given fields: resource, roleIDs +func (_m *Manager) ListPermissionsByResource(resource *v0.Resource, roleIDs []string) ([]*v0.Permission, error) { + ret := _m.Called(resource, roleIDs) + + if len(ret) == 0 { + panic("no return value specified for ListPermissionsByResource") + } + + var r0 []*v0.Permission + var r1 error + if rf, ok := ret.Get(0).(func(*v0.Resource, []string) ([]*v0.Permission, error)); ok { + return rf(resource, roleIDs) + } + if rf, ok := ret.Get(0).(func(*v0.Resource, []string) []*v0.Permission); ok { + r0 = rf(resource, roleIDs) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*v0.Permission) + } + } + + if rf, ok := ret.Get(1).(func(*v0.Resource, []string) error); ok { + r1 = rf(resource, roleIDs) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ListPermissionsByResource_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListPermissionsByResource' +type Manager_ListPermissionsByResource_Call struct { + *mock.Call +} + +// ListPermissionsByResource is a helper method to define mock.On call +// - resource *v0.Resource +// - roleIDs []string +func (_e *Manager_Expecter) ListPermissionsByResource(resource interface{}, roleIDs interface{}) *Manager_ListPermissionsByResource_Call { + return &Manager_ListPermissionsByResource_Call{Call: _e.mock.On("ListPermissionsByResource", resource, roleIDs)} +} + +func (_c *Manager_ListPermissionsByResource_Call) Run(run func(resource *v0.Resource, roleIDs []string)) *Manager_ListPermissionsByResource_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*v0.Resource), args[1].([]string)) + }) + return _c +} + +func (_c *Manager_ListPermissionsByResource_Call) Return(_a0 []*v0.Permission, _a1 error) *Manager_ListPermissionsByResource_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ListPermissionsByResource_Call) RunAndReturn(run func(*v0.Resource, []string) ([]*v0.Permission, error)) *Manager_ListPermissionsByResource_Call { + _c.Call.Return(run) + return _c +} + +// ListRoleAssignments provides a mock function with given fields: accountUUID +func (_m *Manager) ListRoleAssignments(accountUUID string) ([]*v0.UserRoleAssignment, error) { + ret := _m.Called(accountUUID) + + if len(ret) == 0 { + panic("no return value specified for ListRoleAssignments") + } + + var r0 []*v0.UserRoleAssignment + var r1 error + if rf, ok := ret.Get(0).(func(string) ([]*v0.UserRoleAssignment, error)); ok { + return rf(accountUUID) + } + if rf, ok := ret.Get(0).(func(string) []*v0.UserRoleAssignment); ok { + r0 = rf(accountUUID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*v0.UserRoleAssignment) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(accountUUID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ListRoleAssignments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListRoleAssignments' +type Manager_ListRoleAssignments_Call struct { + *mock.Call +} + +// ListRoleAssignments is a helper method to define mock.On call +// - accountUUID string +func (_e *Manager_Expecter) ListRoleAssignments(accountUUID interface{}) *Manager_ListRoleAssignments_Call { + return &Manager_ListRoleAssignments_Call{Call: _e.mock.On("ListRoleAssignments", accountUUID)} +} + +func (_c *Manager_ListRoleAssignments_Call) Run(run func(accountUUID string)) *Manager_ListRoleAssignments_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Manager_ListRoleAssignments_Call) Return(_a0 []*v0.UserRoleAssignment, _a1 error) *Manager_ListRoleAssignments_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ListRoleAssignments_Call) RunAndReturn(run func(string) ([]*v0.UserRoleAssignment, error)) *Manager_ListRoleAssignments_Call { + _c.Call.Return(run) + return _c +} + +// ListValues provides a mock function with given fields: bundleID, accountUUID +func (_m *Manager) ListValues(bundleID string, accountUUID string) ([]*v0.Value, error) { + ret := _m.Called(bundleID, accountUUID) + + if len(ret) == 0 { + panic("no return value specified for ListValues") + } + + var r0 []*v0.Value + var r1 error + if rf, ok := ret.Get(0).(func(string, string) ([]*v0.Value, error)); ok { + return rf(bundleID, accountUUID) + } + if rf, ok := ret.Get(0).(func(string, string) []*v0.Value); ok { + r0 = rf(bundleID, accountUUID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*v0.Value) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(bundleID, accountUUID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ListValues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListValues' +type Manager_ListValues_Call struct { + *mock.Call +} + +// ListValues is a helper method to define mock.On call +// - bundleID string +// - accountUUID string +func (_e *Manager_Expecter) ListValues(bundleID interface{}, accountUUID interface{}) *Manager_ListValues_Call { + return &Manager_ListValues_Call{Call: _e.mock.On("ListValues", bundleID, accountUUID)} +} + +func (_c *Manager_ListValues_Call) Run(run func(bundleID string, accountUUID string)) *Manager_ListValues_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Manager_ListValues_Call) Return(_a0 []*v0.Value, _a1 error) *Manager_ListValues_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ListValues_Call) RunAndReturn(run func(string, string) ([]*v0.Value, error)) *Manager_ListValues_Call { + _c.Call.Return(run) + return _c +} + +// ReadBundle provides a mock function with given fields: bundleID +func (_m *Manager) ReadBundle(bundleID string) (*v0.Bundle, error) { + ret := _m.Called(bundleID) + + if len(ret) == 0 { + panic("no return value specified for ReadBundle") + } + + var r0 *v0.Bundle + var r1 error + if rf, ok := ret.Get(0).(func(string) (*v0.Bundle, error)); ok { + return rf(bundleID) + } + if rf, ok := ret.Get(0).(func(string) *v0.Bundle); ok { + r0 = rf(bundleID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Bundle) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(bundleID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ReadBundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadBundle' +type Manager_ReadBundle_Call struct { + *mock.Call +} + +// ReadBundle is a helper method to define mock.On call +// - bundleID string +func (_e *Manager_Expecter) ReadBundle(bundleID interface{}) *Manager_ReadBundle_Call { + return &Manager_ReadBundle_Call{Call: _e.mock.On("ReadBundle", bundleID)} +} + +func (_c *Manager_ReadBundle_Call) Run(run func(bundleID string)) *Manager_ReadBundle_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Manager_ReadBundle_Call) Return(_a0 *v0.Bundle, _a1 error) *Manager_ReadBundle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ReadBundle_Call) RunAndReturn(run func(string) (*v0.Bundle, error)) *Manager_ReadBundle_Call { + _c.Call.Return(run) + return _c +} + +// ReadPermissionByID provides a mock function with given fields: permissionID, roleIDs +func (_m *Manager) ReadPermissionByID(permissionID string, roleIDs []string) (*v0.Permission, error) { + ret := _m.Called(permissionID, roleIDs) + + if len(ret) == 0 { + panic("no return value specified for ReadPermissionByID") + } + + var r0 *v0.Permission + var r1 error + if rf, ok := ret.Get(0).(func(string, []string) (*v0.Permission, error)); ok { + return rf(permissionID, roleIDs) + } + if rf, ok := ret.Get(0).(func(string, []string) *v0.Permission); ok { + r0 = rf(permissionID, roleIDs) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Permission) + } + } + + if rf, ok := ret.Get(1).(func(string, []string) error); ok { + r1 = rf(permissionID, roleIDs) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ReadPermissionByID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadPermissionByID' +type Manager_ReadPermissionByID_Call struct { + *mock.Call +} + +// ReadPermissionByID is a helper method to define mock.On call +// - permissionID string +// - roleIDs []string +func (_e *Manager_Expecter) ReadPermissionByID(permissionID interface{}, roleIDs interface{}) *Manager_ReadPermissionByID_Call { + return &Manager_ReadPermissionByID_Call{Call: _e.mock.On("ReadPermissionByID", permissionID, roleIDs)} +} + +func (_c *Manager_ReadPermissionByID_Call) Run(run func(permissionID string, roleIDs []string)) *Manager_ReadPermissionByID_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]string)) + }) + return _c +} + +func (_c *Manager_ReadPermissionByID_Call) Return(_a0 *v0.Permission, _a1 error) *Manager_ReadPermissionByID_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ReadPermissionByID_Call) RunAndReturn(run func(string, []string) (*v0.Permission, error)) *Manager_ReadPermissionByID_Call { + _c.Call.Return(run) + return _c +} + +// ReadPermissionByName provides a mock function with given fields: name, roleIDs +func (_m *Manager) ReadPermissionByName(name string, roleIDs []string) (*v0.Permission, error) { + ret := _m.Called(name, roleIDs) + + if len(ret) == 0 { + panic("no return value specified for ReadPermissionByName") + } + + var r0 *v0.Permission + var r1 error + if rf, ok := ret.Get(0).(func(string, []string) (*v0.Permission, error)); ok { + return rf(name, roleIDs) + } + if rf, ok := ret.Get(0).(func(string, []string) *v0.Permission); ok { + r0 = rf(name, roleIDs) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Permission) + } + } + + if rf, ok := ret.Get(1).(func(string, []string) error); ok { + r1 = rf(name, roleIDs) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ReadPermissionByName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadPermissionByName' +type Manager_ReadPermissionByName_Call struct { + *mock.Call +} + +// ReadPermissionByName is a helper method to define mock.On call +// - name string +// - roleIDs []string +func (_e *Manager_Expecter) ReadPermissionByName(name interface{}, roleIDs interface{}) *Manager_ReadPermissionByName_Call { + return &Manager_ReadPermissionByName_Call{Call: _e.mock.On("ReadPermissionByName", name, roleIDs)} +} + +func (_c *Manager_ReadPermissionByName_Call) Run(run func(name string, roleIDs []string)) *Manager_ReadPermissionByName_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].([]string)) + }) + return _c +} + +func (_c *Manager_ReadPermissionByName_Call) Return(_a0 *v0.Permission, _a1 error) *Manager_ReadPermissionByName_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ReadPermissionByName_Call) RunAndReturn(run func(string, []string) (*v0.Permission, error)) *Manager_ReadPermissionByName_Call { + _c.Call.Return(run) + return _c +} + +// ReadSetting provides a mock function with given fields: settingID +func (_m *Manager) ReadSetting(settingID string) (*v0.Setting, error) { + ret := _m.Called(settingID) + + if len(ret) == 0 { + panic("no return value specified for ReadSetting") + } + + var r0 *v0.Setting + var r1 error + if rf, ok := ret.Get(0).(func(string) (*v0.Setting, error)); ok { + return rf(settingID) + } + if rf, ok := ret.Get(0).(func(string) *v0.Setting); ok { + r0 = rf(settingID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Setting) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(settingID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ReadSetting_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadSetting' +type Manager_ReadSetting_Call struct { + *mock.Call +} + +// ReadSetting is a helper method to define mock.On call +// - settingID string +func (_e *Manager_Expecter) ReadSetting(settingID interface{}) *Manager_ReadSetting_Call { + return &Manager_ReadSetting_Call{Call: _e.mock.On("ReadSetting", settingID)} +} + +func (_c *Manager_ReadSetting_Call) Run(run func(settingID string)) *Manager_ReadSetting_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Manager_ReadSetting_Call) Return(_a0 *v0.Setting, _a1 error) *Manager_ReadSetting_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ReadSetting_Call) RunAndReturn(run func(string) (*v0.Setting, error)) *Manager_ReadSetting_Call { + _c.Call.Return(run) + return _c +} + +// ReadValue provides a mock function with given fields: valueID +func (_m *Manager) ReadValue(valueID string) (*v0.Value, error) { + ret := _m.Called(valueID) + + if len(ret) == 0 { + panic("no return value specified for ReadValue") + } + + var r0 *v0.Value + var r1 error + if rf, ok := ret.Get(0).(func(string) (*v0.Value, error)); ok { + return rf(valueID) + } + if rf, ok := ret.Get(0).(func(string) *v0.Value); ok { + r0 = rf(valueID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Value) + } + } + + if rf, ok := ret.Get(1).(func(string) error); ok { + r1 = rf(valueID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ReadValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadValue' +type Manager_ReadValue_Call struct { + *mock.Call +} + +// ReadValue is a helper method to define mock.On call +// - valueID string +func (_e *Manager_Expecter) ReadValue(valueID interface{}) *Manager_ReadValue_Call { + return &Manager_ReadValue_Call{Call: _e.mock.On("ReadValue", valueID)} +} + +func (_c *Manager_ReadValue_Call) Run(run func(valueID string)) *Manager_ReadValue_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Manager_ReadValue_Call) Return(_a0 *v0.Value, _a1 error) *Manager_ReadValue_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ReadValue_Call) RunAndReturn(run func(string) (*v0.Value, error)) *Manager_ReadValue_Call { + _c.Call.Return(run) + return _c +} + +// ReadValueByUniqueIdentifiers provides a mock function with given fields: accountUUID, settingID +func (_m *Manager) ReadValueByUniqueIdentifiers(accountUUID string, settingID string) (*v0.Value, error) { + ret := _m.Called(accountUUID, settingID) + + if len(ret) == 0 { + panic("no return value specified for ReadValueByUniqueIdentifiers") + } + + var r0 *v0.Value + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*v0.Value, error)); ok { + return rf(accountUUID, settingID) + } + if rf, ok := ret.Get(0).(func(string, string) *v0.Value); ok { + r0 = rf(accountUUID, settingID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Value) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(accountUUID, settingID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_ReadValueByUniqueIdentifiers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReadValueByUniqueIdentifiers' +type Manager_ReadValueByUniqueIdentifiers_Call struct { + *mock.Call +} + +// ReadValueByUniqueIdentifiers is a helper method to define mock.On call +// - accountUUID string +// - settingID string +func (_e *Manager_Expecter) ReadValueByUniqueIdentifiers(accountUUID interface{}, settingID interface{}) *Manager_ReadValueByUniqueIdentifiers_Call { + return &Manager_ReadValueByUniqueIdentifiers_Call{Call: _e.mock.On("ReadValueByUniqueIdentifiers", accountUUID, settingID)} +} + +func (_c *Manager_ReadValueByUniqueIdentifiers_Call) Run(run func(accountUUID string, settingID string)) *Manager_ReadValueByUniqueIdentifiers_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Manager_ReadValueByUniqueIdentifiers_Call) Return(_a0 *v0.Value, _a1 error) *Manager_ReadValueByUniqueIdentifiers_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_ReadValueByUniqueIdentifiers_Call) RunAndReturn(run func(string, string) (*v0.Value, error)) *Manager_ReadValueByUniqueIdentifiers_Call { + _c.Call.Return(run) + return _c +} + +// RemoveRoleAssignment provides a mock function with given fields: assignmentID +func (_m *Manager) RemoveRoleAssignment(assignmentID string) error { + ret := _m.Called(assignmentID) + + if len(ret) == 0 { + panic("no return value specified for RemoveRoleAssignment") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string) error); ok { + r0 = rf(assignmentID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Manager_RemoveRoleAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveRoleAssignment' +type Manager_RemoveRoleAssignment_Call struct { + *mock.Call +} + +// RemoveRoleAssignment is a helper method to define mock.On call +// - assignmentID string +func (_e *Manager_Expecter) RemoveRoleAssignment(assignmentID interface{}) *Manager_RemoveRoleAssignment_Call { + return &Manager_RemoveRoleAssignment_Call{Call: _e.mock.On("RemoveRoleAssignment", assignmentID)} +} + +func (_c *Manager_RemoveRoleAssignment_Call) Run(run func(assignmentID string)) *Manager_RemoveRoleAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string)) + }) + return _c +} + +func (_c *Manager_RemoveRoleAssignment_Call) Return(_a0 error) *Manager_RemoveRoleAssignment_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Manager_RemoveRoleAssignment_Call) RunAndReturn(run func(string) error) *Manager_RemoveRoleAssignment_Call { + _c.Call.Return(run) + return _c +} + +// RemoveSettingFromBundle provides a mock function with given fields: bundleID, settingID +func (_m *Manager) RemoveSettingFromBundle(bundleID string, settingID string) error { + ret := _m.Called(bundleID, settingID) + + if len(ret) == 0 { + panic("no return value specified for RemoveSettingFromBundle") + } + + var r0 error + if rf, ok := ret.Get(0).(func(string, string) error); ok { + r0 = rf(bundleID, settingID) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Manager_RemoveSettingFromBundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveSettingFromBundle' +type Manager_RemoveSettingFromBundle_Call struct { + *mock.Call +} + +// RemoveSettingFromBundle is a helper method to define mock.On call +// - bundleID string +// - settingID string +func (_e *Manager_Expecter) RemoveSettingFromBundle(bundleID interface{}, settingID interface{}) *Manager_RemoveSettingFromBundle_Call { + return &Manager_RemoveSettingFromBundle_Call{Call: _e.mock.On("RemoveSettingFromBundle", bundleID, settingID)} +} + +func (_c *Manager_RemoveSettingFromBundle_Call) Run(run func(bundleID string, settingID string)) *Manager_RemoveSettingFromBundle_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Manager_RemoveSettingFromBundle_Call) Return(_a0 error) *Manager_RemoveSettingFromBundle_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *Manager_RemoveSettingFromBundle_Call) RunAndReturn(run func(string, string) error) *Manager_RemoveSettingFromBundle_Call { + _c.Call.Return(run) + return _c +} + +// WriteBundle provides a mock function with given fields: bundle +func (_m *Manager) WriteBundle(bundle *v0.Bundle) (*v0.Bundle, error) { + ret := _m.Called(bundle) + + if len(ret) == 0 { + panic("no return value specified for WriteBundle") + } + + var r0 *v0.Bundle + var r1 error + if rf, ok := ret.Get(0).(func(*v0.Bundle) (*v0.Bundle, error)); ok { + return rf(bundle) + } + if rf, ok := ret.Get(0).(func(*v0.Bundle) *v0.Bundle); ok { + r0 = rf(bundle) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Bundle) + } + } + + if rf, ok := ret.Get(1).(func(*v0.Bundle) error); ok { + r1 = rf(bundle) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_WriteBundle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteBundle' +type Manager_WriteBundle_Call struct { + *mock.Call +} + +// WriteBundle is a helper method to define mock.On call +// - bundle *v0.Bundle +func (_e *Manager_Expecter) WriteBundle(bundle interface{}) *Manager_WriteBundle_Call { + return &Manager_WriteBundle_Call{Call: _e.mock.On("WriteBundle", bundle)} +} + +func (_c *Manager_WriteBundle_Call) Run(run func(bundle *v0.Bundle)) *Manager_WriteBundle_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*v0.Bundle)) + }) + return _c +} + +func (_c *Manager_WriteBundle_Call) Return(_a0 *v0.Bundle, _a1 error) *Manager_WriteBundle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_WriteBundle_Call) RunAndReturn(run func(*v0.Bundle) (*v0.Bundle, error)) *Manager_WriteBundle_Call { + _c.Call.Return(run) + return _c +} + +// WriteRoleAssignment provides a mock function with given fields: accountUUID, roleID +func (_m *Manager) WriteRoleAssignment(accountUUID string, roleID string) (*v0.UserRoleAssignment, error) { + ret := _m.Called(accountUUID, roleID) + + if len(ret) == 0 { + panic("no return value specified for WriteRoleAssignment") + } + + var r0 *v0.UserRoleAssignment + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*v0.UserRoleAssignment, error)); ok { + return rf(accountUUID, roleID) + } + if rf, ok := ret.Get(0).(func(string, string) *v0.UserRoleAssignment); ok { + r0 = rf(accountUUID, roleID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.UserRoleAssignment) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(accountUUID, roleID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_WriteRoleAssignment_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteRoleAssignment' +type Manager_WriteRoleAssignment_Call struct { + *mock.Call +} + +// WriteRoleAssignment is a helper method to define mock.On call +// - accountUUID string +// - roleID string +func (_e *Manager_Expecter) WriteRoleAssignment(accountUUID interface{}, roleID interface{}) *Manager_WriteRoleAssignment_Call { + return &Manager_WriteRoleAssignment_Call{Call: _e.mock.On("WriteRoleAssignment", accountUUID, roleID)} +} + +func (_c *Manager_WriteRoleAssignment_Call) Run(run func(accountUUID string, roleID string)) *Manager_WriteRoleAssignment_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *Manager_WriteRoleAssignment_Call) Return(_a0 *v0.UserRoleAssignment, _a1 error) *Manager_WriteRoleAssignment_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_WriteRoleAssignment_Call) RunAndReturn(run func(string, string) (*v0.UserRoleAssignment, error)) *Manager_WriteRoleAssignment_Call { + _c.Call.Return(run) + return _c +} + +// WriteValue provides a mock function with given fields: value +func (_m *Manager) WriteValue(value *v0.Value) (*v0.Value, error) { + ret := _m.Called(value) + + if len(ret) == 0 { + panic("no return value specified for WriteValue") + } + + var r0 *v0.Value + var r1 error + if rf, ok := ret.Get(0).(func(*v0.Value) (*v0.Value, error)); ok { + return rf(value) + } + if rf, ok := ret.Get(0).(func(*v0.Value) *v0.Value); ok { + r0 = rf(value) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*v0.Value) + } + } + + if rf, ok := ret.Get(1).(func(*v0.Value) error); ok { + r1 = rf(value) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Manager_WriteValue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteValue' +type Manager_WriteValue_Call struct { + *mock.Call +} + +// WriteValue is a helper method to define mock.On call +// - value *v0.Value +func (_e *Manager_Expecter) WriteValue(value interface{}) *Manager_WriteValue_Call { + return &Manager_WriteValue_Call{Call: _e.mock.On("WriteValue", value)} +} + +func (_c *Manager_WriteValue_Call) Run(run func(value *v0.Value)) *Manager_WriteValue_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*v0.Value)) + }) + return _c +} + +func (_c *Manager_WriteValue_Call) Return(_a0 *v0.Value, _a1 error) *Manager_WriteValue_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Manager_WriteValue_Call) RunAndReturn(run func(*v0.Value) (*v0.Value, error)) *Manager_WriteValue_Call { + _c.Call.Return(run) + return _c +} + +// NewManager creates a new instance of Manager. 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 NewManager(t interface { + mock.TestingT + Cleanup(func()) +}) *Manager { + mock := &Manager{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}