Documentation ¶
Index ¶
- type BidiStreamMock
- func (mock *BidiStreamMock) Close() error
- func (mock *BidiStreamMock) CloseCalls() []struct{}
- func (mock *BidiStreamMock) Receive(res *proto.Message) error
- func (mock *BidiStreamMock) ReceiveCalls() []struct{ ... }
- func (mock *BidiStreamMock) Send(req proto.Message) error
- func (mock *BidiStreamMock) SendCalls() []struct{ ... }
- type ClientStreamMock
- type FieldMock
- func (mock *FieldMock) FQRN() string
- func (mock *FieldMock) FQRNCalls() []struct{}
- func (mock *FieldMock) FieldName() string
- func (mock *FieldMock) FieldNameCalls() []struct{}
- func (mock *FieldMock) IsRepeated() bool
- func (mock *FieldMock) IsRepeatedCalls() []struct{}
- func (mock *FieldMock) PBType() string
- func (mock *FieldMock) PBTypeCalls() []struct{}
- func (mock *FieldMock) Type() entity.FieldType
- func (mock *FieldMock) TypeCalls() []struct{}
- type GRPCClientMock
- func (mock *GRPCClientMock) Close(ctx context.Context) error
- func (mock *GRPCClientMock) CloseCalls() []struct{ ... }
- func (mock *GRPCClientMock) Invoke(ctx context.Context, fqrn string, req interface{}, res interface{}) error
- func (mock *GRPCClientMock) InvokeCalls() []struct{ ... }
- func (mock *GRPCClientMock) ListPackages() ([]*entity.Package, error)
- func (mock *GRPCClientMock) ListServicesCalls() []struct{}
- func (mock *GRPCClientMock) NewBidiStream(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error)
- func (mock *GRPCClientMock) NewBidiStreamCalls() []struct{ ... }
- func (mock *GRPCClientMock) NewClientStream(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error)
- func (mock *GRPCClientMock) NewClientStreamCalls() []struct{ ... }
- func (mock *GRPCClientMock) NewServerStream(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error)
- func (mock *GRPCClientMock) NewServerStreamCalls() []struct{ ... }
- func (mock *GRPCClientMock) ReflectionEnabled() bool
- func (mock *GRPCClientMock) ReflectionEnabledCalls() []struct{}
- type MessageMock
- type RPCMock
- func (mock *RPCMock) FQRN() string
- func (mock *RPCMock) FQRNCalls() []struct{}
- func (mock *RPCMock) IsClientStreaming() bool
- func (mock *RPCMock) IsClientStreamingCalls() []struct{}
- func (mock *RPCMock) IsServerStreaming() bool
- func (mock *RPCMock) IsServerStreamingCalls() []struct{}
- func (mock *RPCMock) Name() string
- func (mock *RPCMock) NameCalls() []struct{}
- func (mock *RPCMock) RequestMessage() entity.Message
- func (mock *RPCMock) RequestMessageCalls() []struct{}
- func (mock *RPCMock) ResponseMessage() entity.Message
- func (mock *RPCMock) ResponseMessageCalls() []struct{}
- func (mock *RPCMock) StreamDesc() *grpc.StreamDesc
- func (mock *RPCMock) StreamDescCalls() []struct{}
- type ServerStreamMock
- type ServiceMock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BidiStreamMock ¶
type BidiStreamMock struct { // CloseFunc mocks the Close method. CloseFunc func() error // ReceiveFunc mocks the Receive method. ReceiveFunc func(res *proto.Message) error // SendFunc mocks the Send method. SendFunc func(req proto.Message) error // contains filtered or unexported fields }
BidiStreamMock is a mock implementation of BidiStream.
func TestSomethingThatUsesBidiStream(t *testing.T) { // make and configure a mocked BidiStream mockedBidiStream := &BidiStreamMock{ CloseFunc: func() error { panic("TODO: mock out the Close method") }, ReceiveFunc: func(res *proto.Message) error { panic("TODO: mock out the Receive method") }, SendFunc: func(req proto.Message) error { panic("TODO: mock out the Send method") }, } // TODO: use mockedBidiStream in code that requires BidiStream // and then make assertions. }
func (*BidiStreamMock) CloseCalls ¶
func (mock *BidiStreamMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedBidiStream.CloseCalls())
func (*BidiStreamMock) Receive ¶
func (mock *BidiStreamMock) Receive(res *proto.Message) error
Receive calls ReceiveFunc.
func (*BidiStreamMock) ReceiveCalls ¶
func (mock *BidiStreamMock) ReceiveCalls() []struct { Res *proto.Message }
ReceiveCalls gets all the calls that were made to Receive. Check the length with:
len(mockedBidiStream.ReceiveCalls())
func (*BidiStreamMock) Send ¶
func (mock *BidiStreamMock) Send(req proto.Message) error
Send calls SendFunc.
func (*BidiStreamMock) SendCalls ¶
func (mock *BidiStreamMock) SendCalls() []struct { Req proto.Message }
SendCalls gets all the calls that were made to Send. Check the length with:
len(mockedBidiStream.SendCalls())
type ClientStreamMock ¶
type ClientStreamMock struct { // CloseAndReceiveFunc mocks the CloseAndReceive method. CloseAndReceiveFunc func(res *proto.Message) error // SendFunc mocks the Send method. SendFunc func(req proto.Message) error // contains filtered or unexported fields }
ClientStreamMock is a mock implementation of ClientStream.
func TestSomethingThatUsesClientStream(t *testing.T) { // make and configure a mocked ClientStream mockedClientStream := &ClientStreamMock{ CloseAndReceiveFunc: func(res *proto.Message) error { panic("TODO: mock out the CloseAndReceive method") }, SendFunc: func(req proto.Message) error { panic("TODO: mock out the Send method") }, } // TODO: use mockedClientStream in code that requires ClientStream // and then make assertions. }
func (*ClientStreamMock) CloseAndReceive ¶
func (mock *ClientStreamMock) CloseAndReceive(res *proto.Message) error
CloseAndReceive calls CloseAndReceiveFunc.
func (*ClientStreamMock) CloseAndReceiveCalls ¶
func (mock *ClientStreamMock) CloseAndReceiveCalls() []struct { Res *proto.Message }
CloseAndReceiveCalls gets all the calls that were made to CloseAndReceive. Check the length with:
len(mockedClientStream.CloseAndReceiveCalls())
func (*ClientStreamMock) Send ¶
func (mock *ClientStreamMock) Send(req proto.Message) error
Send calls SendFunc.
func (*ClientStreamMock) SendCalls ¶
func (mock *ClientStreamMock) SendCalls() []struct { Req proto.Message }
SendCalls gets all the calls that were made to Send. Check the length with:
len(mockedClientStream.SendCalls())
type FieldMock ¶
type FieldMock struct { // FQRNFunc mocks the FQRN method. FQRNFunc func() string // FieldNameFunc mocks the FieldName method. FieldNameFunc func() string // IsRepeatedFunc mocks the IsRepeated method. IsRepeatedFunc func() bool // PBTypeFunc mocks the PBType method. PBTypeFunc func() string // TypeFunc mocks the Type method. TypeFunc func() entity.FieldType // contains filtered or unexported fields }
FieldMock is a mock implementation of Field.
func TestSomethingThatUsesField(t *testing.T) { // make and configure a mocked Field mockedField := &FieldMock{ FQRNFunc: func() string { panic("TODO: mock out the FQRN method") }, FieldNameFunc: func() string { panic("TODO: mock out the FieldName method") }, IsRepeatedFunc: func() bool { panic("TODO: mock out the IsRepeated method") }, PBTypeFunc: func() string { panic("TODO: mock out the PBType method") }, TypeFunc: func() entity.FieldType { panic("TODO: mock out the Type method") }, } // TODO: use mockedField in code that requires Field // and then make assertions. }
func (*FieldMock) FQRNCalls ¶
func (mock *FieldMock) FQRNCalls() []struct { }
FQRNCalls gets all the calls that were made to FQRN. Check the length with:
len(mockedField.FQRNCalls())
func (*FieldMock) FieldNameCalls ¶
func (mock *FieldMock) FieldNameCalls() []struct { }
FieldNameCalls gets all the calls that were made to FieldName. Check the length with:
len(mockedField.FieldNameCalls())
func (*FieldMock) IsRepeated ¶
IsRepeated calls IsRepeatedFunc.
func (*FieldMock) IsRepeatedCalls ¶
func (mock *FieldMock) IsRepeatedCalls() []struct { }
IsRepeatedCalls gets all the calls that were made to IsRepeated. Check the length with:
len(mockedField.IsRepeatedCalls())
func (*FieldMock) PBTypeCalls ¶
func (mock *FieldMock) PBTypeCalls() []struct { }
PBTypeCalls gets all the calls that were made to PBType. Check the length with:
len(mockedField.PBTypeCalls())
type GRPCClientMock ¶
type GRPCClientMock struct { // CloseFunc mocks the Close method. CloseFunc func(ctx context.Context) error // InvokeFunc mocks the Invoke method. InvokeFunc func(ctx context.Context, fqrn string, req interface{}, res interface{}) error // ListServicesFunc mocks the ListPackages method. ListServicesFunc func() ([]*entity.Package, error) // NewBidiStreamFunc mocks the NewBidiStream method. NewBidiStreamFunc func(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error) // NewClientStreamFunc mocks the NewClientStream method. NewClientStreamFunc func(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error) // NewServerStreamFunc mocks the NewServerStream method. NewServerStreamFunc func(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error) // ReflectionEnabledFunc mocks the ReflectionEnabled method. ReflectionEnabledFunc func() bool // contains filtered or unexported fields }
GRPCClientMock is a mock implementation of GRPCClient.
func TestSomethingThatUsesGRPCClient(t *testing.T) { // make and configure a mocked GRPCClient mockedGRPCClient := &GRPCClientMock{ CloseFunc: func(ctx context.Context) error { panic("TODO: mock out the Close method") }, InvokeFunc: func(ctx context.Context, fqrn string, req interface{}, res interface{}) error { panic("TODO: mock out the Invoke method") }, ListServicesFunc: func() ([]entity.Service, []entity.Message, error) { panic("TODO: mock out the ListPackages method") }, NewBidiStreamFunc: func(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error) { panic("TODO: mock out the NewBidiStream method") }, NewClientStreamFunc: func(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error) { panic("TODO: mock out the NewClientStream method") }, NewServerStreamFunc: func(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error) { panic("TODO: mock out the NewServerStream method") }, ReflectionEnabledFunc: func() bool { panic("TODO: mock out the ReflectionEnabled method") }, } // TODO: use mockedGRPCClient in code that requires GRPCClient // and then make assertions. }
func (*GRPCClientMock) Close ¶
func (mock *GRPCClientMock) Close(ctx context.Context) error
Close calls CloseFunc.
func (*GRPCClientMock) CloseCalls ¶
func (mock *GRPCClientMock) CloseCalls() []struct { Ctx context.Context }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedGRPCClient.CloseCalls())
func (*GRPCClientMock) Invoke ¶
func (mock *GRPCClientMock) Invoke(ctx context.Context, fqrn string, req interface{}, res interface{}) error
Invoke calls InvokeFunc.
func (*GRPCClientMock) InvokeCalls ¶
func (mock *GRPCClientMock) InvokeCalls() []struct { Ctx context.Context Fqrn string Req interface{} Res interface{} }
InvokeCalls gets all the calls that were made to Invoke. Check the length with:
len(mockedGRPCClient.InvokeCalls())
func (*GRPCClientMock) ListPackages ¶ added in v0.7.1
func (mock *GRPCClientMock) ListPackages() ([]*entity.Package, error)
ListPackages calls ListServicesFunc.
func (*GRPCClientMock) ListServicesCalls ¶
func (mock *GRPCClientMock) ListServicesCalls() []struct { }
ListServicesCalls gets all the calls that were made to ListPackages. Check the length with:
len(mockedGRPCClient.ListServicesCalls())
func (*GRPCClientMock) NewBidiStream ¶
func (mock *GRPCClientMock) NewBidiStream(ctx context.Context, rpc entity.RPC) (entity.BidiStream, error)
NewBidiStream calls NewBidiStreamFunc.
func (*GRPCClientMock) NewBidiStreamCalls ¶
func (mock *GRPCClientMock) NewBidiStreamCalls() []struct { Ctx context.Context RPC entity.RPC }
NewBidiStreamCalls gets all the calls that were made to NewBidiStream. Check the length with:
len(mockedGRPCClient.NewBidiStreamCalls())
func (*GRPCClientMock) NewClientStream ¶
func (mock *GRPCClientMock) NewClientStream(ctx context.Context, rpc entity.RPC) (entity.ClientStream, error)
NewClientStream calls NewClientStreamFunc.
func (*GRPCClientMock) NewClientStreamCalls ¶
func (mock *GRPCClientMock) NewClientStreamCalls() []struct { Ctx context.Context RPC entity.RPC }
NewClientStreamCalls gets all the calls that were made to NewClientStream. Check the length with:
len(mockedGRPCClient.NewClientStreamCalls())
func (*GRPCClientMock) NewServerStream ¶
func (mock *GRPCClientMock) NewServerStream(ctx context.Context, rpc entity.RPC) (entity.ServerStream, error)
NewServerStream calls NewServerStreamFunc.
func (*GRPCClientMock) NewServerStreamCalls ¶
func (mock *GRPCClientMock) NewServerStreamCalls() []struct { Ctx context.Context RPC entity.RPC }
NewServerStreamCalls gets all the calls that were made to NewServerStream. Check the length with:
len(mockedGRPCClient.NewServerStreamCalls())
func (*GRPCClientMock) ReflectionEnabled ¶
func (mock *GRPCClientMock) ReflectionEnabled() bool
ReflectionEnabled calls ReflectionEnabledFunc.
func (*GRPCClientMock) ReflectionEnabledCalls ¶
func (mock *GRPCClientMock) ReflectionEnabledCalls() []struct { }
ReflectionEnabledCalls gets all the calls that were made to ReflectionEnabled. Check the length with:
len(mockedGRPCClient.ReflectionEnabledCalls())
type MessageMock ¶
type MessageMock struct { // FieldsFunc mocks the Fields method. FieldsFunc func() []entity.Field // IsCycledFunc mocks the IsCycled method. IsCycledFunc func() bool // NameFunc mocks the Name method. NameFunc func() string // contains filtered or unexported fields }
MessageMock is a mock implementation of Message.
func TestSomethingThatUsesMessage(t *testing.T) { // make and configure a mocked Message mockedMessage := &MessageMock{ FieldsFunc: func() []entity.Field { panic("TODO: mock out the Fields method") }, IsCycledFunc: func() bool { panic("TODO: mock out the IsCycled method") }, NameFunc: func() string { panic("TODO: mock out the Name method") }, } // TODO: use mockedMessage in code that requires Message // and then make assertions. }
func (*MessageMock) Fields ¶
func (mock *MessageMock) Fields() []entity.Field
Fields calls FieldsFunc.
func (*MessageMock) FieldsCalls ¶
func (mock *MessageMock) FieldsCalls() []struct { }
FieldsCalls gets all the calls that were made to Fields. Check the length with:
len(mockedMessage.FieldsCalls())
func (*MessageMock) IsCycled ¶
func (mock *MessageMock) IsCycled() bool
IsCycled calls IsCycledFunc.
func (*MessageMock) IsCycledCalls ¶
func (mock *MessageMock) IsCycledCalls() []struct { }
IsCycledCalls gets all the calls that were made to IsCycled. Check the length with:
len(mockedMessage.IsCycledCalls())
func (*MessageMock) NameCalls ¶
func (mock *MessageMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedMessage.NameCalls())
type RPCMock ¶
type RPCMock struct { // FQRNFunc mocks the FQRN method. FQRNFunc func() string // IsClientStreamingFunc mocks the IsClientStreaming method. IsClientStreamingFunc func() bool // IsServerStreamingFunc mocks the IsServerStreaming method. IsServerStreamingFunc func() bool // NameFunc mocks the Name method. NameFunc func() string // RequestMessageFunc mocks the RequestMessage method. RequestMessageFunc func() entity.Message // ResponseMessageFunc mocks the ResponseMessage method. ResponseMessageFunc func() entity.Message // StreamDescFunc mocks the StreamDesc method. StreamDescFunc func() *grpc.StreamDesc // contains filtered or unexported fields }
RPCMock is a mock implementation of RPC.
func TestSomethingThatUsesRPC(t *testing.T) { // make and configure a mocked RPC mockedRPC := &RPCMock{ FQRNFunc: func() string { panic("TODO: mock out the FQRN method") }, IsClientStreamingFunc: func() bool { panic("TODO: mock out the IsClientStreaming method") }, IsServerStreamingFunc: func() bool { panic("TODO: mock out the IsServerStreaming method") }, NameFunc: func() string { panic("TODO: mock out the Name method") }, RequestMessageFunc: func() entity.Message { panic("TODO: mock out the RequestMessage method") }, ResponseMessageFunc: func() entity.Message { panic("TODO: mock out the ResponseMessage method") }, StreamDescFunc: func() *grpc.StreamDesc { panic("TODO: mock out the StreamDesc method") }, } // TODO: use mockedRPC in code that requires RPC // and then make assertions. }
func (*RPCMock) FQRNCalls ¶
func (mock *RPCMock) FQRNCalls() []struct { }
FQRNCalls gets all the calls that were made to FQRN. Check the length with:
len(mockedRPC.FQRNCalls())
func (*RPCMock) IsClientStreaming ¶
IsClientStreaming calls IsClientStreamingFunc.
func (*RPCMock) IsClientStreamingCalls ¶
func (mock *RPCMock) IsClientStreamingCalls() []struct { }
IsClientStreamingCalls gets all the calls that were made to IsClientStreaming. Check the length with:
len(mockedRPC.IsClientStreamingCalls())
func (*RPCMock) IsServerStreaming ¶
IsServerStreaming calls IsServerStreamingFunc.
func (*RPCMock) IsServerStreamingCalls ¶
func (mock *RPCMock) IsServerStreamingCalls() []struct { }
IsServerStreamingCalls gets all the calls that were made to IsServerStreaming. Check the length with:
len(mockedRPC.IsServerStreamingCalls())
func (*RPCMock) NameCalls ¶
func (mock *RPCMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedRPC.NameCalls())
func (*RPCMock) RequestMessage ¶
RequestMessage calls RequestMessageFunc.
func (*RPCMock) RequestMessageCalls ¶
func (mock *RPCMock) RequestMessageCalls() []struct { }
RequestMessageCalls gets all the calls that were made to RequestMessage. Check the length with:
len(mockedRPC.RequestMessageCalls())
func (*RPCMock) ResponseMessage ¶
ResponseMessage calls ResponseMessageFunc.
func (*RPCMock) ResponseMessageCalls ¶
func (mock *RPCMock) ResponseMessageCalls() []struct { }
ResponseMessageCalls gets all the calls that were made to ResponseMessage. Check the length with:
len(mockedRPC.ResponseMessageCalls())
func (*RPCMock) StreamDesc ¶
func (mock *RPCMock) StreamDesc() *grpc.StreamDesc
StreamDesc calls StreamDescFunc.
func (*RPCMock) StreamDescCalls ¶
func (mock *RPCMock) StreamDescCalls() []struct { }
StreamDescCalls gets all the calls that were made to StreamDesc. Check the length with:
len(mockedRPC.StreamDescCalls())
type ServerStreamMock ¶
type ServerStreamMock struct { // ReceiveFunc mocks the Receive method. ReceiveFunc func(res *proto.Message) error // SendFunc mocks the Send method. SendFunc func(req proto.Message) error // contains filtered or unexported fields }
ServerStreamMock is a mock implementation of ServerStream.
func TestSomethingThatUsesServerStream(t *testing.T) { // make and configure a mocked ServerStream mockedServerStream := &ServerStreamMock{ ReceiveFunc: func(res *proto.Message) error { panic("TODO: mock out the Receive method") }, SendFunc: func(req proto.Message) error { panic("TODO: mock out the Send method") }, } // TODO: use mockedServerStream in code that requires ServerStream // and then make assertions. }
func (*ServerStreamMock) Receive ¶
func (mock *ServerStreamMock) Receive(res *proto.Message) error
Receive calls ReceiveFunc.
func (*ServerStreamMock) ReceiveCalls ¶
func (mock *ServerStreamMock) ReceiveCalls() []struct { Res *proto.Message }
ReceiveCalls gets all the calls that were made to Receive. Check the length with:
len(mockedServerStream.ReceiveCalls())
func (*ServerStreamMock) Send ¶
func (mock *ServerStreamMock) Send(req proto.Message) error
Send calls SendFunc.
func (*ServerStreamMock) SendCalls ¶
func (mock *ServerStreamMock) SendCalls() []struct { Req proto.Message }
SendCalls gets all the calls that were made to Send. Check the length with:
len(mockedServerStream.SendCalls())
type ServiceMock ¶
type ServiceMock struct { // FQRNFunc mocks the FQRN method. FQRNFunc func() string // NameFunc mocks the Name method. NameFunc func() string // RPCsFunc mocks the RPCs method. RPCsFunc func() []entity.RPC // contains filtered or unexported fields }
ServiceMock is a mock implementation of Service.
func TestSomethingThatUsesService(t *testing.T) { // make and configure a mocked Service mockedService := &ServiceMock{ FQRNFunc: func() string { panic("TODO: mock out the FQRN method") }, NameFunc: func() string { panic("TODO: mock out the Name method") }, RPCsFunc: func() []entity.RPC { panic("TODO: mock out the RPCs method") }, } // TODO: use mockedService in code that requires Service // and then make assertions. }
func (*ServiceMock) FQRNCalls ¶
func (mock *ServiceMock) FQRNCalls() []struct { }
FQRNCalls gets all the calls that were made to FQRN. Check the length with:
len(mockedService.FQRNCalls())
func (*ServiceMock) NameCalls ¶
func (mock *ServiceMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedService.NameCalls())
func (*ServiceMock) RPCsCalls ¶
func (mock *ServiceMock) RPCsCalls() []struct { }
RPCsCalls gets all the calls that were made to RPCs. Check the length with:
len(mockedService.RPCsCalls())