mocks

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMockResult

func NewMockResult(sid string) *common.CommandResult

NewMockResult builds a new result with sid as transmission

Types

type MockController

type MockController struct {
	Started bool
}

MockController implements controller interface for tests

func NewMockController

func NewMockController() MockController

NewMockController builds new mock controller instance

func (*MockController) Authenticate

func (c *MockController) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Authenticate emulates authentication process: - if path is equal to "failure" then authentication failed - otherwise returns value of headers['id'] as identifier

func (*MockController) Disconnect

func (c *MockController) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error

Disconnect method stub

func (*MockController) Perform

func (c *MockController) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)

Perform return result with Transmissions containing data (i.e. emulates "echo" action)

func (*MockController) Shutdown

func (c *MockController) Shutdown() error

Shutdown changes Started to false

func (*MockController) Start added in v1.1.0

func (c *MockController) Start() error

func (*MockController) Subscribe

func (c *MockController) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Subscribe emulates subscription process: - if channel is equal to "failure" then returns subscription error - if channel is equal to "disconnect" then returns result with disconnect set to true - if channel is equal to "stream" then add "stream" to result.Streams - otherwise returns success result with one transmission equal to sid

func (*MockController) Unsubscribe

func (c *MockController) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)

Unsubscribe returns command result

type RPCClient

type RPCClient struct {
	mock.Mock
}

RPCClient is an autogenerated mock type for the RPCClient type

func (*RPCClient) Command

Command provides a mock function with given fields: ctx, in, opts

func (*RPCClient) Connect

Connect provides a mock function with given fields: ctx, in, opts

func (*RPCClient) Disconnect

Disconnect provides a mock function with given fields: ctx, in, opts

Jump to

Keyboard shortcuts

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