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
+26
View File
@@ -87,6 +87,32 @@ def test_scheduler_routes_expose_status_history_and_disabled_manual_run(schedule
assert manual.status_code == 400
def test_scheduler_samples_all_values_reads_all_retained_samples(scheduler_client):
client, store = scheduler_client
service = store.upsert_service(
{
"service_type": "qbittorrent",
"name": "qbit",
"config": {"base_url": "http://qbit:8080"},
"secrets": {},
"enabled": True,
}
)
retained = [{"ts": 10, "dl_speed": 20, "up_speed": 30}]
with patch("media_library_viewer_api.routers.scheduler.QbittorrentSampleStore") as store_cls:
store_cls.return_value.window.return_value = retained
response = client.get(f"/api/scheduler/services/{service['id']}/samples?all_values=true")
assert response.status_code == 200
assert response.json() == {
"service_id": service["id"],
"window_seconds": None,
"all_values": True,
"samples": retained,
}
store_cls.return_value.window.assert_called_once_with(service["id"])
def test_sample_store_applies_time_and_row_limits(tmp_path):
harness = ServiceDataHarness(tmp_path)
harness.register(QBITTORRENT_CONCERN)