-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathteam_members_test.go
53 lines (44 loc) · 989 Bytes
/
team_members_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 latitude
import (
"testing"
)
func deleteMember(t *testing.T, c *Client, id string) {
if _, err := c.Members.Delete(id); err != nil {
t.Fatal(err)
}
}
func TestAccMembersBasic(t *testing.T) {
skipUnlessAcceptanceTestsAllowed(t)
c, stopRecord := setup(t)
defer stopRecord()
t.Run("List Members", func(t *testing.T) {
// List Members
members, _, err := c.Members.List(nil)
if err != nil {
t.Fatal(err)
}
if len(members) < 1 {
t.Fatal("Team must have at least a owner")
}
})
var memberID string
t.Run("Create Member", func(t *testing.T) {
request := MemberCreateRequest{
Data: MemberCreateData{
Type: "memberships",
Attributes: MemberCreateAttributes{
FirstName: "go-sdk",
LastName: "test",
Email: "[email protected]",
Role: Collaborator,
},
},
}
m, _, err := c.Members.Create(&request)
if err != nil {
t.Fatal(err)
}
memberID = m.ID
})
defer deleteMember(t, c, memberID)
}