From 2c9980de2b63da433465836be689510634df5690 Mon Sep 17 00:00:00 2001 From: Christian Lohr Date: Tue, 21 May 2024 15:45:18 +0200 Subject: [PATCH] chore: add missing consensus query mocks --- x/consensus/types/mocks/QueryServer.go | 230 ++++++++++++++++++------- 1 file changed, 168 insertions(+), 62 deletions(-) diff --git a/x/consensus/types/mocks/QueryServer.go b/x/consensus/types/mocks/QueryServer.go index c3b8f058..bf257a88 100644 --- a/x/consensus/types/mocks/QueryServer.go +++ b/x/consensus/types/mocks/QueryServer.go @@ -1,38 +1,89 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.1. DO NOT EDIT. package mocks import ( context "context" - types "github.com/palomachain/paloma/x/consensus/types" + grpc "google.golang.org/grpc" + mock "github.com/stretchr/testify/mock" + + types "github.com/palomachain/paloma/x/consensus/types" ) -// QueryServer is an autogenerated mock type for the QueryServer type +// QueryServer is an autogenerated mock type for the QueryClient type type QueryServer struct { mock.Mock } -// GetAllQueueNames provides a mock function with given fields: _a0, _a1 -func (_m *QueryServer) GetAllQueueNames(_a0 context.Context, _a1 *types.QueryGetAllQueueNamesRequest) (*types.QueryGetAllQueueNamesResponse, error) { - ret := _m.Called(_a0, _a1) +// GetAllQueueNames provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) GetAllQueueNames(ctx context.Context, in *types.QueryGetAllQueueNamesRequest, opts ...grpc.CallOption) (*types.QueryGetAllQueueNamesResponse, 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 GetAllQueueNames") + } var r0 *types.QueryGetAllQueueNamesResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetAllQueueNamesRequest) (*types.QueryGetAllQueueNamesResponse, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetAllQueueNamesRequest, ...grpc.CallOption) (*types.QueryGetAllQueueNamesResponse, error)); ok { + return rf(ctx, in, opts...) } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetAllQueueNamesRequest) *types.QueryGetAllQueueNamesResponse); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryGetAllQueueNamesRequest, ...grpc.CallOption) *types.QueryGetAllQueueNamesResponse); ok { + r0 = rf(ctx, in, opts...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.QueryGetAllQueueNamesResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryGetAllQueueNamesRequest) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryGetAllQueueNamesRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MessageByID provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) MessageByID(ctx context.Context, in *types.QueryMessageByIDRequest, opts ...grpc.CallOption) (*types.MessageWithSignatures, 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 MessageByID") + } + + var r0 *types.MessageWithSignatures + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryMessageByIDRequest, ...grpc.CallOption) (*types.MessageWithSignatures, error)); ok { + return rf(ctx, in, opts...) + } + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryMessageByIDRequest, ...grpc.CallOption) *types.MessageWithSignatures); ok { + r0 = rf(ctx, in, opts...) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.MessageWithSignatures) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryMessageByIDRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) } else { r1 = ret.Error(1) } @@ -40,25 +91,36 @@ func (_m *QueryServer) GetAllQueueNames(_a0 context.Context, _a1 *types.QueryGet return r0, r1 } -// MessagesInQueue provides a mock function with given fields: _a0, _a1 -func (_m *QueryServer) MessagesInQueue(_a0 context.Context, _a1 *types.QueryMessagesInQueueRequest) (*types.QueryMessagesInQueueResponse, error) { - ret := _m.Called(_a0, _a1) +// MessagesInQueue provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) MessagesInQueue(ctx context.Context, in *types.QueryMessagesInQueueRequest, opts ...grpc.CallOption) (*types.QueryMessagesInQueueResponse, 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 MessagesInQueue") + } var r0 *types.QueryMessagesInQueueResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryMessagesInQueueRequest) (*types.QueryMessagesInQueueResponse, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryMessagesInQueueRequest, ...grpc.CallOption) (*types.QueryMessagesInQueueResponse, error)); ok { + return rf(ctx, in, opts...) } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryMessagesInQueueRequest) *types.QueryMessagesInQueueResponse); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryMessagesInQueueRequest, ...grpc.CallOption) *types.QueryMessagesInQueueResponse); ok { + r0 = rf(ctx, in, opts...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.QueryMessagesInQueueResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryMessagesInQueueRequest) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryMessagesInQueueRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) } else { r1 = ret.Error(1) } @@ -66,25 +128,36 @@ func (_m *QueryServer) MessagesInQueue(_a0 context.Context, _a1 *types.QueryMess return r0, r1 } -// Params provides a mock function with given fields: _a0, _a1 -func (_m *QueryServer) Params(_a0 context.Context, _a1 *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - ret := _m.Called(_a0, _a1) +// Params provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) Params(ctx context.Context, in *types.QueryParamsRequest, opts ...grpc.CallOption) (*types.QueryParamsResponse, 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 Params") + } var r0 *types.QueryParamsResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryParamsRequest) (*types.QueryParamsResponse, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryParamsRequest, ...grpc.CallOption) (*types.QueryParamsResponse, error)); ok { + return rf(ctx, in, opts...) } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryParamsRequest) *types.QueryParamsResponse); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryParamsRequest, ...grpc.CallOption) *types.QueryParamsResponse); ok { + r0 = rf(ctx, in, opts...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.QueryParamsResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryParamsRequest) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryParamsRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) } else { r1 = ret.Error(1) } @@ -92,25 +165,36 @@ func (_m *QueryServer) Params(_a0 context.Context, _a1 *types.QueryParamsRequest return r0, r1 } -// QueuedMessagesForAttesting provides a mock function with given fields: _a0, _a1 -func (_m *QueryServer) QueuedMessagesForAttesting(_a0 context.Context, _a1 *types.QueryQueuedMessagesForAttestingRequest) (*types.QueryQueuedMessagesForAttestingResponse, error) { - ret := _m.Called(_a0, _a1) +// QueuedMessagesForAttesting provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) QueuedMessagesForAttesting(ctx context.Context, in *types.QueryQueuedMessagesForAttestingRequest, opts ...grpc.CallOption) (*types.QueryQueuedMessagesForAttestingResponse, 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 QueuedMessagesForAttesting") + } var r0 *types.QueryQueuedMessagesForAttestingResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForAttestingRequest) (*types.QueryQueuedMessagesForAttestingResponse, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForAttestingRequest, ...grpc.CallOption) (*types.QueryQueuedMessagesForAttestingResponse, error)); ok { + return rf(ctx, in, opts...) } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForAttestingRequest) *types.QueryQueuedMessagesForAttestingResponse); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForAttestingRequest, ...grpc.CallOption) *types.QueryQueuedMessagesForAttestingResponse); ok { + r0 = rf(ctx, in, opts...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.QueryQueuedMessagesForAttestingResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryQueuedMessagesForAttestingRequest) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryQueuedMessagesForAttestingRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) } else { r1 = ret.Error(1) } @@ -118,25 +202,36 @@ func (_m *QueryServer) QueuedMessagesForAttesting(_a0 context.Context, _a1 *type return r0, r1 } -// QueuedMessagesForRelaying provides a mock function with given fields: _a0, _a1 -func (_m *QueryServer) QueuedMessagesForRelaying(_a0 context.Context, _a1 *types.QueryQueuedMessagesForRelayingRequest) (*types.QueryQueuedMessagesForRelayingResponse, error) { - ret := _m.Called(_a0, _a1) +// QueuedMessagesForRelaying provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) QueuedMessagesForRelaying(ctx context.Context, in *types.QueryQueuedMessagesForRelayingRequest, opts ...grpc.CallOption) (*types.QueryQueuedMessagesForRelayingResponse, 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 QueuedMessagesForRelaying") + } var r0 *types.QueryQueuedMessagesForRelayingResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForRelayingRequest) (*types.QueryQueuedMessagesForRelayingResponse, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForRelayingRequest, ...grpc.CallOption) (*types.QueryQueuedMessagesForRelayingResponse, error)); ok { + return rf(ctx, in, opts...) } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForRelayingRequest) *types.QueryQueuedMessagesForRelayingResponse); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForRelayingRequest, ...grpc.CallOption) *types.QueryQueuedMessagesForRelayingResponse); ok { + r0 = rf(ctx, in, opts...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.QueryQueuedMessagesForRelayingResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryQueuedMessagesForRelayingRequest) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryQueuedMessagesForRelayingRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) } else { r1 = ret.Error(1) } @@ -144,25 +239,36 @@ func (_m *QueryServer) QueuedMessagesForRelaying(_a0 context.Context, _a1 *types return r0, r1 } -// QueuedMessagesForSigning provides a mock function with given fields: _a0, _a1 -func (_m *QueryServer) QueuedMessagesForSigning(_a0 context.Context, _a1 *types.QueryQueuedMessagesForSigningRequest) (*types.QueryQueuedMessagesForSigningResponse, error) { - ret := _m.Called(_a0, _a1) +// QueuedMessagesForSigning provides a mock function with given fields: ctx, in, opts +func (_m *QueryServer) QueuedMessagesForSigning(ctx context.Context, in *types.QueryQueuedMessagesForSigningRequest, opts ...grpc.CallOption) (*types.QueryQueuedMessagesForSigningResponse, 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 QueuedMessagesForSigning") + } var r0 *types.QueryQueuedMessagesForSigningResponse var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForSigningRequest) (*types.QueryQueuedMessagesForSigningResponse, error)); ok { - return rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForSigningRequest, ...grpc.CallOption) (*types.QueryQueuedMessagesForSigningResponse, error)); ok { + return rf(ctx, in, opts...) } - if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForSigningRequest) *types.QueryQueuedMessagesForSigningResponse); ok { - r0 = rf(_a0, _a1) + if rf, ok := ret.Get(0).(func(context.Context, *types.QueryQueuedMessagesForSigningRequest, ...grpc.CallOption) *types.QueryQueuedMessagesForSigningResponse); ok { + r0 = rf(ctx, in, opts...) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*types.QueryQueuedMessagesForSigningResponse) } } - if rf, ok := ret.Get(1).(func(context.Context, *types.QueryQueuedMessagesForSigningRequest) error); ok { - r1 = rf(_a0, _a1) + if rf, ok := ret.Get(1).(func(context.Context, *types.QueryQueuedMessagesForSigningRequest, ...grpc.CallOption) error); ok { + r1 = rf(ctx, in, opts...) } else { r1 = ret.Error(1) } @@ -170,13 +276,13 @@ func (_m *QueryServer) QueuedMessagesForSigning(_a0 context.Context, _a1 *types. return r0, r1 } -type mockConstructorTestingTNewQueryServer interface { +// NewQueryServer creates a new instance of QueryServer. 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 NewQueryServer(t interface { mock.TestingT Cleanup(func()) -} - -// NewQueryServer creates a new instance of QueryServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewQueryServer(t mockConstructorTestingTNewQueryServer) *QueryServer { +}, +) *QueryServer { mock := &QueryServer{} mock.Mock.Test(t)