mock

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mock provides a mock client for testing

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) Init

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

func (*MockClient) NewMessage added in v0.8.0

func (m *MockClient) NewMessage(topic string, msg interface{}, opts ...client.MessageOption) client.Message

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.Message, opts ...client.PublishOption) error

func (*MockClient) Stream

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

func (*MockClient) String

func (m *MockClient) String() string

type MockResponse

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

Directories

Path Synopsis
client module
mock Module
rpc Module
cmd module
codec module
bytes Module
grpc Module
json Module
jsonrpc Module
proto Module
protorpc Module
errors module
metadata module
registry module
consul Module
gossip Module
gossip/proto Module
mdns Module
memory Module
selector module
dns Module
registry Module
static Module
server module
debug Module
mock Module
rpc Module
transport module
http Module
memory Module

Jump to

Keyboard shortcuts

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