@@ -16,6 +16,11 @@ var _ = Describe("Teams Client", func() {
16
16
Name : "team-name" ,
17
17
}
18
18
19
+ mockTeam2 := Team {
20
+ Id : "team-id2" ,
21
+ Name : "team-name2" ,
22
+ }
23
+
19
24
Describe ("Get Single Team" , func () {
20
25
var returnedTeam Team
21
26
@@ -40,13 +45,29 @@ var _ = Describe("Teams Client", func() {
40
45
Describe ("Get All Teams" , func () {
41
46
var returnedTeams []Team
42
47
mockTeams := []Team {mockTeam }
48
+ mockTeams2 := []Team {mockTeam2 }
43
49
44
50
BeforeEach (func () {
45
51
mockOrganizationIdCall ()
46
52
httpCall = mockHttpClient .EXPECT ().
47
- Get ("/teams/organizations/" + organizationId , nil , gomock .Any ()).
48
- Do (func (path string , request interface {}, response * []Team ) {
49
- * response = mockTeams
53
+ Get ("/teams/organizations/" + organizationId , map [string ]string {
54
+ "limit" : "100" ,
55
+ }, gomock .Any ()).
56
+ Do (func (path string , request interface {}, response * PaginatedTeamsResponse ) {
57
+ * response = PaginatedTeamsResponse {
58
+ Teams : mockTeams ,
59
+ NextPageKey : "next_page_key" ,
60
+ }
61
+ })
62
+ httpCall2 = mockHttpClient .EXPECT ().
63
+ Get ("/teams/organizations/" + organizationId , map [string ]string {
64
+ "offset" : "next_page_key" ,
65
+ "limit" : "100" ,
66
+ }, gomock .Any ()).
67
+ Do (func (path string , request interface {}, response * PaginatedTeamsResponse ) {
68
+ * response = PaginatedTeamsResponse {
69
+ Teams : mockTeams2 ,
70
+ }
50
71
})
51
72
returnedTeams , _ = apiClient .Teams ()
52
73
})
@@ -57,10 +78,11 @@ var _ = Describe("Teams Client", func() {
57
78
58
79
It ("Should send GET request" , func () {
59
80
httpCall .Times (1 )
81
+ httpCall2 .Times (1 )
60
82
})
61
83
62
84
It ("Should return teams" , func () {
63
- Expect (returnedTeams ).To (Equal (mockTeams ))
85
+ Expect (returnedTeams ).To (Equal (append ( mockTeams , mockTeams2 ... ) ))
64
86
})
65
87
})
66
88
0 commit comments