From 190b8154b4bef7bc5572ab51e679a9d6c0928eab Mon Sep 17 00:00:00 2001 From: Colin Maudry Date: Wed, 1 Jul 2026 11:17:18 +0200 Subject: [PATCH] refactor: replace decpinfo with colibre in test client identifiers Update test fixtures and client references to use colibre branding instead of the legacy decpinfo naming convention. Co-Authored-By: Claude Haiku 4.5 --- tests/api/benchmark.py | 2 +- tests/api/test_auth.py | 2 +- tests/subscriptions/test_client.py | 22 +++++++++++----------- tests/subscriptions/test_routes.py | 22 +++++++++++----------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/tests/api/benchmark.py b/tests/api/benchmark.py index 7250819..4f44b43 100644 --- a/tests/api/benchmark.py +++ b/tests/api/benchmark.py @@ -252,7 +252,7 @@ def main() -> None: parser.add_argument( "--token", default=None, - help="Token Bearer colibre (format decpinfo_xxx)", + help="Token Bearer colibre (format colibre_xxx)", ) parser.add_argument( "--runs", diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py index 1584bed..7b97fbd 100644 --- a/tests/api/test_auth.py +++ b/tests/api/test_auth.py @@ -32,7 +32,7 @@ def test_bearer_without_value_returns_401(temp_db): def test_invalid_token_returns_401(temp_db): app = _make_app() resp = app.test_client().get( - "/protected", headers={"Authorization": "Bearer decpinfo_unknown"} + "/protected", headers={"Authorization": "Bearer colibre_unknown"} ) assert resp.status_code == 401 assert resp.get_json()["message"] == "invalid_token" diff --git a/tests/subscriptions/test_client.py b/tests/subscriptions/test_client.py index 9878ecd..f4d204a 100644 --- a/tests/subscriptions/test_client.py +++ b/tests/subscriptions/test_client.py @@ -4,22 +4,22 @@ from src.subscriptions import client def test_auth_and_base_url_used(fake_httpx): - fake_httpx["queue"].append(fake_httpx["Response"](200, {"handle": "decpinfo-1"})) - client.get_customer("decpinfo-1") + fake_httpx["queue"].append(fake_httpx["Response"](200, {"handle": "colibre-1"})) + client.get_customer("colibre-1") call = fake_httpx["calls"][0] - assert call["url"] == "https://api.test/v1/customer/decpinfo-1" + assert call["url"] == "https://api.test/v1/customer/colibre-1" assert call["auth"] == ("priv_test", "") def test_get_customer(fake_httpx): - fake_httpx["queue"].append(fake_httpx["Response"](200, {"handle": "decpinfo-1"})) - result = client.get_customer("decpinfo-1") - assert result == {"handle": "decpinfo-1"} + fake_httpx["queue"].append(fake_httpx["Response"](200, {"handle": "colibre-1"})) + result = client.get_customer("colibre-1") + assert result == {"handle": "colibre-1"} def test_update_customer(fake_httpx): - fake_httpx["queue"].append(fake_httpx["Response"](200, {"handle": "decpinfo-1"})) - client.update_customer("decpinfo-1", {"email": "a@b.fr"}) + fake_httpx["queue"].append(fake_httpx["Response"](200, {"handle": "colibre-1"})) + client.update_customer("colibre-1", {"email": "a@b.fr"}) call = fake_httpx["calls"][0] assert call["method"] == "PUT" assert call["json"] == {"email": "a@b.fr"} @@ -40,12 +40,12 @@ def test_create_subscription_session_with_customer_handle(fake_httpx): "plan_simple", "https://app/ok", "https://app/ko", - customer_handle="decpinfo-1", + customer_handle="colibre-1", ) assert url == "https://checkout.reepay.com/#/sub-1" body = fake_httpx["calls"][0]["json"] assert body["plan"] == "plan_simple" - assert body["customer"] == "decpinfo-1" + assert body["customer"] == "colibre-1" assert body["signup_method"] == "link" assert "prepare_subscription" not in body @@ -66,7 +66,7 @@ def test_create_subscription_session_no_trial(fake_httpx): "https://app/ok", "https://app/ko", no_trial=True, - customer_handle="decpinfo-1", + customer_handle="colibre-1", ) assert fake_httpx["calls"][0]["json"]["no_trial"] is True diff --git a/tests/subscriptions/test_routes.py b/tests/subscriptions/test_routes.py index 3812fac..1a0287f 100644 --- a/tests/subscriptions/test_routes.py +++ b/tests/subscriptions/test_routes.py @@ -33,13 +33,13 @@ def test_subscribe_redirects_to_hosted_url(logged_in_client, monkeypatch): def test_subscribe_disables_trial_after_first_use(logged_in_client, monkeypatch): client, uid = logged_in_client # L'utilisateur a déjà consommé un essai par le passé (abonnement maintenant expiré). - db.create_pending(uid, "decpinfo-%d" % uid, "simple") + db.create_pending(uid, "colibre-%d" % uid, "simple") db.update_from_webhook( - "decpinfo-%d" % uid, "sub_42", "trial", "2099-01-01T00:00:00+00:00" + "colibre-%d" % uid, "sub_42", "trial", "2099-01-01T00:00:00+00:00" ) # L'essai est terminé : abonnement expiré, trial_used reste à 1. db.update_from_webhook( - "decpinfo-%d" % uid, "sub_42", "expired", "2020-01-01T00:00:00+00:00" + "colibre-%d" % uid, "sub_42", "expired", "2020-01-01T00:00:00+00:00" ) captured = {} monkeypatch.setattr(frisbii_client, "update_customer", lambda h, d: {}) @@ -83,9 +83,9 @@ def test_subscribe_requires_login(sub_app): def test_cancel_calls_api_and_marks_cancelled(logged_in_client, monkeypatch): client, uid = logged_in_client - db.create_pending(uid, "decpinfo-%d" % uid, "simple") + db.create_pending(uid, "colibre-%d" % uid, "simple") db.update_from_webhook( - "decpinfo-%d" % uid, "sub_42", "active", "2099-01-01T00:00:00+00:00" + "colibre-%d" % uid, "sub_42", "active", "2099-01-01T00:00:00+00:00" ) monkeypatch.setattr( frisbii_client, @@ -112,7 +112,7 @@ def test_webhook_updates_subscription(sub_app, monkeypatch): auth_db.init_schema() uid = auth_db.create_user("wh@ex.fr", "hash") - db.create_pending(uid, "decpinfo-%d" % uid, "simple") + db.create_pending(uid, "colibre-%d" % uid, "simple") monkeypatch.setattr( frisbii_client, "get_subscription", @@ -122,7 +122,7 @@ def test_webhook_updates_subscription(sub_app, monkeypatch): "id": "evt_1", "timestamp": "2026-06-25T10:00:00Z", "event_type": "subscription_created", - "customer": "decpinfo-%d" % uid, + "customer": "colibre-%d" % uid, "subscription": "sub_42", } payload["signature"] = _sign("s3cr3t", payload["timestamp"], payload["id"]) @@ -136,9 +136,9 @@ def test_webhook_updates_subscription(sub_app, monkeypatch): def test_subscribe_skips_if_already_active(logged_in_client, monkeypatch): """Fix 1 : un abonné actif ne doit pas voir son statut remis à 'pending'.""" client, uid = logged_in_client - db.create_pending(uid, "decpinfo-%d" % uid, "simple") + db.create_pending(uid, "colibre-%d" % uid, "simple") db.update_from_webhook( - "decpinfo-%d" % uid, "sub_42", "active", "2099-01-01T00:00:00+00:00" + "colibre-%d" % uid, "sub_42", "active", "2099-01-01T00:00:00+00:00" ) called = [] monkeypatch.setattr( @@ -156,9 +156,9 @@ def test_subscribe_skips_if_already_active(logged_in_client, monkeypatch): def test_subscribe_skips_if_trial_active(logged_in_client, monkeypatch): """Fix 1 : un abonné en période d'essai est protégé de la même façon.""" client, uid = logged_in_client - db.create_pending(uid, "decpinfo-%d" % uid, "simple") + db.create_pending(uid, "colibre-%d" % uid, "simple") db.update_from_webhook( - "decpinfo-%d" % uid, "sub_42", "trial", "2099-01-01T00:00:00+00:00" + "colibre-%d" % uid, "sub_42", "trial", "2099-01-01T00:00:00+00:00" ) resp = client.post("/subscriptions/subscribe", data={"plan": "simple"}) assert resp.status_code == 302