diff --git a/tests/test_draco_config.py b/tests/test_draco_config.py index 99bae2c..d7337a1 100644 --- a/tests/test_draco_config.py +++ b/tests/test_draco_config.py @@ -19,7 +19,8 @@ def env_propre(monkeypatch): """Aucune variable d'URL d'écosystème posée (défauts officiels).""" for nom in ( "DRACO_AGENT_URL", "DRACO_OBSIGATE_URL", "DRACO_FLOWDECK_URL", - "DRACO_TIKTAK_URL", "DRACO_KANBANTE_URL", "DRACO_GITEA_URL", + "DRACO_TIKTAK_URL", "DRACO_KANBANTE_URL", "DRACO_SHAARIT_URL", + "DRACO_GITEA_URL", "AGENT_EVENEMENTS_URL", ): monkeypatch.delenv(nom, raising=False) @@ -37,6 +38,20 @@ def test_defauts_officiels_sans_dev(env_propre): assert "-dev" not in url +def test_shaarit_defaut_et_derivation(env_propre): + """Barre v0.2.0 : ShaarIt suit le même mécanisme que les autres + sœurs — défaut officiel, dérivation -dev depuis l'hôte de l'agent, + variable explicite prioritaire.""" + assert draco_config.app_url("shaarit") == "https://shaarit.dracodev.net" + env_propre.setenv( + "AGENT_EVENEMENTS_URL", "https://agent-dev.dracodev.net/api/v1/evenements") + assert draco_config.app_url("shaarit") == "https://shaarit-dev.dracodev.net" + assert draco_config.urls_publiques()["shaarit"] == \ + "https://shaarit-dev.dracodev.net" + env_propre.setenv("DRACO_SHAARIT_URL", "https://bm.example.net/") + assert draco_config.app_url("shaarit") == "https://bm.example.net" + + def test_agent_derive_des_evenements(env_propre): """Sans DRACO_AGENT_URL, l'origine suit AGENT_EVENEMENTS_URL — la configuration réelle du poste (dev inclus)."""