forked from andersfylling/disgord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rest_auditlog_test.go
53 lines (42 loc) · 964 Bytes
/
rest_auditlog_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
package disgord
import (
"os"
"testing"
"github.com/andersfylling/disgord/constant"
)
func TestAuditLogParams(t *testing.T) {
params := &GuildAuditLogsParams{}
var wants string
wants = ""
verifyQueryString(t, params, wants)
s := "438543957"
params.UserID, _ = GetSnowflake(s)
wants = "?user_id=" + s
verifyQueryString(t, params, wants)
params.ActionType = 6
wants += "&action_type=6"
verifyQueryString(t, params, wants)
params.ActionType = 0
wants = "?user_id=" + s
verifyQueryString(t, params, wants)
}
func TestGuildAuditLogs(t *testing.T) {
client, err := createTestRequester()
if err != nil {
t.Skip()
return
}
s, err := GetSnowflake(os.Getenv(constant.DisgordTestGuildAdmin))
if err != nil {
t.Skip()
return
}
params := &GuildAuditLogsParams{}
log, err := GuildAuditLogs(client, s, params)
if err != nil {
t.Error(err)
}
if log == nil {
t.Error("did not get a datastructure from rest.GuildAuditLogs()")
}
}