diff --git a/geotribu_cli/content/header_check.py b/geotribu_cli/content/header_check.py index dac8d4b..fbf3d41 100644 --- a/geotribu_cli/content/header_check.py +++ b/geotribu_cli/content/header_check.py @@ -3,8 +3,6 @@ import os import shutil import uuid -from datetime import datetime -from typing import Any import requests import yaml @@ -13,7 +11,6 @@ from geotribu_cli.__about__ import __executable_name__, __version__ from geotribu_cli.constants import GeotribuDefaults from geotribu_cli.content.json_feed import JsonFeedClient -from geotribu_cli.utils.dates_manipulation import is_more_recent logger = logging.getLogger(__name__) defaults_settings = GeotribuDefaults() @@ -83,15 +80,6 @@ def parser_header_check( # ################################ -def check_publish_date(date: Any) -> bool: - if isinstance(date, str): - publish_date = datetime.strptime(date.split(" ")[0], "%Y-%m-%d").date() - else: - publish_date = date - # TODO: check if date is another type and raise error - return is_more_recent(datetime.now().date(), publish_date) - - def check_image_ratio(image_url: str, min_ratio: float, max_ratio: float) -> bool: r = requests.get( image_url, @@ -162,15 +150,6 @@ def run(args: argparse.Namespace) -> None: yaml_meta = yaml.safe_load(front_matter) logger.debug(f"YAML metadata loaded : {yaml_meta}") - # check that datetime is in the future - if not check_publish_date(yaml_meta["date"]): - msg = "La date de publication n'est pas dans le turfu !" - logger.error(msg) - if args.raise_exceptions: - raise ValueError(msg) - else: - logger.info("Date de publication ok") - # check that image ratio is okayyy if "image" in yaml_meta: if not check_image_ratio( diff --git a/tests/test_yaml_header_check.py b/tests/test_yaml_header_check.py index 655524c..bdd452c 100644 --- a/tests/test_yaml_header_check.py +++ b/tests/test_yaml_header_check.py @@ -6,7 +6,6 @@ from geotribu_cli.content.header_check import ( check_existing_tags, check_mandatory_keys, - check_publish_date, check_tags_order, ) @@ -23,12 +22,6 @@ def setUp(self): _, front_matter, _ = future_content.split("---", 2) self.future_yaml_meta = yaml.safe_load(front_matter) - def test_past_publish_date(self): - self.assertFalse(check_publish_date(self.past_yaml_meta["date"])) - - def test_future_publish_date(self): - self.assertTrue(check_publish_date(self.future_yaml_meta["date"])) - @patch("geotribu_cli.content.header_check.get_existing_tags") def test_past_tags_existence(self, get_existing_tags_mock): get_existing_tags_mock.return_value = ["QGIS", "OSM"]