Documentation
¶
Index ¶
- func NewMockResult(sid string) *common.CommandResult
- type Controller
- func (_m *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
- func (_m *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
- func (_m *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
- func (_m *Controller) Shutdown() error
- func (_m *Controller) Start() error
- func (_m *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- func (_m *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- type Handler
- type Identifier
- type MockController
- func (c *MockController) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
- func (c *MockController) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
- func (c *MockController) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
- func (c *MockController) Shutdown() error
- func (c *MockController) Start() error
- func (c *MockController) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- func (c *MockController) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- type RPCClient
- func (_m *RPCClient) Command(ctx context.Context, in *anycable.CommandMessage, opts ...grpc.CallOption) (*anycable.CommandResponse, error)
- func (_m *RPCClient) Connect(ctx context.Context, in *anycable.ConnectionRequest, opts ...grpc.CallOption) (*anycable.ConnectionResponse, error)
- func (_m *RPCClient) Disconnect(ctx context.Context, in *anycable.DisconnectRequest, opts ...grpc.CallOption) (*anycable.DisconnectResponse, error)
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
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
Handler is an autogenerated mock type for the Handler type
func (*Handler) HandlePubSub ¶ added in v1.1.4
HandlePubSub provides a mock function with given fields: json
type Identifier ¶ added in v1.2.0
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 ¶
RPCClient is an autogenerated mock type for the RPCClient type
func (*RPCClient) Command ¶
func (_m *RPCClient) Command(ctx context.Context, in *anycable.CommandMessage, opts ...grpc.CallOption) (*anycable.CommandResponse, error)
Command provides a mock function with given fields: ctx, in, opts
func (*RPCClient) Connect ¶
func (_m *RPCClient) Connect(ctx context.Context, in *anycable.ConnectionRequest, opts ...grpc.CallOption) (*anycable.ConnectionResponse, error)
Connect provides a mock function with given fields: ctx, in, opts
func (*RPCClient) Disconnect ¶
func (_m *RPCClient) Disconnect(ctx context.Context, in *anycable.DisconnectRequest, opts ...grpc.CallOption) (*anycable.DisconnectResponse, error)
Disconnect provides a mock function with given fields: ctx, in, opts