diff --git a/.mockery.yaml b/.mockery.yaml new file mode 100644 index 0000000..7e686ce --- /dev/null +++ b/.mockery.yaml @@ -0,0 +1,56 @@ +with-expecter: true +outpkg: "{{.PackageName}}_mocks" +packages: + github.com/infinimesh/proto/eventbus: + interfaces: + EventsServiceClient: + github.com/infinimesh/proto/eventbus/eventbusconnect: + interfaces: + EventsServiceClient: + + github.com/infinimesh/proto/handsfree: + interfaces: + HandsfreeServiceClient: + github.com/infinimesh/proto/handsfree/handsfreeconnect: + interfaces: + HandsfreeServiceClient: + + github.com/infinimesh/proto/node: + interfaces: + AccountsServiceClient: + DevicesServiceClient: + NamespacesServiceClient: + SessionsServiceClient: + ShadowServiceClient: + InternalServiceClient: + + github.com/infinimesh/proto/node/nodeconnect: + interfaces: + AccountsServiceClient: + DevicesServiceClient: + NamespacesServiceClient: + SessionsServiceClient: + ShadowServiceClient: + InternalServiceClient: + + github.com/infinimesh/proto/shadow: + interfaces: + ShadowServiceClient: + ShadowService_StreamShadowServer: + github.com/infinimesh/proto/shadow/shadowconnect: + interfaces: + ShadowServiceClient: + + github.com/infinimesh/proto/plugins: + interfaces: + PluginsServiceClient: + github.com/infinimesh/proto/plugins/pluginsconnect: + interfaces: + PluginsServiceClient: + + github.com/infinimesh/proto/timeseries: + interfaces: + TimeseriesServiceClient: + github.com/infinimesh/proto/timeseries/timeseriesconnect: + interfaces: + TimeseriesServiceClient: diff --git a/go.mod b/go.mod index f3c6bb2..ccd144b 100644 --- a/go.mod +++ b/go.mod @@ -5,16 +5,23 @@ go 1.18 require ( connectrpc.com/connect v1.15.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 + github.com/stretchr/testify v1.8.4 google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe google.golang.org/grpc v1.61.1 google.golang.org/protobuf v1.32.0 ) require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + github.com/stretchr/objx v0.5.0 // indirect golang.org/x/net v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto v0.0.0-20240116215550-a9fa1716bcac // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 3789361..07d0ee5 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,9 @@ connectrpc.com/connect v1.15.0 h1:lFdeCbZrVVDydAqwr4xGV2y+ULn+0Z73s5JBj2LikWo= connectrpc.com/connect v1.15.0/go.mod h1:bQmjpDY8xItMnttnurVgOkHUBMRT9cpsNi2O4AjKhmA= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -7,6 +11,21 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= @@ -26,3 +45,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/mocks/github.com/infinimesh/proto/eventbus/eventbusconnect/mock_EventsServiceClient.go b/mocks/github.com/infinimesh/proto/eventbus/eventbusconnect/mock_EventsServiceClient.go new file mode 100644 index 0000000..f793c04 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/eventbus/eventbusconnect/mock_EventsServiceClient.go @@ -0,0 +1,101 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package eventbusconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + eventbus "github.com/infinimesh/proto/eventbus" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" +) + +// MockEventsServiceClient is an autogenerated mock type for the EventsServiceClient type +type MockEventsServiceClient struct { + mock.Mock +} + +type MockEventsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEventsServiceClient) EXPECT() *MockEventsServiceClient_Expecter { + return &MockEventsServiceClient_Expecter{mock: &_m.Mock} +} + +// Subscribe provides a mock function with given fields: _a0, _a1 +func (_m *MockEventsServiceClient) Subscribe(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage]) (*connect.ServerStreamForClient[eventbus.Event], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Subscribe") + } + + var r0 *connect.ServerStreamForClient[eventbus.Event] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.ServerStreamForClient[eventbus.Event], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) *connect.ServerStreamForClient[eventbus.Event]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.ServerStreamForClient[eventbus.Event]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.EmptyMessage]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEventsServiceClient_Subscribe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Subscribe' +type MockEventsServiceClient_Subscribe_Call struct { + *mock.Call +} + +// Subscribe is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.EmptyMessage] +func (_e *MockEventsServiceClient_Expecter) Subscribe(_a0 interface{}, _a1 interface{}) *MockEventsServiceClient_Subscribe_Call { + return &MockEventsServiceClient_Subscribe_Call{Call: _e.mock.On("Subscribe", _a0, _a1)} +} + +func (_c *MockEventsServiceClient_Subscribe_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage])) *MockEventsServiceClient_Subscribe_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.EmptyMessage])) + }) + return _c +} + +func (_c *MockEventsServiceClient_Subscribe_Call) Return(_a0 *connect.ServerStreamForClient[eventbus.Event], _a1 error) *MockEventsServiceClient_Subscribe_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEventsServiceClient_Subscribe_Call) RunAndReturn(run func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.ServerStreamForClient[eventbus.Event], error)) *MockEventsServiceClient_Subscribe_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEventsServiceClient creates a new instance of MockEventsServiceClient. 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 NewMockEventsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEventsServiceClient { + mock := &MockEventsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/eventbus/mock_EventsServiceClient.go b/mocks/github.com/infinimesh/proto/eventbus/mock_EventsServiceClient.go new file mode 100644 index 0000000..8622deb --- /dev/null +++ b/mocks/github.com/infinimesh/proto/eventbus/mock_EventsServiceClient.go @@ -0,0 +1,115 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package eventbus_mocks + +import ( + context "context" + + eventbus "github.com/infinimesh/proto/eventbus" + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" +) + +// MockEventsServiceClient is an autogenerated mock type for the EventsServiceClient type +type MockEventsServiceClient struct { + mock.Mock +} + +type MockEventsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockEventsServiceClient) EXPECT() *MockEventsServiceClient_Expecter { + return &MockEventsServiceClient_Expecter{mock: &_m.Mock} +} + +// Subscribe provides a mock function with given fields: ctx, in, opts +func (_m *MockEventsServiceClient) Subscribe(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption) (eventbus.EventsService_SubscribeClient, 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 Subscribe") + } + + var r0 eventbus.EventsService_SubscribeClient + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (eventbus.EventsService_SubscribeClient, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) eventbus.EventsService_SubscribeClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(eventbus.EventsService_SubscribeClient) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockEventsServiceClient_Subscribe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Subscribe' +type MockEventsServiceClient_Subscribe_Call struct { + *mock.Call +} + +// Subscribe is a helper method to define mock.On call +// - ctx context.Context +// - in *node.EmptyMessage +// - opts ...grpc.CallOption +func (_e *MockEventsServiceClient_Expecter) Subscribe(ctx interface{}, in interface{}, opts ...interface{}) *MockEventsServiceClient_Subscribe_Call { + return &MockEventsServiceClient_Subscribe_Call{Call: _e.mock.On("Subscribe", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockEventsServiceClient_Subscribe_Call) Run(run func(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption)) *MockEventsServiceClient_Subscribe_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].(*node.EmptyMessage), variadicArgs...) + }) + return _c +} + +func (_c *MockEventsServiceClient_Subscribe_Call) Return(_a0 eventbus.EventsService_SubscribeClient, _a1 error) *MockEventsServiceClient_Subscribe_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockEventsServiceClient_Subscribe_Call) RunAndReturn(run func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (eventbus.EventsService_SubscribeClient, error)) *MockEventsServiceClient_Subscribe_Call { + _c.Call.Return(run) + return _c +} + +// NewMockEventsServiceClient creates a new instance of MockEventsServiceClient. 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 NewMockEventsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockEventsServiceClient { + mock := &MockEventsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/handsfree/handsfreeconnect/mock_HandsfreeServiceClient.go b/mocks/github.com/infinimesh/proto/handsfree/handsfreeconnect/mock_HandsfreeServiceClient.go new file mode 100644 index 0000000..6b3f8d1 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/handsfree/handsfreeconnect/mock_HandsfreeServiceClient.go @@ -0,0 +1,158 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package handsfreeconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + handsfree "github.com/infinimesh/proto/handsfree" + + mock "github.com/stretchr/testify/mock" +) + +// MockHandsfreeServiceClient is an autogenerated mock type for the HandsfreeServiceClient type +type MockHandsfreeServiceClient struct { + mock.Mock +} + +type MockHandsfreeServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockHandsfreeServiceClient) EXPECT() *MockHandsfreeServiceClient_Expecter { + return &MockHandsfreeServiceClient_Expecter{mock: &_m.Mock} +} + +// Connect provides a mock function with given fields: _a0, _a1 +func (_m *MockHandsfreeServiceClient) Connect(_a0 context.Context, _a1 *connect.Request[handsfree.ConnectionRequest]) (*connect.ServerStreamForClient[handsfree.ControlPacket], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Connect") + } + + var r0 *connect.ServerStreamForClient[handsfree.ControlPacket] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[handsfree.ConnectionRequest]) (*connect.ServerStreamForClient[handsfree.ControlPacket], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[handsfree.ConnectionRequest]) *connect.ServerStreamForClient[handsfree.ControlPacket]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.ServerStreamForClient[handsfree.ControlPacket]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[handsfree.ConnectionRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockHandsfreeServiceClient_Connect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connect' +type MockHandsfreeServiceClient_Connect_Call struct { + *mock.Call +} + +// Connect is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[handsfree.ConnectionRequest] +func (_e *MockHandsfreeServiceClient_Expecter) Connect(_a0 interface{}, _a1 interface{}) *MockHandsfreeServiceClient_Connect_Call { + return &MockHandsfreeServiceClient_Connect_Call{Call: _e.mock.On("Connect", _a0, _a1)} +} + +func (_c *MockHandsfreeServiceClient_Connect_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[handsfree.ConnectionRequest])) *MockHandsfreeServiceClient_Connect_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[handsfree.ConnectionRequest])) + }) + return _c +} + +func (_c *MockHandsfreeServiceClient_Connect_Call) Return(_a0 *connect.ServerStreamForClient[handsfree.ControlPacket], _a1 error) *MockHandsfreeServiceClient_Connect_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockHandsfreeServiceClient_Connect_Call) RunAndReturn(run func(context.Context, *connect.Request[handsfree.ConnectionRequest]) (*connect.ServerStreamForClient[handsfree.ControlPacket], error)) *MockHandsfreeServiceClient_Connect_Call { + _c.Call.Return(run) + return _c +} + +// Send provides a mock function with given fields: _a0, _a1 +func (_m *MockHandsfreeServiceClient) Send(_a0 context.Context, _a1 *connect.Request[handsfree.ControlPacket]) (*connect.Response[handsfree.ControlPacket], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Send") + } + + var r0 *connect.Response[handsfree.ControlPacket] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[handsfree.ControlPacket]) (*connect.Response[handsfree.ControlPacket], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[handsfree.ControlPacket]) *connect.Response[handsfree.ControlPacket]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[handsfree.ControlPacket]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[handsfree.ControlPacket]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockHandsfreeServiceClient_Send_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Send' +type MockHandsfreeServiceClient_Send_Call struct { + *mock.Call +} + +// Send is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[handsfree.ControlPacket] +func (_e *MockHandsfreeServiceClient_Expecter) Send(_a0 interface{}, _a1 interface{}) *MockHandsfreeServiceClient_Send_Call { + return &MockHandsfreeServiceClient_Send_Call{Call: _e.mock.On("Send", _a0, _a1)} +} + +func (_c *MockHandsfreeServiceClient_Send_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[handsfree.ControlPacket])) *MockHandsfreeServiceClient_Send_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[handsfree.ControlPacket])) + }) + return _c +} + +func (_c *MockHandsfreeServiceClient_Send_Call) Return(_a0 *connect.Response[handsfree.ControlPacket], _a1 error) *MockHandsfreeServiceClient_Send_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockHandsfreeServiceClient_Send_Call) RunAndReturn(run func(context.Context, *connect.Request[handsfree.ControlPacket]) (*connect.Response[handsfree.ControlPacket], error)) *MockHandsfreeServiceClient_Send_Call { + _c.Call.Return(run) + return _c +} + +// NewMockHandsfreeServiceClient creates a new instance of MockHandsfreeServiceClient. 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 NewMockHandsfreeServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockHandsfreeServiceClient { + mock := &MockHandsfreeServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/handsfree/mock_HandsfreeServiceClient.go b/mocks/github.com/infinimesh/proto/handsfree/mock_HandsfreeServiceClient.go new file mode 100644 index 0000000..1e616cb --- /dev/null +++ b/mocks/github.com/infinimesh/proto/handsfree/mock_HandsfreeServiceClient.go @@ -0,0 +1,188 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package handsfree_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + handsfree "github.com/infinimesh/proto/handsfree" + + mock "github.com/stretchr/testify/mock" +) + +// MockHandsfreeServiceClient is an autogenerated mock type for the HandsfreeServiceClient type +type MockHandsfreeServiceClient struct { + mock.Mock +} + +type MockHandsfreeServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockHandsfreeServiceClient) EXPECT() *MockHandsfreeServiceClient_Expecter { + return &MockHandsfreeServiceClient_Expecter{mock: &_m.Mock} +} + +// Connect provides a mock function with given fields: ctx, in, opts +func (_m *MockHandsfreeServiceClient) Connect(ctx context.Context, in *handsfree.ConnectionRequest, opts ...grpc.CallOption) (handsfree.HandsfreeService_ConnectClient, 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 Connect") + } + + var r0 handsfree.HandsfreeService_ConnectClient + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *handsfree.ConnectionRequest, ...grpc.CallOption) (handsfree.HandsfreeService_ConnectClient, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *handsfree.ConnectionRequest, ...grpc.CallOption) handsfree.HandsfreeService_ConnectClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(handsfree.HandsfreeService_ConnectClient) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *handsfree.ConnectionRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockHandsfreeServiceClient_Connect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Connect' +type MockHandsfreeServiceClient_Connect_Call struct { + *mock.Call +} + +// Connect is a helper method to define mock.On call +// - ctx context.Context +// - in *handsfree.ConnectionRequest +// - opts ...grpc.CallOption +func (_e *MockHandsfreeServiceClient_Expecter) Connect(ctx interface{}, in interface{}, opts ...interface{}) *MockHandsfreeServiceClient_Connect_Call { + return &MockHandsfreeServiceClient_Connect_Call{Call: _e.mock.On("Connect", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockHandsfreeServiceClient_Connect_Call) Run(run func(ctx context.Context, in *handsfree.ConnectionRequest, opts ...grpc.CallOption)) *MockHandsfreeServiceClient_Connect_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].(*handsfree.ConnectionRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockHandsfreeServiceClient_Connect_Call) Return(_a0 handsfree.HandsfreeService_ConnectClient, _a1 error) *MockHandsfreeServiceClient_Connect_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockHandsfreeServiceClient_Connect_Call) RunAndReturn(run func(context.Context, *handsfree.ConnectionRequest, ...grpc.CallOption) (handsfree.HandsfreeService_ConnectClient, error)) *MockHandsfreeServiceClient_Connect_Call { + _c.Call.Return(run) + return _c +} + +// Send provides a mock function with given fields: ctx, in, opts +func (_m *MockHandsfreeServiceClient) Send(ctx context.Context, in *handsfree.ControlPacket, opts ...grpc.CallOption) (*handsfree.ControlPacket, 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 Send") + } + + var r0 *handsfree.ControlPacket + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *handsfree.ControlPacket, ...grpc.CallOption) (*handsfree.ControlPacket, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *handsfree.ControlPacket, ...grpc.CallOption) *handsfree.ControlPacket); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*handsfree.ControlPacket) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *handsfree.ControlPacket, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockHandsfreeServiceClient_Send_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Send' +type MockHandsfreeServiceClient_Send_Call struct { + *mock.Call +} + +// Send is a helper method to define mock.On call +// - ctx context.Context +// - in *handsfree.ControlPacket +// - opts ...grpc.CallOption +func (_e *MockHandsfreeServiceClient_Expecter) Send(ctx interface{}, in interface{}, opts ...interface{}) *MockHandsfreeServiceClient_Send_Call { + return &MockHandsfreeServiceClient_Send_Call{Call: _e.mock.On("Send", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockHandsfreeServiceClient_Send_Call) Run(run func(ctx context.Context, in *handsfree.ControlPacket, opts ...grpc.CallOption)) *MockHandsfreeServiceClient_Send_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].(*handsfree.ControlPacket), variadicArgs...) + }) + return _c +} + +func (_c *MockHandsfreeServiceClient_Send_Call) Return(_a0 *handsfree.ControlPacket, _a1 error) *MockHandsfreeServiceClient_Send_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockHandsfreeServiceClient_Send_Call) RunAndReturn(run func(context.Context, *handsfree.ControlPacket, ...grpc.CallOption) (*handsfree.ControlPacket, error)) *MockHandsfreeServiceClient_Send_Call { + _c.Call.Return(run) + return _c +} + +// NewMockHandsfreeServiceClient creates a new instance of MockHandsfreeServiceClient. 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 NewMockHandsfreeServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockHandsfreeServiceClient { + mock := &MockHandsfreeServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/mock_AccountsServiceClient.go b/mocks/github.com/infinimesh/proto/node/mock_AccountsServiceClient.go new file mode 100644 index 0000000..0a8e2f0 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/mock_AccountsServiceClient.go @@ -0,0 +1,1007 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package node_mocks + +import ( + access "github.com/infinimesh/proto/node/access" + accounts "github.com/infinimesh/proto/node/accounts" + + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + namespaces "github.com/infinimesh/proto/node/namespaces" + + node "github.com/infinimesh/proto/node" +) + +// MockAccountsServiceClient is an autogenerated mock type for the AccountsServiceClient type +type MockAccountsServiceClient struct { + mock.Mock +} + +type MockAccountsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountsServiceClient) EXPECT() *MockAccountsServiceClient_Expecter { + return &MockAccountsServiceClient_Expecter{mock: &_m.Mock} +} + +// Accessibles provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Accessibles(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*access.Nodes, 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 Accessibles") + } + + var r0 *access.Nodes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*access.Nodes, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *access.Nodes); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*access.Nodes) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Accessibles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accessibles' +type MockAccountsServiceClient_Accessibles_Call struct { + *mock.Call +} + +// Accessibles is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Accessibles(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Accessibles_Call { + return &MockAccountsServiceClient_Accessibles_Call{Call: _e.mock.On("Accessibles", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Accessibles_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockAccountsServiceClient_Accessibles_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Accessibles_Call) Return(_a0 *access.Nodes, _a1 error) *MockAccountsServiceClient_Accessibles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Accessibles_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*access.Nodes, error)) *MockAccountsServiceClient_Accessibles_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Create(ctx context.Context, in *accounts.CreateRequest, opts ...grpc.CallOption) (*accounts.CreateResponse, 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 Create") + } + + var r0 *accounts.CreateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *accounts.CreateRequest, ...grpc.CallOption) (*accounts.CreateResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *accounts.CreateRequest, ...grpc.CallOption) *accounts.CreateResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.CreateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *accounts.CreateRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockAccountsServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - in *accounts.CreateRequest +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Create(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Create_Call { + return &MockAccountsServiceClient_Create_Call{Call: _e.mock.On("Create", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Create_Call) Run(run func(ctx context.Context, in *accounts.CreateRequest, opts ...grpc.CallOption)) *MockAccountsServiceClient_Create_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].(*accounts.CreateRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Create_Call) Return(_a0 *accounts.CreateResponse, _a1 error) *MockAccountsServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Create_Call) RunAndReturn(run func(context.Context, *accounts.CreateRequest, ...grpc.CallOption) (*accounts.CreateResponse, error)) *MockAccountsServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// DelCredentials provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) DelCredentials(ctx context.Context, in *node.DeleteCredentialsRequest, opts ...grpc.CallOption) (*node.DeleteResponse, 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 DelCredentials") + } + + var r0 *node.DeleteResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.DeleteCredentialsRequest, ...grpc.CallOption) (*node.DeleteResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.DeleteCredentialsRequest, ...grpc.CallOption) *node.DeleteResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.DeleteResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.DeleteCredentialsRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_DelCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DelCredentials' +type MockAccountsServiceClient_DelCredentials_Call struct { + *mock.Call +} + +// DelCredentials is a helper method to define mock.On call +// - ctx context.Context +// - in *node.DeleteCredentialsRequest +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) DelCredentials(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_DelCredentials_Call { + return &MockAccountsServiceClient_DelCredentials_Call{Call: _e.mock.On("DelCredentials", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_DelCredentials_Call) Run(run func(ctx context.Context, in *node.DeleteCredentialsRequest, opts ...grpc.CallOption)) *MockAccountsServiceClient_DelCredentials_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].(*node.DeleteCredentialsRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_DelCredentials_Call) Return(_a0 *node.DeleteResponse, _a1 error) *MockAccountsServiceClient_DelCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_DelCredentials_Call) RunAndReturn(run func(context.Context, *node.DeleteCredentialsRequest, ...grpc.CallOption) (*node.DeleteResponse, error)) *MockAccountsServiceClient_DelCredentials_Call { + _c.Call.Return(run) + return _c +} + +// Deletables provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Deletables(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption) (*access.Nodes, 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 Deletables") + } + + var r0 *access.Nodes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) (*access.Nodes, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) *access.Nodes); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*access.Nodes) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *accounts.Account, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Deletables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deletables' +type MockAccountsServiceClient_Deletables_Call struct { + *mock.Call +} + +// Deletables is a helper method to define mock.On call +// - ctx context.Context +// - in *accounts.Account +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Deletables(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Deletables_Call { + return &MockAccountsServiceClient_Deletables_Call{Call: _e.mock.On("Deletables", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Deletables_Call) Run(run func(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption)) *MockAccountsServiceClient_Deletables_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].(*accounts.Account), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Deletables_Call) Return(_a0 *access.Nodes, _a1 error) *MockAccountsServiceClient_Deletables_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Deletables_Call) RunAndReturn(run func(context.Context, *accounts.Account, ...grpc.CallOption) (*access.Nodes, error)) *MockAccountsServiceClient_Deletables_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Delete(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption) (*node.DeleteResponse, 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 Delete") + } + + var r0 *node.DeleteResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) (*node.DeleteResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) *node.DeleteResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.DeleteResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *accounts.Account, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockAccountsServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - in *accounts.Account +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Delete(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Delete_Call { + return &MockAccountsServiceClient_Delete_Call{Call: _e.mock.On("Delete", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Delete_Call) Run(run func(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption)) *MockAccountsServiceClient_Delete_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].(*accounts.Account), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Delete_Call) Return(_a0 *node.DeleteResponse, _a1 error) *MockAccountsServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *accounts.Account, ...grpc.CallOption) (*node.DeleteResponse, error)) *MockAccountsServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Get(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption) (*accounts.Account, 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 Get") + } + + var r0 *accounts.Account + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) (*accounts.Account, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) *accounts.Account); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.Account) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *accounts.Account, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockAccountsServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *accounts.Account +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Get_Call { + return &MockAccountsServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Get_Call) Run(run func(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption)) *MockAccountsServiceClient_Get_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].(*accounts.Account), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Get_Call) Return(_a0 *accounts.Account, _a1 error) *MockAccountsServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Get_Call) RunAndReturn(run func(context.Context, *accounts.Account, ...grpc.CallOption) (*accounts.Account, error)) *MockAccountsServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetCredentials provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) GetCredentials(ctx context.Context, in *node.GetCredentialsRequest, opts ...grpc.CallOption) (*node.GetCredentialsResponse, 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 GetCredentials") + } + + var r0 *node.GetCredentialsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.GetCredentialsRequest, ...grpc.CallOption) (*node.GetCredentialsResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.GetCredentialsRequest, ...grpc.CallOption) *node.GetCredentialsResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.GetCredentialsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.GetCredentialsRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_GetCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCredentials' +type MockAccountsServiceClient_GetCredentials_Call struct { + *mock.Call +} + +// GetCredentials is a helper method to define mock.On call +// - ctx context.Context +// - in *node.GetCredentialsRequest +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) GetCredentials(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_GetCredentials_Call { + return &MockAccountsServiceClient_GetCredentials_Call{Call: _e.mock.On("GetCredentials", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_GetCredentials_Call) Run(run func(ctx context.Context, in *node.GetCredentialsRequest, opts ...grpc.CallOption)) *MockAccountsServiceClient_GetCredentials_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].(*node.GetCredentialsRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_GetCredentials_Call) Return(_a0 *node.GetCredentialsResponse, _a1 error) *MockAccountsServiceClient_GetCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_GetCredentials_Call) RunAndReturn(run func(context.Context, *node.GetCredentialsRequest, ...grpc.CallOption) (*node.GetCredentialsResponse, error)) *MockAccountsServiceClient_GetCredentials_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) List(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption) (*accounts.Accounts, 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 List") + } + + var r0 *accounts.Accounts + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*accounts.Accounts, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) *accounts.Accounts); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.Accounts) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockAccountsServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - in *node.EmptyMessage +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) List(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_List_Call { + return &MockAccountsServiceClient_List_Call{Call: _e.mock.On("List", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_List_Call) Run(run func(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption)) *MockAccountsServiceClient_List_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].(*node.EmptyMessage), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_List_Call) Return(_a0 *accounts.Accounts, _a1 error) *MockAccountsServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_List_Call) RunAndReturn(run func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*accounts.Accounts, error)) *MockAccountsServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// Move provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Move(ctx context.Context, in *node.MoveRequest, opts ...grpc.CallOption) (*node.EmptyMessage, 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 Move") + } + + var r0 *node.EmptyMessage + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.MoveRequest, ...grpc.CallOption) (*node.EmptyMessage, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.MoveRequest, ...grpc.CallOption) *node.EmptyMessage); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.EmptyMessage) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.MoveRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move' +type MockAccountsServiceClient_Move_Call struct { + *mock.Call +} + +// Move is a helper method to define mock.On call +// - ctx context.Context +// - in *node.MoveRequest +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Move(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Move_Call { + return &MockAccountsServiceClient_Move_Call{Call: _e.mock.On("Move", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Move_Call) Run(run func(ctx context.Context, in *node.MoveRequest, opts ...grpc.CallOption)) *MockAccountsServiceClient_Move_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].(*node.MoveRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Move_Call) Return(_a0 *node.EmptyMessage, _a1 error) *MockAccountsServiceClient_Move_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Move_Call) RunAndReturn(run func(context.Context, *node.MoveRequest, ...grpc.CallOption) (*node.EmptyMessage, error)) *MockAccountsServiceClient_Move_Call { + _c.Call.Return(run) + return _c +} + +// SetCredentials provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) SetCredentials(ctx context.Context, in *node.SetCredentialsRequest, opts ...grpc.CallOption) (*node.SetCredentialsResponse, 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 SetCredentials") + } + + var r0 *node.SetCredentialsResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.SetCredentialsRequest, ...grpc.CallOption) (*node.SetCredentialsResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.SetCredentialsRequest, ...grpc.CallOption) *node.SetCredentialsResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.SetCredentialsResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.SetCredentialsRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_SetCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCredentials' +type MockAccountsServiceClient_SetCredentials_Call struct { + *mock.Call +} + +// SetCredentials is a helper method to define mock.On call +// - ctx context.Context +// - in *node.SetCredentialsRequest +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) SetCredentials(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_SetCredentials_Call { + return &MockAccountsServiceClient_SetCredentials_Call{Call: _e.mock.On("SetCredentials", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_SetCredentials_Call) Run(run func(ctx context.Context, in *node.SetCredentialsRequest, opts ...grpc.CallOption)) *MockAccountsServiceClient_SetCredentials_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].(*node.SetCredentialsRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_SetCredentials_Call) Return(_a0 *node.SetCredentialsResponse, _a1 error) *MockAccountsServiceClient_SetCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_SetCredentials_Call) RunAndReturn(run func(context.Context, *node.SetCredentialsRequest, ...grpc.CallOption) (*node.SetCredentialsResponse, error)) *MockAccountsServiceClient_SetCredentials_Call { + _c.Call.Return(run) + return _c +} + +// Toggle provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Toggle(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption) (*accounts.Account, 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 Toggle") + } + + var r0 *accounts.Account + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) (*accounts.Account, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) *accounts.Account); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.Account) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *accounts.Account, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Toggle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Toggle' +type MockAccountsServiceClient_Toggle_Call struct { + *mock.Call +} + +// Toggle is a helper method to define mock.On call +// - ctx context.Context +// - in *accounts.Account +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Toggle(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Toggle_Call { + return &MockAccountsServiceClient_Toggle_Call{Call: _e.mock.On("Toggle", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Toggle_Call) Run(run func(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption)) *MockAccountsServiceClient_Toggle_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].(*accounts.Account), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Toggle_Call) Return(_a0 *accounts.Account, _a1 error) *MockAccountsServiceClient_Toggle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Toggle_Call) RunAndReturn(run func(context.Context, *accounts.Account, ...grpc.CallOption) (*accounts.Account, error)) *MockAccountsServiceClient_Toggle_Call { + _c.Call.Return(run) + return _c +} + +// Token provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Token(ctx context.Context, in *node.TokenRequest, opts ...grpc.CallOption) (*node.TokenResponse, 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 Token") + } + + var r0 *node.TokenResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.TokenRequest, ...grpc.CallOption) (*node.TokenResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.TokenRequest, ...grpc.CallOption) *node.TokenResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.TokenResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.TokenRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Token_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Token' +type MockAccountsServiceClient_Token_Call struct { + *mock.Call +} + +// Token is a helper method to define mock.On call +// - ctx context.Context +// - in *node.TokenRequest +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Token(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Token_Call { + return &MockAccountsServiceClient_Token_Call{Call: _e.mock.On("Token", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Token_Call) Run(run func(ctx context.Context, in *node.TokenRequest, opts ...grpc.CallOption)) *MockAccountsServiceClient_Token_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].(*node.TokenRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Token_Call) Return(_a0 *node.TokenResponse, _a1 error) *MockAccountsServiceClient_Token_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Token_Call) RunAndReturn(run func(context.Context, *node.TokenRequest, ...grpc.CallOption) (*node.TokenResponse, error)) *MockAccountsServiceClient_Token_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, in, opts +func (_m *MockAccountsServiceClient) Update(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption) (*accounts.Account, 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 Update") + } + + var r0 *accounts.Account + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) (*accounts.Account, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *accounts.Account, ...grpc.CallOption) *accounts.Account); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.Account) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *accounts.Account, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockAccountsServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - in *accounts.Account +// - opts ...grpc.CallOption +func (_e *MockAccountsServiceClient_Expecter) Update(ctx interface{}, in interface{}, opts ...interface{}) *MockAccountsServiceClient_Update_Call { + return &MockAccountsServiceClient_Update_Call{Call: _e.mock.On("Update", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockAccountsServiceClient_Update_Call) Run(run func(ctx context.Context, in *accounts.Account, opts ...grpc.CallOption)) *MockAccountsServiceClient_Update_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].(*accounts.Account), variadicArgs...) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Update_Call) Return(_a0 *accounts.Account, _a1 error) *MockAccountsServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Update_Call) RunAndReturn(run func(context.Context, *accounts.Account, ...grpc.CallOption) (*accounts.Account, error)) *MockAccountsServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountsServiceClient creates a new instance of MockAccountsServiceClient. 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 NewMockAccountsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountsServiceClient { + mock := &MockAccountsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/mock_DevicesServiceClient.go b/mocks/github.com/infinimesh/proto/node/mock_DevicesServiceClient.go new file mode 100644 index 0000000..108a7d8 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/mock_DevicesServiceClient.go @@ -0,0 +1,1080 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package node_mocks + +import ( + context "context" + + access "github.com/infinimesh/proto/node/access" + + devices "github.com/infinimesh/proto/node/devices" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" +) + +// MockDevicesServiceClient is an autogenerated mock type for the DevicesServiceClient type +type MockDevicesServiceClient struct { + mock.Mock +} + +type MockDevicesServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDevicesServiceClient) EXPECT() *MockDevicesServiceClient_Expecter { + return &MockDevicesServiceClient_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Create(ctx context.Context, in *devices.CreateRequest, opts ...grpc.CallOption) (*devices.CreateResponse, 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 Create") + } + + var r0 *devices.CreateResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.CreateRequest, ...grpc.CallOption) (*devices.CreateResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.CreateRequest, ...grpc.CallOption) *devices.CreateResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.CreateResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.CreateRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockDevicesServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.CreateRequest +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Create(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Create_Call { + return &MockDevicesServiceClient_Create_Call{Call: _e.mock.On("Create", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Create_Call) Run(run func(ctx context.Context, in *devices.CreateRequest, opts ...grpc.CallOption)) *MockDevicesServiceClient_Create_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].(*devices.CreateRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Create_Call) Return(_a0 *devices.CreateResponse, _a1 error) *MockDevicesServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Create_Call) RunAndReturn(run func(context.Context, *devices.CreateRequest, ...grpc.CallOption) (*devices.CreateResponse, error)) *MockDevicesServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Delete(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*node.DeleteResponse, 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 Delete") + } + + var r0 *node.DeleteResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*node.DeleteResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *node.DeleteResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.DeleteResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockDevicesServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Delete(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Delete_Call { + return &MockDevicesServiceClient_Delete_Call{Call: _e.mock.On("Delete", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Delete_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_Delete_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Delete_Call) Return(_a0 *node.DeleteResponse, _a1 error) *MockDevicesServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*node.DeleteResponse, error)) *MockDevicesServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Get(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*devices.Device, 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 Get") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockDevicesServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Get_Call { + return &MockDevicesServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Get_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_Get_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Get_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Get_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByFingerprint provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) GetByFingerprint(ctx context.Context, in *devices.GetByFingerprintRequest, opts ...grpc.CallOption) (*devices.Device, 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 GetByFingerprint") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.GetByFingerprintRequest, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.GetByFingerprintRequest, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.GetByFingerprintRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_GetByFingerprint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByFingerprint' +type MockDevicesServiceClient_GetByFingerprint_Call struct { + *mock.Call +} + +// GetByFingerprint is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.GetByFingerprintRequest +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) GetByFingerprint(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_GetByFingerprint_Call { + return &MockDevicesServiceClient_GetByFingerprint_Call{Call: _e.mock.On("GetByFingerprint", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_GetByFingerprint_Call) Run(run func(ctx context.Context, in *devices.GetByFingerprintRequest, opts ...grpc.CallOption)) *MockDevicesServiceClient_GetByFingerprint_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].(*devices.GetByFingerprintRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_GetByFingerprint_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_GetByFingerprint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_GetByFingerprint_Call) RunAndReturn(run func(context.Context, *devices.GetByFingerprintRequest, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_GetByFingerprint_Call { + _c.Call.Return(run) + return _c +} + +// GetByToken provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) GetByToken(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*devices.Device, 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 GetByToken") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_GetByToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByToken' +type MockDevicesServiceClient_GetByToken_Call struct { + *mock.Call +} + +// GetByToken is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) GetByToken(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_GetByToken_Call { + return &MockDevicesServiceClient_GetByToken_Call{Call: _e.mock.On("GetByToken", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_GetByToken_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_GetByToken_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_GetByToken_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_GetByToken_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_GetByToken_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_GetByToken_Call { + _c.Call.Return(run) + return _c +} + +// Join provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Join(ctx context.Context, in *node.JoinGeneralRequest, opts ...grpc.CallOption) (*access.Node, 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 Join") + } + + var r0 *access.Node + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.JoinGeneralRequest, ...grpc.CallOption) (*access.Node, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.JoinGeneralRequest, ...grpc.CallOption) *access.Node); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*access.Node) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.JoinGeneralRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Join_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Join' +type MockDevicesServiceClient_Join_Call struct { + *mock.Call +} + +// Join is a helper method to define mock.On call +// - ctx context.Context +// - in *node.JoinGeneralRequest +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Join(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Join_Call { + return &MockDevicesServiceClient_Join_Call{Call: _e.mock.On("Join", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Join_Call) Run(run func(ctx context.Context, in *node.JoinGeneralRequest, opts ...grpc.CallOption)) *MockDevicesServiceClient_Join_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].(*node.JoinGeneralRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Join_Call) Return(_a0 *access.Node, _a1 error) *MockDevicesServiceClient_Join_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Join_Call) RunAndReturn(run func(context.Context, *node.JoinGeneralRequest, ...grpc.CallOption) (*access.Node, error)) *MockDevicesServiceClient_Join_Call { + _c.Call.Return(run) + return _c +} + +// Joins provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Joins(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*access.Nodes, 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 Joins") + } + + var r0 *access.Nodes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*access.Nodes, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *access.Nodes); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*access.Nodes) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Joins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Joins' +type MockDevicesServiceClient_Joins_Call struct { + *mock.Call +} + +// Joins is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Joins(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Joins_Call { + return &MockDevicesServiceClient_Joins_Call{Call: _e.mock.On("Joins", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Joins_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_Joins_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Joins_Call) Return(_a0 *access.Nodes, _a1 error) *MockDevicesServiceClient_Joins_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Joins_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*access.Nodes, error)) *MockDevicesServiceClient_Joins_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) List(ctx context.Context, in *node.QueryRequest, opts ...grpc.CallOption) (*devices.Devices, 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 List") + } + + var r0 *devices.Devices + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.QueryRequest, ...grpc.CallOption) (*devices.Devices, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.QueryRequest, ...grpc.CallOption) *devices.Devices); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Devices) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.QueryRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockDevicesServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - in *node.QueryRequest +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) List(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_List_Call { + return &MockDevicesServiceClient_List_Call{Call: _e.mock.On("List", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_List_Call) Run(run func(ctx context.Context, in *node.QueryRequest, opts ...grpc.CallOption)) *MockDevicesServiceClient_List_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].(*node.QueryRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_List_Call) Return(_a0 *devices.Devices, _a1 error) *MockDevicesServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_List_Call) RunAndReturn(run func(context.Context, *node.QueryRequest, ...grpc.CallOption) (*devices.Devices, error)) *MockDevicesServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// MakeDevicesToken provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) MakeDevicesToken(ctx context.Context, in *node.DevicesTokenRequest, opts ...grpc.CallOption) (*node.TokenResponse, 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 MakeDevicesToken") + } + + var r0 *node.TokenResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.DevicesTokenRequest, ...grpc.CallOption) (*node.TokenResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.DevicesTokenRequest, ...grpc.CallOption) *node.TokenResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.TokenResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.DevicesTokenRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_MakeDevicesToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MakeDevicesToken' +type MockDevicesServiceClient_MakeDevicesToken_Call struct { + *mock.Call +} + +// MakeDevicesToken is a helper method to define mock.On call +// - ctx context.Context +// - in *node.DevicesTokenRequest +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) MakeDevicesToken(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_MakeDevicesToken_Call { + return &MockDevicesServiceClient_MakeDevicesToken_Call{Call: _e.mock.On("MakeDevicesToken", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_MakeDevicesToken_Call) Run(run func(ctx context.Context, in *node.DevicesTokenRequest, opts ...grpc.CallOption)) *MockDevicesServiceClient_MakeDevicesToken_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].(*node.DevicesTokenRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_MakeDevicesToken_Call) Return(_a0 *node.TokenResponse, _a1 error) *MockDevicesServiceClient_MakeDevicesToken_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_MakeDevicesToken_Call) RunAndReturn(run func(context.Context, *node.DevicesTokenRequest, ...grpc.CallOption) (*node.TokenResponse, error)) *MockDevicesServiceClient_MakeDevicesToken_Call { + _c.Call.Return(run) + return _c +} + +// Move provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Move(ctx context.Context, in *node.MoveRequest, opts ...grpc.CallOption) (*node.EmptyMessage, 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 Move") + } + + var r0 *node.EmptyMessage + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.MoveRequest, ...grpc.CallOption) (*node.EmptyMessage, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.MoveRequest, ...grpc.CallOption) *node.EmptyMessage); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.EmptyMessage) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.MoveRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move' +type MockDevicesServiceClient_Move_Call struct { + *mock.Call +} + +// Move is a helper method to define mock.On call +// - ctx context.Context +// - in *node.MoveRequest +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Move(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Move_Call { + return &MockDevicesServiceClient_Move_Call{Call: _e.mock.On("Move", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Move_Call) Run(run func(ctx context.Context, in *node.MoveRequest, opts ...grpc.CallOption)) *MockDevicesServiceClient_Move_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].(*node.MoveRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Move_Call) Return(_a0 *node.EmptyMessage, _a1 error) *MockDevicesServiceClient_Move_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Move_Call) RunAndReturn(run func(context.Context, *node.MoveRequest, ...grpc.CallOption) (*node.EmptyMessage, error)) *MockDevicesServiceClient_Move_Call { + _c.Call.Return(run) + return _c +} + +// PatchConfig provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) PatchConfig(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*devices.Device, 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 PatchConfig") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_PatchConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchConfig' +type MockDevicesServiceClient_PatchConfig_Call struct { + *mock.Call +} + +// PatchConfig is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) PatchConfig(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_PatchConfig_Call { + return &MockDevicesServiceClient_PatchConfig_Call{Call: _e.mock.On("PatchConfig", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_PatchConfig_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_PatchConfig_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_PatchConfig_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_PatchConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_PatchConfig_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_PatchConfig_Call { + _c.Call.Return(run) + return _c +} + +// Toggle provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Toggle(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*devices.Device, 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 Toggle") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Toggle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Toggle' +type MockDevicesServiceClient_Toggle_Call struct { + *mock.Call +} + +// Toggle is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Toggle(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Toggle_Call { + return &MockDevicesServiceClient_Toggle_Call{Call: _e.mock.On("Toggle", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Toggle_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_Toggle_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Toggle_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_Toggle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Toggle_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_Toggle_Call { + _c.Call.Return(run) + return _c +} + +// ToggleBasic provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) ToggleBasic(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*devices.Device, 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 ToggleBasic") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_ToggleBasic_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ToggleBasic' +type MockDevicesServiceClient_ToggleBasic_Call struct { + *mock.Call +} + +// ToggleBasic is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) ToggleBasic(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_ToggleBasic_Call { + return &MockDevicesServiceClient_ToggleBasic_Call{Call: _e.mock.On("ToggleBasic", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_ToggleBasic_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_ToggleBasic_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_ToggleBasic_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_ToggleBasic_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_ToggleBasic_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_ToggleBasic_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, in, opts +func (_m *MockDevicesServiceClient) Update(ctx context.Context, in *devices.Device, opts ...grpc.CallOption) (*devices.Device, 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 Update") + } + + var r0 *devices.Device + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *devices.Device, ...grpc.CallOption) *devices.Device); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*devices.Device) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *devices.Device, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockDevicesServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - in *devices.Device +// - opts ...grpc.CallOption +func (_e *MockDevicesServiceClient_Expecter) Update(ctx interface{}, in interface{}, opts ...interface{}) *MockDevicesServiceClient_Update_Call { + return &MockDevicesServiceClient_Update_Call{Call: _e.mock.On("Update", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockDevicesServiceClient_Update_Call) Run(run func(ctx context.Context, in *devices.Device, opts ...grpc.CallOption)) *MockDevicesServiceClient_Update_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].(*devices.Device), variadicArgs...) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Update_Call) Return(_a0 *devices.Device, _a1 error) *MockDevicesServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Update_Call) RunAndReturn(run func(context.Context, *devices.Device, ...grpc.CallOption) (*devices.Device, error)) *MockDevicesServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockDevicesServiceClient creates a new instance of MockDevicesServiceClient. 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 NewMockDevicesServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDevicesServiceClient { + mock := &MockDevicesServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/mock_InternalServiceClient.go b/mocks/github.com/infinimesh/proto/node/mock_InternalServiceClient.go new file mode 100644 index 0000000..645a785 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/mock_InternalServiceClient.go @@ -0,0 +1,114 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package node_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" +) + +// MockInternalServiceClient is an autogenerated mock type for the InternalServiceClient type +type MockInternalServiceClient struct { + mock.Mock +} + +type MockInternalServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInternalServiceClient) EXPECT() *MockInternalServiceClient_Expecter { + return &MockInternalServiceClient_Expecter{mock: &_m.Mock} +} + +// GetLDAPProviders provides a mock function with given fields: ctx, in, opts +func (_m *MockInternalServiceClient) GetLDAPProviders(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption) (*node.LDAPProviders, 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 GetLDAPProviders") + } + + var r0 *node.LDAPProviders + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*node.LDAPProviders, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) *node.LDAPProviders); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.LDAPProviders) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockInternalServiceClient_GetLDAPProviders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLDAPProviders' +type MockInternalServiceClient_GetLDAPProviders_Call struct { + *mock.Call +} + +// GetLDAPProviders is a helper method to define mock.On call +// - ctx context.Context +// - in *node.EmptyMessage +// - opts ...grpc.CallOption +func (_e *MockInternalServiceClient_Expecter) GetLDAPProviders(ctx interface{}, in interface{}, opts ...interface{}) *MockInternalServiceClient_GetLDAPProviders_Call { + return &MockInternalServiceClient_GetLDAPProviders_Call{Call: _e.mock.On("GetLDAPProviders", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockInternalServiceClient_GetLDAPProviders_Call) Run(run func(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption)) *MockInternalServiceClient_GetLDAPProviders_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].(*node.EmptyMessage), variadicArgs...) + }) + return _c +} + +func (_c *MockInternalServiceClient_GetLDAPProviders_Call) Return(_a0 *node.LDAPProviders, _a1 error) *MockInternalServiceClient_GetLDAPProviders_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockInternalServiceClient_GetLDAPProviders_Call) RunAndReturn(run func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*node.LDAPProviders, error)) *MockInternalServiceClient_GetLDAPProviders_Call { + _c.Call.Return(run) + return _c +} + +// NewMockInternalServiceClient creates a new instance of MockInternalServiceClient. 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 NewMockInternalServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInternalServiceClient { + mock := &MockInternalServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/mock_NamespacesServiceClient.go b/mocks/github.com/infinimesh/proto/node/mock_NamespacesServiceClient.go new file mode 100644 index 0000000..18349c5 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/mock_NamespacesServiceClient.go @@ -0,0 +1,711 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package node_mocks + +import ( + access "github.com/infinimesh/proto/node/access" + accounts "github.com/infinimesh/proto/node/accounts" + + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + namespaces "github.com/infinimesh/proto/node/namespaces" + + node "github.com/infinimesh/proto/node" +) + +// MockNamespacesServiceClient is an autogenerated mock type for the NamespacesServiceClient type +type MockNamespacesServiceClient struct { + mock.Mock +} + +type MockNamespacesServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockNamespacesServiceClient) EXPECT() *MockNamespacesServiceClient_Expecter { + return &MockNamespacesServiceClient_Expecter{mock: &_m.Mock} +} + +// Accessibles provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Accessibles(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*access.Nodes, 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 Accessibles") + } + + var r0 *access.Nodes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*access.Nodes, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *access.Nodes); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*access.Nodes) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Accessibles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accessibles' +type MockNamespacesServiceClient_Accessibles_Call struct { + *mock.Call +} + +// Accessibles is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Accessibles(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Accessibles_Call { + return &MockNamespacesServiceClient_Accessibles_Call{Call: _e.mock.On("Accessibles", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Accessibles_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Accessibles_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Accessibles_Call) Return(_a0 *access.Nodes, _a1 error) *MockNamespacesServiceClient_Accessibles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Accessibles_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*access.Nodes, error)) *MockNamespacesServiceClient_Accessibles_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Create(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*namespaces.Namespace, 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 Create") + } + + var r0 *namespaces.Namespace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*namespaces.Namespace, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *namespaces.Namespace); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*namespaces.Namespace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockNamespacesServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Create(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Create_Call { + return &MockNamespacesServiceClient_Create_Call{Call: _e.mock.On("Create", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Create_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Create_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Create_Call) Return(_a0 *namespaces.Namespace, _a1 error) *MockNamespacesServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Create_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*namespaces.Namespace, error)) *MockNamespacesServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// Deletables provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Deletables(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*access.Nodes, 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 Deletables") + } + + var r0 *access.Nodes + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*access.Nodes, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *access.Nodes); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*access.Nodes) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Deletables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deletables' +type MockNamespacesServiceClient_Deletables_Call struct { + *mock.Call +} + +// Deletables is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Deletables(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Deletables_Call { + return &MockNamespacesServiceClient_Deletables_Call{Call: _e.mock.On("Deletables", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Deletables_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Deletables_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Deletables_Call) Return(_a0 *access.Nodes, _a1 error) *MockNamespacesServiceClient_Deletables_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Deletables_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*access.Nodes, error)) *MockNamespacesServiceClient_Deletables_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Delete(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*node.DeleteResponse, 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 Delete") + } + + var r0 *node.DeleteResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*node.DeleteResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *node.DeleteResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.DeleteResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockNamespacesServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Delete(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Delete_Call { + return &MockNamespacesServiceClient_Delete_Call{Call: _e.mock.On("Delete", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Delete_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Delete_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Delete_Call) Return(_a0 *node.DeleteResponse, _a1 error) *MockNamespacesServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*node.DeleteResponse, error)) *MockNamespacesServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Get(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*namespaces.Namespace, 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 Get") + } + + var r0 *namespaces.Namespace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*namespaces.Namespace, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *namespaces.Namespace); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*namespaces.Namespace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockNamespacesServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Get_Call { + return &MockNamespacesServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Get_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Get_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Get_Call) Return(_a0 *namespaces.Namespace, _a1 error) *MockNamespacesServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Get_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*namespaces.Namespace, error)) *MockNamespacesServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// Join provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Join(ctx context.Context, in *node.JoinRequest, opts ...grpc.CallOption) (*accounts.Accounts, 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 Join") + } + + var r0 *accounts.Accounts + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.JoinRequest, ...grpc.CallOption) (*accounts.Accounts, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.JoinRequest, ...grpc.CallOption) *accounts.Accounts); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.Accounts) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.JoinRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Join_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Join' +type MockNamespacesServiceClient_Join_Call struct { + *mock.Call +} + +// Join is a helper method to define mock.On call +// - ctx context.Context +// - in *node.JoinRequest +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Join(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Join_Call { + return &MockNamespacesServiceClient_Join_Call{Call: _e.mock.On("Join", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Join_Call) Run(run func(ctx context.Context, in *node.JoinRequest, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Join_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].(*node.JoinRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Join_Call) Return(_a0 *accounts.Accounts, _a1 error) *MockNamespacesServiceClient_Join_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Join_Call) RunAndReturn(run func(context.Context, *node.JoinRequest, ...grpc.CallOption) (*accounts.Accounts, error)) *MockNamespacesServiceClient_Join_Call { + _c.Call.Return(run) + return _c +} + +// Joins provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Joins(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*accounts.Accounts, 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 Joins") + } + + var r0 *accounts.Accounts + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*accounts.Accounts, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *accounts.Accounts); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*accounts.Accounts) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Joins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Joins' +type MockNamespacesServiceClient_Joins_Call struct { + *mock.Call +} + +// Joins is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Joins(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Joins_Call { + return &MockNamespacesServiceClient_Joins_Call{Call: _e.mock.On("Joins", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Joins_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Joins_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Joins_Call) Return(_a0 *accounts.Accounts, _a1 error) *MockNamespacesServiceClient_Joins_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Joins_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*accounts.Accounts, error)) *MockNamespacesServiceClient_Joins_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) List(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption) (*namespaces.Namespaces, 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 List") + } + + var r0 *namespaces.Namespaces + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*namespaces.Namespaces, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) *namespaces.Namespaces); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*namespaces.Namespaces) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockNamespacesServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - in *node.EmptyMessage +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) List(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_List_Call { + return &MockNamespacesServiceClient_List_Call{Call: _e.mock.On("List", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_List_Call) Run(run func(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption)) *MockNamespacesServiceClient_List_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].(*node.EmptyMessage), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_List_Call) Return(_a0 *namespaces.Namespaces, _a1 error) *MockNamespacesServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_List_Call) RunAndReturn(run func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*namespaces.Namespaces, error)) *MockNamespacesServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, in, opts +func (_m *MockNamespacesServiceClient) Update(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption) (*namespaces.Namespace, 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 Update") + } + + var r0 *namespaces.Namespace + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*namespaces.Namespace, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) *namespaces.Namespace); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*namespaces.Namespace) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *namespaces.Namespace, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockNamespacesServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - in *namespaces.Namespace +// - opts ...grpc.CallOption +func (_e *MockNamespacesServiceClient_Expecter) Update(ctx interface{}, in interface{}, opts ...interface{}) *MockNamespacesServiceClient_Update_Call { + return &MockNamespacesServiceClient_Update_Call{Call: _e.mock.On("Update", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockNamespacesServiceClient_Update_Call) Run(run func(ctx context.Context, in *namespaces.Namespace, opts ...grpc.CallOption)) *MockNamespacesServiceClient_Update_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].(*namespaces.Namespace), variadicArgs...) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Update_Call) Return(_a0 *namespaces.Namespace, _a1 error) *MockNamespacesServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Update_Call) RunAndReturn(run func(context.Context, *namespaces.Namespace, ...grpc.CallOption) (*namespaces.Namespace, error)) *MockNamespacesServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockNamespacesServiceClient creates a new instance of MockNamespacesServiceClient. 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 NewMockNamespacesServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockNamespacesServiceClient { + mock := &MockNamespacesServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/mock_SessionsServiceClient.go b/mocks/github.com/infinimesh/proto/node/mock_SessionsServiceClient.go new file mode 100644 index 0000000..bdaf102 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/mock_SessionsServiceClient.go @@ -0,0 +1,264 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package node_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" + + sessions "github.com/infinimesh/proto/node/sessions" +) + +// MockSessionsServiceClient is an autogenerated mock type for the SessionsServiceClient type +type MockSessionsServiceClient struct { + mock.Mock +} + +type MockSessionsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSessionsServiceClient) EXPECT() *MockSessionsServiceClient_Expecter { + return &MockSessionsServiceClient_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockSessionsServiceClient) Get(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption) (*sessions.Sessions, 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 Get") + } + + var r0 *sessions.Sessions + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*sessions.Sessions, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) *sessions.Sessions); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sessions.Sessions) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSessionsServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockSessionsServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *node.EmptyMessage +// - opts ...grpc.CallOption +func (_e *MockSessionsServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockSessionsServiceClient_Get_Call { + return &MockSessionsServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockSessionsServiceClient_Get_Call) Run(run func(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption)) *MockSessionsServiceClient_Get_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].(*node.EmptyMessage), variadicArgs...) + }) + return _c +} + +func (_c *MockSessionsServiceClient_Get_Call) Return(_a0 *sessions.Sessions, _a1 error) *MockSessionsServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSessionsServiceClient_Get_Call) RunAndReturn(run func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*sessions.Sessions, error)) *MockSessionsServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetActivity provides a mock function with given fields: ctx, in, opts +func (_m *MockSessionsServiceClient) GetActivity(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption) (*sessions.Activity, 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 GetActivity") + } + + var r0 *sessions.Activity + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*sessions.Activity, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) *sessions.Activity); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*sessions.Activity) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *node.EmptyMessage, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSessionsServiceClient_GetActivity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActivity' +type MockSessionsServiceClient_GetActivity_Call struct { + *mock.Call +} + +// GetActivity is a helper method to define mock.On call +// - ctx context.Context +// - in *node.EmptyMessage +// - opts ...grpc.CallOption +func (_e *MockSessionsServiceClient_Expecter) GetActivity(ctx interface{}, in interface{}, opts ...interface{}) *MockSessionsServiceClient_GetActivity_Call { + return &MockSessionsServiceClient_GetActivity_Call{Call: _e.mock.On("GetActivity", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockSessionsServiceClient_GetActivity_Call) Run(run func(ctx context.Context, in *node.EmptyMessage, opts ...grpc.CallOption)) *MockSessionsServiceClient_GetActivity_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].(*node.EmptyMessage), variadicArgs...) + }) + return _c +} + +func (_c *MockSessionsServiceClient_GetActivity_Call) Return(_a0 *sessions.Activity, _a1 error) *MockSessionsServiceClient_GetActivity_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSessionsServiceClient_GetActivity_Call) RunAndReturn(run func(context.Context, *node.EmptyMessage, ...grpc.CallOption) (*sessions.Activity, error)) *MockSessionsServiceClient_GetActivity_Call { + _c.Call.Return(run) + return _c +} + +// Revoke provides a mock function with given fields: ctx, in, opts +func (_m *MockSessionsServiceClient) Revoke(ctx context.Context, in *sessions.Session, opts ...grpc.CallOption) (*node.DeleteResponse, 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 Revoke") + } + + var r0 *node.DeleteResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *sessions.Session, ...grpc.CallOption) (*node.DeleteResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *sessions.Session, ...grpc.CallOption) *node.DeleteResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*node.DeleteResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *sessions.Session, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSessionsServiceClient_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke' +type MockSessionsServiceClient_Revoke_Call struct { + *mock.Call +} + +// Revoke is a helper method to define mock.On call +// - ctx context.Context +// - in *sessions.Session +// - opts ...grpc.CallOption +func (_e *MockSessionsServiceClient_Expecter) Revoke(ctx interface{}, in interface{}, opts ...interface{}) *MockSessionsServiceClient_Revoke_Call { + return &MockSessionsServiceClient_Revoke_Call{Call: _e.mock.On("Revoke", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockSessionsServiceClient_Revoke_Call) Run(run func(ctx context.Context, in *sessions.Session, opts ...grpc.CallOption)) *MockSessionsServiceClient_Revoke_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].(*sessions.Session), variadicArgs...) + }) + return _c +} + +func (_c *MockSessionsServiceClient_Revoke_Call) Return(_a0 *node.DeleteResponse, _a1 error) *MockSessionsServiceClient_Revoke_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSessionsServiceClient_Revoke_Call) RunAndReturn(run func(context.Context, *sessions.Session, ...grpc.CallOption) (*node.DeleteResponse, error)) *MockSessionsServiceClient_Revoke_Call { + _c.Call.Return(run) + return _c +} + +// NewMockSessionsServiceClient creates a new instance of MockSessionsServiceClient. 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 NewMockSessionsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSessionsServiceClient { + mock := &MockSessionsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/mock_ShadowServiceClient.go b/mocks/github.com/infinimesh/proto/node/mock_ShadowServiceClient.go new file mode 100644 index 0000000..7b5ddcb --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/mock_ShadowServiceClient.go @@ -0,0 +1,412 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package node_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" + + shadow "github.com/infinimesh/proto/shadow" +) + +// MockShadowServiceClient is an autogenerated mock type for the ShadowServiceClient type +type MockShadowServiceClient struct { + mock.Mock +} + +type MockShadowServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockShadowServiceClient) EXPECT() *MockShadowServiceClient_Expecter { + return &MockShadowServiceClient_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) Get(ctx context.Context, in *shadow.GetRequest, opts ...grpc.CallOption) (*shadow.GetResponse, 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 Get") + } + + var r0 *shadow.GetResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.GetRequest, ...grpc.CallOption) (*shadow.GetResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.GetRequest, ...grpc.CallOption) *shadow.GetResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shadow.GetResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.GetRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockShadowServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.GetRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_Get_Call { + return &MockShadowServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_Get_Call) Run(run func(ctx context.Context, in *shadow.GetRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_Get_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].(*shadow.GetRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) Return(_a0 *shadow.GetResponse, _a1 error) *MockShadowServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) RunAndReturn(run func(context.Context, *shadow.GetRequest, ...grpc.CallOption) (*shadow.GetResponse, error)) *MockShadowServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) Patch(ctx context.Context, in *shadow.Shadow, opts ...grpc.CallOption) (*shadow.Shadow, 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 Patch") + } + + var r0 *shadow.Shadow + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.Shadow, ...grpc.CallOption) (*shadow.Shadow, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.Shadow, ...grpc.CallOption) *shadow.Shadow); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shadow.Shadow) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.Shadow, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockShadowServiceClient_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.Shadow +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) Patch(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_Patch_Call { + return &MockShadowServiceClient_Patch_Call{Call: _e.mock.On("Patch", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_Patch_Call) Run(run func(ctx context.Context, in *shadow.Shadow, opts ...grpc.CallOption)) *MockShadowServiceClient_Patch_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].(*shadow.Shadow), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) Return(_a0 *shadow.Shadow, _a1 error) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) RunAndReturn(run func(context.Context, *shadow.Shadow, ...grpc.CallOption) (*shadow.Shadow, error)) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) Remove(ctx context.Context, in *shadow.RemoveRequest, opts ...grpc.CallOption) (*shadow.Shadow, 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 Remove") + } + + var r0 *shadow.Shadow + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) (*shadow.Shadow, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) *shadow.Shadow); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shadow.Shadow) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type MockShadowServiceClient_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.RemoveRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) Remove(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_Remove_Call { + return &MockShadowServiceClient_Remove_Call{Call: _e.mock.On("Remove", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_Remove_Call) Run(run func(ctx context.Context, in *shadow.RemoveRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_Remove_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].(*shadow.RemoveRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) Return(_a0 *shadow.Shadow, _a1 error) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) RunAndReturn(run func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) (*shadow.Shadow, error)) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(run) + return _c +} + +// StreamShadow provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) StreamShadow(ctx context.Context, in *shadow.StreamShadowRequest, opts ...grpc.CallOption) (node.ShadowService_StreamShadowClient, 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 StreamShadow") + } + + var r0 node.ShadowService_StreamShadowClient + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) (node.ShadowService_StreamShadowClient, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) node.ShadowService_StreamShadowClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(node.ShadowService_StreamShadowClient) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_StreamShadow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StreamShadow' +type MockShadowServiceClient_StreamShadow_Call struct { + *mock.Call +} + +// StreamShadow is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.StreamShadowRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) StreamShadow(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_StreamShadow_Call { + return &MockShadowServiceClient_StreamShadow_Call{Call: _e.mock.On("StreamShadow", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Run(run func(ctx context.Context, in *shadow.StreamShadowRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_StreamShadow_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].(*shadow.StreamShadowRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Return(_a0 node.ShadowService_StreamShadowClient, _a1 error) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) RunAndReturn(run func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) (node.ShadowService_StreamShadowClient, error)) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(run) + return _c +} + +// StreamShadowSync provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) StreamShadowSync(ctx context.Context, in *shadow.StreamShadowRequest, opts ...grpc.CallOption) (node.ShadowService_StreamShadowSyncClient, 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 StreamShadowSync") + } + + var r0 node.ShadowService_StreamShadowSyncClient + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) (node.ShadowService_StreamShadowSyncClient, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) node.ShadowService_StreamShadowSyncClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(node.ShadowService_StreamShadowSyncClient) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_StreamShadowSync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StreamShadowSync' +type MockShadowServiceClient_StreamShadowSync_Call struct { + *mock.Call +} + +// StreamShadowSync is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.StreamShadowRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) StreamShadowSync(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_StreamShadowSync_Call { + return &MockShadowServiceClient_StreamShadowSync_Call{Call: _e.mock.On("StreamShadowSync", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_StreamShadowSync_Call) Run(run func(ctx context.Context, in *shadow.StreamShadowRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_StreamShadowSync_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].(*shadow.StreamShadowRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadowSync_Call) Return(_a0 node.ShadowService_StreamShadowSyncClient, _a1 error) *MockShadowServiceClient_StreamShadowSync_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadowSync_Call) RunAndReturn(run func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) (node.ShadowService_StreamShadowSyncClient, error)) *MockShadowServiceClient_StreamShadowSync_Call { + _c.Call.Return(run) + return _c +} + +// NewMockShadowServiceClient creates a new instance of MockShadowServiceClient. 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 NewMockShadowServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockShadowServiceClient { + mock := &MockShadowServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_AccountsServiceClient.go b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_AccountsServiceClient.go new file mode 100644 index 0000000..b853a1c --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_AccountsServiceClient.go @@ -0,0 +1,812 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package nodeconnect_mocks + +import ( + access "github.com/infinimesh/proto/node/access" + accounts "github.com/infinimesh/proto/node/accounts" + + connect "connectrpc.com/connect" + + context "context" + + mock "github.com/stretchr/testify/mock" + + namespaces "github.com/infinimesh/proto/node/namespaces" + + node "github.com/infinimesh/proto/node" +) + +// MockAccountsServiceClient is an autogenerated mock type for the AccountsServiceClient type +type MockAccountsServiceClient struct { + mock.Mock +} + +type MockAccountsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockAccountsServiceClient) EXPECT() *MockAccountsServiceClient_Expecter { + return &MockAccountsServiceClient_Expecter{mock: &_m.Mock} +} + +// Accessibles provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Accessibles(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Accessibles") + } + + var r0 *connect.Response[access.Nodes] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[access.Nodes]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[access.Nodes]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Accessibles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accessibles' +type MockAccountsServiceClient_Accessibles_Call struct { + *mock.Call +} + +// Accessibles is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockAccountsServiceClient_Expecter) Accessibles(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Accessibles_Call { + return &MockAccountsServiceClient_Accessibles_Call{Call: _e.mock.On("Accessibles", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Accessibles_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockAccountsServiceClient_Accessibles_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Accessibles_Call) Return(_a0 *connect.Response[access.Nodes], _a1 error) *MockAccountsServiceClient_Accessibles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Accessibles_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error)) *MockAccountsServiceClient_Accessibles_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Create(_a0 context.Context, _a1 *connect.Request[accounts.CreateRequest]) (*connect.Response[accounts.CreateResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *connect.Response[accounts.CreateResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.CreateRequest]) (*connect.Response[accounts.CreateResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.CreateRequest]) *connect.Response[accounts.CreateResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.CreateResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[accounts.CreateRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockAccountsServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[accounts.CreateRequest] +func (_e *MockAccountsServiceClient_Expecter) Create(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Create_Call { + return &MockAccountsServiceClient_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Create_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[accounts.CreateRequest])) *MockAccountsServiceClient_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[accounts.CreateRequest])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Create_Call) Return(_a0 *connect.Response[accounts.CreateResponse], _a1 error) *MockAccountsServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Create_Call) RunAndReturn(run func(context.Context, *connect.Request[accounts.CreateRequest]) (*connect.Response[accounts.CreateResponse], error)) *MockAccountsServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// DelCredentials provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) DelCredentials(_a0 context.Context, _a1 *connect.Request[node.DeleteCredentialsRequest]) (*connect.Response[node.DeleteResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for DelCredentials") + } + + var r0 *connect.Response[node.DeleteResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.DeleteCredentialsRequest]) (*connect.Response[node.DeleteResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.DeleteCredentialsRequest]) *connect.Response[node.DeleteResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.DeleteResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.DeleteCredentialsRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_DelCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DelCredentials' +type MockAccountsServiceClient_DelCredentials_Call struct { + *mock.Call +} + +// DelCredentials is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.DeleteCredentialsRequest] +func (_e *MockAccountsServiceClient_Expecter) DelCredentials(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_DelCredentials_Call { + return &MockAccountsServiceClient_DelCredentials_Call{Call: _e.mock.On("DelCredentials", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_DelCredentials_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.DeleteCredentialsRequest])) *MockAccountsServiceClient_DelCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.DeleteCredentialsRequest])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_DelCredentials_Call) Return(_a0 *connect.Response[node.DeleteResponse], _a1 error) *MockAccountsServiceClient_DelCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_DelCredentials_Call) RunAndReturn(run func(context.Context, *connect.Request[node.DeleteCredentialsRequest]) (*connect.Response[node.DeleteResponse], error)) *MockAccountsServiceClient_DelCredentials_Call { + _c.Call.Return(run) + return _c +} + +// Deletables provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Deletables(_a0 context.Context, _a1 *connect.Request[accounts.Account]) (*connect.Response[access.Nodes], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Deletables") + } + + var r0 *connect.Response[access.Nodes] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[access.Nodes], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) *connect.Response[access.Nodes]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[access.Nodes]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[accounts.Account]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Deletables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deletables' +type MockAccountsServiceClient_Deletables_Call struct { + *mock.Call +} + +// Deletables is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[accounts.Account] +func (_e *MockAccountsServiceClient_Expecter) Deletables(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Deletables_Call { + return &MockAccountsServiceClient_Deletables_Call{Call: _e.mock.On("Deletables", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Deletables_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[accounts.Account])) *MockAccountsServiceClient_Deletables_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[accounts.Account])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Deletables_Call) Return(_a0 *connect.Response[access.Nodes], _a1 error) *MockAccountsServiceClient_Deletables_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Deletables_Call) RunAndReturn(run func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[access.Nodes], error)) *MockAccountsServiceClient_Deletables_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Delete(_a0 context.Context, _a1 *connect.Request[accounts.Account]) (*connect.Response[node.DeleteResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *connect.Response[node.DeleteResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[node.DeleteResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) *connect.Response[node.DeleteResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.DeleteResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[accounts.Account]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockAccountsServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[accounts.Account] +func (_e *MockAccountsServiceClient_Expecter) Delete(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Delete_Call { + return &MockAccountsServiceClient_Delete_Call{Call: _e.mock.On("Delete", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Delete_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[accounts.Account])) *MockAccountsServiceClient_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[accounts.Account])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Delete_Call) Return(_a0 *connect.Response[node.DeleteResponse], _a1 error) *MockAccountsServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[node.DeleteResponse], error)) *MockAccountsServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Get(_a0 context.Context, _a1 *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[accounts.Account] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) *connect.Response[accounts.Account]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.Account]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[accounts.Account]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockAccountsServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[accounts.Account] +func (_e *MockAccountsServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Get_Call { + return &MockAccountsServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[accounts.Account])) *MockAccountsServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[accounts.Account])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Get_Call) Return(_a0 *connect.Response[accounts.Account], _a1 error) *MockAccountsServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error)) *MockAccountsServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetCredentials provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) GetCredentials(_a0 context.Context, _a1 *connect.Request[node.GetCredentialsRequest]) (*connect.Response[node.GetCredentialsResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for GetCredentials") + } + + var r0 *connect.Response[node.GetCredentialsResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.GetCredentialsRequest]) (*connect.Response[node.GetCredentialsResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.GetCredentialsRequest]) *connect.Response[node.GetCredentialsResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.GetCredentialsResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.GetCredentialsRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_GetCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCredentials' +type MockAccountsServiceClient_GetCredentials_Call struct { + *mock.Call +} + +// GetCredentials is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.GetCredentialsRequest] +func (_e *MockAccountsServiceClient_Expecter) GetCredentials(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_GetCredentials_Call { + return &MockAccountsServiceClient_GetCredentials_Call{Call: _e.mock.On("GetCredentials", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_GetCredentials_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.GetCredentialsRequest])) *MockAccountsServiceClient_GetCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.GetCredentialsRequest])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_GetCredentials_Call) Return(_a0 *connect.Response[node.GetCredentialsResponse], _a1 error) *MockAccountsServiceClient_GetCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_GetCredentials_Call) RunAndReturn(run func(context.Context, *connect.Request[node.GetCredentialsRequest]) (*connect.Response[node.GetCredentialsResponse], error)) *MockAccountsServiceClient_GetCredentials_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) List(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage]) (*connect.Response[accounts.Accounts], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 *connect.Response[accounts.Accounts] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[accounts.Accounts], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) *connect.Response[accounts.Accounts]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.Accounts]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.EmptyMessage]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockAccountsServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.EmptyMessage] +func (_e *MockAccountsServiceClient_Expecter) List(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_List_Call { + return &MockAccountsServiceClient_List_Call{Call: _e.mock.On("List", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_List_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage])) *MockAccountsServiceClient_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.EmptyMessage])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_List_Call) Return(_a0 *connect.Response[accounts.Accounts], _a1 error) *MockAccountsServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_List_Call) RunAndReturn(run func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[accounts.Accounts], error)) *MockAccountsServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// Move provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Move(_a0 context.Context, _a1 *connect.Request[node.MoveRequest]) (*connect.Response[node.EmptyMessage], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Move") + } + + var r0 *connect.Response[node.EmptyMessage] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.MoveRequest]) (*connect.Response[node.EmptyMessage], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.MoveRequest]) *connect.Response[node.EmptyMessage]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.EmptyMessage]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.MoveRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move' +type MockAccountsServiceClient_Move_Call struct { + *mock.Call +} + +// Move is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.MoveRequest] +func (_e *MockAccountsServiceClient_Expecter) Move(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Move_Call { + return &MockAccountsServiceClient_Move_Call{Call: _e.mock.On("Move", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Move_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.MoveRequest])) *MockAccountsServiceClient_Move_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.MoveRequest])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Move_Call) Return(_a0 *connect.Response[node.EmptyMessage], _a1 error) *MockAccountsServiceClient_Move_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Move_Call) RunAndReturn(run func(context.Context, *connect.Request[node.MoveRequest]) (*connect.Response[node.EmptyMessage], error)) *MockAccountsServiceClient_Move_Call { + _c.Call.Return(run) + return _c +} + +// SetCredentials provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) SetCredentials(_a0 context.Context, _a1 *connect.Request[node.SetCredentialsRequest]) (*connect.Response[node.SetCredentialsResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for SetCredentials") + } + + var r0 *connect.Response[node.SetCredentialsResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.SetCredentialsRequest]) (*connect.Response[node.SetCredentialsResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.SetCredentialsRequest]) *connect.Response[node.SetCredentialsResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.SetCredentialsResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.SetCredentialsRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_SetCredentials_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCredentials' +type MockAccountsServiceClient_SetCredentials_Call struct { + *mock.Call +} + +// SetCredentials is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.SetCredentialsRequest] +func (_e *MockAccountsServiceClient_Expecter) SetCredentials(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_SetCredentials_Call { + return &MockAccountsServiceClient_SetCredentials_Call{Call: _e.mock.On("SetCredentials", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_SetCredentials_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.SetCredentialsRequest])) *MockAccountsServiceClient_SetCredentials_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.SetCredentialsRequest])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_SetCredentials_Call) Return(_a0 *connect.Response[node.SetCredentialsResponse], _a1 error) *MockAccountsServiceClient_SetCredentials_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_SetCredentials_Call) RunAndReturn(run func(context.Context, *connect.Request[node.SetCredentialsRequest]) (*connect.Response[node.SetCredentialsResponse], error)) *MockAccountsServiceClient_SetCredentials_Call { + _c.Call.Return(run) + return _c +} + +// Toggle provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Toggle(_a0 context.Context, _a1 *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Toggle") + } + + var r0 *connect.Response[accounts.Account] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) *connect.Response[accounts.Account]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.Account]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[accounts.Account]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Toggle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Toggle' +type MockAccountsServiceClient_Toggle_Call struct { + *mock.Call +} + +// Toggle is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[accounts.Account] +func (_e *MockAccountsServiceClient_Expecter) Toggle(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Toggle_Call { + return &MockAccountsServiceClient_Toggle_Call{Call: _e.mock.On("Toggle", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Toggle_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[accounts.Account])) *MockAccountsServiceClient_Toggle_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[accounts.Account])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Toggle_Call) Return(_a0 *connect.Response[accounts.Account], _a1 error) *MockAccountsServiceClient_Toggle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Toggle_Call) RunAndReturn(run func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error)) *MockAccountsServiceClient_Toggle_Call { + _c.Call.Return(run) + return _c +} + +// Token provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Token(_a0 context.Context, _a1 *connect.Request[node.TokenRequest]) (*connect.Response[node.TokenResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Token") + } + + var r0 *connect.Response[node.TokenResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.TokenRequest]) (*connect.Response[node.TokenResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.TokenRequest]) *connect.Response[node.TokenResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.TokenResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.TokenRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Token_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Token' +type MockAccountsServiceClient_Token_Call struct { + *mock.Call +} + +// Token is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.TokenRequest] +func (_e *MockAccountsServiceClient_Expecter) Token(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Token_Call { + return &MockAccountsServiceClient_Token_Call{Call: _e.mock.On("Token", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Token_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.TokenRequest])) *MockAccountsServiceClient_Token_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.TokenRequest])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Token_Call) Return(_a0 *connect.Response[node.TokenResponse], _a1 error) *MockAccountsServiceClient_Token_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Token_Call) RunAndReturn(run func(context.Context, *connect.Request[node.TokenRequest]) (*connect.Response[node.TokenResponse], error)) *MockAccountsServiceClient_Token_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: _a0, _a1 +func (_m *MockAccountsServiceClient) Update(_a0 context.Context, _a1 *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *connect.Response[accounts.Account] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[accounts.Account]) *connect.Response[accounts.Account]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.Account]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[accounts.Account]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockAccountsServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockAccountsServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[accounts.Account] +func (_e *MockAccountsServiceClient_Expecter) Update(_a0 interface{}, _a1 interface{}) *MockAccountsServiceClient_Update_Call { + return &MockAccountsServiceClient_Update_Call{Call: _e.mock.On("Update", _a0, _a1)} +} + +func (_c *MockAccountsServiceClient_Update_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[accounts.Account])) *MockAccountsServiceClient_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[accounts.Account])) + }) + return _c +} + +func (_c *MockAccountsServiceClient_Update_Call) Return(_a0 *connect.Response[accounts.Account], _a1 error) *MockAccountsServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockAccountsServiceClient_Update_Call) RunAndReturn(run func(context.Context, *connect.Request[accounts.Account]) (*connect.Response[accounts.Account], error)) *MockAccountsServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockAccountsServiceClient creates a new instance of MockAccountsServiceClient. 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 NewMockAccountsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockAccountsServiceClient { + mock := &MockAccountsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_DevicesServiceClient.go b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_DevicesServiceClient.go new file mode 100644 index 0000000..c301b4d --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_DevicesServiceClient.go @@ -0,0 +1,869 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package nodeconnect_mocks + +import ( + connect "connectrpc.com/connect" + access "github.com/infinimesh/proto/node/access" + + context "context" + + devices "github.com/infinimesh/proto/node/devices" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" +) + +// MockDevicesServiceClient is an autogenerated mock type for the DevicesServiceClient type +type MockDevicesServiceClient struct { + mock.Mock +} + +type MockDevicesServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockDevicesServiceClient) EXPECT() *MockDevicesServiceClient_Expecter { + return &MockDevicesServiceClient_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Create(_a0 context.Context, _a1 *connect.Request[devices.CreateRequest]) (*connect.Response[devices.CreateResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *connect.Response[devices.CreateResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.CreateRequest]) (*connect.Response[devices.CreateResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.CreateRequest]) *connect.Response[devices.CreateResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.CreateResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.CreateRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockDevicesServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.CreateRequest] +func (_e *MockDevicesServiceClient_Expecter) Create(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Create_Call { + return &MockDevicesServiceClient_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Create_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.CreateRequest])) *MockDevicesServiceClient_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.CreateRequest])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Create_Call) Return(_a0 *connect.Response[devices.CreateResponse], _a1 error) *MockDevicesServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Create_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.CreateRequest]) (*connect.Response[devices.CreateResponse], error)) *MockDevicesServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Delete(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[node.DeleteResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *connect.Response[node.DeleteResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[node.DeleteResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[node.DeleteResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.DeleteResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockDevicesServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) Delete(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Delete_Call { + return &MockDevicesServiceClient_Delete_Call{Call: _e.mock.On("Delete", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Delete_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Delete_Call) Return(_a0 *connect.Response[node.DeleteResponse], _a1 error) *MockDevicesServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[node.DeleteResponse], error)) *MockDevicesServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Get(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockDevicesServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Get_Call { + return &MockDevicesServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Get_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetByFingerprint provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) GetByFingerprint(_a0 context.Context, _a1 *connect.Request[devices.GetByFingerprintRequest]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for GetByFingerprint") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.GetByFingerprintRequest]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.GetByFingerprintRequest]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.GetByFingerprintRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_GetByFingerprint_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByFingerprint' +type MockDevicesServiceClient_GetByFingerprint_Call struct { + *mock.Call +} + +// GetByFingerprint is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.GetByFingerprintRequest] +func (_e *MockDevicesServiceClient_Expecter) GetByFingerprint(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_GetByFingerprint_Call { + return &MockDevicesServiceClient_GetByFingerprint_Call{Call: _e.mock.On("GetByFingerprint", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_GetByFingerprint_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.GetByFingerprintRequest])) *MockDevicesServiceClient_GetByFingerprint_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.GetByFingerprintRequest])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_GetByFingerprint_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_GetByFingerprint_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_GetByFingerprint_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.GetByFingerprintRequest]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_GetByFingerprint_Call { + _c.Call.Return(run) + return _c +} + +// GetByToken provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) GetByToken(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for GetByToken") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_GetByToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetByToken' +type MockDevicesServiceClient_GetByToken_Call struct { + *mock.Call +} + +// GetByToken is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) GetByToken(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_GetByToken_Call { + return &MockDevicesServiceClient_GetByToken_Call{Call: _e.mock.On("GetByToken", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_GetByToken_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_GetByToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_GetByToken_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_GetByToken_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_GetByToken_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_GetByToken_Call { + _c.Call.Return(run) + return _c +} + +// Join provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Join(_a0 context.Context, _a1 *connect.Request[node.JoinGeneralRequest]) (*connect.Response[access.Node], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Join") + } + + var r0 *connect.Response[access.Node] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.JoinGeneralRequest]) (*connect.Response[access.Node], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.JoinGeneralRequest]) *connect.Response[access.Node]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[access.Node]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.JoinGeneralRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Join_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Join' +type MockDevicesServiceClient_Join_Call struct { + *mock.Call +} + +// Join is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.JoinGeneralRequest] +func (_e *MockDevicesServiceClient_Expecter) Join(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Join_Call { + return &MockDevicesServiceClient_Join_Call{Call: _e.mock.On("Join", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Join_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.JoinGeneralRequest])) *MockDevicesServiceClient_Join_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.JoinGeneralRequest])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Join_Call) Return(_a0 *connect.Response[access.Node], _a1 error) *MockDevicesServiceClient_Join_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Join_Call) RunAndReturn(run func(context.Context, *connect.Request[node.JoinGeneralRequest]) (*connect.Response[access.Node], error)) *MockDevicesServiceClient_Join_Call { + _c.Call.Return(run) + return _c +} + +// Joins provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Joins(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[access.Nodes], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Joins") + } + + var r0 *connect.Response[access.Nodes] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[access.Nodes], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[access.Nodes]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[access.Nodes]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Joins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Joins' +type MockDevicesServiceClient_Joins_Call struct { + *mock.Call +} + +// Joins is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) Joins(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Joins_Call { + return &MockDevicesServiceClient_Joins_Call{Call: _e.mock.On("Joins", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Joins_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_Joins_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Joins_Call) Return(_a0 *connect.Response[access.Nodes], _a1 error) *MockDevicesServiceClient_Joins_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Joins_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[access.Nodes], error)) *MockDevicesServiceClient_Joins_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) List(_a0 context.Context, _a1 *connect.Request[node.QueryRequest]) (*connect.Response[devices.Devices], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 *connect.Response[devices.Devices] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.QueryRequest]) (*connect.Response[devices.Devices], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.QueryRequest]) *connect.Response[devices.Devices]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Devices]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.QueryRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockDevicesServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.QueryRequest] +func (_e *MockDevicesServiceClient_Expecter) List(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_List_Call { + return &MockDevicesServiceClient_List_Call{Call: _e.mock.On("List", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_List_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.QueryRequest])) *MockDevicesServiceClient_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.QueryRequest])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_List_Call) Return(_a0 *connect.Response[devices.Devices], _a1 error) *MockDevicesServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_List_Call) RunAndReturn(run func(context.Context, *connect.Request[node.QueryRequest]) (*connect.Response[devices.Devices], error)) *MockDevicesServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// MakeDevicesToken provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) MakeDevicesToken(_a0 context.Context, _a1 *connect.Request[node.DevicesTokenRequest]) (*connect.Response[node.TokenResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for MakeDevicesToken") + } + + var r0 *connect.Response[node.TokenResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.DevicesTokenRequest]) (*connect.Response[node.TokenResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.DevicesTokenRequest]) *connect.Response[node.TokenResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.TokenResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.DevicesTokenRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_MakeDevicesToken_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MakeDevicesToken' +type MockDevicesServiceClient_MakeDevicesToken_Call struct { + *mock.Call +} + +// MakeDevicesToken is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.DevicesTokenRequest] +func (_e *MockDevicesServiceClient_Expecter) MakeDevicesToken(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_MakeDevicesToken_Call { + return &MockDevicesServiceClient_MakeDevicesToken_Call{Call: _e.mock.On("MakeDevicesToken", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_MakeDevicesToken_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.DevicesTokenRequest])) *MockDevicesServiceClient_MakeDevicesToken_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.DevicesTokenRequest])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_MakeDevicesToken_Call) Return(_a0 *connect.Response[node.TokenResponse], _a1 error) *MockDevicesServiceClient_MakeDevicesToken_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_MakeDevicesToken_Call) RunAndReturn(run func(context.Context, *connect.Request[node.DevicesTokenRequest]) (*connect.Response[node.TokenResponse], error)) *MockDevicesServiceClient_MakeDevicesToken_Call { + _c.Call.Return(run) + return _c +} + +// Move provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Move(_a0 context.Context, _a1 *connect.Request[node.MoveRequest]) (*connect.Response[node.EmptyMessage], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Move") + } + + var r0 *connect.Response[node.EmptyMessage] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.MoveRequest]) (*connect.Response[node.EmptyMessage], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.MoveRequest]) *connect.Response[node.EmptyMessage]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.EmptyMessage]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.MoveRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Move_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Move' +type MockDevicesServiceClient_Move_Call struct { + *mock.Call +} + +// Move is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.MoveRequest] +func (_e *MockDevicesServiceClient_Expecter) Move(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Move_Call { + return &MockDevicesServiceClient_Move_Call{Call: _e.mock.On("Move", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Move_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.MoveRequest])) *MockDevicesServiceClient_Move_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.MoveRequest])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Move_Call) Return(_a0 *connect.Response[node.EmptyMessage], _a1 error) *MockDevicesServiceClient_Move_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Move_Call) RunAndReturn(run func(context.Context, *connect.Request[node.MoveRequest]) (*connect.Response[node.EmptyMessage], error)) *MockDevicesServiceClient_Move_Call { + _c.Call.Return(run) + return _c +} + +// PatchConfig provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) PatchConfig(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for PatchConfig") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_PatchConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PatchConfig' +type MockDevicesServiceClient_PatchConfig_Call struct { + *mock.Call +} + +// PatchConfig is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) PatchConfig(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_PatchConfig_Call { + return &MockDevicesServiceClient_PatchConfig_Call{Call: _e.mock.On("PatchConfig", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_PatchConfig_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_PatchConfig_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_PatchConfig_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_PatchConfig_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_PatchConfig_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_PatchConfig_Call { + _c.Call.Return(run) + return _c +} + +// Toggle provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Toggle(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Toggle") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Toggle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Toggle' +type MockDevicesServiceClient_Toggle_Call struct { + *mock.Call +} + +// Toggle is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) Toggle(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Toggle_Call { + return &MockDevicesServiceClient_Toggle_Call{Call: _e.mock.On("Toggle", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Toggle_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_Toggle_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Toggle_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_Toggle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Toggle_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_Toggle_Call { + _c.Call.Return(run) + return _c +} + +// ToggleBasic provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) ToggleBasic(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for ToggleBasic") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_ToggleBasic_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ToggleBasic' +type MockDevicesServiceClient_ToggleBasic_Call struct { + *mock.Call +} + +// ToggleBasic is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) ToggleBasic(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_ToggleBasic_Call { + return &MockDevicesServiceClient_ToggleBasic_Call{Call: _e.mock.On("ToggleBasic", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_ToggleBasic_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_ToggleBasic_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_ToggleBasic_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_ToggleBasic_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_ToggleBasic_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_ToggleBasic_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: _a0, _a1 +func (_m *MockDevicesServiceClient) Update(_a0 context.Context, _a1 *connect.Request[devices.Device]) (*connect.Response[devices.Device], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *connect.Response[devices.Device] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[devices.Device]) *connect.Response[devices.Device]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[devices.Device]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[devices.Device]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockDevicesServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockDevicesServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[devices.Device] +func (_e *MockDevicesServiceClient_Expecter) Update(_a0 interface{}, _a1 interface{}) *MockDevicesServiceClient_Update_Call { + return &MockDevicesServiceClient_Update_Call{Call: _e.mock.On("Update", _a0, _a1)} +} + +func (_c *MockDevicesServiceClient_Update_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[devices.Device])) *MockDevicesServiceClient_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[devices.Device])) + }) + return _c +} + +func (_c *MockDevicesServiceClient_Update_Call) Return(_a0 *connect.Response[devices.Device], _a1 error) *MockDevicesServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockDevicesServiceClient_Update_Call) RunAndReturn(run func(context.Context, *connect.Request[devices.Device]) (*connect.Response[devices.Device], error)) *MockDevicesServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockDevicesServiceClient creates a new instance of MockDevicesServiceClient. 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 NewMockDevicesServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockDevicesServiceClient { + mock := &MockDevicesServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_InternalServiceClient.go b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_InternalServiceClient.go new file mode 100644 index 0000000..8042e0a --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_InternalServiceClient.go @@ -0,0 +1,99 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package nodeconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" +) + +// MockInternalServiceClient is an autogenerated mock type for the InternalServiceClient type +type MockInternalServiceClient struct { + mock.Mock +} + +type MockInternalServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockInternalServiceClient) EXPECT() *MockInternalServiceClient_Expecter { + return &MockInternalServiceClient_Expecter{mock: &_m.Mock} +} + +// GetLDAPProviders provides a mock function with given fields: _a0, _a1 +func (_m *MockInternalServiceClient) GetLDAPProviders(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage]) (*connect.Response[node.LDAPProviders], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for GetLDAPProviders") + } + + var r0 *connect.Response[node.LDAPProviders] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[node.LDAPProviders], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) *connect.Response[node.LDAPProviders]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.LDAPProviders]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.EmptyMessage]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockInternalServiceClient_GetLDAPProviders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLDAPProviders' +type MockInternalServiceClient_GetLDAPProviders_Call struct { + *mock.Call +} + +// GetLDAPProviders is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.EmptyMessage] +func (_e *MockInternalServiceClient_Expecter) GetLDAPProviders(_a0 interface{}, _a1 interface{}) *MockInternalServiceClient_GetLDAPProviders_Call { + return &MockInternalServiceClient_GetLDAPProviders_Call{Call: _e.mock.On("GetLDAPProviders", _a0, _a1)} +} + +func (_c *MockInternalServiceClient_GetLDAPProviders_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage])) *MockInternalServiceClient_GetLDAPProviders_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.EmptyMessage])) + }) + return _c +} + +func (_c *MockInternalServiceClient_GetLDAPProviders_Call) Return(_a0 *connect.Response[node.LDAPProviders], _a1 error) *MockInternalServiceClient_GetLDAPProviders_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockInternalServiceClient_GetLDAPProviders_Call) RunAndReturn(run func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[node.LDAPProviders], error)) *MockInternalServiceClient_GetLDAPProviders_Call { + _c.Call.Return(run) + return _c +} + +// NewMockInternalServiceClient creates a new instance of MockInternalServiceClient. 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 NewMockInternalServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockInternalServiceClient { + mock := &MockInternalServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_NamespacesServiceClient.go b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_NamespacesServiceClient.go new file mode 100644 index 0000000..c92e1d7 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_NamespacesServiceClient.go @@ -0,0 +1,576 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package nodeconnect_mocks + +import ( + access "github.com/infinimesh/proto/node/access" + accounts "github.com/infinimesh/proto/node/accounts" + + connect "connectrpc.com/connect" + + context "context" + + mock "github.com/stretchr/testify/mock" + + namespaces "github.com/infinimesh/proto/node/namespaces" + + node "github.com/infinimesh/proto/node" +) + +// MockNamespacesServiceClient is an autogenerated mock type for the NamespacesServiceClient type +type MockNamespacesServiceClient struct { + mock.Mock +} + +type MockNamespacesServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockNamespacesServiceClient) EXPECT() *MockNamespacesServiceClient_Expecter { + return &MockNamespacesServiceClient_Expecter{mock: &_m.Mock} +} + +// Accessibles provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Accessibles(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Accessibles") + } + + var r0 *connect.Response[access.Nodes] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[access.Nodes]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[access.Nodes]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Accessibles_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Accessibles' +type MockNamespacesServiceClient_Accessibles_Call struct { + *mock.Call +} + +// Accessibles is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Accessibles(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Accessibles_Call { + return &MockNamespacesServiceClient_Accessibles_Call{Call: _e.mock.On("Accessibles", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Accessibles_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Accessibles_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Accessibles_Call) Return(_a0 *connect.Response[access.Nodes], _a1 error) *MockNamespacesServiceClient_Accessibles_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Accessibles_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error)) *MockNamespacesServiceClient_Accessibles_Call { + _c.Call.Return(run) + return _c +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Create(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *connect.Response[namespaces.Namespace] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[namespaces.Namespace]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[namespaces.Namespace]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockNamespacesServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Create(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Create_Call { + return &MockNamespacesServiceClient_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Create_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Create_Call) Return(_a0 *connect.Response[namespaces.Namespace], _a1 error) *MockNamespacesServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Create_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error)) *MockNamespacesServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// Deletables provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Deletables(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Deletables") + } + + var r0 *connect.Response[access.Nodes] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[access.Nodes]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[access.Nodes]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Deletables_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Deletables' +type MockNamespacesServiceClient_Deletables_Call struct { + *mock.Call +} + +// Deletables is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Deletables(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Deletables_Call { + return &MockNamespacesServiceClient_Deletables_Call{Call: _e.mock.On("Deletables", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Deletables_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Deletables_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Deletables_Call) Return(_a0 *connect.Response[access.Nodes], _a1 error) *MockNamespacesServiceClient_Deletables_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Deletables_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[access.Nodes], error)) *MockNamespacesServiceClient_Deletables_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Delete(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[node.DeleteResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *connect.Response[node.DeleteResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[node.DeleteResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[node.DeleteResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.DeleteResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockNamespacesServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Delete(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Delete_Call { + return &MockNamespacesServiceClient_Delete_Call{Call: _e.mock.On("Delete", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Delete_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Delete_Call) Return(_a0 *connect.Response[node.DeleteResponse], _a1 error) *MockNamespacesServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[node.DeleteResponse], error)) *MockNamespacesServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Get(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[namespaces.Namespace] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[namespaces.Namespace]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[namespaces.Namespace]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockNamespacesServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Get_Call { + return &MockNamespacesServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Get_Call) Return(_a0 *connect.Response[namespaces.Namespace], _a1 error) *MockNamespacesServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error)) *MockNamespacesServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// Join provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Join(_a0 context.Context, _a1 *connect.Request[node.JoinRequest]) (*connect.Response[accounts.Accounts], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Join") + } + + var r0 *connect.Response[accounts.Accounts] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.JoinRequest]) (*connect.Response[accounts.Accounts], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.JoinRequest]) *connect.Response[accounts.Accounts]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.Accounts]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.JoinRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Join_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Join' +type MockNamespacesServiceClient_Join_Call struct { + *mock.Call +} + +// Join is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.JoinRequest] +func (_e *MockNamespacesServiceClient_Expecter) Join(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Join_Call { + return &MockNamespacesServiceClient_Join_Call{Call: _e.mock.On("Join", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Join_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.JoinRequest])) *MockNamespacesServiceClient_Join_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.JoinRequest])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Join_Call) Return(_a0 *connect.Response[accounts.Accounts], _a1 error) *MockNamespacesServiceClient_Join_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Join_Call) RunAndReturn(run func(context.Context, *connect.Request[node.JoinRequest]) (*connect.Response[accounts.Accounts], error)) *MockNamespacesServiceClient_Join_Call { + _c.Call.Return(run) + return _c +} + +// Joins provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Joins(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[accounts.Accounts], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Joins") + } + + var r0 *connect.Response[accounts.Accounts] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[accounts.Accounts], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[accounts.Accounts]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[accounts.Accounts]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Joins_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Joins' +type MockNamespacesServiceClient_Joins_Call struct { + *mock.Call +} + +// Joins is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Joins(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Joins_Call { + return &MockNamespacesServiceClient_Joins_Call{Call: _e.mock.On("Joins", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Joins_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Joins_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Joins_Call) Return(_a0 *connect.Response[accounts.Accounts], _a1 error) *MockNamespacesServiceClient_Joins_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Joins_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[accounts.Accounts], error)) *MockNamespacesServiceClient_Joins_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) List(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage]) (*connect.Response[namespaces.Namespaces], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 *connect.Response[namespaces.Namespaces] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[namespaces.Namespaces], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) *connect.Response[namespaces.Namespaces]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[namespaces.Namespaces]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.EmptyMessage]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockNamespacesServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.EmptyMessage] +func (_e *MockNamespacesServiceClient_Expecter) List(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_List_Call { + return &MockNamespacesServiceClient_List_Call{Call: _e.mock.On("List", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_List_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage])) *MockNamespacesServiceClient_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.EmptyMessage])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_List_Call) Return(_a0 *connect.Response[namespaces.Namespaces], _a1 error) *MockNamespacesServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_List_Call) RunAndReturn(run func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[namespaces.Namespaces], error)) *MockNamespacesServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: _a0, _a1 +func (_m *MockNamespacesServiceClient) Update(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *connect.Response[namespaces.Namespace] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[namespaces.Namespace]) *connect.Response[namespaces.Namespace]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[namespaces.Namespace]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[namespaces.Namespace]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockNamespacesServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockNamespacesServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[namespaces.Namespace] +func (_e *MockNamespacesServiceClient_Expecter) Update(_a0 interface{}, _a1 interface{}) *MockNamespacesServiceClient_Update_Call { + return &MockNamespacesServiceClient_Update_Call{Call: _e.mock.On("Update", _a0, _a1)} +} + +func (_c *MockNamespacesServiceClient_Update_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[namespaces.Namespace])) *MockNamespacesServiceClient_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[namespaces.Namespace])) + }) + return _c +} + +func (_c *MockNamespacesServiceClient_Update_Call) Return(_a0 *connect.Response[namespaces.Namespace], _a1 error) *MockNamespacesServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockNamespacesServiceClient_Update_Call) RunAndReturn(run func(context.Context, *connect.Request[namespaces.Namespace]) (*connect.Response[namespaces.Namespace], error)) *MockNamespacesServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockNamespacesServiceClient creates a new instance of MockNamespacesServiceClient. 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 NewMockNamespacesServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockNamespacesServiceClient { + mock := &MockNamespacesServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_SessionsServiceClient.go b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_SessionsServiceClient.go new file mode 100644 index 0000000..a050eca --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_SessionsServiceClient.go @@ -0,0 +1,219 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package nodeconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + mock "github.com/stretchr/testify/mock" + + node "github.com/infinimesh/proto/node" + + sessions "github.com/infinimesh/proto/node/sessions" +) + +// MockSessionsServiceClient is an autogenerated mock type for the SessionsServiceClient type +type MockSessionsServiceClient struct { + mock.Mock +} + +type MockSessionsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockSessionsServiceClient) EXPECT() *MockSessionsServiceClient_Expecter { + return &MockSessionsServiceClient_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockSessionsServiceClient) Get(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage]) (*connect.Response[sessions.Sessions], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[sessions.Sessions] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[sessions.Sessions], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) *connect.Response[sessions.Sessions]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[sessions.Sessions]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.EmptyMessage]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSessionsServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockSessionsServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.EmptyMessage] +func (_e *MockSessionsServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockSessionsServiceClient_Get_Call { + return &MockSessionsServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockSessionsServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage])) *MockSessionsServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.EmptyMessage])) + }) + return _c +} + +func (_c *MockSessionsServiceClient_Get_Call) Return(_a0 *connect.Response[sessions.Sessions], _a1 error) *MockSessionsServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSessionsServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[sessions.Sessions], error)) *MockSessionsServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// GetActivity provides a mock function with given fields: _a0, _a1 +func (_m *MockSessionsServiceClient) GetActivity(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage]) (*connect.Response[sessions.Activity], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for GetActivity") + } + + var r0 *connect.Response[sessions.Activity] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[sessions.Activity], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[node.EmptyMessage]) *connect.Response[sessions.Activity]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[sessions.Activity]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[node.EmptyMessage]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSessionsServiceClient_GetActivity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetActivity' +type MockSessionsServiceClient_GetActivity_Call struct { + *mock.Call +} + +// GetActivity is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[node.EmptyMessage] +func (_e *MockSessionsServiceClient_Expecter) GetActivity(_a0 interface{}, _a1 interface{}) *MockSessionsServiceClient_GetActivity_Call { + return &MockSessionsServiceClient_GetActivity_Call{Call: _e.mock.On("GetActivity", _a0, _a1)} +} + +func (_c *MockSessionsServiceClient_GetActivity_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[node.EmptyMessage])) *MockSessionsServiceClient_GetActivity_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[node.EmptyMessage])) + }) + return _c +} + +func (_c *MockSessionsServiceClient_GetActivity_Call) Return(_a0 *connect.Response[sessions.Activity], _a1 error) *MockSessionsServiceClient_GetActivity_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSessionsServiceClient_GetActivity_Call) RunAndReturn(run func(context.Context, *connect.Request[node.EmptyMessage]) (*connect.Response[sessions.Activity], error)) *MockSessionsServiceClient_GetActivity_Call { + _c.Call.Return(run) + return _c +} + +// Revoke provides a mock function with given fields: _a0, _a1 +func (_m *MockSessionsServiceClient) Revoke(_a0 context.Context, _a1 *connect.Request[sessions.Session]) (*connect.Response[node.DeleteResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Revoke") + } + + var r0 *connect.Response[node.DeleteResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[sessions.Session]) (*connect.Response[node.DeleteResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[sessions.Session]) *connect.Response[node.DeleteResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[node.DeleteResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[sessions.Session]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockSessionsServiceClient_Revoke_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Revoke' +type MockSessionsServiceClient_Revoke_Call struct { + *mock.Call +} + +// Revoke is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[sessions.Session] +func (_e *MockSessionsServiceClient_Expecter) Revoke(_a0 interface{}, _a1 interface{}) *MockSessionsServiceClient_Revoke_Call { + return &MockSessionsServiceClient_Revoke_Call{Call: _e.mock.On("Revoke", _a0, _a1)} +} + +func (_c *MockSessionsServiceClient_Revoke_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[sessions.Session])) *MockSessionsServiceClient_Revoke_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[sessions.Session])) + }) + return _c +} + +func (_c *MockSessionsServiceClient_Revoke_Call) Return(_a0 *connect.Response[node.DeleteResponse], _a1 error) *MockSessionsServiceClient_Revoke_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockSessionsServiceClient_Revoke_Call) RunAndReturn(run func(context.Context, *connect.Request[sessions.Session]) (*connect.Response[node.DeleteResponse], error)) *MockSessionsServiceClient_Revoke_Call { + _c.Call.Return(run) + return _c +} + +// NewMockSessionsServiceClient creates a new instance of MockSessionsServiceClient. 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 NewMockSessionsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockSessionsServiceClient { + mock := &MockSessionsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_ShadowServiceClient.go b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_ShadowServiceClient.go new file mode 100644 index 0000000..4a3798a --- /dev/null +++ b/mocks/github.com/infinimesh/proto/node/nodeconnect/mock_ShadowServiceClient.go @@ -0,0 +1,335 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package nodeconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + mock "github.com/stretchr/testify/mock" + + shadow "github.com/infinimesh/proto/shadow" +) + +// MockShadowServiceClient is an autogenerated mock type for the ShadowServiceClient type +type MockShadowServiceClient struct { + mock.Mock +} + +type MockShadowServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockShadowServiceClient) EXPECT() *MockShadowServiceClient_Expecter { + return &MockShadowServiceClient_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) Get(_a0 context.Context, _a1 *connect.Request[shadow.GetRequest]) (*connect.Response[shadow.GetResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[shadow.GetResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.GetRequest]) (*connect.Response[shadow.GetResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.GetRequest]) *connect.Response[shadow.GetResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[shadow.GetResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.GetRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockShadowServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.GetRequest] +func (_e *MockShadowServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_Get_Call { + return &MockShadowServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.GetRequest])) *MockShadowServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.GetRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) Return(_a0 *connect.Response[shadow.GetResponse], _a1 error) *MockShadowServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.GetRequest]) (*connect.Response[shadow.GetResponse], error)) *MockShadowServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) Patch(_a0 context.Context, _a1 *connect.Request[shadow.Shadow]) (*connect.Response[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 *connect.Response[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.Shadow]) (*connect.Response[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.Shadow]) *connect.Response[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.Shadow]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockShadowServiceClient_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.Shadow] +func (_e *MockShadowServiceClient_Expecter) Patch(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_Patch_Call { + return &MockShadowServiceClient_Patch_Call{Call: _e.mock.On("Patch", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_Patch_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.Shadow])) *MockShadowServiceClient_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.Shadow])) + }) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) Return(_a0 *connect.Response[shadow.Shadow], _a1 error) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.Shadow]) (*connect.Response[shadow.Shadow], error)) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) Remove(_a0 context.Context, _a1 *connect.Request[shadow.RemoveRequest]) (*connect.Response[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 *connect.Response[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.RemoveRequest]) (*connect.Response[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.RemoveRequest]) *connect.Response[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.RemoveRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type MockShadowServiceClient_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.RemoveRequest] +func (_e *MockShadowServiceClient_Expecter) Remove(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_Remove_Call { + return &MockShadowServiceClient_Remove_Call{Call: _e.mock.On("Remove", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_Remove_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.RemoveRequest])) *MockShadowServiceClient_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.RemoveRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) Return(_a0 *connect.Response[shadow.Shadow], _a1 error) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.RemoveRequest]) (*connect.Response[shadow.Shadow], error)) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(run) + return _c +} + +// StreamShadow provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) StreamShadow(_a0 context.Context, _a1 *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for StreamShadow") + } + + var r0 *connect.ServerStreamForClient[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) *connect.ServerStreamForClient[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.ServerStreamForClient[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_StreamShadow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StreamShadow' +type MockShadowServiceClient_StreamShadow_Call struct { + *mock.Call +} + +// StreamShadow is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.StreamShadowRequest] +func (_e *MockShadowServiceClient_Expecter) StreamShadow(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_StreamShadow_Call { + return &MockShadowServiceClient_StreamShadow_Call{Call: _e.mock.On("StreamShadow", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.StreamShadowRequest])) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.StreamShadowRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Return(_a0 *connect.ServerStreamForClient[shadow.Shadow], _a1 error) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error)) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(run) + return _c +} + +// StreamShadowSync provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) StreamShadowSync(_a0 context.Context, _a1 *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for StreamShadowSync") + } + + var r0 *connect.ServerStreamForClient[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) *connect.ServerStreamForClient[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.ServerStreamForClient[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_StreamShadowSync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StreamShadowSync' +type MockShadowServiceClient_StreamShadowSync_Call struct { + *mock.Call +} + +// StreamShadowSync is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.StreamShadowRequest] +func (_e *MockShadowServiceClient_Expecter) StreamShadowSync(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_StreamShadowSync_Call { + return &MockShadowServiceClient_StreamShadowSync_Call{Call: _e.mock.On("StreamShadowSync", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_StreamShadowSync_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.StreamShadowRequest])) *MockShadowServiceClient_StreamShadowSync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.StreamShadowRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadowSync_Call) Return(_a0 *connect.ServerStreamForClient[shadow.Shadow], _a1 error) *MockShadowServiceClient_StreamShadowSync_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadowSync_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error)) *MockShadowServiceClient_StreamShadowSync_Call { + _c.Call.Return(run) + return _c +} + +// NewMockShadowServiceClient creates a new instance of MockShadowServiceClient. 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 NewMockShadowServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockShadowServiceClient { + mock := &MockShadowServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/plugins/mock_PluginsServiceClient.go b/mocks/github.com/infinimesh/proto/plugins/mock_PluginsServiceClient.go new file mode 100644 index 0000000..708eb3f --- /dev/null +++ b/mocks/github.com/infinimesh/proto/plugins/mock_PluginsServiceClient.go @@ -0,0 +1,410 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package plugins_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + plugins "github.com/infinimesh/proto/plugins" +) + +// MockPluginsServiceClient is an autogenerated mock type for the PluginsServiceClient type +type MockPluginsServiceClient struct { + mock.Mock +} + +type MockPluginsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPluginsServiceClient) EXPECT() *MockPluginsServiceClient_Expecter { + return &MockPluginsServiceClient_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: ctx, in, opts +func (_m *MockPluginsServiceClient) Create(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption) (*plugins.Plugin, 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 Create") + } + + var r0 *plugins.Plugin + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) *plugins.Plugin); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*plugins.Plugin) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockPluginsServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - ctx context.Context +// - in *plugins.Plugin +// - opts ...grpc.CallOption +func (_e *MockPluginsServiceClient_Expecter) Create(ctx interface{}, in interface{}, opts ...interface{}) *MockPluginsServiceClient_Create_Call { + return &MockPluginsServiceClient_Create_Call{Call: _e.mock.On("Create", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockPluginsServiceClient_Create_Call) Run(run func(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption)) *MockPluginsServiceClient_Create_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].(*plugins.Plugin), variadicArgs...) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Create_Call) Return(_a0 *plugins.Plugin, _a1 error) *MockPluginsServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Create_Call) RunAndReturn(run func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)) *MockPluginsServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: ctx, in, opts +func (_m *MockPluginsServiceClient) Delete(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption) (*plugins.Plugin, 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 Delete") + } + + var r0 *plugins.Plugin + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) *plugins.Plugin); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*plugins.Plugin) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockPluginsServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - ctx context.Context +// - in *plugins.Plugin +// - opts ...grpc.CallOption +func (_e *MockPluginsServiceClient_Expecter) Delete(ctx interface{}, in interface{}, opts ...interface{}) *MockPluginsServiceClient_Delete_Call { + return &MockPluginsServiceClient_Delete_Call{Call: _e.mock.On("Delete", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockPluginsServiceClient_Delete_Call) Run(run func(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption)) *MockPluginsServiceClient_Delete_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].(*plugins.Plugin), variadicArgs...) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Delete_Call) Return(_a0 *plugins.Plugin, _a1 error) *MockPluginsServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)) *MockPluginsServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockPluginsServiceClient) Get(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption) (*plugins.Plugin, 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 Get") + } + + var r0 *plugins.Plugin + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) *plugins.Plugin); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*plugins.Plugin) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockPluginsServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *plugins.Plugin +// - opts ...grpc.CallOption +func (_e *MockPluginsServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockPluginsServiceClient_Get_Call { + return &MockPluginsServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockPluginsServiceClient_Get_Call) Run(run func(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption)) *MockPluginsServiceClient_Get_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].(*plugins.Plugin), variadicArgs...) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Get_Call) Return(_a0 *plugins.Plugin, _a1 error) *MockPluginsServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Get_Call) RunAndReturn(run func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)) *MockPluginsServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: ctx, in, opts +func (_m *MockPluginsServiceClient) List(ctx context.Context, in *plugins.ListRequest, opts ...grpc.CallOption) (*plugins.Plugins, 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 List") + } + + var r0 *plugins.Plugins + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *plugins.ListRequest, ...grpc.CallOption) (*plugins.Plugins, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *plugins.ListRequest, ...grpc.CallOption) *plugins.Plugins); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*plugins.Plugins) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *plugins.ListRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockPluginsServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - ctx context.Context +// - in *plugins.ListRequest +// - opts ...grpc.CallOption +func (_e *MockPluginsServiceClient_Expecter) List(ctx interface{}, in interface{}, opts ...interface{}) *MockPluginsServiceClient_List_Call { + return &MockPluginsServiceClient_List_Call{Call: _e.mock.On("List", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockPluginsServiceClient_List_Call) Run(run func(ctx context.Context, in *plugins.ListRequest, opts ...grpc.CallOption)) *MockPluginsServiceClient_List_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].(*plugins.ListRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockPluginsServiceClient_List_Call) Return(_a0 *plugins.Plugins, _a1 error) *MockPluginsServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_List_Call) RunAndReturn(run func(context.Context, *plugins.ListRequest, ...grpc.CallOption) (*plugins.Plugins, error)) *MockPluginsServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: ctx, in, opts +func (_m *MockPluginsServiceClient) Update(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption) (*plugins.Plugin, 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 Update") + } + + var r0 *plugins.Plugin + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) *plugins.Plugin); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*plugins.Plugin) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *plugins.Plugin, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockPluginsServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - ctx context.Context +// - in *plugins.Plugin +// - opts ...grpc.CallOption +func (_e *MockPluginsServiceClient_Expecter) Update(ctx interface{}, in interface{}, opts ...interface{}) *MockPluginsServiceClient_Update_Call { + return &MockPluginsServiceClient_Update_Call{Call: _e.mock.On("Update", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockPluginsServiceClient_Update_Call) Run(run func(ctx context.Context, in *plugins.Plugin, opts ...grpc.CallOption)) *MockPluginsServiceClient_Update_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].(*plugins.Plugin), variadicArgs...) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Update_Call) Return(_a0 *plugins.Plugin, _a1 error) *MockPluginsServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Update_Call) RunAndReturn(run func(context.Context, *plugins.Plugin, ...grpc.CallOption) (*plugins.Plugin, error)) *MockPluginsServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockPluginsServiceClient creates a new instance of MockPluginsServiceClient. 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 NewMockPluginsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPluginsServiceClient { + mock := &MockPluginsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/plugins/pluginsconnect/mock_PluginsServiceClient.go b/mocks/github.com/infinimesh/proto/plugins/pluginsconnect/mock_PluginsServiceClient.go new file mode 100644 index 0000000..f271eca --- /dev/null +++ b/mocks/github.com/infinimesh/proto/plugins/pluginsconnect/mock_PluginsServiceClient.go @@ -0,0 +1,335 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package pluginsconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + mock "github.com/stretchr/testify/mock" + + plugins "github.com/infinimesh/proto/plugins" +) + +// MockPluginsServiceClient is an autogenerated mock type for the PluginsServiceClient type +type MockPluginsServiceClient struct { + mock.Mock +} + +type MockPluginsServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockPluginsServiceClient) EXPECT() *MockPluginsServiceClient_Expecter { + return &MockPluginsServiceClient_Expecter{mock: &_m.Mock} +} + +// Create provides a mock function with given fields: _a0, _a1 +func (_m *MockPluginsServiceClient) Create(_a0 context.Context, _a1 *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Create") + } + + var r0 *connect.Response[plugins.Plugin] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) *connect.Response[plugins.Plugin]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[plugins.Plugin]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[plugins.Plugin]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Create_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Create' +type MockPluginsServiceClient_Create_Call struct { + *mock.Call +} + +// Create is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[plugins.Plugin] +func (_e *MockPluginsServiceClient_Expecter) Create(_a0 interface{}, _a1 interface{}) *MockPluginsServiceClient_Create_Call { + return &MockPluginsServiceClient_Create_Call{Call: _e.mock.On("Create", _a0, _a1)} +} + +func (_c *MockPluginsServiceClient_Create_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[plugins.Plugin])) *MockPluginsServiceClient_Create_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[plugins.Plugin])) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Create_Call) Return(_a0 *connect.Response[plugins.Plugin], _a1 error) *MockPluginsServiceClient_Create_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Create_Call) RunAndReturn(run func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)) *MockPluginsServiceClient_Create_Call { + _c.Call.Return(run) + return _c +} + +// Delete provides a mock function with given fields: _a0, _a1 +func (_m *MockPluginsServiceClient) Delete(_a0 context.Context, _a1 *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Delete") + } + + var r0 *connect.Response[plugins.Plugin] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) *connect.Response[plugins.Plugin]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[plugins.Plugin]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[plugins.Plugin]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete' +type MockPluginsServiceClient_Delete_Call struct { + *mock.Call +} + +// Delete is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[plugins.Plugin] +func (_e *MockPluginsServiceClient_Expecter) Delete(_a0 interface{}, _a1 interface{}) *MockPluginsServiceClient_Delete_Call { + return &MockPluginsServiceClient_Delete_Call{Call: _e.mock.On("Delete", _a0, _a1)} +} + +func (_c *MockPluginsServiceClient_Delete_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[plugins.Plugin])) *MockPluginsServiceClient_Delete_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[plugins.Plugin])) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Delete_Call) Return(_a0 *connect.Response[plugins.Plugin], _a1 error) *MockPluginsServiceClient_Delete_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Delete_Call) RunAndReturn(run func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)) *MockPluginsServiceClient_Delete_Call { + _c.Call.Return(run) + return _c +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockPluginsServiceClient) Get(_a0 context.Context, _a1 *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[plugins.Plugin] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) *connect.Response[plugins.Plugin]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[plugins.Plugin]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[plugins.Plugin]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockPluginsServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[plugins.Plugin] +func (_e *MockPluginsServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockPluginsServiceClient_Get_Call { + return &MockPluginsServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockPluginsServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[plugins.Plugin])) *MockPluginsServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[plugins.Plugin])) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Get_Call) Return(_a0 *connect.Response[plugins.Plugin], _a1 error) *MockPluginsServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)) *MockPluginsServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// List provides a mock function with given fields: _a0, _a1 +func (_m *MockPluginsServiceClient) List(_a0 context.Context, _a1 *connect.Request[plugins.ListRequest]) (*connect.Response[plugins.Plugins], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for List") + } + + var r0 *connect.Response[plugins.Plugins] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.ListRequest]) (*connect.Response[plugins.Plugins], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.ListRequest]) *connect.Response[plugins.Plugins]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[plugins.Plugins]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[plugins.ListRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_List_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'List' +type MockPluginsServiceClient_List_Call struct { + *mock.Call +} + +// List is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[plugins.ListRequest] +func (_e *MockPluginsServiceClient_Expecter) List(_a0 interface{}, _a1 interface{}) *MockPluginsServiceClient_List_Call { + return &MockPluginsServiceClient_List_Call{Call: _e.mock.On("List", _a0, _a1)} +} + +func (_c *MockPluginsServiceClient_List_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[plugins.ListRequest])) *MockPluginsServiceClient_List_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[plugins.ListRequest])) + }) + return _c +} + +func (_c *MockPluginsServiceClient_List_Call) Return(_a0 *connect.Response[plugins.Plugins], _a1 error) *MockPluginsServiceClient_List_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_List_Call) RunAndReturn(run func(context.Context, *connect.Request[plugins.ListRequest]) (*connect.Response[plugins.Plugins], error)) *MockPluginsServiceClient_List_Call { + _c.Call.Return(run) + return _c +} + +// Update provides a mock function with given fields: _a0, _a1 +func (_m *MockPluginsServiceClient) Update(_a0 context.Context, _a1 *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Update") + } + + var r0 *connect.Response[plugins.Plugin] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[plugins.Plugin]) *connect.Response[plugins.Plugin]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[plugins.Plugin]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[plugins.Plugin]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockPluginsServiceClient_Update_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Update' +type MockPluginsServiceClient_Update_Call struct { + *mock.Call +} + +// Update is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[plugins.Plugin] +func (_e *MockPluginsServiceClient_Expecter) Update(_a0 interface{}, _a1 interface{}) *MockPluginsServiceClient_Update_Call { + return &MockPluginsServiceClient_Update_Call{Call: _e.mock.On("Update", _a0, _a1)} +} + +func (_c *MockPluginsServiceClient_Update_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[plugins.Plugin])) *MockPluginsServiceClient_Update_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[plugins.Plugin])) + }) + return _c +} + +func (_c *MockPluginsServiceClient_Update_Call) Return(_a0 *connect.Response[plugins.Plugin], _a1 error) *MockPluginsServiceClient_Update_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockPluginsServiceClient_Update_Call) RunAndReturn(run func(context.Context, *connect.Request[plugins.Plugin]) (*connect.Response[plugins.Plugin], error)) *MockPluginsServiceClient_Update_Call { + _c.Call.Return(run) + return _c +} + +// NewMockPluginsServiceClient creates a new instance of MockPluginsServiceClient. 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 NewMockPluginsServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockPluginsServiceClient { + mock := &MockPluginsServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/shadow/mock_ShadowServiceClient.go b/mocks/github.com/infinimesh/proto/shadow/mock_ShadowServiceClient.go new file mode 100644 index 0000000..083a0db --- /dev/null +++ b/mocks/github.com/infinimesh/proto/shadow/mock_ShadowServiceClient.go @@ -0,0 +1,336 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package shadow_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + shadow "github.com/infinimesh/proto/shadow" +) + +// MockShadowServiceClient is an autogenerated mock type for the ShadowServiceClient type +type MockShadowServiceClient struct { + mock.Mock +} + +type MockShadowServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockShadowServiceClient) EXPECT() *MockShadowServiceClient_Expecter { + return &MockShadowServiceClient_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) Get(ctx context.Context, in *shadow.GetRequest, opts ...grpc.CallOption) (*shadow.GetResponse, 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 Get") + } + + var r0 *shadow.GetResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.GetRequest, ...grpc.CallOption) (*shadow.GetResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.GetRequest, ...grpc.CallOption) *shadow.GetResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shadow.GetResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.GetRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockShadowServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.GetRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) Get(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_Get_Call { + return &MockShadowServiceClient_Get_Call{Call: _e.mock.On("Get", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_Get_Call) Run(run func(ctx context.Context, in *shadow.GetRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_Get_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].(*shadow.GetRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) Return(_a0 *shadow.GetResponse, _a1 error) *MockShadowServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) RunAndReturn(run func(context.Context, *shadow.GetRequest, ...grpc.CallOption) (*shadow.GetResponse, error)) *MockShadowServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) Patch(ctx context.Context, in *shadow.Shadow, opts ...grpc.CallOption) (*shadow.Shadow, 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 Patch") + } + + var r0 *shadow.Shadow + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.Shadow, ...grpc.CallOption) (*shadow.Shadow, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.Shadow, ...grpc.CallOption) *shadow.Shadow); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shadow.Shadow) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.Shadow, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockShadowServiceClient_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.Shadow +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) Patch(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_Patch_Call { + return &MockShadowServiceClient_Patch_Call{Call: _e.mock.On("Patch", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_Patch_Call) Run(run func(ctx context.Context, in *shadow.Shadow, opts ...grpc.CallOption)) *MockShadowServiceClient_Patch_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].(*shadow.Shadow), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) Return(_a0 *shadow.Shadow, _a1 error) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) RunAndReturn(run func(context.Context, *shadow.Shadow, ...grpc.CallOption) (*shadow.Shadow, error)) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) Remove(ctx context.Context, in *shadow.RemoveRequest, opts ...grpc.CallOption) (*shadow.Shadow, 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 Remove") + } + + var r0 *shadow.Shadow + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) (*shadow.Shadow, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) *shadow.Shadow); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*shadow.Shadow) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type MockShadowServiceClient_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.RemoveRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) Remove(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_Remove_Call { + return &MockShadowServiceClient_Remove_Call{Call: _e.mock.On("Remove", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_Remove_Call) Run(run func(ctx context.Context, in *shadow.RemoveRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_Remove_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].(*shadow.RemoveRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) Return(_a0 *shadow.Shadow, _a1 error) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) RunAndReturn(run func(context.Context, *shadow.RemoveRequest, ...grpc.CallOption) (*shadow.Shadow, error)) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(run) + return _c +} + +// StreamShadow provides a mock function with given fields: ctx, in, opts +func (_m *MockShadowServiceClient) StreamShadow(ctx context.Context, in *shadow.StreamShadowRequest, opts ...grpc.CallOption) (shadow.ShadowService_StreamShadowClient, 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 StreamShadow") + } + + var r0 shadow.ShadowService_StreamShadowClient + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) (shadow.ShadowService_StreamShadowClient, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) shadow.ShadowService_StreamShadowClient); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(shadow.ShadowService_StreamShadowClient) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_StreamShadow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StreamShadow' +type MockShadowServiceClient_StreamShadow_Call struct { + *mock.Call +} + +// StreamShadow is a helper method to define mock.On call +// - ctx context.Context +// - in *shadow.StreamShadowRequest +// - opts ...grpc.CallOption +func (_e *MockShadowServiceClient_Expecter) StreamShadow(ctx interface{}, in interface{}, opts ...interface{}) *MockShadowServiceClient_StreamShadow_Call { + return &MockShadowServiceClient_StreamShadow_Call{Call: _e.mock.On("StreamShadow", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Run(run func(ctx context.Context, in *shadow.StreamShadowRequest, opts ...grpc.CallOption)) *MockShadowServiceClient_StreamShadow_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].(*shadow.StreamShadowRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Return(_a0 shadow.ShadowService_StreamShadowClient, _a1 error) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) RunAndReturn(run func(context.Context, *shadow.StreamShadowRequest, ...grpc.CallOption) (shadow.ShadowService_StreamShadowClient, error)) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(run) + return _c +} + +// NewMockShadowServiceClient creates a new instance of MockShadowServiceClient. 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 NewMockShadowServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockShadowServiceClient { + mock := &MockShadowServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/shadow/mock_ShadowService_StreamShadowServer.go b/mocks/github.com/infinimesh/proto/shadow/mock_ShadowService_StreamShadowServer.go new file mode 100644 index 0000000..c4273f4 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/shadow/mock_ShadowService_StreamShadowServer.go @@ -0,0 +1,349 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package shadow_mocks + +import ( + context "context" + + mock "github.com/stretchr/testify/mock" + metadata "google.golang.org/grpc/metadata" + + shadow "github.com/infinimesh/proto/shadow" +) + +// MockShadowService_StreamShadowServer is an autogenerated mock type for the ShadowService_StreamShadowServer type +type MockShadowService_StreamShadowServer struct { + mock.Mock +} + +type MockShadowService_StreamShadowServer_Expecter struct { + mock *mock.Mock +} + +func (_m *MockShadowService_StreamShadowServer) EXPECT() *MockShadowService_StreamShadowServer_Expecter { + return &MockShadowService_StreamShadowServer_Expecter{mock: &_m.Mock} +} + +// Context provides a mock function with given fields: +func (_m *MockShadowService_StreamShadowServer) Context() context.Context { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Context") + } + + var r0 context.Context + if rf, ok := ret.Get(0).(func() context.Context); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(context.Context) + } + } + + return r0 +} + +// MockShadowService_StreamShadowServer_Context_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Context' +type MockShadowService_StreamShadowServer_Context_Call struct { + *mock.Call +} + +// Context is a helper method to define mock.On call +func (_e *MockShadowService_StreamShadowServer_Expecter) Context() *MockShadowService_StreamShadowServer_Context_Call { + return &MockShadowService_StreamShadowServer_Context_Call{Call: _e.mock.On("Context")} +} + +func (_c *MockShadowService_StreamShadowServer_Context_Call) Run(run func()) *MockShadowService_StreamShadowServer_Context_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_Context_Call) Return(_a0 context.Context) *MockShadowService_StreamShadowServer_Context_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_Context_Call) RunAndReturn(run func() context.Context) *MockShadowService_StreamShadowServer_Context_Call { + _c.Call.Return(run) + return _c +} + +// RecvMsg provides a mock function with given fields: m +func (_m *MockShadowService_StreamShadowServer) RecvMsg(m interface{}) error { + ret := _m.Called(m) + + if len(ret) == 0 { + panic("no return value specified for RecvMsg") + } + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockShadowService_StreamShadowServer_RecvMsg_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RecvMsg' +type MockShadowService_StreamShadowServer_RecvMsg_Call struct { + *mock.Call +} + +// RecvMsg is a helper method to define mock.On call +// - m interface{} +func (_e *MockShadowService_StreamShadowServer_Expecter) RecvMsg(m interface{}) *MockShadowService_StreamShadowServer_RecvMsg_Call { + return &MockShadowService_StreamShadowServer_RecvMsg_Call{Call: _e.mock.On("RecvMsg", m)} +} + +func (_c *MockShadowService_StreamShadowServer_RecvMsg_Call) Run(run func(m interface{})) *MockShadowService_StreamShadowServer_RecvMsg_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_RecvMsg_Call) Return(_a0 error) *MockShadowService_StreamShadowServer_RecvMsg_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_RecvMsg_Call) RunAndReturn(run func(interface{}) error) *MockShadowService_StreamShadowServer_RecvMsg_Call { + _c.Call.Return(run) + return _c +} + +// Send provides a mock function with given fields: _a0 +func (_m *MockShadowService_StreamShadowServer) Send(_a0 *shadow.Shadow) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for Send") + } + + var r0 error + if rf, ok := ret.Get(0).(func(*shadow.Shadow) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockShadowService_StreamShadowServer_Send_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Send' +type MockShadowService_StreamShadowServer_Send_Call struct { + *mock.Call +} + +// Send is a helper method to define mock.On call +// - _a0 *shadow.Shadow +func (_e *MockShadowService_StreamShadowServer_Expecter) Send(_a0 interface{}) *MockShadowService_StreamShadowServer_Send_Call { + return &MockShadowService_StreamShadowServer_Send_Call{Call: _e.mock.On("Send", _a0)} +} + +func (_c *MockShadowService_StreamShadowServer_Send_Call) Run(run func(_a0 *shadow.Shadow)) *MockShadowService_StreamShadowServer_Send_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*shadow.Shadow)) + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_Send_Call) Return(_a0 error) *MockShadowService_StreamShadowServer_Send_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_Send_Call) RunAndReturn(run func(*shadow.Shadow) error) *MockShadowService_StreamShadowServer_Send_Call { + _c.Call.Return(run) + return _c +} + +// SendHeader provides a mock function with given fields: _a0 +func (_m *MockShadowService_StreamShadowServer) SendHeader(_a0 metadata.MD) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for SendHeader") + } + + var r0 error + if rf, ok := ret.Get(0).(func(metadata.MD) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockShadowService_StreamShadowServer_SendHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendHeader' +type MockShadowService_StreamShadowServer_SendHeader_Call struct { + *mock.Call +} + +// SendHeader is a helper method to define mock.On call +// - _a0 metadata.MD +func (_e *MockShadowService_StreamShadowServer_Expecter) SendHeader(_a0 interface{}) *MockShadowService_StreamShadowServer_SendHeader_Call { + return &MockShadowService_StreamShadowServer_SendHeader_Call{Call: _e.mock.On("SendHeader", _a0)} +} + +func (_c *MockShadowService_StreamShadowServer_SendHeader_Call) Run(run func(_a0 metadata.MD)) *MockShadowService_StreamShadowServer_SendHeader_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metadata.MD)) + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SendHeader_Call) Return(_a0 error) *MockShadowService_StreamShadowServer_SendHeader_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SendHeader_Call) RunAndReturn(run func(metadata.MD) error) *MockShadowService_StreamShadowServer_SendHeader_Call { + _c.Call.Return(run) + return _c +} + +// SendMsg provides a mock function with given fields: m +func (_m *MockShadowService_StreamShadowServer) SendMsg(m interface{}) error { + ret := _m.Called(m) + + if len(ret) == 0 { + panic("no return value specified for SendMsg") + } + + var r0 error + if rf, ok := ret.Get(0).(func(interface{}) error); ok { + r0 = rf(m) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockShadowService_StreamShadowServer_SendMsg_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMsg' +type MockShadowService_StreamShadowServer_SendMsg_Call struct { + *mock.Call +} + +// SendMsg is a helper method to define mock.On call +// - m interface{} +func (_e *MockShadowService_StreamShadowServer_Expecter) SendMsg(m interface{}) *MockShadowService_StreamShadowServer_SendMsg_Call { + return &MockShadowService_StreamShadowServer_SendMsg_Call{Call: _e.mock.On("SendMsg", m)} +} + +func (_c *MockShadowService_StreamShadowServer_SendMsg_Call) Run(run func(m interface{})) *MockShadowService_StreamShadowServer_SendMsg_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(interface{})) + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SendMsg_Call) Return(_a0 error) *MockShadowService_StreamShadowServer_SendMsg_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SendMsg_Call) RunAndReturn(run func(interface{}) error) *MockShadowService_StreamShadowServer_SendMsg_Call { + _c.Call.Return(run) + return _c +} + +// SetHeader provides a mock function with given fields: _a0 +func (_m *MockShadowService_StreamShadowServer) SetHeader(_a0 metadata.MD) error { + ret := _m.Called(_a0) + + if len(ret) == 0 { + panic("no return value specified for SetHeader") + } + + var r0 error + if rf, ok := ret.Get(0).(func(metadata.MD) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockShadowService_StreamShadowServer_SetHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetHeader' +type MockShadowService_StreamShadowServer_SetHeader_Call struct { + *mock.Call +} + +// SetHeader is a helper method to define mock.On call +// - _a0 metadata.MD +func (_e *MockShadowService_StreamShadowServer_Expecter) SetHeader(_a0 interface{}) *MockShadowService_StreamShadowServer_SetHeader_Call { + return &MockShadowService_StreamShadowServer_SetHeader_Call{Call: _e.mock.On("SetHeader", _a0)} +} + +func (_c *MockShadowService_StreamShadowServer_SetHeader_Call) Run(run func(_a0 metadata.MD)) *MockShadowService_StreamShadowServer_SetHeader_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metadata.MD)) + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SetHeader_Call) Return(_a0 error) *MockShadowService_StreamShadowServer_SetHeader_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SetHeader_Call) RunAndReturn(run func(metadata.MD) error) *MockShadowService_StreamShadowServer_SetHeader_Call { + _c.Call.Return(run) + return _c +} + +// SetTrailer provides a mock function with given fields: _a0 +func (_m *MockShadowService_StreamShadowServer) SetTrailer(_a0 metadata.MD) { + _m.Called(_a0) +} + +// MockShadowService_StreamShadowServer_SetTrailer_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetTrailer' +type MockShadowService_StreamShadowServer_SetTrailer_Call struct { + *mock.Call +} + +// SetTrailer is a helper method to define mock.On call +// - _a0 metadata.MD +func (_e *MockShadowService_StreamShadowServer_Expecter) SetTrailer(_a0 interface{}) *MockShadowService_StreamShadowServer_SetTrailer_Call { + return &MockShadowService_StreamShadowServer_SetTrailer_Call{Call: _e.mock.On("SetTrailer", _a0)} +} + +func (_c *MockShadowService_StreamShadowServer_SetTrailer_Call) Run(run func(_a0 metadata.MD)) *MockShadowService_StreamShadowServer_SetTrailer_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(metadata.MD)) + }) + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SetTrailer_Call) Return() *MockShadowService_StreamShadowServer_SetTrailer_Call { + _c.Call.Return() + return _c +} + +func (_c *MockShadowService_StreamShadowServer_SetTrailer_Call) RunAndReturn(run func(metadata.MD)) *MockShadowService_StreamShadowServer_SetTrailer_Call { + _c.Call.Return(run) + return _c +} + +// NewMockShadowService_StreamShadowServer creates a new instance of MockShadowService_StreamShadowServer. 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 NewMockShadowService_StreamShadowServer(t interface { + mock.TestingT + Cleanup(func()) +}) *MockShadowService_StreamShadowServer { + mock := &MockShadowService_StreamShadowServer{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/shadow/shadowconnect/mock_ShadowServiceClient.go b/mocks/github.com/infinimesh/proto/shadow/shadowconnect/mock_ShadowServiceClient.go new file mode 100644 index 0000000..9a2fbdf --- /dev/null +++ b/mocks/github.com/infinimesh/proto/shadow/shadowconnect/mock_ShadowServiceClient.go @@ -0,0 +1,276 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package shadowconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + mock "github.com/stretchr/testify/mock" + + shadow "github.com/infinimesh/proto/shadow" +) + +// MockShadowServiceClient is an autogenerated mock type for the ShadowServiceClient type +type MockShadowServiceClient struct { + mock.Mock +} + +type MockShadowServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockShadowServiceClient) EXPECT() *MockShadowServiceClient_Expecter { + return &MockShadowServiceClient_Expecter{mock: &_m.Mock} +} + +// Get provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) Get(_a0 context.Context, _a1 *connect.Request[shadow.GetRequest]) (*connect.Response[shadow.GetResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Get") + } + + var r0 *connect.Response[shadow.GetResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.GetRequest]) (*connect.Response[shadow.GetResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.GetRequest]) *connect.Response[shadow.GetResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[shadow.GetResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.GetRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get' +type MockShadowServiceClient_Get_Call struct { + *mock.Call +} + +// Get is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.GetRequest] +func (_e *MockShadowServiceClient_Expecter) Get(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_Get_Call { + return &MockShadowServiceClient_Get_Call{Call: _e.mock.On("Get", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_Get_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.GetRequest])) *MockShadowServiceClient_Get_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.GetRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) Return(_a0 *connect.Response[shadow.GetResponse], _a1 error) *MockShadowServiceClient_Get_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Get_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.GetRequest]) (*connect.Response[shadow.GetResponse], error)) *MockShadowServiceClient_Get_Call { + _c.Call.Return(run) + return _c +} + +// Patch provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) Patch(_a0 context.Context, _a1 *connect.Request[shadow.Shadow]) (*connect.Response[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Patch") + } + + var r0 *connect.Response[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.Shadow]) (*connect.Response[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.Shadow]) *connect.Response[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.Shadow]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Patch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Patch' +type MockShadowServiceClient_Patch_Call struct { + *mock.Call +} + +// Patch is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.Shadow] +func (_e *MockShadowServiceClient_Expecter) Patch(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_Patch_Call { + return &MockShadowServiceClient_Patch_Call{Call: _e.mock.On("Patch", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_Patch_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.Shadow])) *MockShadowServiceClient_Patch_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.Shadow])) + }) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) Return(_a0 *connect.Response[shadow.Shadow], _a1 error) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Patch_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.Shadow]) (*connect.Response[shadow.Shadow], error)) *MockShadowServiceClient_Patch_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) Remove(_a0 context.Context, _a1 *connect.Request[shadow.RemoveRequest]) (*connect.Response[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 *connect.Response[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.RemoveRequest]) (*connect.Response[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.RemoveRequest]) *connect.Response[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.RemoveRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type MockShadowServiceClient_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.RemoveRequest] +func (_e *MockShadowServiceClient_Expecter) Remove(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_Remove_Call { + return &MockShadowServiceClient_Remove_Call{Call: _e.mock.On("Remove", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_Remove_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.RemoveRequest])) *MockShadowServiceClient_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.RemoveRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) Return(_a0 *connect.Response[shadow.Shadow], _a1 error) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_Remove_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.RemoveRequest]) (*connect.Response[shadow.Shadow], error)) *MockShadowServiceClient_Remove_Call { + _c.Call.Return(run) + return _c +} + +// StreamShadow provides a mock function with given fields: _a0, _a1 +func (_m *MockShadowServiceClient) StreamShadow(_a0 context.Context, _a1 *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for StreamShadow") + } + + var r0 *connect.ServerStreamForClient[shadow.Shadow] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) *connect.ServerStreamForClient[shadow.Shadow]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.ServerStreamForClient[shadow.Shadow]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[shadow.StreamShadowRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockShadowServiceClient_StreamShadow_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StreamShadow' +type MockShadowServiceClient_StreamShadow_Call struct { + *mock.Call +} + +// StreamShadow is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[shadow.StreamShadowRequest] +func (_e *MockShadowServiceClient_Expecter) StreamShadow(_a0 interface{}, _a1 interface{}) *MockShadowServiceClient_StreamShadow_Call { + return &MockShadowServiceClient_StreamShadow_Call{Call: _e.mock.On("StreamShadow", _a0, _a1)} +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[shadow.StreamShadowRequest])) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[shadow.StreamShadowRequest])) + }) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) Return(_a0 *connect.ServerStreamForClient[shadow.Shadow], _a1 error) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockShadowServiceClient_StreamShadow_Call) RunAndReturn(run func(context.Context, *connect.Request[shadow.StreamShadowRequest]) (*connect.ServerStreamForClient[shadow.Shadow], error)) *MockShadowServiceClient_StreamShadow_Call { + _c.Call.Return(run) + return _c +} + +// NewMockShadowServiceClient creates a new instance of MockShadowServiceClient. 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 NewMockShadowServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockShadowServiceClient { + mock := &MockShadowServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/timeseries/mock_TimeseriesServiceClient.go b/mocks/github.com/infinimesh/proto/timeseries/mock_TimeseriesServiceClient.go new file mode 100644 index 0000000..be1c2f2 --- /dev/null +++ b/mocks/github.com/infinimesh/proto/timeseries/mock_TimeseriesServiceClient.go @@ -0,0 +1,410 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package timeseries_mocks + +import ( + context "context" + + grpc "google.golang.org/grpc" + + mock "github.com/stretchr/testify/mock" + + timeseries "github.com/infinimesh/proto/timeseries" +) + +// MockTimeseriesServiceClient is an autogenerated mock type for the TimeseriesServiceClient type +type MockTimeseriesServiceClient struct { + mock.Mock +} + +type MockTimeseriesServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTimeseriesServiceClient) EXPECT() *MockTimeseriesServiceClient_Expecter { + return &MockTimeseriesServiceClient_Expecter{mock: &_m.Mock} +} + +// Flush provides a mock function with given fields: ctx, in, opts +func (_m *MockTimeseriesServiceClient) Flush(ctx context.Context, in *timeseries.FlushRequest, opts ...grpc.CallOption) (*timeseries.FlushResponse, 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 Flush") + } + + var r0 *timeseries.FlushResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.FlushRequest, ...grpc.CallOption) (*timeseries.FlushResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.FlushRequest, ...grpc.CallOption) *timeseries.FlushResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*timeseries.FlushResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *timeseries.FlushRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Flush_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Flush' +type MockTimeseriesServiceClient_Flush_Call struct { + *mock.Call +} + +// Flush is a helper method to define mock.On call +// - ctx context.Context +// - in *timeseries.FlushRequest +// - opts ...grpc.CallOption +func (_e *MockTimeseriesServiceClient_Expecter) Flush(ctx interface{}, in interface{}, opts ...interface{}) *MockTimeseriesServiceClient_Flush_Call { + return &MockTimeseriesServiceClient_Flush_Call{Call: _e.mock.On("Flush", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockTimeseriesServiceClient_Flush_Call) Run(run func(ctx context.Context, in *timeseries.FlushRequest, opts ...grpc.CallOption)) *MockTimeseriesServiceClient_Flush_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].(*timeseries.FlushRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Flush_Call) Return(_a0 *timeseries.FlushResponse, _a1 error) *MockTimeseriesServiceClient_Flush_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Flush_Call) RunAndReturn(run func(context.Context, *timeseries.FlushRequest, ...grpc.CallOption) (*timeseries.FlushResponse, error)) *MockTimeseriesServiceClient_Flush_Call { + _c.Call.Return(run) + return _c +} + +// Read provides a mock function with given fields: ctx, in, opts +func (_m *MockTimeseriesServiceClient) Read(ctx context.Context, in *timeseries.ReadRequest, opts ...grpc.CallOption) (*timeseries.ReadResponse, 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 Read") + } + + var r0 *timeseries.ReadResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.ReadRequest, ...grpc.CallOption) (*timeseries.ReadResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.ReadRequest, ...grpc.CallOption) *timeseries.ReadResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*timeseries.ReadResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *timeseries.ReadRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read' +type MockTimeseriesServiceClient_Read_Call struct { + *mock.Call +} + +// Read is a helper method to define mock.On call +// - ctx context.Context +// - in *timeseries.ReadRequest +// - opts ...grpc.CallOption +func (_e *MockTimeseriesServiceClient_Expecter) Read(ctx interface{}, in interface{}, opts ...interface{}) *MockTimeseriesServiceClient_Read_Call { + return &MockTimeseriesServiceClient_Read_Call{Call: _e.mock.On("Read", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockTimeseriesServiceClient_Read_Call) Run(run func(ctx context.Context, in *timeseries.ReadRequest, opts ...grpc.CallOption)) *MockTimeseriesServiceClient_Read_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].(*timeseries.ReadRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Read_Call) Return(_a0 *timeseries.ReadResponse, _a1 error) *MockTimeseriesServiceClient_Read_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Read_Call) RunAndReturn(run func(context.Context, *timeseries.ReadRequest, ...grpc.CallOption) (*timeseries.ReadResponse, error)) *MockTimeseriesServiceClient_Read_Call { + _c.Call.Return(run) + return _c +} + +// Stat provides a mock function with given fields: ctx, in, opts +func (_m *MockTimeseriesServiceClient) Stat(ctx context.Context, in *timeseries.StatRequest, opts ...grpc.CallOption) (*timeseries.StatResponse, 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 Stat") + } + + var r0 *timeseries.StatResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.StatRequest, ...grpc.CallOption) (*timeseries.StatResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.StatRequest, ...grpc.CallOption) *timeseries.StatResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*timeseries.StatResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *timeseries.StatRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Stat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stat' +type MockTimeseriesServiceClient_Stat_Call struct { + *mock.Call +} + +// Stat is a helper method to define mock.On call +// - ctx context.Context +// - in *timeseries.StatRequest +// - opts ...grpc.CallOption +func (_e *MockTimeseriesServiceClient_Expecter) Stat(ctx interface{}, in interface{}, opts ...interface{}) *MockTimeseriesServiceClient_Stat_Call { + return &MockTimeseriesServiceClient_Stat_Call{Call: _e.mock.On("Stat", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockTimeseriesServiceClient_Stat_Call) Run(run func(ctx context.Context, in *timeseries.StatRequest, opts ...grpc.CallOption)) *MockTimeseriesServiceClient_Stat_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].(*timeseries.StatRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Stat_Call) Return(_a0 *timeseries.StatResponse, _a1 error) *MockTimeseriesServiceClient_Stat_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Stat_Call) RunAndReturn(run func(context.Context, *timeseries.StatRequest, ...grpc.CallOption) (*timeseries.StatResponse, error)) *MockTimeseriesServiceClient_Stat_Call { + _c.Call.Return(run) + return _c +} + +// Write provides a mock function with given fields: ctx, in, opts +func (_m *MockTimeseriesServiceClient) Write(ctx context.Context, in *timeseries.WriteRequest, opts ...grpc.CallOption) (*timeseries.WriteResponse, 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 Write") + } + + var r0 *timeseries.WriteResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.WriteRequest, ...grpc.CallOption) (*timeseries.WriteResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.WriteRequest, ...grpc.CallOption) *timeseries.WriteResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*timeseries.WriteResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *timeseries.WriteRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' +type MockTimeseriesServiceClient_Write_Call struct { + *mock.Call +} + +// Write is a helper method to define mock.On call +// - ctx context.Context +// - in *timeseries.WriteRequest +// - opts ...grpc.CallOption +func (_e *MockTimeseriesServiceClient_Expecter) Write(ctx interface{}, in interface{}, opts ...interface{}) *MockTimeseriesServiceClient_Write_Call { + return &MockTimeseriesServiceClient_Write_Call{Call: _e.mock.On("Write", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockTimeseriesServiceClient_Write_Call) Run(run func(ctx context.Context, in *timeseries.WriteRequest, opts ...grpc.CallOption)) *MockTimeseriesServiceClient_Write_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].(*timeseries.WriteRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Write_Call) Return(_a0 *timeseries.WriteResponse, _a1 error) *MockTimeseriesServiceClient_Write_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Write_Call) RunAndReturn(run func(context.Context, *timeseries.WriteRequest, ...grpc.CallOption) (*timeseries.WriteResponse, error)) *MockTimeseriesServiceClient_Write_Call { + _c.Call.Return(run) + return _c +} + +// WriteBulk provides a mock function with given fields: ctx, in, opts +func (_m *MockTimeseriesServiceClient) WriteBulk(ctx context.Context, in *timeseries.WriteBulkRequest, opts ...grpc.CallOption) (*timeseries.WriteBulkResponse, 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 WriteBulk") + } + + var r0 *timeseries.WriteBulkResponse + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.WriteBulkRequest, ...grpc.CallOption) (*timeseries.WriteBulkResponse, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *timeseries.WriteBulkRequest, ...grpc.CallOption) *timeseries.WriteBulkResponse); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*timeseries.WriteBulkResponse) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *timeseries.WriteBulkRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_WriteBulk_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteBulk' +type MockTimeseriesServiceClient_WriteBulk_Call struct { + *mock.Call +} + +// WriteBulk is a helper method to define mock.On call +// - ctx context.Context +// - in *timeseries.WriteBulkRequest +// - opts ...grpc.CallOption +func (_e *MockTimeseriesServiceClient_Expecter) WriteBulk(ctx interface{}, in interface{}, opts ...interface{}) *MockTimeseriesServiceClient_WriteBulk_Call { + return &MockTimeseriesServiceClient_WriteBulk_Call{Call: _e.mock.On("WriteBulk", + append([]interface{}{ctx, in}, opts...)...)} +} + +func (_c *MockTimeseriesServiceClient_WriteBulk_Call) Run(run func(ctx context.Context, in *timeseries.WriteBulkRequest, opts ...grpc.CallOption)) *MockTimeseriesServiceClient_WriteBulk_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].(*timeseries.WriteBulkRequest), variadicArgs...) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_WriteBulk_Call) Return(_a0 *timeseries.WriteBulkResponse, _a1 error) *MockTimeseriesServiceClient_WriteBulk_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_WriteBulk_Call) RunAndReturn(run func(context.Context, *timeseries.WriteBulkRequest, ...grpc.CallOption) (*timeseries.WriteBulkResponse, error)) *MockTimeseriesServiceClient_WriteBulk_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTimeseriesServiceClient creates a new instance of MockTimeseriesServiceClient. 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 NewMockTimeseriesServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTimeseriesServiceClient { + mock := &MockTimeseriesServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/github.com/infinimesh/proto/timeseries/timeseriesconnect/mock_TimeseriesServiceClient.go b/mocks/github.com/infinimesh/proto/timeseries/timeseriesconnect/mock_TimeseriesServiceClient.go new file mode 100644 index 0000000..7ac6bce --- /dev/null +++ b/mocks/github.com/infinimesh/proto/timeseries/timeseriesconnect/mock_TimeseriesServiceClient.go @@ -0,0 +1,335 @@ +// Code generated by mockery v2.40.1. DO NOT EDIT. + +package timeseriesconnect_mocks + +import ( + context "context" + + connect "connectrpc.com/connect" + + mock "github.com/stretchr/testify/mock" + + timeseries "github.com/infinimesh/proto/timeseries" +) + +// MockTimeseriesServiceClient is an autogenerated mock type for the TimeseriesServiceClient type +type MockTimeseriesServiceClient struct { + mock.Mock +} + +type MockTimeseriesServiceClient_Expecter struct { + mock *mock.Mock +} + +func (_m *MockTimeseriesServiceClient) EXPECT() *MockTimeseriesServiceClient_Expecter { + return &MockTimeseriesServiceClient_Expecter{mock: &_m.Mock} +} + +// Flush provides a mock function with given fields: _a0, _a1 +func (_m *MockTimeseriesServiceClient) Flush(_a0 context.Context, _a1 *connect.Request[timeseries.FlushRequest]) (*connect.Response[timeseries.FlushResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Flush") + } + + var r0 *connect.Response[timeseries.FlushResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.FlushRequest]) (*connect.Response[timeseries.FlushResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.FlushRequest]) *connect.Response[timeseries.FlushResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[timeseries.FlushResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[timeseries.FlushRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Flush_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Flush' +type MockTimeseriesServiceClient_Flush_Call struct { + *mock.Call +} + +// Flush is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[timeseries.FlushRequest] +func (_e *MockTimeseriesServiceClient_Expecter) Flush(_a0 interface{}, _a1 interface{}) *MockTimeseriesServiceClient_Flush_Call { + return &MockTimeseriesServiceClient_Flush_Call{Call: _e.mock.On("Flush", _a0, _a1)} +} + +func (_c *MockTimeseriesServiceClient_Flush_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[timeseries.FlushRequest])) *MockTimeseriesServiceClient_Flush_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[timeseries.FlushRequest])) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Flush_Call) Return(_a0 *connect.Response[timeseries.FlushResponse], _a1 error) *MockTimeseriesServiceClient_Flush_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Flush_Call) RunAndReturn(run func(context.Context, *connect.Request[timeseries.FlushRequest]) (*connect.Response[timeseries.FlushResponse], error)) *MockTimeseriesServiceClient_Flush_Call { + _c.Call.Return(run) + return _c +} + +// Read provides a mock function with given fields: _a0, _a1 +func (_m *MockTimeseriesServiceClient) Read(_a0 context.Context, _a1 *connect.Request[timeseries.ReadRequest]) (*connect.Response[timeseries.ReadResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Read") + } + + var r0 *connect.Response[timeseries.ReadResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.ReadRequest]) (*connect.Response[timeseries.ReadResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.ReadRequest]) *connect.Response[timeseries.ReadResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[timeseries.ReadResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[timeseries.ReadRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read' +type MockTimeseriesServiceClient_Read_Call struct { + *mock.Call +} + +// Read is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[timeseries.ReadRequest] +func (_e *MockTimeseriesServiceClient_Expecter) Read(_a0 interface{}, _a1 interface{}) *MockTimeseriesServiceClient_Read_Call { + return &MockTimeseriesServiceClient_Read_Call{Call: _e.mock.On("Read", _a0, _a1)} +} + +func (_c *MockTimeseriesServiceClient_Read_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[timeseries.ReadRequest])) *MockTimeseriesServiceClient_Read_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[timeseries.ReadRequest])) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Read_Call) Return(_a0 *connect.Response[timeseries.ReadResponse], _a1 error) *MockTimeseriesServiceClient_Read_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Read_Call) RunAndReturn(run func(context.Context, *connect.Request[timeseries.ReadRequest]) (*connect.Response[timeseries.ReadResponse], error)) *MockTimeseriesServiceClient_Read_Call { + _c.Call.Return(run) + return _c +} + +// Stat provides a mock function with given fields: _a0, _a1 +func (_m *MockTimeseriesServiceClient) Stat(_a0 context.Context, _a1 *connect.Request[timeseries.StatRequest]) (*connect.Response[timeseries.StatResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Stat") + } + + var r0 *connect.Response[timeseries.StatResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.StatRequest]) (*connect.Response[timeseries.StatResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.StatRequest]) *connect.Response[timeseries.StatResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[timeseries.StatResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[timeseries.StatRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Stat_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stat' +type MockTimeseriesServiceClient_Stat_Call struct { + *mock.Call +} + +// Stat is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[timeseries.StatRequest] +func (_e *MockTimeseriesServiceClient_Expecter) Stat(_a0 interface{}, _a1 interface{}) *MockTimeseriesServiceClient_Stat_Call { + return &MockTimeseriesServiceClient_Stat_Call{Call: _e.mock.On("Stat", _a0, _a1)} +} + +func (_c *MockTimeseriesServiceClient_Stat_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[timeseries.StatRequest])) *MockTimeseriesServiceClient_Stat_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[timeseries.StatRequest])) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Stat_Call) Return(_a0 *connect.Response[timeseries.StatResponse], _a1 error) *MockTimeseriesServiceClient_Stat_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Stat_Call) RunAndReturn(run func(context.Context, *connect.Request[timeseries.StatRequest]) (*connect.Response[timeseries.StatResponse], error)) *MockTimeseriesServiceClient_Stat_Call { + _c.Call.Return(run) + return _c +} + +// Write provides a mock function with given fields: _a0, _a1 +func (_m *MockTimeseriesServiceClient) Write(_a0 context.Context, _a1 *connect.Request[timeseries.WriteRequest]) (*connect.Response[timeseries.WriteResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for Write") + } + + var r0 *connect.Response[timeseries.WriteResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.WriteRequest]) (*connect.Response[timeseries.WriteResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.WriteRequest]) *connect.Response[timeseries.WriteResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[timeseries.WriteResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[timeseries.WriteRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write' +type MockTimeseriesServiceClient_Write_Call struct { + *mock.Call +} + +// Write is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[timeseries.WriteRequest] +func (_e *MockTimeseriesServiceClient_Expecter) Write(_a0 interface{}, _a1 interface{}) *MockTimeseriesServiceClient_Write_Call { + return &MockTimeseriesServiceClient_Write_Call{Call: _e.mock.On("Write", _a0, _a1)} +} + +func (_c *MockTimeseriesServiceClient_Write_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[timeseries.WriteRequest])) *MockTimeseriesServiceClient_Write_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[timeseries.WriteRequest])) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_Write_Call) Return(_a0 *connect.Response[timeseries.WriteResponse], _a1 error) *MockTimeseriesServiceClient_Write_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_Write_Call) RunAndReturn(run func(context.Context, *connect.Request[timeseries.WriteRequest]) (*connect.Response[timeseries.WriteResponse], error)) *MockTimeseriesServiceClient_Write_Call { + _c.Call.Return(run) + return _c +} + +// WriteBulk provides a mock function with given fields: _a0, _a1 +func (_m *MockTimeseriesServiceClient) WriteBulk(_a0 context.Context, _a1 *connect.Request[timeseries.WriteBulkRequest]) (*connect.Response[timeseries.WriteBulkResponse], error) { + ret := _m.Called(_a0, _a1) + + if len(ret) == 0 { + panic("no return value specified for WriteBulk") + } + + var r0 *connect.Response[timeseries.WriteBulkResponse] + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.WriteBulkRequest]) (*connect.Response[timeseries.WriteBulkResponse], error)); ok { + return rf(_a0, _a1) + } + if rf, ok := ret.Get(0).(func(context.Context, *connect.Request[timeseries.WriteBulkRequest]) *connect.Response[timeseries.WriteBulkResponse]); ok { + r0 = rf(_a0, _a1) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*connect.Response[timeseries.WriteBulkResponse]) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *connect.Request[timeseries.WriteBulkRequest]) error); ok { + r1 = rf(_a0, _a1) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockTimeseriesServiceClient_WriteBulk_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WriteBulk' +type MockTimeseriesServiceClient_WriteBulk_Call struct { + *mock.Call +} + +// WriteBulk is a helper method to define mock.On call +// - _a0 context.Context +// - _a1 *connect.Request[timeseries.WriteBulkRequest] +func (_e *MockTimeseriesServiceClient_Expecter) WriteBulk(_a0 interface{}, _a1 interface{}) *MockTimeseriesServiceClient_WriteBulk_Call { + return &MockTimeseriesServiceClient_WriteBulk_Call{Call: _e.mock.On("WriteBulk", _a0, _a1)} +} + +func (_c *MockTimeseriesServiceClient_WriteBulk_Call) Run(run func(_a0 context.Context, _a1 *connect.Request[timeseries.WriteBulkRequest])) *MockTimeseriesServiceClient_WriteBulk_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*connect.Request[timeseries.WriteBulkRequest])) + }) + return _c +} + +func (_c *MockTimeseriesServiceClient_WriteBulk_Call) Return(_a0 *connect.Response[timeseries.WriteBulkResponse], _a1 error) *MockTimeseriesServiceClient_WriteBulk_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockTimeseriesServiceClient_WriteBulk_Call) RunAndReturn(run func(context.Context, *connect.Request[timeseries.WriteBulkRequest]) (*connect.Response[timeseries.WriteBulkResponse], error)) *MockTimeseriesServiceClient_WriteBulk_Call { + _c.Call.Return(run) + return _c +} + +// NewMockTimeseriesServiceClient creates a new instance of MockTimeseriesServiceClient. 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 NewMockTimeseriesServiceClient(t interface { + mock.TestingT + Cleanup(func()) +}) *MockTimeseriesServiceClient { + mock := &MockTimeseriesServiceClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}