Skip to content

Commit acf4f18

Browse files
committed
Merge branch 'develop' into PTDT-2863
2 parents ac91b9a + 97bd850 commit acf4f18

File tree

5 files changed

+49
-16
lines changed

5 files changed

+49
-16
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
project = 'Python SDK reference'
1717
copyright = '2024, Labelbox'
1818
author = 'Labelbox'
19-
release = '6.2.0'
19+
release = '6.3.0'
2020

2121
# -- General configuration ---------------------------------------------------
2222

libs/labelbox/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Changelog
2+
# Version 6.3.0 (2024-12-12)
3+
## Added
4+
* Group member upload([#1924](https://github.com/Labelbox/labelbox-python/pull/1924))
5+
* Group member export([#1925](https://github.com/Labelbox/labelbox-python/pull/1925))
6+
7+
## Note
8+
* The `Invite` class no longer returns the invite ID (uid).
9+
210
# Version 6.2.0 (2024-11-26)
311
## Added
412
* Prompt Issue ontology support([#1917](https://github.com/Labelbox/labelbox-python/pull/1917)), ([#1891](https://github.com/Labelbox/labelbox-python/pull/1891))

libs/labelbox/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "labelbox"
3-
version = "6.2.0"
3+
version = "6.3.0"
44
description = "Labelbox Python API"
55
authors = [{ name = "Labelbox", email = "engineering@labelbox.com" }]
66
dependencies = [

libs/labelbox/src/labelbox/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "labelbox"
22

3-
__version__ = "6.2.0"
3+
__version__ = "6.3.0"
44

55
from labelbox.client import Client
66
from labelbox.schema.annotation_import import (

libs/labelbox/tests/integration/test_user_management.py

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
from typing import Optional
2+
13
import pytest
4+
from faker import Faker
25

36
from labelbox import ProjectRole
4-
from faker import Faker
7+
from labelbox.schema.invite import Invite
58

69
faker = Faker()
710

811

12+
def find_invite_and_id_by_email(
13+
queries, client, invite_email
14+
) -> Optional[Invite]:
15+
"""For security reasons, invite uid is not returned for a query for a single invite.
16+
This function is a workaround to find the invite uid by email using another query that returns all invites.
17+
"""
18+
outstanding_invites = queries.get_invites(client)
19+
20+
for outstanding_invite in outstanding_invites:
21+
if outstanding_invite.email == invite_email:
22+
return outstanding_invite
23+
return None
24+
25+
926
@pytest.fixture
1027
def org_invite(client, organization, environ, queries):
1128
role = client.get_roles()["LABELER"]
@@ -27,7 +44,9 @@ def org_invite(client, organization, environ, queries):
2744

2845
yield invite, invite_limit
2946

30-
queries.cancel_invite(client, invite.uid)
47+
found_invite = find_invite_and_id_by_email(queries, client, invite.email)
48+
assert found_invite is not None, "Invite not found"
49+
queries.cancel_invite(client, found_invite.uid)
3150

3251

3352
@pytest.fixture
@@ -60,30 +79,32 @@ def create_project_invite(
6079

6180
yield invite
6281

63-
queries.cancel_invite(client, invite.uid)
82+
found_invite = find_invite_and_id_by_email(queries, client, invite.email)
83+
assert found_invite is not None, "Invite not found"
84+
queries.cancel_invite(client, found_invite.uid)
6485

6586

6687
def test_org_invite(client, organization, environ, queries, org_invite):
6788
invite, invite_limit = org_invite
6889
role = client.get_roles()["LABELER"]
6990

91+
assert (
92+
invite.uid == "invited"
93+
) # for security reasons we don't return the invite uid
94+
7095
if environ.value == "prod":
7196
invite_limit_after = organization.invite_limit()
7297
# One user added
7398
assert invite_limit.remaining - invite_limit_after.remaining == 1
7499
# An invite shouldn't effect the user count until after it is accepted
75100

76-
outstanding_invites = queries.get_invites(client)
77-
in_list = False
101+
found_invite = find_invite_and_id_by_email(queries, client, invite.email)
78102

79-
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"
103+
assert found_invite is not None, "Invite not found"
104+
org_role = found_invite.organization_role_name.lower()
105+
assert (
106+
org_role == role.name.lower()
107+
), "Role should be labeler. Found {org_role} "
87108

88109

89110
def test_cancel_invite(
@@ -96,6 +117,10 @@ def test_cancel_invite(
96117
"".join(faker.random_letters(26))
97118
)
98119
invite = organization.invite_user(dummy_email, role)
120+
found_invite = find_invite_and_id_by_email(queries, client, invite.email)
121+
assert found_invite is not None, "Invite not found"
122+
invite.uid = found_invite.uid # for security reasons we don't return the invite uid directly but need it in order to cancel the invite
123+
99124
queries.cancel_invite(client, invite.uid)
100125
outstanding_invites = [i.uid for i in queries.get_invites(client)]
101126
assert invite.uid not in outstanding_invites

0 commit comments

Comments
 (0)