-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgithub_test.go
46 lines (35 loc) · 907 Bytes
/
github_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
package main
import (
"github.com/google/go-github/github"
"testing"
)
func TestfindTeamByName_found(t *testing.T) {
teams := []*github.Team{}
team1ID := 1
team2ID := 2
team1Name := "team1"
team2Name := "team2"
team1 := github.Team{ID: &team1ID, Name: &team1Name}
team2 := github.Team{ID: &team2ID, Name: &team2Name}
teams = append(teams, &team1)
teams = append(teams, &team2)
r := findTeamByName("team1", teams)
if *r.ID != 1 {
t.Error("team1 should have ID:1")
}
}
func TestfindTeamByName_notfound(t *testing.T) {
teams := []*github.Team{}
team1ID := 1
team2ID := 2
team1Name := "team1"
team2Name := "team2"
team1 := github.Team{ID: &team1ID, Name: &team1Name}
team2 := github.Team{ID: &team2ID, Name: &team2Name}
teams = append(teams, &team1)
teams = append(teams, &team2)
r := findTeamByName("team3", teams)
if r != nil {
t.Error("no team should be found.")
}
}