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: _, \\, -, /." ) 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"]