check_deploy: author.html is expected behind the login (302) when the backend is active; check admin and static files

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
denis
2026-10-17 12:48:28 +02:00
parent 71951e1f11
commit 973fb98b91
3 changed files with 22 additions and 3 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ service if it was running). See the ports in use: `ss -ltnp`.
| go back to the previous site version | `./scripts/server_update.sh --rollback` | | go back to the previous site version | `./scripts/server_update.sh --rollback` |
| simulate an update | `./scripts/server_update.sh --dry-run` | | simulate an update | `./scripts/server_update.sh --dry-run` |
| see the server state | `./scripts/vps_doctor.sh` | | see the server state | `./scripts/vps_doctor.sh` |
| check the published site | `./scripts/check_deploy.sh https://domain` | | check the published site | `./scripts/check_deploy.sh https://domain` (with the backend: `author.html` must answer **302** to the login, and so must the administration; without a backend, `author.html` is public) |
| manage authors | `https://domain/api/admin/` or `./scripts/server_manage.sh create_author ada` | | manage authors | `https://domain/api/admin/` or `./scripts/server_manage.sh create_author ada` |
| read the logs | `journalctl -u pyquest -f`; `/var/log/nginx/error.log` | | read the logs | `journalctl -u pyquest -f`; `/var/log/nginx/error.log` |
+1 -1
View File
@@ -65,7 +65,7 @@ service s'il tournait). Voir les ports utilisés : `ss -ltnp`.
| revenir à la version précédente du site | `./scripts/server_update.sh --rollback` | | revenir à la version précédente du site | `./scripts/server_update.sh --rollback` |
| simuler une mise à jour | `./scripts/server_update.sh --dry-run` | | simuler une mise à jour | `./scripts/server_update.sh --dry-run` |
| voir l'état du serveur | `./scripts/vps_doctor.sh` | | voir l'état du serveur | `./scripts/vps_doctor.sh` |
| contrôler le site publié | `./scripts/check_deploy.sh https://domaine` | | contrôler le site publié | `./scripts/check_deploy.sh https://domaine` (avec le backend : `author.html` doit répondre **302** vers la connexion, l'administration aussi ; sans backend, `author.html` est public) |
| gérer les auteurs | `https://domaine/api/admin/` ou `./scripts/server_manage.sh create_author ada` | | gérer les auteurs | `https://domaine/api/admin/` ou `./scripts/server_manage.sh create_author ada` |
| lire les journaux | `journalctl -u pyquest -f` ; `/var/log/nginx/error.log` | | lire les journaux | `journalctl -u pyquest -f` ; `/var/log/nginx/error.log` |
+20 -1
View File
@@ -41,7 +41,26 @@ expect_header "${BASE}/service-worker.js" Cache-Control no-cache
expect_header "${BASE}/css/base.css" Content-Type text/css expect_header "${BASE}/css/base.css" Content-Type text/css
expect_header "${BASE}/manifest.webmanifest" Content-Type manifest+json expect_header "${BASE}/manifest.webmanifest" Content-Type manifest+json
expect_status "${BASE}/levels/manifest.json" 200 expect_status "${BASE}/levels/manifest.json" 200
expect_status "${BASE}/author.html" 200
# Éditeur de niveaux : derrière le backend il est protégé (302 vers la connexion) ; sans backend il est public (200).
author_code="$(status "${BASE}/author.html")"
author_location="$(header "${BASE}/author.html" Location)"
if [[ "${author_code}" == 302 && "${author_location}" == *"/api/auth/login/"* ]]; then
ok "author.html protégé par connexion (302 vers /api/auth/login/)"
expect_status "${BASE}/api/auth/login/" 200
expect_header "${BASE}/api/auth/login/" Content-Type text/html
# Le contrôle interne réservé à nginx ne doit pas être joignable de l'extérieur.
expect_status "${BASE}/api/auth/check/" 404
# Administration : redirige vers sa connexion ; ses fichiers statiques sont servis par nginx.
admin_code="$(status "${BASE}/api/admin/")"
if [[ "${admin_code}" == 302 ]]; then ok "administration protégée (302 vers sa connexion)"; else ko "/api/admin/ : 302 attendu, reçu ${admin_code}"; fi
expect_status "${BASE}/api/static/admin/css/base.css" 200
expect_header "${BASE}/api/static/admin/css/base.css" Content-Type text/css
elif [[ "${author_code}" == 200 ]]; then
info "author.html est PUBLIC (200) : normal sans backend Django, sinon l'accès authentifié n'est pas actif"
else
ko "author.html : 200 (public) ou 302 vers la connexion attendus, reçu ${author_code}"
fi
if [[ "${BASE}" == https://* ]]; then if [[ "${BASE}" == https://* ]]; then
redirect="$(curl -s -o /dev/null -w '%{http_code}' --max-time 20 "http://${BASE#https://}/")" redirect="$(curl -s -o /dev/null -w '%{http_code}' --max-time 20 "http://${BASE#https://}/")"