feat: write snapshots to fixed filename snapshots.html

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tudor Sitaru
2026-05-16 20:17:30 +01:00
parent b13f38c821
commit 68d5996165
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -599,7 +599,7 @@ class SnapshotDownloader:
)
# Generate filename
filename = f"snapshots_{date_from}_to_{date_to}.html"
filename = "snapshots.html"
filepath = self.output_dir / filename
# Generate HTML content
+12
View File
@@ -1,5 +1,7 @@
import asyncio
import json
import pytest
from unittest.mock import patch, AsyncMock
from src.snapshot_downloader import SnapshotDownloader
@@ -74,3 +76,13 @@ def test_save_last_run_date_writes_json(tmp_path):
d.save_last_run_date("2025-06-01")
data = json.loads((tmp_path / "last_run.json").read_text())
assert data == {"last_date_to": "2025-06-01"}
# --- generate_html_file fixed filename ---
def test_generate_html_file_uses_fixed_filename(tmp_path):
d = _downloader(tmp_path)
with patch.object(d, "generate_html_template", new_callable=AsyncMock, return_value="<html></html>"):
result = asyncio.run(d.generate_html_file([], "2024-01-01", "2025-01-01"))
assert result.name == "snapshots.html"
assert (tmp_path / "snapshots.html").exists()