mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-09 00:14:57 +00:00
33 lines
502 B
Go
33 lines
502 B
Go
// +build integration
|
|
|
|
package api
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestIntegration(t *testing.T) {
|
|
var token = os.Getenv("BOT_TOKEN")
|
|
if token == "" {
|
|
t.Fatal("Missing $BOT_TOKEN")
|
|
}
|
|
|
|
client := NewClient("Bot " + token)
|
|
|
|
// Simple GET request
|
|
u, err := client.Me()
|
|
if err != nil {
|
|
t.Fatal("Can't get self:", err)
|
|
}
|
|
|
|
log.Println("API user:", u.Username)
|
|
|
|
// POST with URL param and paginator
|
|
_, err = client.Guilds(100)
|
|
if err != nil {
|
|
t.Fatal("Can't get guilds:", err)
|
|
}
|
|
}
|