當前位置: 首頁>>代碼示例>>Python>>正文


Python WorkspaceApi.get_all_manageable方法代碼示例

本文整理匯總了Python中tracim.lib.workspace.WorkspaceApi.get_all_manageable方法的典型用法代碼示例。如果您正苦於以下問題:Python WorkspaceApi.get_all_manageable方法的具體用法?Python WorkspaceApi.get_all_manageable怎麽用?Python WorkspaceApi.get_all_manageable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tracim.lib.workspace.WorkspaceApi的用法示例。


在下文中一共展示了WorkspaceApi.get_all_manageable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_unit__get_all_manageable

# 需要導入模塊: from tracim.lib.workspace import WorkspaceApi [as 別名]
# 或者: from tracim.lib.workspace.WorkspaceApi import get_all_manageable [as 別名]
 def test_unit__get_all_manageable(self):
     admin = DBSession.query(User) \
         .filter(User.email == '[email protected]').one()
     uapi = UserApi(admin)
     # Checks a case without workspaces.
     wapi = WorkspaceApi(current_user=admin)
     eq_([], wapi.get_all_manageable())
     # Checks an admin gets all workspaces.
     w4 = wapi.create_workspace(label='w4')
     w3 = wapi.create_workspace(label='w3')
     w2 = wapi.create_workspace(label='w2')
     w1 = wapi.create_workspace(label='w1')
     eq_([w1, w2, w3, w4], wapi.get_all_manageable())
     # Checks a regular user gets none workspace.
     gapi = GroupApi(None)
     u = uapi.create_user('[email protected]', [gapi.get_one(Group.TIM_USER)], True)
     wapi = WorkspaceApi(current_user=u)
     rapi = RoleApi(current_user=u)
     rapi.create_one(u, w4, UserRoleInWorkspace.READER, False)
     rapi.create_one(u, w3, UserRoleInWorkspace.CONTRIBUTOR, False)
     rapi.create_one(u, w2, UserRoleInWorkspace.CONTENT_MANAGER, False)
     rapi.create_one(u, w1, UserRoleInWorkspace.WORKSPACE_MANAGER, False)
     eq_([], wapi.get_all_manageable())
     # Checks a manager gets only its own workspaces.
     u.groups.append(gapi.get_one(Group.TIM_MANAGER))
     rapi.delete_one(u.user_id, w2.workspace_id)
     rapi.create_one(u, w2, UserRoleInWorkspace.WORKSPACE_MANAGER, False)
     eq_([w1, w2], wapi.get_all_manageable())
開發者ID:lebouquetin,項目名稱:tracim,代碼行數:30,代碼來源:test_workspace.py


注:本文中的tracim.lib.workspace.WorkspaceApi.get_all_manageable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。