本文整理汇总了Python中tracim_backend.lib.core.user.UserApi.get_one方法的典型用法代码示例。如果您正苦于以下问题:Python UserApi.get_one方法的具体用法?Python UserApi.get_one怎么用?Python UserApi.get_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim_backend.lib.core.user.UserApi
的用法示例。
在下文中一共展示了UserApi.get_one方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_user
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_one [as 别名]
def _get_user(self, user_id_fetcher: typing.Callable):
user_id = user_id_fetcher()
uapi = UserApi(
None,
show_deleted=True,
session=self.dbsession,
config=self.app_config
)
return uapi.get_one(user_id)
示例2: test_unit__get_one__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_one [as 别名]
def test_unit__get_one__ok__nominal_case(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
api.update(u, 'titi', '[email protected]', 'password', do_save=True)
one = api.get_one(u.user_id)
eq_(u.user_id, one.user_id)
示例3: test_unit__disable_user___ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import get_one [as 别名]
def test_unit__disable_user___ok__nominal_case(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
gapi = GroupApi(
current_user=None,
session=self.session,
config=self.app_config,
)
groups = [gapi.get_one_with_name('users')]
user = api.create_user(
email='[email protected]',
password='password',
name='bob',
groups=groups,
timezone='Europe/Paris',
do_save=True,
do_notify=False,
)
user2 = api.create_user(
email='[email protected]',
password='password',
name='bob2',
groups=groups,
timezone='Europe/Paris',
do_save=True,
do_notify=False,
)
api2 = UserApi(current_user=user,session=self.session, config=self.app_config)
from tracim_backend.exceptions import UserCantDisableHimself
api2.disable(user2)
updated_user2 = api.get_one(user2.user_id)
assert updated_user2.is_active == False
assert updated_user2.user_id == user2.user_id
assert updated_user2.email == user2.email