test_utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ecommerce_api 作者: nbschool 项目源码 文件源码
def add_user(email, password, id=None, first_name='John', last_name='Doe'):
    """
    Create a single user in the test database.
    If an email is provided it will be used, otherwise it will be generated
    by the function before adding the User to the database.
    """
    email = email or 'johndoe{}@email.com'.format(int(random.random() * 100))

    return User.create(
        first_name=first_name,
        last_name=last_name,
        email=email,
        password=User.hash_password(password),
        uuid=id or uuid.uuid4(),
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号