factories.py 文件源码

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

项目:postix 作者: c3cashdesk 项目源码 文件源码
def user_factory(troubleshooter=False, superuser=False, backoffice=False, password=None):
    fake = Faker('en-US')
    u = User(username=fake.user_name(),
             firstname=fake.first_name(),
             lastname=fake.last_name(),
             is_active=True,
             is_superuser=superuser,
             is_backoffice_user=backoffice,
             is_troubleshooter=troubleshooter)
    u.set_password(password or fake.password())
    if troubleshooter:
        u.auth_token = get_random_string(32)
    u.save()
    return u
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号