fix: show active qBittorrent transfers

This commit is contained in:
Developer
2026-07-14 16:07:04 +00:00
parent 70511d97f9
commit a541a4fd16
11 changed files with 376 additions and 187 deletions
+21 -2
View File
@@ -1086,6 +1086,22 @@ def _fake_qbit_maindata():
"dlspeed": 0,
"upspeed": 0,
},
"h5": {
"name": "Forced download",
"state": "forcedDL",
"size": 5000,
"progress": 0.4,
"dlspeed": 0,
"upspeed": 0,
},
"h6": {
"name": "Stalled upload",
"state": "stalledUP",
"size": 6000,
"progress": 1.0,
"dlspeed": 0,
"upspeed": 0,
},
},
}
@@ -1107,11 +1123,12 @@ async def test_qbittorrent_totals_counts_all_torrents():
mock_client.return_value.maindata.return_value = _fake_qbit_maindata()
result = await adapter.fetch(service, "totals", {})
assert result["total"] == 4
assert result["total"] == 6
assert result["by_state"]["downloading"] == 1
assert result["by_state"]["uploading"] == 1
assert result["by_state"]["queuedDL"] == 1
assert result["by_state"]["pausedDL"] == 1
assert result["by_direction"] == {"downloading": 2, "uploading": 2}
@pytest.mark.asyncio
@@ -1132,10 +1149,12 @@ async def test_qbittorrent_active_filters_dl_ul_only():
result = await adapter.fetch(service, "active", {})
active = result["torrents"]
assert len(active) == 2
assert len(active) == 4
names = [t["name"] for t in active]
assert "Movie.mkv" in names
assert "Show.mkv" in names
assert "Forced download" in names
assert "Stalled upload" in names
# Queued and paused are excluded
assert "Queued" not in names
assert "Paused" not in names