feat: write snapshots to fixed filename snapshots.html
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -599,7 +599,7 @@ class SnapshotDownloader:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Generate filename
|
# Generate filename
|
||||||
filename = f"snapshots_{date_from}_to_{date_to}.html"
|
filename = "snapshots.html"
|
||||||
filepath = self.output_dir / filename
|
filepath = self.output_dir / filename
|
||||||
|
|
||||||
# Generate HTML content
|
# Generate HTML content
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
import asyncio
|
||||||
import json
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
|
from unittest.mock import patch, AsyncMock
|
||||||
|
|
||||||
from src.snapshot_downloader import SnapshotDownloader
|
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")
|
d.save_last_run_date("2025-06-01")
|
||||||
data = json.loads((tmp_path / "last_run.json").read_text())
|
data = json.loads((tmp_path / "last_run.json").read_text())
|
||||||
assert data == {"last_date_to": "2025-06-01"}
|
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()
|
||||||
|
|||||||
Reference in New Issue
Block a user