Implementing htaccess generation

This commit is contained in:
Massimo Gismondi 2025-01-07 11:02:29 +01:00
parent b7f908e305
commit 933aa6159d
4 changed files with 34 additions and 2 deletions

View file

@ -6,7 +6,7 @@ cd to the `code` directory and run `pytest`
import json
from pathlib import Path
from robots import json_to_txt, json_to_table
from robots import json_to_txt, json_to_table, json_to_htaccess
def test_robots_txt_creation():
@ -19,3 +19,9 @@ def test_table_of_bot_metrices_md():
robots_json = json.loads(Path("test_files/robots.json").read_text())
robots_table = json_to_table(robots_json)
assert Path("test_files/table-of-bot-metrics.md").read_text() == robots_table
def test_htaccess_creation():
robots_json = json.loads(Path("test_files/robots.json").read_text())
robots_htaccess = json_to_htaccess(robots_json)
assert Path("test_files/.htaccess").read_text() == robots_htaccess