Skip to content

Commit be5c67a

Browse files
authored
Merge branch 'develop' into develop
2 parents 171c5e0 + b0aace2 commit be5c67a

File tree

4 files changed

+19
-24
lines changed

4 files changed

+19
-24
lines changed

libs/labelbox/src/labelbox/schema/timeunit.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class TimeUnit(Enum):
1414
WEEK (int): 604800 seconds (7 days)
1515
"""
1616

17-
SECOND: int = 1
18-
MINUTE: int = 60
19-
HOUR: int = 60 * 60
20-
DAY: int = 24 * 60 * 60
21-
WEEK: int = 7 * 24 * 60 * 60
17+
SECOND = 1
18+
MINUTE = 60
19+
HOUR = 60 * 60
20+
DAY = 24 * 60 * 60
21+
WEEK = 7 * 24 * 60 * 60

libs/labelbox/tests/integration/test_api_keys.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -231,23 +231,22 @@ def test_create_api_key_invalid_time_unit(client):
231231

232232
@pytest.mark.skipif(
233233
condition=os.environ["LABELBOX_TEST_ENVIRON"] == "prod",
234-
reason="Accounts with sdmin permission can create API keys",
234+
reason="Accounts with admin permission can create API keys",
235235
)
236236
def test_create_api_key_insufficient_permissions(client):
237237
"""Test that creating an API key fails when the user has insufficient permissions."""
238238
user_email = client.get_user().email
239239

240-
assert client.get_user().org_role().name == "Admin"
241-
242-
# Attempt to create another API key using the limited permissions client
243-
# This should fail due to insufficient permissions
244-
with pytest.raises(LabelboxError) as excinfo:
245-
client.create_api_key(
246-
name=f"Test Key {uuid.uuid4()}",
247-
user=user_email,
248-
role="Admin",
249-
validity=5,
250-
time_unit=TimeUnit.MINUTE,
251-
)
252-
253-
assert "192" in str(excinfo.value)
240+
if client.get_user().org_role().name != "Admin":
241+
# Attempt to create another API key using the limited permissions client
242+
# This should fail due to insufficient permissions
243+
with pytest.raises(LabelboxError) as excinfo:
244+
client.create_api_key(
245+
name=f"Test Key {uuid.uuid4()}",
246+
user=user_email,
247+
role="Admin",
248+
validity=5,
249+
time_unit=TimeUnit.MINUTE,
250+
)
251+
252+
assert "192" in str(excinfo.value)

requirements-dev.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# features: []
77
# all-features: true
88
# with-sources: false
9-
# generate-hashes: false
10-
# universal: false
119

1210
-e file:libs/labelbox
1311
-e file:libs/lbox-clients

requirements.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# features: []
77
# all-features: true
88
# with-sources: false
9-
# generate-hashes: false
10-
# universal: false
119

1210
-e file:libs/labelbox
1311
-e file:libs/lbox-clients

0 commit comments

Comments
 (0)