本文整理汇总了Python中tracim_backend.lib.core.user.UserApi.create_minimal_user方法的典型用法代码示例。如果您正苦于以下问题:Python UserApi.create_minimal_user方法的具体用法?Python UserApi.create_minimal_user怎么用?Python UserApi.create_minimal_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracim_backend.lib.core.user.UserApi
的用法示例。
在下文中一共展示了UserApi.create_minimal_user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_unit__create_minimal_user__err__too_short_email
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__create_minimal_user__err__too_short_email(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
with pytest.raises(TracimValidationFailed):
u = api.create_minimal_user('[email protected]')
示例2: test_unit__create_minimal_user_and_update__err__set_unaivalable_auth_type
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__create_minimal_user_and_update__err__set_unaivalable_auth_type(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
with pytest.raises(UserAuthTypeDisabled):
api.update(u, name='bob', email='[email protected]', auth_type=AuthType.LDAP, do_save=True)
示例3: test_unit__create_minimal_user__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__create_minimal_user__ok__nominal_case(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
assert u.email == '[email protected]'
assert u.display_name == 'bob'
示例4: test_unit__create_minimal_user__err__too_long_email
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__create_minimal_user__err__too_long_email(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
with pytest.raises(TracimValidationFailed):
email = 'b{}[email protected]'.format('o'*255)
u = api.create_minimal_user(email)
示例5: test_unit__update_timezone__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_timezone__ok__nominal_case(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
assert u.timezone is None
u = api.update(user=u, timezone='Europe/Paris')
assert u.timezone == 'Europe/Paris'
示例6: test_unit__update_user_email__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_user_email__ok__nominal_case(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
assert u.email == '[email protected]'
u = api.update(user=u, email='[email protected]')
assert u.email == '[email protected]'
示例7: test_unit__get_one__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [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)
示例8: test_unit__get_all__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__get_all__ok__nominal_case(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u1 = api.create_minimal_user('[email protected]')
users = api.get_all()
# u1 + Admin user from BaseFixture
assert 2 == len(users)
示例9: test_unit__update_user_email__err__wrong_format
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_user_email__err__wrong_format(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
# 2 char
with pytest.raises(EmailValidationFailed):
u = api.update(user=u, email='b+b')
示例10: test_unit__update_user_public_name__err__too_long_password
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_user_public_name__err__too_long_password(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
with pytest.raises(TracimValidationFailed):
name = 'n' * 256
u = api.update(user=u, name=name)
name = 'n' * 255
u = api.update(user=u, name=name)
示例11: test_unit__update_user_password__err__too_long_password
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_user_password__err__too_long_password(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
with pytest.raises(TracimValidationFailed):
password = 'p' * 513
u = api.update(user=u, password=password)
password = 'p' * 512
u = api.update(user=u, password=password)
示例12: test_unit__update_user_password__err__too_short_password
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_user_password__err__too_short_password(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
# 5 char
with pytest.raises(TracimValidationFailed):
u = api.update(user=u, password='passw')
# 6 char
u = api.update(user=u, password='passwo')
示例13: test_unit__update_user_lang__err__too_long_lang
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_user_lang__err__too_long_lang(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
with pytest.raises(TracimValidationFailed):
lang = 'n' * 4
u = api.update(user=u, lang=lang)
lang = 'n' * 3
u = api.update(user=u, lang=lang)
示例14: test_unit__update_timezone__too_long_timezone
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__update_timezone__too_long_timezone(self):
api = UserApi(
current_user=None,
session=self.session,
config=self.app_config,
)
u = api.create_minimal_user('[email protected]')
with pytest.raises(TracimValidationFailed):
timezone = 't' * 33
u = api.update(user=u, timezone=timezone)
timezone = 't' * 32
u = api.update(user=u, timezone=timezone)
示例15: test_unit__user_with_email_exists__ok__nominal_case
# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import create_minimal_user [as 别名]
def test_unit__user_with_email_exists__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, 'bibi', '[email protected]', 'password', do_save=True)
transaction.commit()
eq_(True, api.user_with_email_exists('[email protected]'))
eq_(False, api.user_with_email_exists('unknown'))