mocks

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 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 Controller added in v1.2.0

type Controller struct {
	mock.Mock
}

Controller is an autogenerated mock type for the Controller type

func (*Controller) Authenticate added in v1.2.0

func (_m *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Authenticate provides a mock function with given fields: sid, env

func (*Controller) Disconnect added in v1.2.0

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

Disconnect provides a mock function with given fields: sid, env, id, subscriptions

func (*Controller) Perform added in v1.2.0

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

Perform provides a mock function with given fields: sid, env, id, channel, data

func (*Controller) Shutdown added in v1.2.0

func (_m *Controller) Shutdown() error

Shutdown provides a mock function with given fields:

func (*Controller) Start added in v1.2.0

func (_m *Controller) Start() error

Start provides a mock function with given fields:

func (*Controller) Subscribe added in v1.2.0

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

Subscribe provides a mock function with given fields: sid, env, id, channel

func (*Controller) Unsubscribe added in v1.2.0

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

Unsubscribe provides a mock function with given fields: sid, env, id, channel

type Handler added in v1.1.4

type Handler struct {
	mock.Mock
}

Handler is an autogenerated mock type for the Handler type

func (*Handler) HandlePubSub added in v1.1.4

func (_m *Handler) HandlePubSub(json []byte)

HandlePubSub provides a mock function with given fields: json

type Identifier added in v1.2.0

type Identifier struct {
	mock.Mock
}

Identifier is an autogenerated mock type for the Identifier type

func (*Identifier) Identify added in v1.2.0

func (_m *Identifier) Identify(sid string, env *common.SessionEnv) (*common.ConnectResult, error)

Identify provides a mock function with given fields: sid, env

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