mock

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2018 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Response

func Response(service string, response []MockResponse) client.Option

Response sets the response methods for a service

Types

type MockClient

type MockClient struct {
	Client client.Client
	Opts   client.Options

	sync.Mutex
	Response map[string][]MockResponse
}

func NewClient

func NewClient(opts ...client.Option) *MockClient

func (*MockClient) Call

func (m *MockClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error

func (*MockClient) CallRemote

func (m *MockClient) CallRemote(ctx context.Context, addr string, req client.Request, rsp interface{}, opts ...client.CallOption) error

func (*MockClient) Init

func (m *MockClient) Init(opts ...client.Option) error

func (*MockClient) NewJsonRequest

func (m *MockClient) NewJsonRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request

func (*MockClient) NewProtoRequest

func (m *MockClient) NewProtoRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request

func (*MockClient) NewPublication

func (m *MockClient) NewPublication(topic string, msg interface{}) client.Publication

func (*MockClient) NewRequest

func (m *MockClient) NewRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request

func (*MockClient) Options

func (m *MockClient) Options() client.Options

func (*MockClient) Publish

func (m *MockClient) Publish(ctx context.Context, p client.Publication, opts ...client.PublishOption) error

func (*MockClient) Stream

func (m *MockClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Streamer, error)

func (*MockClient) StreamRemote

func (m *MockClient) StreamRemote(ctx context.Context, addr string, req client.Request, opts ...client.CallOption) (client.Streamer, error)

func (*MockClient) String

func (m *MockClient) String() string

type MockResponse

type MockResponse struct {
	Method   string
	Response interface{}
	Error    error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL