-
Notifications
You must be signed in to change notification settings - Fork 19
/
reactions_test.go
65 lines (51 loc) · 1.62 KB
/
reactions_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package slack_test
import (
"context"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
)
func TestReactionsAddUnit(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
s := httptest.NewServer(newDummyServer())
defer s.Close()
c := newSlackWithDummy(s)
err := c.Reactions().Add("foo").File("bar").FileComment("baz").Channel("quux").Timestamp("farb").Do(ctx)
if !assert.NoError(t, err, "Reactions.Add should succeed") {
return
}
}
func TestReactionsGetUnit(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
s := httptest.NewServer(newDummyServer())
defer s.Close()
c := newSlackWithDummy(s)
_, err := c.Reactions().Get().File("bar").FileComment("baz").Channel("quux").Timestamp("farb").Full(true).Do(ctx)
if !assert.NoError(t, err, "Reactions.Get should succeed") {
return
}
}
func TestReactionsListUnit(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
s := httptest.NewServer(newDummyServer())
defer s.Close()
c := newSlackWithDummy(s)
_, err := c.Reactions().List().User("bar").Full(true).Count(100).Page(5).Do(ctx)
if !assert.NoError(t, err, "Reactions.List should succeed") {
return
}
}
func TestReactionsRemoveUnit(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
s := httptest.NewServer(newDummyServer())
defer s.Close()
c := newSlackWithDummy(s)
err := c.Reactions().Remove("foo").File("bar").FileComment("baz").Channel("quux").Timestamp("farb").Do(ctx)
if !assert.NoError(t, err, "Reactions.Remove should succeed") {
return
}
}