Page d'accueil, mentions legales, licence, guide de contribution, catalogue porte a 39 packs
This commit is contained in:
1 parent
6c602c97ad
commit
469305b4a7
33 files changed
+1329
-258
No files matched your search
+1
-1
@@ -15,7 +15,7 @@ ENCLUME_CATALOG=${ENCLUME_CATALOG:-catalog} python3 - "$PAGE" <<'PY'
|
||||
import sys
|
||||
from enclume.webapp import create_app
|
||||
with open(sys.argv[1], "w", encoding="utf-8") as sortie:
|
||||
sortie.write(create_app().test_client().get("/").data.decode())
|
||||
sortie.write(create_app().test_client().get("/editeur").data.decode())
|
||||
PY
|
||||
|
||||
NODE_PATH=tests/node_modules node tests/interface.mjs "$PAGE"
|
||||
@@ -104,7 +104,7 @@ def test_toutes_les_ressources_de_la_page_existent():
|
||||
import re
|
||||
|
||||
client = create_app().test_client()
|
||||
html = client.get("/").data.decode()
|
||||
html = client.get("/editeur").data.decode()
|
||||
refs = re.findall(r'(?:src|href)="(/static/[^"]+)"', html)
|
||||
assert refs, "la page ne reference aucune ressource statique"
|
||||
for ref in refs:
|
||||
@@ -116,7 +116,23 @@ def test_le_script_expose_les_gestionnaires_attendus():
|
||||
import re
|
||||
|
||||
client = create_app().test_client()
|
||||
html = client.get("/").data.decode()
|
||||
html = client.get("/editeur").data.decode()
|
||||
script = client.get("/static/editeur.js").data.decode()
|
||||
for identifiant in re.findall(r'id="(btn-[^"]+|projet-[^"]+)"', html):
|
||||
assert identifiant in script, f"aucun gestionnaire pour {identifiant}"
|
||||
|
||||
|
||||
def test_accueil_et_mentions():
|
||||
"""Le site public a une porte d'entree et ses mentions, distinctes de l'outil."""
|
||||
client = create_app().test_client()
|
||||
|
||||
accueil = client.get("/")
|
||||
assert accueil.status_code == 200
|
||||
assert b"/editeur" in accueil.data
|
||||
assert b"Centreon SAS" in accueil.data
|
||||
|
||||
mentions = client.get("/mentions")
|
||||
assert mentions.status_code == 200
|
||||
assert b"Donn" in mentions.data # section donnees personnelles
|
||||
|
||||
assert client.get("/editeur").status_code == 200
|
||||
@@ -420,3 +420,43 @@ def test_alembic_supporte_un_mot_de_passe_encode():
|
||||
marque in sortie
|
||||
for marque in ("OperationalError", "could not translate", "Name or service not known")
|
||||
), sortie[-800:]
|
||||
|
||||
|
||||
def test_sante_publie_l_uri_de_retour(app_oidc):
|
||||
"""Comparer l'URI envoyee au fournisseur ne doit pas demander de lire les journaux."""
|
||||
donnees = app_oidc.test_client().get(
|
||||
"/sante", headers={"X-Forwarded-Proto": "https", "X-Forwarded-Host": "enclume.example"}
|
||||
).get_json()
|
||||
assert donnees["uri_de_retour"].endswith("/connexion/retour")
|
||||
assert donnees["uri_de_retour"].startswith("https://")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"saisie, attendu",
|
||||
[
|
||||
("https://enclume.example/", "https://enclume.example"),
|
||||
("enclume.example", "https://enclume.example"),
|
||||
(" https://enclume.example ", "https://enclume.example"),
|
||||
("", ""),
|
||||
],
|
||||
)
|
||||
def test_url_publique_normalisee(monkeypatch, saisie, attendu):
|
||||
"""Une barre finale ou un protocole oublie ferait diverger l'URI de redirection."""
|
||||
import importlib
|
||||
|
||||
monkeypatch.setenv("ENCLUME_URL_PUBLIQUE", saisie)
|
||||
import enclume.config
|
||||
|
||||
importlib.reload(enclume.config)
|
||||
obtenu = enclume.config.Config.URL_PUBLIQUE
|
||||
assert obtenu == attendu
|
||||
|
||||
|
||||
def test_les_deux_routes_de_sante(app):
|
||||
"""/health est la route de reference ; /sante reste servi pour la compatibilite."""
|
||||
client = app.test_client()
|
||||
reference = client.get("/health")
|
||||
ancienne = client.get("/sante")
|
||||
assert reference.status_code == 200
|
||||
assert ancienne.status_code == 200
|
||||
assert reference.get_json()["statut"] == ancienne.get_json()["statut"] == "ok"
|
||||
Reference in new issue
Block a user