def users(): if UserModel.table_exists(): UserModel.truncate_table(cascade=True) UserModel.create_table() salt = os.urandom(32) users = [ UserModel.create( username="******", email_address="*****@*****.**", key=get_hash(password="******", salt=salt), salt=salt, role=UserRole.ADMIN, ), UserModel.create( username="******", email_address="*****@*****.**", key=get_hash(password="******", salt=salt), salt=salt, role=UserRole.ADMIN, ), UserModel.create( username="******", email_address="*****@*****.**", key=get_hash(password="******", salt=salt), salt=salt, ), UserModel.create( username="******", email_address="*****@*****.**", key=get_hash(password="******", salt=salt), salt=salt, ), ] yield users UserModel.truncate_table(cascade=True)
def clear_table(): UserModel.truncate_table(cascade=True)