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(),
)
评论列表
文章目录