diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 7197fee..17d1891 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,14 +1,8 @@ -# Syntaxe : <@utilisateur ou @org/équipe> +# Tout changement requiert une approbation de votre binôme +* @benslimane-byte @bambstk -# Par défaut : tout changement requiert une review de ces personnes -* @ +# Les workflows ne peuvent être modifiés qu'avec validation des deux +.github/workflows/ @benslimane-byte @bambstk -# Les workflows CI/CD ne peuvent être modifiés que par le lead DevOps -.github/workflows/ @ - -# Le fichier de dépendances requiert une validation technique -ressources/requirements.txt @ - -# Les fichiers de sécurité requièrent une double validation -.github/dependabot.yml @ -.github/CODEOWNERS @ +# Le code applicatif +ressources/ @benslimane-byte @bambstk diff --git a/notes.md b/notes.md index 2c821cd..1f511cb 100644 --- a/notes.md +++ b/notes.md @@ -1 +1 @@ -# Mon TP GitHub Actions +# Mon TP GitHub Actions ! diff --git a/ressources/__pycache__/app.cpython-314.pyc b/ressources/__pycache__/app.cpython-314.pyc index 9c6bb8f..8a104e1 100644 Binary files a/ressources/__pycache__/app.cpython-314.pyc and b/ressources/__pycache__/app.cpython-314.pyc differ diff --git a/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc b/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc index b3576df..8f93bd2 100644 Binary files a/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc and b/ressources/__pycache__/test_app.cpython-314-pytest-8.2.0.pyc differ diff --git a/ressources/app.py b/ressources/app.py index d7e75f2..eee358d 100644 --- a/ressources/app.py +++ b/ressources/app.py @@ -38,5 +38,14 @@ def logs_critical(): return jsonify({"critical_count": seuil, "alerte": alerte}) +@app.route("/logs/stats") +def logs_stats(): + total = sum(LOG_SUMMARY.values()) + return jsonify({ + "total": total, + "breakdown": LOG_SUMMARY + }) + + if __name__ == "__main__": app.run(debug=True, port=5001) diff --git a/ressources/test_app.py b/ressources/test_app.py index ce56a43..a886678 100644 --- a/ressources/test_app.py +++ b/ressources/test_app.py @@ -57,3 +57,13 @@ def test_logs_critical_alerte(client): assert "critical_count" in data assert "alerte" in data assert data["alerte"] is True + + +def test_logs_stats(client): + """La route /logs/stats retourne le total et le détail.""" + response = client.get("/logs/stats") + assert response.status_code == 200 + data = response.get_json() + assert "total" in data + assert "breakdown" in data + assert data["total"] == 185 # 142 + 28 + 12 + 3