当前位置: 首页>>代码示例>>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;未经允许,请勿转载。