Bandeau TOUS_ABONNES et boutons S'abonner désactivés
Affiche un bandeau d'info sur /compte/abonnement et grise les boutons S'abonner quand l'accès gratuit pour tous est activé. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ def test_plan_cards_present_when_no_subscription(monkeypatch):
|
||||
|
||||
cards = compte_abonnement._plan_cards(trial_for=lambda key: 2)
|
||||
text = str(cards)
|
||||
assert "Abonnement simple" in text
|
||||
assert "Abonnement" in text
|
||||
assert "Abonnement de soutien" in text
|
||||
assert "2 jours d'essai gratuit" in text
|
||||
|
||||
@@ -41,3 +41,39 @@ def test_active_view_trial_banner(monkeypatch):
|
||||
"current_period_end": "2099-01-01T00:00:00+00:00",
|
||||
}
|
||||
assert "Essai gratuit" in str(compte_abonnement._active_view(row))
|
||||
|
||||
|
||||
def test_subscribe_buttons_disabled_when_tous_abonnes(monkeypatch):
|
||||
monkeypatch.setenv("FRISBII_PLAN_SIMPLE", "plan_simple")
|
||||
monkeypatch.setenv("FRISBII_PLAN_SOUTIEN", "plan_soutien")
|
||||
monkeypatch.setattr("src.utils.TOUS_ABONNES", True)
|
||||
from src.pages import compte_abonnement
|
||||
|
||||
text = str(compte_abonnement._plan_cards(trial_for=lambda key: 2))
|
||||
assert "btn-secondary disabled" in text
|
||||
assert "btn-primary" not in text
|
||||
|
||||
|
||||
def test_subscribe_buttons_active_when_flag_off(monkeypatch):
|
||||
monkeypatch.setenv("FRISBII_PLAN_SIMPLE", "plan_simple")
|
||||
monkeypatch.setenv("FRISBII_PLAN_SOUTIEN", "plan_soutien")
|
||||
monkeypatch.setattr("src.utils.TOUS_ABONNES", False)
|
||||
from src.pages import compte_abonnement
|
||||
|
||||
text = str(compte_abonnement._plan_cards(trial_for=lambda key: 2))
|
||||
assert "btn-primary" in text
|
||||
|
||||
|
||||
def test_banner_present_when_tous_abonnes(monkeypatch):
|
||||
monkeypatch.setattr("src.utils.TOUS_ABONNES", True)
|
||||
from src.pages import compte_abonnement
|
||||
|
||||
text = str(compte_abonnement._tous_abonnes_banner())
|
||||
assert "accessibles à tous et toutes" in text
|
||||
|
||||
|
||||
def test_banner_absent_when_flag_off(monkeypatch):
|
||||
monkeypatch.setattr("src.utils.TOUS_ABONNES", False)
|
||||
from src.pages import compte_abonnement
|
||||
|
||||
assert compte_abonnement._tous_abonnes_banner() is None
|
||||
|
||||
Reference in New Issue
Block a user