File tree Expand file tree Collapse file tree 2 files changed +51
-8
lines changed
src/superannotate/lib/app/interface
tests/integration/folders Expand file tree Collapse file tree 2 files changed +51
-8
lines changed Original file line number Diff line number Diff line change @@ -2141,15 +2141,10 @@ def assign_folder(
21412141 if response .errors :
21422142 raise AppException (response .errors )
21432143 project = response .data
2144- response = self .controller .projects . get_metadata (
2145- project = project , include_contributors = True
2144+ project_contributors = self .controller .work_management . list_users (
2145+ project = project
21462146 )
2147-
2148- if response .errors :
2149- raise AppException (response .errors )
2150-
2151- contributors = response .data .users
2152- verified_users = [i .user_id for i in contributors ]
2147+ verified_users = [i .email for i in project_contributors ]
21532148 verified_users = set (users ).intersection (set (verified_users ))
21542149 unverified_contributor = set (users ) - verified_users
21552150
Original file line number Diff line number Diff line change 1+ from superannotate import SAClient
2+ from tests .integration .base import BaseTestCase
3+
4+ sa = SAClient ()
5+
6+
7+ class TestAssignFolderToUsers (BaseTestCase ):
8+ PROJECT_NAME = "TestAssignFolderToUsers"
9+ PROJECT_TYPE = "Vector"
10+ FOLDER_NAME = "test_folder_assign"
11+
12+ def setUp (self ):
13+ super ().setUp ()
14+ team_users = sa .list_users ()
15+ assert len (team_users ) > 0
16+ self .scapegoat_accepted = next (
17+ (
18+ u
19+ for u in team_users
20+ if u ["state" ] == "Confirmed" and u ["role" ] == "Contributor"
21+ ),
22+ None ,
23+ )
24+ self .scapegoat_pending = next (
25+ (
26+ u
27+ for u in team_users
28+ if u ["state" ] == "Pending" and u ["role" ] == "Contributor"
29+ ),
30+ None ,
31+ )
32+ sa .add_contributors_to_project (
33+ self .PROJECT_NAME ,
34+ [self .scapegoat_accepted ["email" ], self .scapegoat_pending ["email" ]],
35+ "Annotator" ,
36+ )
37+ project_users = sa .list_users (project = self .PROJECT_NAME )
38+ assert len (project_users ) == 2
39+
40+ def test_assign_folder_to_users (self ):
41+ # create folder
42+ sa .create_folder (self .PROJECT_NAME , self .FOLDER_NAME )
43+
44+ sa .assign_folder (
45+ self .PROJECT_NAME ,
46+ self .FOLDER_NAME ,
47+ [self .scapegoat_accepted ["email" ], self .scapegoat_pending ["email" ]],
48+ )
You can’t perform that action at this time.
0 commit comments