Skip to content

Commit 382e774

Browse files
author
Val Brodsky
committed
Update invite tests to reflect that the invite id is not returned any more
1 parent b6427ed commit 382e774

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

libs/labelbox/tests/conftest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ def environ() -> Environ:
336336
raise Exception(f"Missing env key in: {os.environ}")
337337

338338

339+
@pytest.mark.skip(
340+
"Test disabled - due to security reasons, invite uid is not returned"
341+
)
339342
def cancel_invite(client, invite_id):
340343
"""
341344
Do not use. Only for testing.

libs/labelbox/tests/integration/test_user_management.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
2+
from faker import Faker
23

34
from labelbox import ProjectRole
4-
from faker import Faker
55

66
faker = Faker()
77

@@ -67,25 +67,34 @@ def test_org_invite(client, organization, environ, queries, org_invite):
6767
invite, invite_limit = org_invite
6868
role = client.get_roles()["LABELER"]
6969

70+
assert (
71+
invite.uid == "invited"
72+
) # for security reasons we don't return the invite uid
73+
7074
if environ.value == "prod":
7175
invite_limit_after = organization.invite_limit()
7276
# One user added
7377
assert invite_limit.remaining - invite_limit_after.remaining == 1
7478
# An invite shouldn't effect the user count until after it is accepted
7579

7680
outstanding_invites = queries.get_invites(client)
77-
in_list = False
7881

82+
found_invite = None
7983
for outstanding_invite in outstanding_invites:
80-
if outstanding_invite.uid == invite.uid:
81-
in_list = True
82-
org_role = outstanding_invite.organization_role_name.lower()
83-
assert (
84-
org_role == role.name.lower()
85-
), "Role should be labeler. Found {org_role} "
86-
assert in_list, "Invite not found"
84+
if outstanding_invite.email == invite.email:
85+
found_invite = outstanding_invite
86+
break
87+
88+
assert found_invite is not None, "Invite not found"
89+
org_role = found_invite.organization_role_name.lower()
90+
assert (
91+
org_role == role.name.lower()
92+
), "Role should be labeler. Found {org_role} "
8793

8894

95+
@pytest.mark.skip(
96+
"Test disabled - due to security reasons, invite uid is not returned"
97+
)
8998
def test_cancel_invite(
9099
client,
91100
organization,

0 commit comments

Comments
 (0)