Documentation ¶
Overview ¶
Package test provides a slack client implementation which uses the slack api.test endpoint so is suitable to testing.
Index ¶
Examples ¶
Constants ¶
View Source
const (
// Endpoint is the slack endpoint which can be used for testing calling code.
Endpoint = "https://slack.com/api/api.test"
)
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a new slack.Client that can be used for testing.
Example ¶
c := New() msg := struct { Param1 string Param2 int }{Param1: "my value", Param2: 20} resp := struct { slack.Response Args struct { Param1 string Param2 int } }{} if err := c.Send("", msg, resp); err != nil { // No error is expected here. fmt.Println("error:", err) } fmt.Println("response:", resp)
Output:
func NewError ¶
NewError returns a new slack.Client that can be used for testing which errors with err.
Example ¶
c := NewError("my error") msg := struct { Param1 string Param2 int }{Param1: "my value", Param2: 20} resp := struct { slack.Response Args struct { Param1 string Param2 int } }{} if err := c.Send("", msg, resp); err != nil { // An error is expected here. fmt.Println("error:", err) } fmt.Println("response:", resp)
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.