def _create_user(screen_name, email_address): try: user = user_service.build_user(screen_name, email_address) except ValueError as e: raise click.UsageError(e) user.enabled = True db.session.add(user) db.session.commit() return user
def create_user(number, *, screen_name=None, email_address=None, enabled=True): if not screen_name: screen_name = 'User-{:d}'.format(number) if not email_address: email_address = 'user{:03d}@example.com'.format(number) user = user_service.build_user(screen_name, email_address) user.id = generate_uuid() user.enabled = enabled return user
def create_user(screen_name, email_address, *, enabled=False): user = user_service.build_user(screen_name, email_address) user.enabled = enabled return user