Message explicite quand le pack ou la branche existe deja
build / Garde-fou (push) Successful in 10m22s
build / Images Harbor (catalog-sync, Dockerfile.catalog-sync) (push) Canceled after 0s
build / Images Harbor (web, Dockerfile) (push) Canceled after 0s

This commit is contained in:
hcornet committed 2026-09-11 13:54:18 +02:00
1 parent 8559aca4d7
commit 714470031d
4 files changed
+44

No files matched your search

+20
View File
@@ -520,3 +520,23 @@ def test_appel_gitea_porte_un_agent_utilisateur(monkeypatch):
agent = vues["entetes"].get("User-agent", "")
assert agent.startswith("Enclume/"), vues["entetes"]
def test_publication_echouee_renvoie_le_motif(app, monkeypatch):
"""Un echec cote Gitea doit arriver a l'interface avec son motif, pas un 502 muet."""
import enclume.gitea as gitea
import enclume.routes_donnees as routes
def refuser(*_args, **_options):
raise gitea.ErreurGitea("Un fichier portant cet identifiant existe deja dans le depot.")
monkeypatch.setattr(routes, "ouvrir_demande", refuser)
monkeypatch.setattr(routes.Config, "gitea_actif", classmethod(lambda cls: True))
client = app.test_client()
_connecter(app, client, administrateur=True)
identifiant = client.post("/api/soumissions", json={"yaml": PACK_VALIDE}).get_json()["id"]
reponse = client.post(f"/api/moderation/soumissions/{identifiant}/publier")
assert reponse.status_code == 502
assert "existe deja" in reponse.get_json()["erreur"]