6
6
"testing"
7
7
)
8
8
9
- func TestGetGroups (t * testing.T ) {
9
+ func TestGetGroupsIterator (t * testing.T ) {
10
10
mockAPI := newMockAPI (http .MethodGet , "groups.json" )
11
11
client := newTestClient (mockAPI )
12
12
defer mockAPI .Close ()
@@ -17,23 +17,23 @@ func TestGetGroups(t *testing.T) {
17
17
it := client .GetGroupsIterator (ctx , ops )
18
18
19
19
expectedLength := 1
20
+ groupsCount := 0
20
21
for it .HasMore () {
21
22
groups , err := it .GetNext ()
22
23
if len (groups ) != expectedLength {
23
24
t .Fatalf ("expected length of groups is 1, but got %d" , len (groups ))
24
25
}
25
- if err == nil {
26
- for _ , group := range groups {
27
- println (group .Name )
28
- }
29
- }
26
+ groupsCount += len (groups )
30
27
if err != nil {
31
28
t .Fatalf ("Failed to get groups: %s" , err )
32
29
}
33
30
}
31
+ if groupsCount != 1 {
32
+ t .Fatalf ("expected length of groups is 1, but got %d" , groupsCount )
33
+ }
34
34
}
35
35
36
- func TestGetGroupsIterator (t * testing.T ) {
36
+ func TestGetGroups (t * testing.T ) {
37
37
mockAPI := newMockAPI (http .MethodGet , "groups.json" )
38
38
client := newTestClient (mockAPI )
39
39
defer mockAPI .Close ()
@@ -48,6 +48,36 @@ func TestGetGroupsIterator(t *testing.T) {
48
48
}
49
49
}
50
50
51
+ func TestGetGroupsOBP (t * testing.T ) {
52
+ mockAPI := newMockAPI (http .MethodGet , "groups.json" )
53
+ client := newTestClient (mockAPI )
54
+ defer mockAPI .Close ()
55
+
56
+ groups , _ , err := client .GetGroupsOBP (ctx , nil )
57
+ if err != nil {
58
+ t .Fatalf ("Failed to get groups: %s" , err )
59
+ }
60
+
61
+ if len (groups ) != 1 {
62
+ t .Fatalf ("expected length of groups is 1, but got %d" , len (groups ))
63
+ }
64
+ }
65
+
66
+ func TestGetGroupsCBP (t * testing.T ) {
67
+ mockAPI := newMockAPI (http .MethodGet , "groups.json" )
68
+ client := newTestClient (mockAPI )
69
+ defer mockAPI .Close ()
70
+
71
+ groups , _ , err := client .GetGroupsCBP (ctx , nil )
72
+ if err != nil {
73
+ t .Fatalf ("Failed to get groups: %s" , err )
74
+ }
75
+
76
+ if len (groups ) != 1 {
77
+ t .Fatalf ("expected length of groups is 1, but got %d" , len (groups ))
78
+ }
79
+ }
80
+
51
81
func TestCreateGroup (t * testing.T ) {
52
82
mockAPI := newMockAPIWithStatus (http .MethodPost , "groups.json" , http .StatusCreated )
53
83
client := newTestClient (mockAPI )
0 commit comments