-
Notifications
You must be signed in to change notification settings - Fork 19
/
svc_team_test.go
80 lines (73 loc) · 1.53 KB
/
svc_team_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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package lokalise
import (
"fmt"
"net/http"
"reflect"
"testing"
)
func TestTeamService_List(t *testing.T) {
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc(
"/teams",
func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
testMethod(t, r, "GET")
testHeader(t, r, apiTokenHeader, testApiToken)
_, _ = fmt.Fprint(w, `{
"teams": [
{
"team_id": 18821,
"name": "MyCompany, Ltd.",
"created_at": "2018-12-31 12:00:00 (Etc/UTC)",
"created_at_timestamp": 1546257600,
"plan": "Essential",
"quota_usage": {
"users": 14,
"keys": 8125,
"projects": 4,
"mau": 119337
},
"quota_allowed": {
"users": 40,
"keys": 10000,
"projects": 99999999,
"mau": 200000
}
}
]
}`)
})
r, err := client.Teams().List()
if err != nil {
t.Errorf("Teams.List returned error: %v", err)
}
want := []Team{
{
WithCreationTime: WithCreationTime{
CreatedAt: "2018-12-31 12:00:00 (Etc/UTC)",
CreatedAtTs: 1546257600,
},
WithTeamID: WithTeamID{
TeamID: 18821,
},
Name: "MyCompany, Ltd.",
Plan: "Essential",
QuotaUsage: Quota{
Users: 14,
Keys: 8125,
Projects: 4,
MAU: 119337,
},
QuotaAllowed: Quota{
Users: 40,
Keys: 10000,
Projects: 99999999,
MAU: 200000,
},
},
}
if !reflect.DeepEqual(r.Teams, want) {
t.Errorf("Screenshots.List returned %+v, want %+v", r.Teams, want)
}
}