Adaptation de l'effet de TOUS_ABONNES

This commit is contained in:
Colin Maudry
2026-07-14 12:53:01 +02:00
parent ad293acd88
commit 70ca65e962
11 changed files with 145 additions and 39 deletions
+15
View File
@@ -16,6 +16,21 @@ def test_verify_email_valid_token_logs_in_and_redirects_to_mes_infos(
assert sess.get("_user_id") == str(uid)
def test_verify_email_tous_abonnes_redirects_to_abonnement(
client, users_db_path, monkeypatch
):
monkeypatch.setattr("src.utils.TOUS_ABONNES", True)
db.init_schema()
uid = db.create_user("t@b.c", "hash")
token = tokens.create_verification_token(uid)
resp = client.get(f"/auth/verify-email?token={token}")
assert resp.status_code == 302
loc = resp.headers["Location"]
assert loc.endswith("/compte/abonnement")
assert "mes-infos" not in loc
def test_verify_email_invalid_token(client):
resp = client.get("/auth/verify-email?token=invalide")
assert "error=invalid_token" in resp.headers["Location"]