mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 06:31:27 +08:00
29 lines
765 B
Python
29 lines
765 B
Python
|
from flask import url_for
|
||
|
|
||
|
|
||
|
def test_register_success(flask_client):
|
||
|
"""User arrives at the waiting activation page."""
|
||
|
r = flask_client.post(
|
||
|
url_for("auth.register"),
|
||
|
data={"email": "a@b.c", "password": "password"},
|
||
|
follow_redirects=True,
|
||
|
)
|
||
|
|
||
|
assert r.status_code == 200
|
||
|
assert b"An email to validate your email is on its way" in r.data
|
||
|
|
||
|
|
||
|
def test_register_disabled(flask_client):
|
||
|
"""User cannot create new account when DISABLE_REGISTRATION."""
|
||
|
from app import config
|
||
|
|
||
|
config.DISABLE_REGISTRATION = True
|
||
|
|
||
|
r = flask_client.post(
|
||
|
url_for("auth.register"),
|
||
|
data={"email": "a@b.c", "password": "password"},
|
||
|
follow_redirects=True,
|
||
|
)
|
||
|
|
||
|
assert b"Registration is closed" in r.data
|