Mark available downloads complete
This commit is contained in:
@@ -228,6 +228,82 @@ class RequestPresentationTests(unittest.TestCase):
|
||||
download_stage = next(stage for stage in presentation["pipeline"] if stage["id"] == "download")
|
||||
self.assertEqual(download_stage["summary"], "No download attempt yet")
|
||||
|
||||
def test_available_content_replaces_stale_download_warning_with_completion(self) -> None:
|
||||
snapshot = Snapshot(
|
||||
request_id="3909",
|
||||
title="Example",
|
||||
request_type=RequestType.tv,
|
||||
state=NormalizedState.completed,
|
||||
actions=[],
|
||||
)
|
||||
|
||||
presentation = _build_presentation(
|
||||
snapshot,
|
||||
approved=True,
|
||||
arr_state="available",
|
||||
arr_details={
|
||||
"availability": {"available": 6, "missing": 0, "total": 6, "seasons": []}
|
||||
},
|
||||
prowlarr_state="ok",
|
||||
download={
|
||||
"visible": True,
|
||||
"state": "missing",
|
||||
"summary": "A previous download was observed, but it is not currently visible in qBittorrent.",
|
||||
"torrents": [],
|
||||
},
|
||||
jellyfin_found=True,
|
||||
jellyfin_link="https://media.test/title/3909",
|
||||
)
|
||||
|
||||
self.assertFalse(presentation["download"]["visible"])
|
||||
self.assertEqual(presentation["download"]["state"], "completed")
|
||||
self.assertEqual(presentation["nextStep"]["title"], "Ready to watch")
|
||||
self.assertEqual(presentation["nextStep"]["actionIds"], [])
|
||||
download_stage = next(stage for stage in presentation["pipeline"] if stage["id"] == "download")
|
||||
self.assertEqual(download_stage["label"], "Download complete")
|
||||
self.assertEqual(download_stage["state"], "complete")
|
||||
self.assertFalse(download_stage["visible"])
|
||||
self.assertEqual(
|
||||
download_stage["summary"],
|
||||
"The requested content has been collected and is available to watch. No further action is needed.",
|
||||
)
|
||||
search_stage = next(stage for stage in presentation["pipeline"] if stage["id"] == "search")
|
||||
self.assertEqual(search_stage["state"], "complete")
|
||||
self.assertEqual(search_stage["actionIds"], [])
|
||||
|
||||
def test_partially_available_content_keeps_missing_download_attention(self) -> None:
|
||||
snapshot = Snapshot(
|
||||
request_id="3909",
|
||||
title="Example",
|
||||
request_type=RequestType.tv,
|
||||
state=NormalizedState.importing,
|
||||
actions=[],
|
||||
)
|
||||
|
||||
presentation = _build_presentation(
|
||||
snapshot,
|
||||
approved=True,
|
||||
arr_state="added",
|
||||
arr_details={
|
||||
"availability": {"available": 3, "missing": 3, "total": 6, "seasons": []}
|
||||
},
|
||||
prowlarr_state="ok",
|
||||
download={
|
||||
"visible": True,
|
||||
"state": "missing",
|
||||
"summary": "A previous download is no longer visible.",
|
||||
"torrents": [],
|
||||
},
|
||||
jellyfin_found=True,
|
||||
jellyfin_link="https://media.test/title/3909",
|
||||
)
|
||||
|
||||
self.assertTrue(presentation["download"]["visible"])
|
||||
download_stage = next(stage for stage in presentation["pipeline"] if stage["id"] == "download")
|
||||
self.assertEqual(download_stage["label"], "Download")
|
||||
self.assertEqual(download_stage["state"], "attention")
|
||||
self.assertTrue(download_stage["visible"])
|
||||
|
||||
|
||||
class LiveDownloadProgressTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_live_download_progress_uses_saved_hash_and_current_qbittorrent_value(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user