Message explicite quand le pack ou la branche existe deja
This commit is contained in:
1 parent
8559aca4d7
commit
714470031d
4 files changed
+44
No files matched your search
@@ -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"]
|
||||
Reference in new issue
Block a user