def test_create_welcome_forum(default_groups): assert not create_welcome_forum() create_user(username="******", password="******", email="*****@*****.**", groupname="admin") assert create_welcome_forum()
def prompt_save_user(username, email, password, group, only_update=False): if not username: username = click.prompt( click.style("Username", fg="magenta"), type=str, default=os.environ.get("USER", "") ) if not email: email = click.prompt( click.style("Email address", fg="magenta"), type=EmailType() ) if not password: password = click.prompt( click.style("Password", fg="magenta"), hide_input=True, confirmation_prompt=True ) if not group: group = click.prompt( click.style("Group", fg="magenta"), type=click.Choice(["admin", "super_mod", "mod", "member"]), default="admin" ) if only_update: return update_user(username, password, email, group) return create_user(username, password, email, group)
def test_create_user(default_groups): user = User.query.filter_by(username="******").first() assert not user user = create_user(username="******", password="******", email="*****@*****.**", groupname="admin") assert user.username == "admin" assert user.permissions["admin"]