feat(charting): unify configurable time windows

This commit is contained in:
Developer
2026-07-15 15:21:57 +00:00
parent 3871f24724
commit d76ea49777
23 changed files with 1398 additions and 1146 deletions
+15
View File
@@ -1224,6 +1224,21 @@ async def test_qbittorrent_speed_reads_samples_without_polling(tmp_path):
assert dl_points[-1]["v"] == 500000
@pytest.mark.asyncio
async def test_qbittorrent_speed_all_values_reads_all_retained_samples():
"""The all-values speed setting intentionally omits the time cutoff."""
from media_library_viewer_api.widgets.sources import QbittorrentWidgetSource
adapter = QbittorrentWidgetSource()
service = ServiceRecord(id="svc-speed", service_type="qbittorrent", name="qbit", config={}, secrets={})
with patch("media_library_viewer_api.widgets.sources.QbittorrentSampleStore") as store_cls:
store_cls.return_value.window.return_value = [{"ts": 10, "dl_speed": 20, "up_speed": 30}]
result = await adapter.fetch(service, "speed", {"window_seconds": "all"})
store_cls.return_value.window.assert_called_once_with("svc-speed")
assert result["series"][0]["points"] == [{"t": 10_000, "v": 20}]
@pytest.mark.asyncio
async def test_qbittorrent_adapter_missing_service():
from media_library_viewer_api.widgets.sources import QbittorrentWidgetSource