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


Python UserApi.update方法代码示例

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


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

示例1: test_unit_update__err__external_auth_ldap_set_email

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
 def test_unit_update__err__external_auth_ldap_set_email(self):
     api = UserApi(
         current_user=None,
         session=self.session,
         config=self.app_config,
     )
     u = api.create_user(
         email='[email protected]',
         password=None,
         name='bob',
         auth_type=AuthType.LDAP,
         timezone='+2',
         lang='en',
         do_save=True,
         do_notify=False,
     )
     with pytest.raises(ExternalAuthUserEmailModificationDisallowed):
         api.update(
             email='[email protected]',
             user = u,
             name='bobi',
             password=None,
             auth_type=AuthType.LDAP,
             timezone='-1',
             lang='fr',
             do_save=True,
         )
开发者ID:tracim,项目名称:tracim,代码行数:29,代码来源:test_user_api.py

示例2: test_unit_update__ok_external_auth_ldap

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
 def test_unit_update__ok_external_auth_ldap(self):
     api = UserApi(
         current_user=None,
         session=self.session,
         config=self.app_config,
     )
     u = api.create_user(
         email='[email protected]',
         password=None,
         name='bob',
         auth_type=AuthType.LDAP,
         timezone='+2',
         lang='en',
         do_save=True,
         do_notify=False,
     )
     api.update(
         email='[email protected]',
         user = u,
         name='bobi',
         password=None,
         auth_type=AuthType.LDAP,
         timezone='-1',
         lang='fr',
         do_save=True,
     )
     assert u.display_name == 'bobi'
开发者ID:tracim,项目名称:tracim,代码行数:29,代码来源:test_user_api.py

示例3: 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 update [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)
开发者ID:tracim,项目名称:tracim,代码行数:11,代码来源:test_user_api.py

示例4: test_unit__get_one__ok__nominal_case

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [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)
开发者ID:tracim,项目名称:tracim,代码行数:12,代码来源:test_user_api.py

示例5: 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 update [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'))
开发者ID:tracim,项目名称:tracim,代码行数:14,代码来源:test_user_api.py

示例6: test_unit__update_timezone__too_long_timezone

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [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)
开发者ID:tracim,项目名称:tracim,代码行数:14,代码来源:test_user_api.py

示例7: 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 update [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)
开发者ID:tracim,项目名称:tracim,代码行数:14,代码来源:test_user_api.py

示例8: 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 update [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)
开发者ID:tracim,项目名称:tracim,代码行数:14,代码来源:test_user_api.py

示例9: 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 update [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)
开发者ID:tracim,项目名称:tracim,代码行数:14,代码来源:test_user_api.py

示例10: 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 update [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')
开发者ID:tracim,项目名称:tracim,代码行数:14,代码来源:test_user_api.py

示例11: test_unit__update_user_lang__err__too_short_lang

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
 def test_unit__update_user_lang__err__too_short_lang(self):
     api = UserApi(
         current_user=None,
         session=self.session,
         config=self.app_config,
     )
     u = api.create_minimal_user('[email protected]')
     # 1 char
     with pytest.raises(TracimValidationFailed):
         u = api.update(user=u, lang='f')
     # 2 char
     u = api.update(user=u, lang='fr')
     assert u.lang == 'fr'
开发者ID:tracim,项目名称:tracim,代码行数:15,代码来源:test_user_api.py

示例12: test_unit__create_minimal_user_and_update__ok__nominal_case

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
 def test_unit__create_minimal_user_and_update__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, 'bob', '[email protected]', 'password', do_save=True)
     nu = api.get_one_by_email('[email protected]')
     assert nu is not None
     assert nu.email == '[email protected]'
     assert nu.display_name == 'bob'
     assert nu.validate_password('password')
开发者ID:tracim,项目名称:tracim,代码行数:15,代码来源:test_user_api.py

示例13: test_get_one_by_email

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
    def test_get_one_by_email(self):
        api = UserApi(
            current_user=None,
            session=self.session,
            config=self.app_config,
        )
        u = api.create_minimal_user('[email protected]')
        self.session.flush()
        api.update(u, 'bibi', '[email protected]', 'password', do_save=True)
        uid = u.user_id
        transaction.commit()

        eq_(uid, api.get_one_by_email('[email protected]').user_id)
开发者ID:tracim,项目名称:tracim,代码行数:15,代码来源:test_user_api.py

示例14: test_unit__update_user_public_name__err__too_short_public_name

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
 def test_unit__update_user_public_name__err__too_short_public_name(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(TracimValidationFailed):
         u = api.update(user=u, name='nn')
     # 3 char
     u = api.update(user=u, name='nnn')
     assert u.display_name == 'nnn'
开发者ID:tracim,项目名称:tracim,代码行数:15,代码来源:test_user_api.py

示例15: test_unit__update_user_lang_name__ok__nominal_case

# 需要导入模块: from tracim_backend.lib.core.user import UserApi [as 别名]
# 或者: from tracim_backend.lib.core.user.UserApi import update [as 别名]
 def test_unit__update_user_lang_name__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.lang is None
     # 2 char
     u = api.update(user=u, lang='fr')
     assert u.lang == 'fr'
     # 3 char
     u = api.update(user=u, lang='fre')
     assert u.lang == 'fre'
开发者ID:tracim,项目名称:tracim,代码行数:16,代码来源:test_user_api.py


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