From 53e937e92e0ae7cabc11e56f4324d45325ca15a3 Mon Sep 17 00:00:00 2001 From: AnthonyGuillauma Date: Sun, 6 Apr 2025 15:11:44 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Feat:=20Chemin=20log=20absolu=20dans=20r?= =?UTF-8?q?=C3=A9sultat=20analyse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Modification du chemin du log analysé dans l'analyse pour ce même chemin mais en version absolue --- app/analyse/analyseur_log_apache.py | 5 +++-- app/cli/parseur_arguments_cli.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/analyse/analyseur_log_apache.py b/app/analyse/analyseur_log_apache.py index 7b559a4..09a7edd 100644 --- a/app/analyse/analyseur_log_apache.py +++ b/app/analyse/analyseur_log_apache.py @@ -2,6 +2,7 @@ Module pour l'analyse statistique d'un fichier log Apache. """ +from os.path import abspath from collections import Counter from parse.fichier_log_apache import FichierLogApache from analyse.filtre_log_apache import FiltreLogApache @@ -113,7 +114,7 @@ def get_analyse_complete(self) -> dict: Retourne l'analyse complète du fichier de log Apache. L'analyse suit la structure suivante : - - chemin: chemin du fichier + - chemin: chemin absolu du fichier - total_entrees: voir :meth:`get_total_entrees` - filtre: filtre appliqué à l'analyse - statistiques: @@ -126,7 +127,7 @@ def get_analyse_complete(self) -> dict: dict: L'analyse sous forme d'un dictionnaire. """ return { - "chemin": self.fichier.chemin, + "chemin": abspath(self.fichier.chemin), "total_entrees": self.get_total_entrees(), "filtre": self.filtre.get_dict_filtre(), "statistiques": { diff --git a/app/cli/parseur_arguments_cli.py b/app/cli/parseur_arguments_cli.py index 49125a2..01895ae 100644 --- a/app/cli/parseur_arguments_cli.py +++ b/app/cli/parseur_arguments_cli.py @@ -106,7 +106,7 @@ def parse_args(self, if not match(regex_chemin, arguments_parses.sortie): raise ArgumentCLIException( - "Le chemin du fichier de sortie doit uniquement contenir les caractères " + "Le chemin du dossier de sortie doit uniquement contenir les caractères " "autorisés. Les caractères autorisés sont les minuscules, majuscules, " "chiffres ou les caractères spéciaux suivants: _, \\, -, /." ) From 40e678b3e1cb6ed4a71f148652829caf0d959ac7 Mon Sep 17 00:00:00 2001 From: AnthonyGuillauma Date: Sun, 6 Apr 2025 15:12:37 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Test:=20Mise=20=C3=A0=20jour=20d'un=20test?= =?UTF-8?q?=20unitaire=20pour=20chemin=20absolu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mise à jour d'un test unitaire suite à la modification du chemin affiché en chemin absolu --- tests/test_analyseur_log_apache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_analyseur_log_apache.py b/tests/test_analyseur_log_apache.py index f8e14f3..4481027 100644 --- a/tests/test_analyseur_log_apache.py +++ b/tests/test_analyseur_log_apache.py @@ -3,6 +3,7 @@ """ import pytest +from os.path import abspath from parse.fichier_log_apache import FichierLogApache from analyse.filtre_log_apache import FiltreLogApache from analyse.analyseur_log_apache import AnalyseurLogApache @@ -324,7 +325,7 @@ def test_analyseur_get_analyse_complete_valide(analyseur_log_apache): de la classe :class:`AnalyseurLogApache`. """ analyse = analyseur_log_apache.get_analyse_complete() - assert analyse["chemin"] == analyseur_log_apache.fichier.chemin + assert analyse["chemin"] == abspath(analyseur_log_apache.fichier.chemin) assert analyse["total_entrees"] == analyseur_log_apache.get_total_entrees() assert analyse["filtre"] == analyseur_log_apache.filtre.get_dict_filtre() statistiques = analyse["statistiques"]