Skip to content

Commit 0022d75

Browse files
author
Matt Sokoloff
committed
fixed test
1 parent ac3d84d commit 0022d75

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

labelbox/schema/role.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,11 @@ def __getitem__(self, name):
4343
)
4444

4545
def __iter__(self):
46+
self.key_iter = iter(self.valid_roles)
4647
return self
4748

4849
def __next__(self):
49-
try:
50-
key = self.valid_roles[self.index]
51-
except:
52-
raise StopIteration
53-
self.index += 1
50+
key = next(self.key_iter)
5451
return getattr(self, key)
5552

5653

tests/integration/test_user_management.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
import pytest
22

33
from labelbox.schema.organization import ProjectRole
4-
from conftest import Environ
54

65

76
def test_org_invite(client, organization, environ):
87
role = client.get_roles()['LABELER']
98
dummy_email = "none@labelbox.com"
109
invite_limit = organization.invite_limit()
1110

12-
if environ == Environ.PROD:
11+
if environ.value == "prod":
1312
user_limit = organization.user_limit()
1413
assert invite_limit.remaining > 0, "No invites available for the account associated with this key."
14+
elif environ.value != "staging":
15+
raise ValueError(
16+
f"Expected tests to run against either prod or staging. Found {environ}"
17+
)
1518

1619
invite = organization.invite_user(dummy_email, role)
1720

18-
if environ == Environ.PROD:
21+
if environ.value == "prod":
1922
invite_limit_after = organization.invite_limit()
2023
user_limit_after = organization.user_limit()
2124
# One user added

0 commit comments

Comments
 (0)