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


Python OSFUser.create_confirmed方法代码示例

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


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

示例1: setUpClass

# 需要导入模块: from osf.models import OSFUser [as 别名]
# 或者: from osf.models.OSFUser import create_confirmed [as 别名]
    def setUpClass(cls):
        super(TestVarnish, cls).setUpClass()
        username = uuid.uuid4()
        cls.user = OSFUser.create_confirmed(
            username='{}@mail.com'.format(str(username)),
            password='password',
            fullname='Mocha Test User')
        cls.user.save()
        cls.authorization = HTTPBasicAuth(cls.user.username, 'password')

        small = 5
        large = 10

        components = [[[range(small, random.randint(small, large))
                        for x in range(small, random.randint(small, large))]
                       for y in range(small, random.randint(small, large))]
                      for z in range(small, random.randint(small, large))]

        number_of_projects = random.randint(1, 11)
        number_of_tags = random.randint(1, 11)
        number_of_users = random.randint(1, 11)

        for i in range(number_of_projects):
            name = ''
            create_fake_project(cls.user, number_of_users,
                                random.choice(['public', 'private']),
                                components, name, number_of_tags, None, False)
开发者ID:erinspace,项目名称:osf.io,代码行数:29,代码来源:test_caching.py

示例2: test_registered_user_csl

# 需要导入模块: from osf.models import OSFUser [as 别名]
# 或者: from osf.models.OSFUser import create_confirmed [as 别名]
 def test_registered_user_csl(self):
     # Tests the csl name for a registered user
     user = OSFUser.create_confirmed(
         username=fake_email(), password='foobar', fullname=fake.name()
     )
     if user.is_registered:
         assert bool(
             user.csl_name() ==
             {
                 'given': user.csl_given_name,
                 'family': user.family_name,
             }
         )
开发者ID:icereval,项目名称:osf.io,代码行数:15,代码来源:test_citations.py

示例3: get_or_create_user

# 需要导入模块: from osf.models import OSFUser [as 别名]
# 或者: from osf.models.OSFUser import create_confirmed [as 别名]
def get_or_create_user(fullname, address, reset_password=True, is_spam=False):
    """
    Get or create user by fullname and email address.

    :param str fullname: user full name
    :param str address: user email address
    :param boolean reset_password: ask user to reset their password
    :param bool is_spam: user flagged as potential spam
    :return: tuple of (user, created)
    """
    from osf.models import OSFUser
    user = get_user(email=address)
    if user:
        return user, False
    else:
        password = str(uuid.uuid4())
        user = OSFUser.create_confirmed(address, password, fullname)
        if reset_password:
            user.verification_key_v2 = generate_verification_key(verification_type='password')
        if is_spam:
            user.save()  # need to save in order to add a tag
            user.add_system_tag('is_spam')
        return user, True
开发者ID:adlius,项目名称:osf.io,代码行数:25,代码来源:__init__.py


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