From 1f57031ea75f3278deab6aa9fd7dd75c2a5898ca Mon Sep 17 00:00:00 2001 From: Felix Gateru Date: Fri, 24 Jan 2025 16:43:21 +0300 Subject: [PATCH] NOISSUE - Remove unnecessary mock files and add sdk tests to CI (#53) Signed-off-by: Felix Gateru --- .github/workflows/tests.yml | 10 + auth/mocks/token_client.go | 192 ---------- certs/mocks/pki.go | 257 -------------- channels/mocks/channels_client.go | 342 ------------------ clients/mocks/clients_client.go | 564 ------------------------------ domains/mocks/domains_client.go | 194 ---------- go.mod | 3 +- groups/mocks/groups_client.go | 118 ------- pkg/sdk/messages.go | 2 +- pkg/sdk/messages_test.go | 2 - 10 files changed, 13 insertions(+), 1671 deletions(-) delete mode 100644 auth/mocks/token_client.go delete mode 100644 certs/mocks/pki.go delete mode 100644 channels/mocks/channels_client.go delete mode 100644 clients/mocks/clients_client.go delete mode 100644 domains/mocks/domains_client.go delete mode 100644 groups/mocks/groups_client.go diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 03d50f94b..a3d20e308 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,6 +90,11 @@ jobs: - "pkg/events/**" - "pkg/messaging/**" + pkg-sdk: + - "pkg/sdk/**" + - "bootstrap/api/**" + - "consumers/notifiers/api/**" + provision: - "provision/**" - "cmd/provision/**" @@ -134,6 +139,11 @@ jobs: run: | go test --race -v -count=1 -coverprofile=coverage/pkg-errors.out ./pkg/errors/... + - name: Run pkg sdk tests + if: steps.changes.outputs.pkg-sdk == 'true' || steps.changes.outputs.workflow == 'true' + run: | + go test --race -v -count=1 -coverprofile=coverage/pkg-sdk.out ./pkg/sdk/... + - name: Run provision tests if: steps.changes.outputs.provision == 'true' || steps.changes.outputs.workflow == 'true' run: | diff --git a/auth/mocks/token_client.go b/auth/mocks/token_client.go deleted file mode 100644 index 10ff3145b..000000000 --- a/auth/mocks/token_client.go +++ /dev/null @@ -1,192 +0,0 @@ -// Copyright (c) Abstract Machines - -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" - - v1 "github.com/absmach/supermq/api/grpc/token/v1" -) - -// TokenServiceClient is an autogenerated mock type for the TokenServiceClient type -type TokenServiceClient struct { - mock.Mock -} - -type TokenServiceClient_Expecter struct { - mock *mock.Mock -} - -func (_m *TokenServiceClient) EXPECT() *TokenServiceClient_Expecter { - return &TokenServiceClient_Expecter{mock: &_m.Mock} -} - -// Issue provides a mock function with given fields: ctx, in, opts -func (_m *TokenServiceClient) Issue(ctx context.Context, in *v1.IssueReq, opts ...grpc.CallOption) (*v1.Token, 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 Issue") - } - - var r0 *v1.Token - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.IssueReq, ...grpc.CallOption) (*v1.Token, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.IssueReq, ...grpc.CallOption) *v1.Token); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Token) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.IssueReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TokenServiceClient_Issue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Issue' -type TokenServiceClient_Issue_Call struct { - *mock.Call -} - -// Issue is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.IssueReq -// - opts ...grpc.CallOption -func (_e *TokenServiceClient_Expecter) Issue(ctx interface{}, in interface{}, opts ...interface{}) *TokenServiceClient_Issue_Call { - return &TokenServiceClient_Issue_Call{Call: _e.mock.On("Issue", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *TokenServiceClient_Issue_Call) Run(run func(ctx context.Context, in *v1.IssueReq, opts ...grpc.CallOption)) *TokenServiceClient_Issue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.IssueReq), variadicArgs...) - }) - return _c -} - -func (_c *TokenServiceClient_Issue_Call) Return(_a0 *v1.Token, _a1 error) *TokenServiceClient_Issue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *TokenServiceClient_Issue_Call) RunAndReturn(run func(context.Context, *v1.IssueReq, ...grpc.CallOption) (*v1.Token, error)) *TokenServiceClient_Issue_Call { - _c.Call.Return(run) - return _c -} - -// Refresh provides a mock function with given fields: ctx, in, opts -func (_m *TokenServiceClient) Refresh(ctx context.Context, in *v1.RefreshReq, opts ...grpc.CallOption) (*v1.Token, 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 Refresh") - } - - var r0 *v1.Token - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.RefreshReq, ...grpc.CallOption) (*v1.Token, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.RefreshReq, ...grpc.CallOption) *v1.Token); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.Token) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.RefreshReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// TokenServiceClient_Refresh_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Refresh' -type TokenServiceClient_Refresh_Call struct { - *mock.Call -} - -// Refresh is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.RefreshReq -// - opts ...grpc.CallOption -func (_e *TokenServiceClient_Expecter) Refresh(ctx interface{}, in interface{}, opts ...interface{}) *TokenServiceClient_Refresh_Call { - return &TokenServiceClient_Refresh_Call{Call: _e.mock.On("Refresh", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *TokenServiceClient_Refresh_Call) Run(run func(ctx context.Context, in *v1.RefreshReq, opts ...grpc.CallOption)) *TokenServiceClient_Refresh_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.RefreshReq), variadicArgs...) - }) - return _c -} - -func (_c *TokenServiceClient_Refresh_Call) Return(_a0 *v1.Token, _a1 error) *TokenServiceClient_Refresh_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *TokenServiceClient_Refresh_Call) RunAndReturn(run func(context.Context, *v1.RefreshReq, ...grpc.CallOption) (*v1.Token, error)) *TokenServiceClient_Refresh_Call { - _c.Call.Return(run) - return _c -} - -// NewTokenServiceClient creates a new instance of TokenServiceClient. 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 NewTokenServiceClient(t interface { - mock.TestingT - Cleanup(func()) -}) *TokenServiceClient { - mock := &TokenServiceClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/certs/mocks/pki.go b/certs/mocks/pki.go deleted file mode 100644 index ad7dde22c..000000000 --- a/certs/mocks/pki.go +++ /dev/null @@ -1,257 +0,0 @@ -// Copyright (c) Abstract Machines - -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - amcerts "github.com/absmach/supermq/certs/pki/amcerts" - mock "github.com/stretchr/testify/mock" - - sdk "github.com/absmach/certs/sdk" -) - -// Agent is an autogenerated mock type for the Agent type -type Agent struct { - mock.Mock -} - -type Agent_Expecter struct { - mock *mock.Mock -} - -func (_m *Agent) EXPECT() *Agent_Expecter { - return &Agent_Expecter{mock: &_m.Mock} -} - -// Issue provides a mock function with given fields: entityId, ttl, ipAddrs -func (_m *Agent) Issue(entityId string, ttl string, ipAddrs []string) (amcerts.Cert, error) { - ret := _m.Called(entityId, ttl, ipAddrs) - - if len(ret) == 0 { - panic("no return value specified for Issue") - } - - var r0 amcerts.Cert - var r1 error - if rf, ok := ret.Get(0).(func(string, string, []string) (amcerts.Cert, error)); ok { - return rf(entityId, ttl, ipAddrs) - } - if rf, ok := ret.Get(0).(func(string, string, []string) amcerts.Cert); ok { - r0 = rf(entityId, ttl, ipAddrs) - } else { - r0 = ret.Get(0).(amcerts.Cert) - } - - if rf, ok := ret.Get(1).(func(string, string, []string) error); ok { - r1 = rf(entityId, ttl, ipAddrs) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Agent_Issue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Issue' -type Agent_Issue_Call struct { - *mock.Call -} - -// Issue is a helper method to define mock.On call -// - entityId string -// - ttl string -// - ipAddrs []string -func (_e *Agent_Expecter) Issue(entityId interface{}, ttl interface{}, ipAddrs interface{}) *Agent_Issue_Call { - return &Agent_Issue_Call{Call: _e.mock.On("Issue", entityId, ttl, ipAddrs)} -} - -func (_c *Agent_Issue_Call) Run(run func(entityId string, ttl string, ipAddrs []string)) *Agent_Issue_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string), args[1].(string), args[2].([]string)) - }) - return _c -} - -func (_c *Agent_Issue_Call) Return(_a0 amcerts.Cert, _a1 error) *Agent_Issue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Agent_Issue_Call) RunAndReturn(run func(string, string, []string) (amcerts.Cert, error)) *Agent_Issue_Call { - _c.Call.Return(run) - return _c -} - -// ListCerts provides a mock function with given fields: pm -func (_m *Agent) ListCerts(pm sdk.PageMetadata) (amcerts.CertPage, error) { - ret := _m.Called(pm) - - if len(ret) == 0 { - panic("no return value specified for ListCerts") - } - - var r0 amcerts.CertPage - var r1 error - if rf, ok := ret.Get(0).(func(sdk.PageMetadata) (amcerts.CertPage, error)); ok { - return rf(pm) - } - if rf, ok := ret.Get(0).(func(sdk.PageMetadata) amcerts.CertPage); ok { - r0 = rf(pm) - } else { - r0 = ret.Get(0).(amcerts.CertPage) - } - - if rf, ok := ret.Get(1).(func(sdk.PageMetadata) error); ok { - r1 = rf(pm) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Agent_ListCerts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListCerts' -type Agent_ListCerts_Call struct { - *mock.Call -} - -// ListCerts is a helper method to define mock.On call -// - pm sdk.PageMetadata -func (_e *Agent_Expecter) ListCerts(pm interface{}) *Agent_ListCerts_Call { - return &Agent_ListCerts_Call{Call: _e.mock.On("ListCerts", pm)} -} - -func (_c *Agent_ListCerts_Call) Run(run func(pm sdk.PageMetadata)) *Agent_ListCerts_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(sdk.PageMetadata)) - }) - return _c -} - -func (_c *Agent_ListCerts_Call) Return(_a0 amcerts.CertPage, _a1 error) *Agent_ListCerts_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Agent_ListCerts_Call) RunAndReturn(run func(sdk.PageMetadata) (amcerts.CertPage, error)) *Agent_ListCerts_Call { - _c.Call.Return(run) - return _c -} - -// Revoke provides a mock function with given fields: serialNumber -func (_m *Agent) Revoke(serialNumber string) error { - ret := _m.Called(serialNumber) - - if len(ret) == 0 { - panic("no return value specified for Revoke") - } - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(serialNumber) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// Agent_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke' -type Agent_Revoke_Call struct { - *mock.Call -} - -// Revoke is a helper method to define mock.On call -// - serialNumber string -func (_e *Agent_Expecter) Revoke(serialNumber interface{}) *Agent_Revoke_Call { - return &Agent_Revoke_Call{Call: _e.mock.On("Revoke", serialNumber)} -} - -func (_c *Agent_Revoke_Call) Run(run func(serialNumber string)) *Agent_Revoke_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *Agent_Revoke_Call) Return(_a0 error) *Agent_Revoke_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *Agent_Revoke_Call) RunAndReturn(run func(string) error) *Agent_Revoke_Call { - _c.Call.Return(run) - return _c -} - -// View provides a mock function with given fields: serialNumber -func (_m *Agent) View(serialNumber string) (amcerts.Cert, error) { - ret := _m.Called(serialNumber) - - if len(ret) == 0 { - panic("no return value specified for View") - } - - var r0 amcerts.Cert - var r1 error - if rf, ok := ret.Get(0).(func(string) (amcerts.Cert, error)); ok { - return rf(serialNumber) - } - if rf, ok := ret.Get(0).(func(string) amcerts.Cert); ok { - r0 = rf(serialNumber) - } else { - r0 = ret.Get(0).(amcerts.Cert) - } - - if rf, ok := ret.Get(1).(func(string) error); ok { - r1 = rf(serialNumber) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// Agent_View_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'View' -type Agent_View_Call struct { - *mock.Call -} - -// View is a helper method to define mock.On call -// - serialNumber string -func (_e *Agent_Expecter) View(serialNumber interface{}) *Agent_View_Call { - return &Agent_View_Call{Call: _e.mock.On("View", serialNumber)} -} - -func (_c *Agent_View_Call) Run(run func(serialNumber string)) *Agent_View_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(string)) - }) - return _c -} - -func (_c *Agent_View_Call) Return(_a0 amcerts.Cert, _a1 error) *Agent_View_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *Agent_View_Call) RunAndReturn(run func(string) (amcerts.Cert, error)) *Agent_View_Call { - _c.Call.Return(run) - return _c -} - -// NewAgent creates a new instance of Agent. 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 NewAgent(t interface { - mock.TestingT - Cleanup(func()) -}) *Agent { - mock := &Agent{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/channels/mocks/channels_client.go b/channels/mocks/channels_client.go deleted file mode 100644 index 239259e81..000000000 --- a/channels/mocks/channels_client.go +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright (c) Abstract Machines - -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - commonv1 "github.com/absmach/supermq/api/grpc/common/v1" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" - - v1 "github.com/absmach/supermq/api/grpc/channels/v1" -) - -// ChannelsServiceClient is an autogenerated mock type for the ChannelsServiceClient type -type ChannelsServiceClient struct { - mock.Mock -} - -type ChannelsServiceClient_Expecter struct { - mock *mock.Mock -} - -func (_m *ChannelsServiceClient) EXPECT() *ChannelsServiceClient_Expecter { - return &ChannelsServiceClient_Expecter{mock: &_m.Mock} -} - -// Authorize provides a mock function with given fields: ctx, in, opts -func (_m *ChannelsServiceClient) Authorize(ctx context.Context, in *v1.AuthzReq, opts ...grpc.CallOption) (*v1.AuthzRes, 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 Authorize") - } - - var r0 *v1.AuthzRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.AuthzReq, ...grpc.CallOption) (*v1.AuthzRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.AuthzReq, ...grpc.CallOption) *v1.AuthzRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.AuthzRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.AuthzReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ChannelsServiceClient_Authorize_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authorize' -type ChannelsServiceClient_Authorize_Call struct { - *mock.Call -} - -// Authorize is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.AuthzReq -// - opts ...grpc.CallOption -func (_e *ChannelsServiceClient_Expecter) Authorize(ctx interface{}, in interface{}, opts ...interface{}) *ChannelsServiceClient_Authorize_Call { - return &ChannelsServiceClient_Authorize_Call{Call: _e.mock.On("Authorize", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ChannelsServiceClient_Authorize_Call) Run(run func(ctx context.Context, in *v1.AuthzReq, opts ...grpc.CallOption)) *ChannelsServiceClient_Authorize_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.AuthzReq), variadicArgs...) - }) - return _c -} - -func (_c *ChannelsServiceClient_Authorize_Call) Return(_a0 *v1.AuthzRes, _a1 error) *ChannelsServiceClient_Authorize_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ChannelsServiceClient_Authorize_Call) RunAndReturn(run func(context.Context, *v1.AuthzReq, ...grpc.CallOption) (*v1.AuthzRes, error)) *ChannelsServiceClient_Authorize_Call { - _c.Call.Return(run) - return _c -} - -// RemoveClientConnections provides a mock function with given fields: ctx, in, opts -func (_m *ChannelsServiceClient) RemoveClientConnections(ctx context.Context, in *v1.RemoveClientConnectionsReq, opts ...grpc.CallOption) (*v1.RemoveClientConnectionsRes, 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 RemoveClientConnections") - } - - var r0 *v1.RemoveClientConnectionsRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.RemoveClientConnectionsReq, ...grpc.CallOption) (*v1.RemoveClientConnectionsRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.RemoveClientConnectionsReq, ...grpc.CallOption) *v1.RemoveClientConnectionsRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.RemoveClientConnectionsRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.RemoveClientConnectionsReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ChannelsServiceClient_RemoveClientConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveClientConnections' -type ChannelsServiceClient_RemoveClientConnections_Call struct { - *mock.Call -} - -// RemoveClientConnections is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.RemoveClientConnectionsReq -// - opts ...grpc.CallOption -func (_e *ChannelsServiceClient_Expecter) RemoveClientConnections(ctx interface{}, in interface{}, opts ...interface{}) *ChannelsServiceClient_RemoveClientConnections_Call { - return &ChannelsServiceClient_RemoveClientConnections_Call{Call: _e.mock.On("RemoveClientConnections", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ChannelsServiceClient_RemoveClientConnections_Call) Run(run func(ctx context.Context, in *v1.RemoveClientConnectionsReq, opts ...grpc.CallOption)) *ChannelsServiceClient_RemoveClientConnections_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.RemoveClientConnectionsReq), variadicArgs...) - }) - return _c -} - -func (_c *ChannelsServiceClient_RemoveClientConnections_Call) Return(_a0 *v1.RemoveClientConnectionsRes, _a1 error) *ChannelsServiceClient_RemoveClientConnections_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ChannelsServiceClient_RemoveClientConnections_Call) RunAndReturn(run func(context.Context, *v1.RemoveClientConnectionsReq, ...grpc.CallOption) (*v1.RemoveClientConnectionsRes, error)) *ChannelsServiceClient_RemoveClientConnections_Call { - _c.Call.Return(run) - return _c -} - -// RetrieveEntity provides a mock function with given fields: ctx, in, opts -func (_m *ChannelsServiceClient) RetrieveEntity(ctx context.Context, in *commonv1.RetrieveEntityReq, opts ...grpc.CallOption) (*commonv1.RetrieveEntityRes, 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 RetrieveEntity") - } - - var r0 *commonv1.RetrieveEntityRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) (*commonv1.RetrieveEntityRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) *commonv1.RetrieveEntityRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*commonv1.RetrieveEntityRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ChannelsServiceClient_RetrieveEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntity' -type ChannelsServiceClient_RetrieveEntity_Call struct { - *mock.Call -} - -// RetrieveEntity is a helper method to define mock.On call -// - ctx context.Context -// - in *commonv1.RetrieveEntityReq -// - opts ...grpc.CallOption -func (_e *ChannelsServiceClient_Expecter) RetrieveEntity(ctx interface{}, in interface{}, opts ...interface{}) *ChannelsServiceClient_RetrieveEntity_Call { - return &ChannelsServiceClient_RetrieveEntity_Call{Call: _e.mock.On("RetrieveEntity", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ChannelsServiceClient_RetrieveEntity_Call) Run(run func(ctx context.Context, in *commonv1.RetrieveEntityReq, opts ...grpc.CallOption)) *ChannelsServiceClient_RetrieveEntity_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*commonv1.RetrieveEntityReq), variadicArgs...) - }) - return _c -} - -func (_c *ChannelsServiceClient_RetrieveEntity_Call) Return(_a0 *commonv1.RetrieveEntityRes, _a1 error) *ChannelsServiceClient_RetrieveEntity_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ChannelsServiceClient_RetrieveEntity_Call) RunAndReturn(run func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) (*commonv1.RetrieveEntityRes, error)) *ChannelsServiceClient_RetrieveEntity_Call { - _c.Call.Return(run) - return _c -} - -// UnsetParentGroupFromChannels provides a mock function with given fields: ctx, in, opts -func (_m *ChannelsServiceClient) UnsetParentGroupFromChannels(ctx context.Context, in *v1.UnsetParentGroupFromChannelsReq, opts ...grpc.CallOption) (*v1.UnsetParentGroupFromChannelsRes, 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 UnsetParentGroupFromChannels") - } - - var r0 *v1.UnsetParentGroupFromChannelsRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.UnsetParentGroupFromChannelsReq, ...grpc.CallOption) (*v1.UnsetParentGroupFromChannelsRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.UnsetParentGroupFromChannelsReq, ...grpc.CallOption) *v1.UnsetParentGroupFromChannelsRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.UnsetParentGroupFromChannelsRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.UnsetParentGroupFromChannelsReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ChannelsServiceClient_UnsetParentGroupFromChannels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsetParentGroupFromChannels' -type ChannelsServiceClient_UnsetParentGroupFromChannels_Call struct { - *mock.Call -} - -// UnsetParentGroupFromChannels is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.UnsetParentGroupFromChannelsReq -// - opts ...grpc.CallOption -func (_e *ChannelsServiceClient_Expecter) UnsetParentGroupFromChannels(ctx interface{}, in interface{}, opts ...interface{}) *ChannelsServiceClient_UnsetParentGroupFromChannels_Call { - return &ChannelsServiceClient_UnsetParentGroupFromChannels_Call{Call: _e.mock.On("UnsetParentGroupFromChannels", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ChannelsServiceClient_UnsetParentGroupFromChannels_Call) Run(run func(ctx context.Context, in *v1.UnsetParentGroupFromChannelsReq, opts ...grpc.CallOption)) *ChannelsServiceClient_UnsetParentGroupFromChannels_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.UnsetParentGroupFromChannelsReq), variadicArgs...) - }) - return _c -} - -func (_c *ChannelsServiceClient_UnsetParentGroupFromChannels_Call) Return(_a0 *v1.UnsetParentGroupFromChannelsRes, _a1 error) *ChannelsServiceClient_UnsetParentGroupFromChannels_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ChannelsServiceClient_UnsetParentGroupFromChannels_Call) RunAndReturn(run func(context.Context, *v1.UnsetParentGroupFromChannelsReq, ...grpc.CallOption) (*v1.UnsetParentGroupFromChannelsRes, error)) *ChannelsServiceClient_UnsetParentGroupFromChannels_Call { - _c.Call.Return(run) - return _c -} - -// NewChannelsServiceClient creates a new instance of ChannelsServiceClient. 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 NewChannelsServiceClient(t interface { - mock.TestingT - Cleanup(func()) -}) *ChannelsServiceClient { - mock := &ChannelsServiceClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/clients/mocks/clients_client.go b/clients/mocks/clients_client.go deleted file mode 100644 index 861fa3035..000000000 --- a/clients/mocks/clients_client.go +++ /dev/null @@ -1,564 +0,0 @@ -// Copyright (c) Abstract Machines - -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - clientsv1 "github.com/absmach/supermq/api/grpc/clients/v1" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" - - v1 "github.com/absmach/supermq/api/grpc/common/v1" -) - -// ClientsServiceClient is an autogenerated mock type for the ClientsServiceClient type -type ClientsServiceClient struct { - mock.Mock -} - -type ClientsServiceClient_Expecter struct { - mock *mock.Mock -} - -func (_m *ClientsServiceClient) EXPECT() *ClientsServiceClient_Expecter { - return &ClientsServiceClient_Expecter{mock: &_m.Mock} -} - -// AddConnections provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) AddConnections(ctx context.Context, in *v1.AddConnectionsReq, opts ...grpc.CallOption) (*v1.AddConnectionsRes, 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 AddConnections") - } - - var r0 *v1.AddConnectionsRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.AddConnectionsReq, ...grpc.CallOption) (*v1.AddConnectionsRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.AddConnectionsReq, ...grpc.CallOption) *v1.AddConnectionsRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.AddConnectionsRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.AddConnectionsReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_AddConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddConnections' -type ClientsServiceClient_AddConnections_Call struct { - *mock.Call -} - -// AddConnections is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.AddConnectionsReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) AddConnections(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_AddConnections_Call { - return &ClientsServiceClient_AddConnections_Call{Call: _e.mock.On("AddConnections", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_AddConnections_Call) Run(run func(ctx context.Context, in *v1.AddConnectionsReq, opts ...grpc.CallOption)) *ClientsServiceClient_AddConnections_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.AddConnectionsReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_AddConnections_Call) Return(_a0 *v1.AddConnectionsRes, _a1 error) *ClientsServiceClient_AddConnections_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_AddConnections_Call) RunAndReturn(run func(context.Context, *v1.AddConnectionsReq, ...grpc.CallOption) (*v1.AddConnectionsRes, error)) *ClientsServiceClient_AddConnections_Call { - _c.Call.Return(run) - return _c -} - -// Authenticate provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) Authenticate(ctx context.Context, in *clientsv1.AuthnReq, opts ...grpc.CallOption) (*clientsv1.AuthnRes, 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 Authenticate") - } - - var r0 *clientsv1.AuthnRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *clientsv1.AuthnReq, ...grpc.CallOption) (*clientsv1.AuthnRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *clientsv1.AuthnReq, ...grpc.CallOption) *clientsv1.AuthnRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*clientsv1.AuthnRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *clientsv1.AuthnReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_Authenticate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Authenticate' -type ClientsServiceClient_Authenticate_Call struct { - *mock.Call -} - -// Authenticate is a helper method to define mock.On call -// - ctx context.Context -// - in *clientsv1.AuthnReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) Authenticate(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_Authenticate_Call { - return &ClientsServiceClient_Authenticate_Call{Call: _e.mock.On("Authenticate", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_Authenticate_Call) Run(run func(ctx context.Context, in *clientsv1.AuthnReq, opts ...grpc.CallOption)) *ClientsServiceClient_Authenticate_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*clientsv1.AuthnReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_Authenticate_Call) Return(_a0 *clientsv1.AuthnRes, _a1 error) *ClientsServiceClient_Authenticate_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_Authenticate_Call) RunAndReturn(run func(context.Context, *clientsv1.AuthnReq, ...grpc.CallOption) (*clientsv1.AuthnRes, error)) *ClientsServiceClient_Authenticate_Call { - _c.Call.Return(run) - return _c -} - -// RemoveChannelConnections provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) RemoveChannelConnections(ctx context.Context, in *clientsv1.RemoveChannelConnectionsReq, opts ...grpc.CallOption) (*clientsv1.RemoveChannelConnectionsRes, 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 RemoveChannelConnections") - } - - var r0 *clientsv1.RemoveChannelConnectionsRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *clientsv1.RemoveChannelConnectionsReq, ...grpc.CallOption) (*clientsv1.RemoveChannelConnectionsRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *clientsv1.RemoveChannelConnectionsReq, ...grpc.CallOption) *clientsv1.RemoveChannelConnectionsRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*clientsv1.RemoveChannelConnectionsRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *clientsv1.RemoveChannelConnectionsReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_RemoveChannelConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveChannelConnections' -type ClientsServiceClient_RemoveChannelConnections_Call struct { - *mock.Call -} - -// RemoveChannelConnections is a helper method to define mock.On call -// - ctx context.Context -// - in *clientsv1.RemoveChannelConnectionsReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) RemoveChannelConnections(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_RemoveChannelConnections_Call { - return &ClientsServiceClient_RemoveChannelConnections_Call{Call: _e.mock.On("RemoveChannelConnections", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_RemoveChannelConnections_Call) Run(run func(ctx context.Context, in *clientsv1.RemoveChannelConnectionsReq, opts ...grpc.CallOption)) *ClientsServiceClient_RemoveChannelConnections_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*clientsv1.RemoveChannelConnectionsReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_RemoveChannelConnections_Call) Return(_a0 *clientsv1.RemoveChannelConnectionsRes, _a1 error) *ClientsServiceClient_RemoveChannelConnections_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_RemoveChannelConnections_Call) RunAndReturn(run func(context.Context, *clientsv1.RemoveChannelConnectionsReq, ...grpc.CallOption) (*clientsv1.RemoveChannelConnectionsRes, error)) *ClientsServiceClient_RemoveChannelConnections_Call { - _c.Call.Return(run) - return _c -} - -// RemoveConnections provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) RemoveConnections(ctx context.Context, in *v1.RemoveConnectionsReq, opts ...grpc.CallOption) (*v1.RemoveConnectionsRes, 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 RemoveConnections") - } - - var r0 *v1.RemoveConnectionsRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.RemoveConnectionsReq, ...grpc.CallOption) (*v1.RemoveConnectionsRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.RemoveConnectionsReq, ...grpc.CallOption) *v1.RemoveConnectionsRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.RemoveConnectionsRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.RemoveConnectionsReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_RemoveConnections_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveConnections' -type ClientsServiceClient_RemoveConnections_Call struct { - *mock.Call -} - -// RemoveConnections is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.RemoveConnectionsReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) RemoveConnections(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_RemoveConnections_Call { - return &ClientsServiceClient_RemoveConnections_Call{Call: _e.mock.On("RemoveConnections", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_RemoveConnections_Call) Run(run func(ctx context.Context, in *v1.RemoveConnectionsReq, opts ...grpc.CallOption)) *ClientsServiceClient_RemoveConnections_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.RemoveConnectionsReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_RemoveConnections_Call) Return(_a0 *v1.RemoveConnectionsRes, _a1 error) *ClientsServiceClient_RemoveConnections_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_RemoveConnections_Call) RunAndReturn(run func(context.Context, *v1.RemoveConnectionsReq, ...grpc.CallOption) (*v1.RemoveConnectionsRes, error)) *ClientsServiceClient_RemoveConnections_Call { - _c.Call.Return(run) - return _c -} - -// RetrieveEntities provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) RetrieveEntities(ctx context.Context, in *v1.RetrieveEntitiesReq, opts ...grpc.CallOption) (*v1.RetrieveEntitiesRes, 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 RetrieveEntities") - } - - var r0 *v1.RetrieveEntitiesRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.RetrieveEntitiesReq, ...grpc.CallOption) (*v1.RetrieveEntitiesRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.RetrieveEntitiesReq, ...grpc.CallOption) *v1.RetrieveEntitiesRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.RetrieveEntitiesRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.RetrieveEntitiesReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_RetrieveEntities_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntities' -type ClientsServiceClient_RetrieveEntities_Call struct { - *mock.Call -} - -// RetrieveEntities is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.RetrieveEntitiesReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) RetrieveEntities(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_RetrieveEntities_Call { - return &ClientsServiceClient_RetrieveEntities_Call{Call: _e.mock.On("RetrieveEntities", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_RetrieveEntities_Call) Run(run func(ctx context.Context, in *v1.RetrieveEntitiesReq, opts ...grpc.CallOption)) *ClientsServiceClient_RetrieveEntities_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.RetrieveEntitiesReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_RetrieveEntities_Call) Return(_a0 *v1.RetrieveEntitiesRes, _a1 error) *ClientsServiceClient_RetrieveEntities_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_RetrieveEntities_Call) RunAndReturn(run func(context.Context, *v1.RetrieveEntitiesReq, ...grpc.CallOption) (*v1.RetrieveEntitiesRes, error)) *ClientsServiceClient_RetrieveEntities_Call { - _c.Call.Return(run) - return _c -} - -// RetrieveEntity provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) RetrieveEntity(ctx context.Context, in *v1.RetrieveEntityReq, opts ...grpc.CallOption) (*v1.RetrieveEntityRes, 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 RetrieveEntity") - } - - var r0 *v1.RetrieveEntityRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) (*v1.RetrieveEntityRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) *v1.RetrieveEntityRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.RetrieveEntityRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_RetrieveEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntity' -type ClientsServiceClient_RetrieveEntity_Call struct { - *mock.Call -} - -// RetrieveEntity is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.RetrieveEntityReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) RetrieveEntity(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_RetrieveEntity_Call { - return &ClientsServiceClient_RetrieveEntity_Call{Call: _e.mock.On("RetrieveEntity", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_RetrieveEntity_Call) Run(run func(ctx context.Context, in *v1.RetrieveEntityReq, opts ...grpc.CallOption)) *ClientsServiceClient_RetrieveEntity_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.RetrieveEntityReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_RetrieveEntity_Call) Return(_a0 *v1.RetrieveEntityRes, _a1 error) *ClientsServiceClient_RetrieveEntity_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_RetrieveEntity_Call) RunAndReturn(run func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) (*v1.RetrieveEntityRes, error)) *ClientsServiceClient_RetrieveEntity_Call { - _c.Call.Return(run) - return _c -} - -// UnsetParentGroupFromClient provides a mock function with given fields: ctx, in, opts -func (_m *ClientsServiceClient) UnsetParentGroupFromClient(ctx context.Context, in *clientsv1.UnsetParentGroupFromClientReq, opts ...grpc.CallOption) (*clientsv1.UnsetParentGroupFromClientRes, 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 UnsetParentGroupFromClient") - } - - var r0 *clientsv1.UnsetParentGroupFromClientRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *clientsv1.UnsetParentGroupFromClientReq, ...grpc.CallOption) (*clientsv1.UnsetParentGroupFromClientRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *clientsv1.UnsetParentGroupFromClientReq, ...grpc.CallOption) *clientsv1.UnsetParentGroupFromClientRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*clientsv1.UnsetParentGroupFromClientRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *clientsv1.UnsetParentGroupFromClientReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// ClientsServiceClient_UnsetParentGroupFromClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnsetParentGroupFromClient' -type ClientsServiceClient_UnsetParentGroupFromClient_Call struct { - *mock.Call -} - -// UnsetParentGroupFromClient is a helper method to define mock.On call -// - ctx context.Context -// - in *clientsv1.UnsetParentGroupFromClientReq -// - opts ...grpc.CallOption -func (_e *ClientsServiceClient_Expecter) UnsetParentGroupFromClient(ctx interface{}, in interface{}, opts ...interface{}) *ClientsServiceClient_UnsetParentGroupFromClient_Call { - return &ClientsServiceClient_UnsetParentGroupFromClient_Call{Call: _e.mock.On("UnsetParentGroupFromClient", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *ClientsServiceClient_UnsetParentGroupFromClient_Call) Run(run func(ctx context.Context, in *clientsv1.UnsetParentGroupFromClientReq, opts ...grpc.CallOption)) *ClientsServiceClient_UnsetParentGroupFromClient_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*clientsv1.UnsetParentGroupFromClientReq), variadicArgs...) - }) - return _c -} - -func (_c *ClientsServiceClient_UnsetParentGroupFromClient_Call) Return(_a0 *clientsv1.UnsetParentGroupFromClientRes, _a1 error) *ClientsServiceClient_UnsetParentGroupFromClient_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *ClientsServiceClient_UnsetParentGroupFromClient_Call) RunAndReturn(run func(context.Context, *clientsv1.UnsetParentGroupFromClientReq, ...grpc.CallOption) (*clientsv1.UnsetParentGroupFromClientRes, error)) *ClientsServiceClient_UnsetParentGroupFromClient_Call { - _c.Call.Return(run) - return _c -} - -// NewClientsServiceClient creates a new instance of ClientsServiceClient. 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 NewClientsServiceClient(t interface { - mock.TestingT - Cleanup(func()) -}) *ClientsServiceClient { - mock := &ClientsServiceClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/domains/mocks/domains_client.go b/domains/mocks/domains_client.go deleted file mode 100644 index 13c42e428..000000000 --- a/domains/mocks/domains_client.go +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Abstract Machines - -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - commonv1 "github.com/absmach/supermq/api/grpc/common/v1" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" - - v1 "github.com/absmach/supermq/api/grpc/domains/v1" -) - -// DomainsServiceClient is an autogenerated mock type for the DomainsServiceClient type -type DomainsServiceClient struct { - mock.Mock -} - -type DomainsServiceClient_Expecter struct { - mock *mock.Mock -} - -func (_m *DomainsServiceClient) EXPECT() *DomainsServiceClient_Expecter { - return &DomainsServiceClient_Expecter{mock: &_m.Mock} -} - -// DeleteUserFromDomains provides a mock function with given fields: ctx, in, opts -func (_m *DomainsServiceClient) DeleteUserFromDomains(ctx context.Context, in *v1.DeleteUserReq, opts ...grpc.CallOption) (*v1.DeleteUserRes, 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 DeleteUserFromDomains") - } - - var r0 *v1.DeleteUserRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteUserReq, ...grpc.CallOption) (*v1.DeleteUserRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.DeleteUserReq, ...grpc.CallOption) *v1.DeleteUserRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.DeleteUserRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.DeleteUserReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DomainsServiceClient_DeleteUserFromDomains_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUserFromDomains' -type DomainsServiceClient_DeleteUserFromDomains_Call struct { - *mock.Call -} - -// DeleteUserFromDomains is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.DeleteUserReq -// - opts ...grpc.CallOption -func (_e *DomainsServiceClient_Expecter) DeleteUserFromDomains(ctx interface{}, in interface{}, opts ...interface{}) *DomainsServiceClient_DeleteUserFromDomains_Call { - return &DomainsServiceClient_DeleteUserFromDomains_Call{Call: _e.mock.On("DeleteUserFromDomains", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *DomainsServiceClient_DeleteUserFromDomains_Call) Run(run func(ctx context.Context, in *v1.DeleteUserReq, opts ...grpc.CallOption)) *DomainsServiceClient_DeleteUserFromDomains_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.DeleteUserReq), variadicArgs...) - }) - return _c -} - -func (_c *DomainsServiceClient_DeleteUserFromDomains_Call) Return(_a0 *v1.DeleteUserRes, _a1 error) *DomainsServiceClient_DeleteUserFromDomains_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *DomainsServiceClient_DeleteUserFromDomains_Call) RunAndReturn(run func(context.Context, *v1.DeleteUserReq, ...grpc.CallOption) (*v1.DeleteUserRes, error)) *DomainsServiceClient_DeleteUserFromDomains_Call { - _c.Call.Return(run) - return _c -} - -// RetrieveEntity provides a mock function with given fields: ctx, in, opts -func (_m *DomainsServiceClient) RetrieveEntity(ctx context.Context, in *commonv1.RetrieveEntityReq, opts ...grpc.CallOption) (*commonv1.RetrieveEntityRes, 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 RetrieveEntity") - } - - var r0 *commonv1.RetrieveEntityRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) (*commonv1.RetrieveEntityRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) *commonv1.RetrieveEntityRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*commonv1.RetrieveEntityRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// DomainsServiceClient_RetrieveEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntity' -type DomainsServiceClient_RetrieveEntity_Call struct { - *mock.Call -} - -// RetrieveEntity is a helper method to define mock.On call -// - ctx context.Context -// - in *commonv1.RetrieveEntityReq -// - opts ...grpc.CallOption -func (_e *DomainsServiceClient_Expecter) RetrieveEntity(ctx interface{}, in interface{}, opts ...interface{}) *DomainsServiceClient_RetrieveEntity_Call { - return &DomainsServiceClient_RetrieveEntity_Call{Call: _e.mock.On("RetrieveEntity", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *DomainsServiceClient_RetrieveEntity_Call) Run(run func(ctx context.Context, in *commonv1.RetrieveEntityReq, opts ...grpc.CallOption)) *DomainsServiceClient_RetrieveEntity_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*commonv1.RetrieveEntityReq), variadicArgs...) - }) - return _c -} - -func (_c *DomainsServiceClient_RetrieveEntity_Call) Return(_a0 *commonv1.RetrieveEntityRes, _a1 error) *DomainsServiceClient_RetrieveEntity_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *DomainsServiceClient_RetrieveEntity_Call) RunAndReturn(run func(context.Context, *commonv1.RetrieveEntityReq, ...grpc.CallOption) (*commonv1.RetrieveEntityRes, error)) *DomainsServiceClient_RetrieveEntity_Call { - _c.Call.Return(run) - return _c -} - -// NewDomainsServiceClient creates a new instance of DomainsServiceClient. 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 NewDomainsServiceClient(t interface { - mock.TestingT - Cleanup(func()) -}) *DomainsServiceClient { - mock := &DomainsServiceClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/go.mod b/go.mod index f09c019f8..bb586c0ab 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.23.4 require ( github.com/0x6flab/namegenerator v1.4.0 github.com/absmach/callhome v0.14.0 - github.com/absmach/certs v0.0.0-20241209153600-91270de67b5a github.com/absmach/supermq v0.16.1-0.20250113091433-3a11b54394b2 github.com/authzed/authzed-go v1.2.1 github.com/authzed/grpcutil v0.0.0-20240123194739-2ea1e3d2d98b @@ -41,6 +40,8 @@ require ( moul.io/http2curl v1.0.0 ) +require github.com/absmach/certs v0.0.0-20241209153600-91270de67b5a // indirect + require ( dario.cat/mergo v1.0.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect diff --git a/groups/mocks/groups_client.go b/groups/mocks/groups_client.go deleted file mode 100644 index d52c008bd..000000000 --- a/groups/mocks/groups_client.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Abstract Machines - -// SPDX-License-Identifier: Apache-2.0 - -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package mocks - -import ( - context "context" - - grpc "google.golang.org/grpc" - - mock "github.com/stretchr/testify/mock" - - v1 "github.com/absmach/supermq/api/grpc/common/v1" -) - -// GroupsServiceClient is an autogenerated mock type for the GroupsServiceClient type -type GroupsServiceClient struct { - mock.Mock -} - -type GroupsServiceClient_Expecter struct { - mock *mock.Mock -} - -func (_m *GroupsServiceClient) EXPECT() *GroupsServiceClient_Expecter { - return &GroupsServiceClient_Expecter{mock: &_m.Mock} -} - -// RetrieveEntity provides a mock function with given fields: ctx, in, opts -func (_m *GroupsServiceClient) RetrieveEntity(ctx context.Context, in *v1.RetrieveEntityReq, opts ...grpc.CallOption) (*v1.RetrieveEntityRes, 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 RetrieveEntity") - } - - var r0 *v1.RetrieveEntityRes - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) (*v1.RetrieveEntityRes, error)); ok { - return rf(ctx, in, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) *v1.RetrieveEntityRes); ok { - r0 = rf(ctx, in, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*v1.RetrieveEntityRes) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) error); ok { - r1 = rf(ctx, in, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// GroupsServiceClient_RetrieveEntity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RetrieveEntity' -type GroupsServiceClient_RetrieveEntity_Call struct { - *mock.Call -} - -// RetrieveEntity is a helper method to define mock.On call -// - ctx context.Context -// - in *v1.RetrieveEntityReq -// - opts ...grpc.CallOption -func (_e *GroupsServiceClient_Expecter) RetrieveEntity(ctx interface{}, in interface{}, opts ...interface{}) *GroupsServiceClient_RetrieveEntity_Call { - return &GroupsServiceClient_RetrieveEntity_Call{Call: _e.mock.On("RetrieveEntity", - append([]interface{}{ctx, in}, opts...)...)} -} - -func (_c *GroupsServiceClient_RetrieveEntity_Call) Run(run func(ctx context.Context, in *v1.RetrieveEntityReq, opts ...grpc.CallOption)) *GroupsServiceClient_RetrieveEntity_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]grpc.CallOption, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(grpc.CallOption) - } - } - run(args[0].(context.Context), args[1].(*v1.RetrieveEntityReq), variadicArgs...) - }) - return _c -} - -func (_c *GroupsServiceClient_RetrieveEntity_Call) Return(_a0 *v1.RetrieveEntityRes, _a1 error) *GroupsServiceClient_RetrieveEntity_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *GroupsServiceClient_RetrieveEntity_Call) RunAndReturn(run func(context.Context, *v1.RetrieveEntityReq, ...grpc.CallOption) (*v1.RetrieveEntityRes, error)) *GroupsServiceClient_RetrieveEntity_Call { - _c.Call.Return(run) - return _c -} - -// NewGroupsServiceClient creates a new instance of GroupsServiceClient. 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 NewGroupsServiceClient(t interface { - mock.TestingT - Cleanup(func()) -}) *GroupsServiceClient { - mock := &GroupsServiceClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/sdk/messages.go b/pkg/sdk/messages.go index 3a14396d7..3dec4cf50 100644 --- a/pkg/sdk/messages.go +++ b/pkg/sdk/messages.go @@ -24,7 +24,7 @@ func (sdk mgSDK) ReadMessages(pm MessagePageMetadata, chanName, domainID, token subtopicPart = fmt.Sprintf("?subtopic=%s", chanNameParts[1]) } - msgURL, err := sdk.withMessageQueryParams(sdk.readersURL, fmt.Sprintf("/%s/channels/%s/messages%s", domainID, chanID, subtopicPart), pm) + msgURL, err := sdk.withMessageQueryParams(sdk.readersURL, fmt.Sprintf("%s/channels/%s/messages%s", domainID, chanID, subtopicPart), pm) if err != nil { return MessagesPage{}, errors.NewSDKError(err) } diff --git a/pkg/sdk/messages_test.go b/pkg/sdk/messages_test.go index 1b772e774..2f7a8d4ca 100644 --- a/pkg/sdk/messages_test.go +++ b/pkg/sdk/messages_test.go @@ -4,7 +4,6 @@ package sdk_test import ( - "fmt" "net/http" "net/http/httptest" "testing" @@ -231,7 +230,6 @@ func TestReadMessages(t *testing.T) { authzCall := channelsGRPCClient.On("Authorize", mock.Anything, mock.Anything).Return(&grpcChannelsV1.AuthzRes{Authorized: true}, tc.authzErr) repoCall := repo.On("ReadAll", channelID, mock.Anything).Return(tc.repoRes, tc.repoErr) response, err := mgsdk.ReadMessages(tc.messagePageMeta, tc.chanName, tc.domainID, tc.token) - fmt.Println(err) assert.Equal(t, tc.err, err) assert.Equal(t, tc.response, response) if tc.err == nil {