Skip to content

Commit

Permalink
Update invite tests to reflect that the invite id is not returned any…
Browse files Browse the repository at this point in the history
… more
  • Loading branch information
vbrodsky committed Dec 12, 2024
1 parent b6427ed commit 382e774
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
3 changes: 3 additions & 0 deletions libs/labelbox/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ def environ() -> Environ:
raise Exception(f"Missing env key in: {os.environ}")


@pytest.mark.skip(
"Test disabled - due to security reasons, invite uid is not returned"
)
def cancel_invite(client, invite_id):
"""
Do not use. Only for testing.
Expand Down
27 changes: 18 additions & 9 deletions libs/labelbox/tests/integration/test_user_management.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
from faker import Faker

from labelbox import ProjectRole
from faker import Faker

faker = Faker()

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

assert (
invite.uid == "invited"
) # for security reasons we don't return the invite uid

if environ.value == "prod":
invite_limit_after = organization.invite_limit()
# One user added
assert invite_limit.remaining - invite_limit_after.remaining == 1
# An invite shouldn't effect the user count until after it is accepted

outstanding_invites = queries.get_invites(client)
in_list = False

found_invite = None
for outstanding_invite in outstanding_invites:
if outstanding_invite.uid == invite.uid:
in_list = True
org_role = outstanding_invite.organization_role_name.lower()
assert (
org_role == role.name.lower()
), "Role should be labeler. Found {org_role} "
assert in_list, "Invite not found"
if outstanding_invite.email == invite.email:
found_invite = outstanding_invite
break

assert found_invite is not None, "Invite not found"
org_role = found_invite.organization_role_name.lower()
assert (
org_role == role.name.lower()
), "Role should be labeler. Found {org_role} "


@pytest.mark.skip(
"Test disabled - due to security reasons, invite uid is not returned"
)
def test_cancel_invite(
client,
organization,
Expand Down

0 comments on commit 382e774

Please sign in to comment.