Skip to content

Commit be3afc3

Browse files
committed
Update test to obtain an org id
1 parent e08cb0b commit be3afc3

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

libs/labelbox/tests/integration/test_external_workforce.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
from labelbox import Project, ExternalWorkforce
22
import os
3+
import sys
34

5+
def _get_workforce_id_for_test() -> str:
6+
# Basic function to provide an organization id for the test
7+
# org id from https://labelbox.atlassian.net/wiki/spaces/PLT/pages/2110816271/How+to+labelbox-python+SDK+CI+Tests
8+
current_version = sys.version_info[:2]
9+
10+
if os.environ['LABELBOX_TEST_ENVIRON'] == "staging":
11+
return "cltp16p2v04dr07ywfgqxf23u" if current_version == (3, 8) else "clum46jsb00jp07z338dh1gvb"
12+
else:
13+
return "cltp1fral01dh07009zsng3zs" if current_version == (3, 8) else "ckcz6bubudyfi0855o1dt1g9s"
14+
415

516
def test_add_external_workforce(project: Project):
6-
# org id from https://labelbox.atlassian.net/wiki/spaces/PLT/pages/2110816271/How+to+labelbox-python+SDK+CI+Tests
7-
workforce_id = "clum46jsb00jp07z338dh1gvb" if os.environ['LABELBOX_TEST_ENVIRON'] == "staging" else "ckcz6bubudyfi0855o1dt1g9s"
17+
workforce_id = _get_workforce_id_for_test()
818

919
external_workforces = project.add_external_workforce(workforce_id)
1020
assert len(external_workforces) == 1
1121
assert isinstance(external_workforces[0], ExternalWorkforce)
1222

1323

1424
def test_get_external_workforces(project: Project):
25+
workforce_id = _get_workforce_id_for_test()
26+
27+
external_workforces = project.add_external_workforce(workforce_id)
28+
1529
external_workforces = project.get_external_workforces()
1630
assert len(external_workforces) == 1
1731
assert isinstance(external_workforces[0], ExternalWorkforce)
1832

1933

20-
def test_remove_external_workforce(project: Project):
21-
# org id from https://labelbox.atlassian.net/wiki/spaces/PLT/pages/2110816271/How+to+labelbox-python+SDK+CI+Tests
22-
workforce_id = "clum46jsb00jp07z338dh1gvb" if os.environ['LABELBOX_TEST_ENVIRON'] == "staging" else "ckcz6bubudyfi0855o1dt1g9s"
34+
def test_remove_external_workforce(project: Project):
35+
workforce_id = _get_workforce_id_for_test()
36+
external_workforces = project.add_external_workforce(workforce_id)
2337

2438
external_workforces = project.remove_external_workforce(workforce_id)
2539
assert len(external_workforces) == 0

0 commit comments

Comments
 (0)