예제 #1
0
def test_create_welcome_forum(default_groups):
    assert not create_welcome_forum()

    create_user(username="******",
                password="******",
                email="*****@*****.**",
                groupname="admin")
    assert create_welcome_forum()
예제 #2
0
파일: utils.py 프로젝트: xiaoyu0/flaskbb
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)
예제 #3
0
파일: utils.py 프로젝트: 1panpan1/tj_dnalab
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)
예제 #4
0
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"]
예제 #5
0
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"]
예제 #6
0
def test_create_welcome_forum(default_groups):
    assert not create_welcome_forum()

    create_user(username="******", password="******",
                email="*****@*****.**", groupname="admin")
    assert create_welcome_forum()