-
Notifications
You must be signed in to change notification settings - Fork 39
/
stat_test.go
51 lines (40 loc) · 942 Bytes
/
stat_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
package sentry
import (
"testing"
"time"
)
func TestStat(t *testing.T) {
t.Parallel()
now := time.Now().Unix()
hourlater := time.Duration(1) * time.Hour
later := now - int64(hourlater.Seconds())
client := newTestClient(t)
org, err := client.GetOrganization(getDefaultOrg())
if err != nil {
t.Fatal(err)
}
t.Run("Run Getting Organization Stats", func(t *testing.T) {
if err != nil {
t.Fatal(err)
}
stats, err := client.GetOrganizationStats(org, StatReceived, later, now, nil)
if err != nil {
t.Error(err)
}
if len(stats) <= 0 {
t.Error("No stats were returned")
}
})
t.Run("Run Getting Team Stats", func(t *testing.T) {
team, cleanup := createTeamHelper(t)
defer cleanup()
_, err = client.GetTeamStats(org, team, StatReceived, later, now, nil)
if err != nil {
t.Error(err)
}
err = client.DeleteTeam(org, team)
if err != nil {
t.Error("Failed to delete test team")
}
})
}