|
@@ -44,19 +44,19 @@ class TestThread(BaseTestThread, TestStandard):
|
44
|
44
|
u.is_active = False
|
45
|
45
|
eq_([], wapi.get_notifiable_roles(workspace=w))
|
46
|
46
|
|
47
|
|
- def test_unit__get_all_admin_for_user(self):
|
|
47
|
+ def test_unit__get_all_manageable(self):
|
48
|
48
|
admin = DBSession.query(User) \
|
49
|
49
|
.filter(User.email == 'admin@admin.admin').one()
|
50
|
50
|
uapi = UserApi(admin)
|
51
|
51
|
# Checks a case without workspaces.
|
52
|
52
|
wapi = WorkspaceApi(current_user=admin)
|
53
|
|
- eq_([], wapi.get_all_manageable_for_user(user=admin))
|
|
53
|
+ eq_([], wapi.get_all_manageable())
|
54
|
54
|
# Checks an admin gets all workspaces.
|
55
|
55
|
w4 = wapi.create_workspace(label='w4')
|
56
|
56
|
w3 = wapi.create_workspace(label='w3')
|
57
|
57
|
w2 = wapi.create_workspace(label='w2')
|
58
|
58
|
w1 = wapi.create_workspace(label='w1')
|
59
|
|
- eq_([w1, w2, w3, w4], wapi.get_all_manageable_for_user(user=admin))
|
|
59
|
+ eq_([w1, w2, w3, w4], wapi.get_all_manageable())
|
60
|
60
|
# Checks a regular user gets none workspace.
|
61
|
61
|
gapi = GroupApi(None)
|
62
|
62
|
u = uapi.create_user('u.s@e.r', [gapi.get_one(Group.TIM_USER)], True)
|
|
@@ -67,9 +67,9 @@ class TestThread(BaseTestThread, TestStandard):
|
67
|
67
|
rapi.create_one(u, w3, UserRoleInWorkspace.CONTRIBUTOR, off)
|
68
|
68
|
rapi.create_one(u, w2, UserRoleInWorkspace.CONTENT_MANAGER, off)
|
69
|
69
|
rapi.create_one(u, w1, UserRoleInWorkspace.WORKSPACE_MANAGER, off)
|
70
|
|
- eq_([], wapi.get_all_manageable_for_user(user=u))
|
|
70
|
+ eq_([], wapi.get_all_manageable())
|
71
|
71
|
# Checks a manager gets only its own workspaces.
|
72
|
72
|
u.groups.append(gapi.get_one(Group.TIM_MANAGER))
|
73
|
73
|
rapi.delete_one(u.user_id, w2.workspace_id)
|
74
|
74
|
rapi.create_one(u, w2, UserRoleInWorkspace.WORKSPACE_MANAGER, off)
|
75
|
|
- eq_([w1, w2], wapi.get_all_manageable_for_user(user=u))
|
|
75
|
+ eq_([w1, w2], wapi.get_all_manageable())
|