test

package
v0.9.1-0...-f613ba5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExportTest = struct {
	Test *testing.T
	sync.Mutex
}{}

ExportTest lets bot_integration_test safely supply the *testing.T

Functions

func Initialize

func Initialize(handler robot.Handler, l *log.Logger) robot.Connector

Initialize sets up the connector and returns a connector object

Types

type BotMessage

type BotMessage struct {
	User, Channel, Message string
	Format                 robot.MessageFormat
}

BotMessage is for receiving messages from the robot

type TestConnector

type TestConnector struct {
	robot.Handler // bot API for connectors
	sync.RWMutex  // shared mutex for locking connector data structures
	// contains filtered or unexported fields
}

TestConnector holds all the relevant data about a connection

func (*TestConnector) GetBotMessage

func (tc *TestConnector) GetBotMessage() (*TestMessage, error)

GetBotMessage for tests to get replies

func (*TestConnector) GetProtocolUserAttribute

func (tc *TestConnector) GetProtocolUserAttribute(u, attr string) (value string, ret robot.RetVal)

GetProtocolUserAttribute returns a string attribute or nil if slack doesn't have that information

func (*TestConnector) JoinChannel

func (tc *TestConnector) JoinChannel(c string) (ret robot.RetVal)

JoinChannel joins a channel given it's human-readable name, e.g. "general" Only useful for connectors that require it, a noop otherwise

func (*TestConnector) MessageHeard

func (tc *TestConnector) MessageHeard(u, c string)

MessageHeard indicates to the user a message was heard; for test/terminal it's a noop.

func (*TestConnector) Run

func (tc *TestConnector) Run(stop <-chan struct{})

Run starts the main loop for the test connector

func (*TestConnector) SendBotMessage

func (tc *TestConnector) SendBotMessage(msg *TestMessage)

SendBotMessage for tests to send messages to the 'bot

func (*TestConnector) SendProtocolChannelMessage

func (tc *TestConnector) SendProtocolChannelMessage(ch string, mesg string, f robot.MessageFormat) (ret robot.RetVal)

SendProtocolChannelMessage sends a message to a channel

func (*TestConnector) SendProtocolUserChannelMessage

func (tc *TestConnector) SendProtocolUserChannelMessage(uid, uname, ch, mesg string, f robot.MessageFormat) (ret robot.RetVal)

SendProtocolUserChannelMessage sends a message to a user in a channel

func (*TestConnector) SendProtocolUserMessage

func (tc *TestConnector) SendProtocolUserMessage(u string, mesg string, f robot.MessageFormat) (ret robot.RetVal)

SendProtocolUserMessage sends a direct message to a user

func (*TestConnector) SetUserMap

func (tc *TestConnector) SetUserMap(map[string]string)

SetUserMap lets Gopherbot provide a mapping of usernames to user IDs

type TestMessage

type TestMessage struct {
	User, Channel, Message string
}

TestMessage is for sending messages to the robot

Jump to

Keyboard shortcuts

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