当前位置: 首页>>代码示例>>Python>>正文


Python UserApi.get_known_user方法代码示例

本文整理汇总了Python中tracim_backend.lib.core.user.UserApi.get_known_user方法的典型用法代码示例。如果您正苦于以下问题:Python UserApi.get_known_user方法的具体用法?Python UserApi.get_known_user怎么用?Python UserApi.get_known_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tracim_backend.lib.core.user.UserApi的用法示例。


在下文中一共展示了UserApi.get_known_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_unit__get_known__user__admin__too_short_acp_str

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_known_user [as 别名]
 def test_unit__get_known__user__admin__too_short_acp_str(self):
     api = UserApi(
         current_user=None,
         session=self.session,
         config=self.app_config,
     )
     u1 = api.create_user(
         email='[email protected]',
         name='name',
         do_notify=False,
         do_save=True,
     )
     with pytest.raises(TooShortAutocompleteString):
         api.get_known_user('e')
开发者ID:tracim,项目名称:tracim,代码行数:16,代码来源:test_user_api.py

示例2: test_unit__get_known__user__distinct_workspaces_users_by_name__exclude_workspace

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_known_user [as 别名]
 def test_unit__get_known__user__distinct_workspaces_users_by_name__exclude_workspace(self):
     admin = self.session.query(User) \
         .filter(User.email == '[email protected]') \
         .one()
     api = UserApi(
         current_user=None,
         session=self.session,
         config=self.app_config,
     )
     u1 = api.create_user(
         email='[email protected]',
         name='name',
         do_notify=False,
         do_save=True,
     )
     u2 = api.create_user(
         email='[email protected]',
         name='name2',
         do_notify=False,
         do_save=True,
     )
     u3 = api.create_user(
         email='[email protected]',
         name='notfound',
         do_notify=False,
         do_save=True,
     )
     wapi = WorkspaceApi(
         current_user=admin,
         session=self.session,
         config=self.app_config,
     )
     workspace = wapi.create_workspace(
         'test workspace n°1',
         save_now=True)
     wapi = WorkspaceApi(
         current_user=admin,
         session=self.session,
         config=self.app_config,
     )
     workspace_2 = wapi.create_workspace(
         'test workspace n°2',
         save_now=True)
     role_api = RoleApi(
         current_user=admin,
         session=self.session,
         config=self.app_config,
     )
     role_api.create_one(u1, workspace, UserRoleInWorkspace.READER, False)
     role_api.create_one(u2, workspace_2, UserRoleInWorkspace.READER, False)
     role_api.create_one(u3, workspace, UserRoleInWorkspace.READER, False)
     role_api.create_one(u3, workspace_2, UserRoleInWorkspace.READER, False)
     api2 = UserApi(
         current_user=u3,
         session=self.session,
         config=self.app_config,
     )
     users = api2.get_known_user('name', exclude_workspace_ids=[workspace.workspace_id])
     assert len(users) == 1
     assert users[0] == u2
开发者ID:tracim,项目名称:tracim,代码行数:62,代码来源:test_user_api.py

示例3: test_unit__get_known__user__admin__by_name

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_known_user [as 别名]
    def test_unit__get_known__user__admin__by_name(self):
        api = UserApi(
            current_user=None,
            session=self.session,
            config=self.app_config,
        )
        u1 = api.create_user(
            email='[email protected]',
            name='name',
            do_notify=False,
            do_save=True,
        )

        users = api.get_known_user('nam')
        assert len(users) == 1
        assert users[0] == u1
开发者ID:tracim,项目名称:tracim,代码行数:18,代码来源:test_user_api.py

示例4: account_known_members

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_known_user [as 别名]
 def account_known_members(self, context, request: TracimRequest, hapic_data=None):
     """
     Get known users list
     """
     app_config = request.registry.settings['CFG']
     uapi = UserApi(
         current_user=request.current_user,  # User
         session=request.dbsession,
         config=app_config,
         show_deactivated=False,
     )
     users = uapi.get_known_user(
         acp=hapic_data.query.acp,
         exclude_user_ids=hapic_data.query.exclude_user_ids,
         exclude_workspace_ids=hapic_data.query.exclude_workspace_ids,
     )
     context_users = [
         uapi.get_user_with_context(user) for user in users
     ]
     return context_users
开发者ID:tracim,项目名称:tracim,代码行数:22,代码来源:account_controller.py

示例5: test_unit__get_known__user__user__no_workspace_empty_known_user

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_known_user [as 别名]
 def test_unit__get_known__user__user__no_workspace_empty_known_user(self):
     admin = self.session.query(User) \
         .filter(User.email == '[email protected]') \
         .one()
     api = UserApi(
         current_user=admin,
         session=self.session,
         config=self.app_config,
     )
     u1 = api.create_user(
         email='[email protected]',
         name='name',
         do_notify=False,
         do_save=True,
     )
     api2 = UserApi(
         current_user=u1,
         session=self.session,
         config=self.app_config,
     )
     users = api2.get_known_user('email')
     assert len(users) == 0
开发者ID:tracim,项目名称:tracim,代码行数:24,代码来源:test_user_api.py


注:本文中的tracim_backend.lib.core.user.UserApi.get_known_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。