Documentation
¶
Overview ¶
Package mmbottest provides fakes and builders for testing mmbot handlers.
Index ¶
- type Client
- func (c *Client) CreatePost(_ context.Context, post mmbot.Post) (*mmbot.Post, error)
- func (c *Client) Mattermost() *model.Client4
- func (c *Client) Posts() []mmbot.Post
- func (c *Client) SetCreatePostError(err error)
- func (c *Client) SetUser(user mmbot.User)
- func (c *Client) SetUserError(userID string, err error)
- func (c *Client) User(_ context.Context, userID string) (*mmbot.User, error)
- type ContextBuilder
- func (b *ContextBuilder) Build() *mmbot.Context
- func (b *ContextBuilder) WithArgs(raw string, args ...string) *ContextBuilder
- func (b *ContextBuilder) WithCommand(command string) *ContextBuilder
- func (b *ContextBuilder) WithContext(ctx context.Context) *ContextBuilder
- func (b *ContextBuilder) WithMessage(message mmbot.Message) *ContextBuilder
- type Harness
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an in-memory implementation of mmbot.Client.
func (*Client) CreatePost ¶
CreatePost records a post or returns the configured error.
func (*Client) Mattermost ¶
Mattermost returns nil because the harness does not use the real SDK.
func (*Client) SetCreatePostError ¶
SetCreatePostError configures the error returned by CreatePost.
func (*Client) SetUserError ¶
SetUserError configures an error returned for a user ID.
type ContextBuilder ¶
type ContextBuilder struct {
// contains filtered or unexported fields
}
ContextBuilder constructs a synthetic mmbot.Context.
func (*ContextBuilder) Build ¶
func (b *ContextBuilder) Build() *mmbot.Context
Build creates the context.
func (*ContextBuilder) WithArgs ¶
func (b *ContextBuilder) WithArgs(raw string, args ...string) *ContextBuilder
WithArgs sets parsed and raw command arguments.
func (*ContextBuilder) WithCommand ¶
func (b *ContextBuilder) WithCommand(command string) *ContextBuilder
WithCommand sets the canonical command name.
func (*ContextBuilder) WithContext ¶
func (b *ContextBuilder) WithContext(ctx context.Context) *ContextBuilder
WithContext sets the standard context.
func (*ContextBuilder) WithMessage ¶
func (b *ContextBuilder) WithMessage(message mmbot.Message) *ContextBuilder
WithMessage sets the incoming message.