-
Notifications
You must be signed in to change notification settings - Fork 72
/
member_test.go
58 lines (49 loc) · 1.28 KB
/
member_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
// Copyright © 2016 Aaron Longwell
//
// Use of this source code is governed by an MIT license.
// Details in the LICENSE file.
package trello
import (
"testing"
)
func TestGetMembersOnBoard(t *testing.T) {
board := testBoard(t)
board.client.BaseURL = mockResponse("members", "board-members-api-example.json").URL
members, err := board.GetMembers(Defaults())
if err != nil {
t.Fatal(err)
}
if len(members) != 3 {
t.Errorf("Expected 3 members, got %d", len(members))
}
}
func TestGetMembersInOrganization(t *testing.T) {
organization := testOrganization(t)
organization.client.BaseURL = mockResponse("members", "trelloapps.json").URL
members, err := organization.GetMembers(Defaults())
if err != nil {
t.Fatal(err)
}
if len(members) != 7 {
t.Errorf("Expected 3 members, got %d", len(members))
}
}
func TestGetMembersOnCard(t *testing.T) {
card := testCard(t)
card.client.BaseURL = mockResponse("members", "card-members-api-example.json").URL
members, err := card.GetMembers(Defaults())
if err != nil {
t.Fatal(err)
}
if len(members) != 1 {
t.Errorf("Expected 1 member, got %d", len(members))
}
}
func TestMemberSetClient(t *testing.T) {
m := Member{}
client := testClient()
m.SetClient(client)
if m.client == nil {
t.Error("Expected non-nil Member.client")
}
}