Skip to content

Commit 136e73a

Browse files
committed
now
1 parent 4c73fb8 commit 136e73a

File tree

6 files changed

+9
-16
lines changed

6 files changed

+9
-16
lines changed

pkg/connector/org_role_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestOrgRole(t *testing.T) {
5858
grants = append(grants, nextGrants...)
5959

6060
require.Nil(t, err)
61-
test.AssertNoRatelimitAnnotations(t, grantsAnnotations)
61+
test.AssertHasRatelimitAnnotations(t, grantsAnnotations)
6262
if nextToken == "" {
6363
break
6464
}
@@ -98,7 +98,7 @@ func TestOrgRole(t *testing.T) {
9898
require.Nil(t, err)
9999
require.Empty(t, resources)
100100
require.Empty(t, nextToken)
101-
test.AssertNoRatelimitAnnotations(t, annotations)
101+
test.AssertHasRatelimitAnnotations(t, annotations)
102102

103103
// Test Grants with permission error
104104
role, _ := orgRoleResource(ctx, &OrganizationRole{
@@ -112,6 +112,6 @@ func TestOrgRole(t *testing.T) {
112112
require.Empty(t, grants)
113113
// The token should contain the initial state for users
114114
require.NotEmpty(t, nextToken)
115-
test.AssertNoRatelimitAnnotations(t, grantsAnnotations)
115+
test.AssertHasRatelimitAnnotations(t, grantsAnnotations)
116116
})
117117
}

pkg/connector/org_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestOrganization(t *testing.T) {
3939

4040
grants, nextToken, grantsAnnotations, err := client.Grants(ctx, organization, &pagination.Token{})
4141
require.Nil(t, err)
42-
test.AssertNoRatelimitAnnotations(t, grantsAnnotations)
42+
test.AssertHasRatelimitAnnotations(t, grantsAnnotations)
4343
require.Equal(t, "", nextToken)
4444
require.Len(t, grants, 2)
4545

pkg/connector/repository_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestRepository(t *testing.T) {
5353
grants = append(grants, nextGrants...)
5454

5555
require.Nil(t, err)
56-
test.AssertNoRatelimitAnnotations(t, grantsAnnotations)
56+
test.AssertHasRatelimitAnnotations(t, grantsAnnotations)
5757
if nextToken == "" {
5858
break
5959
}

pkg/connector/team_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func TestTeam(t *testing.T) {
4141

4242
grants, nextToken, grantsAnnotations, err := client.Grants(ctx, team, &pagination.Token{})
4343
require.Nil(t, err)
44-
test.AssertNoRatelimitAnnotations(t, grantsAnnotations)
44+
test.AssertHasRatelimitAnnotations(t, grantsAnnotations)
4545
require.Equal(t, "", nextToken)
4646
require.Len(t, grants, 1)
4747

pkg/connector/user_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func TestUsersList(t *testing.T) {
5858
&pagination.Token{},
5959
)
6060
require.Nil(t, err)
61-
test.AssertNoRatelimitAnnotations(t, annotations)
61+
test.AssertHasRatelimitAnnotations(t, annotations)
6262
require.Equal(t, "", nextToken)
6363
require.Len(t, users, 1)
6464
require.Equal(t, *githubUser.Login, users[0].Id.Resource)

test/testhelpers.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package test
22

33
import (
4-
"slices"
54
"testing"
65

76
v2 "github.com/conductorone/baton-sdk/pb/c1/connector/v2"
87
"github.com/conductorone/baton-sdk/pkg/annotations"
98
)
109

11-
func AssertNoRatelimitAnnotations(
10+
func AssertHasRatelimitAnnotations(
1211
t *testing.T,
1312
actualAnnotations annotations.Annotations,
1413
) {
@@ -22,13 +21,7 @@ func AssertNoRatelimitAnnotations(
2221
if err != nil {
2322
continue
2423
}
25-
if slices.Contains(
26-
[]v2.RateLimitDescription_Status{
27-
v2.RateLimitDescription_STATUS_ERROR,
28-
v2.RateLimitDescription_STATUS_OVERLIMIT,
29-
},
30-
ratelimitDescription.Status,
31-
) {
24+
if ratelimitDescription.Status != v2.RateLimitDescription_STATUS_OVERLIMIT {
3225
t.Fatal("request was ratelimited, expected not to be ratelimited")
3326
}
3427
}

0 commit comments

Comments
 (0)