Keep removed watchlist shows from reappearing
This commit is contained in:
+61
-1
@@ -346,6 +346,29 @@ class QueueApiTests(unittest.TestCase):
|
||||
self.assertEqual(retried["status"], "pending")
|
||||
self.assertFalse(retried["cancel_requested"])
|
||||
|
||||
def test_detach_show_clears_queue_coverage_and_sync_binding(self):
|
||||
created = self.queue.add(
|
||||
{
|
||||
"show_id": "show-42",
|
||||
"query": "Queued Show",
|
||||
"title": "Queued Show",
|
||||
"anime_name": "Queued Show",
|
||||
"mode": "dub",
|
||||
"quality": "best",
|
||||
"episodes": "1-3",
|
||||
"download_dir": "/tmp/example",
|
||||
"season": "1",
|
||||
}
|
||||
)
|
||||
|
||||
result = self.queue.detach_show("show-42")
|
||||
detached = self.queue.get(created["id"])
|
||||
|
||||
self.assertEqual(result["count"], 1)
|
||||
self.assertEqual(detached["show_id"], "")
|
||||
self.assertTrue(detached["skip_watchlist_sync"])
|
||||
self.assertEqual(self.queue.covered_episodes("show-42", "dub", ["1", "2", "3"]), set())
|
||||
|
||||
def test_save_job_splits_log_and_extra_payload_columns(self):
|
||||
queue = APP.DownloadQueue(lambda: {"mode": "sub", "quality": "best", "download_dir": "/tmp/example"}, start_worker=False)
|
||||
job = {
|
||||
@@ -1210,6 +1233,19 @@ class WatchlistCompletionTests(unittest.TestCase):
|
||||
self.assertEqual(item["finished_badge"], "downloaded")
|
||||
self.assertEqual(item["status"], "queued")
|
||||
|
||||
def test_mark_downloaded_does_not_recreate_removed_show(self):
|
||||
self.seed_watchlist_item(show_id="show-removed", title="Removed Show", category="watching")
|
||||
|
||||
APP.WATCHLIST.remove("show-removed")
|
||||
|
||||
with mock.patch.object(APP.WATCHLIST, "schedule_refresh", side_effect=AssertionError("removed show should not be requeued")), mock.patch.object(
|
||||
APP.WATCHLIST, "refresh", side_effect=AssertionError("mark_downloaded should not refresh synchronously")
|
||||
):
|
||||
item = APP.WATCHLIST.mark_downloaded("show-removed", title="Removed Show", mode="sub", episodes="1")
|
||||
|
||||
self.assertIsNone(item)
|
||||
self.assertFalse(APP.WATCHLIST.has_show("show-removed"))
|
||||
|
||||
def test_mark_downloaded_reconciles_unique_title_match_to_new_show_id(self):
|
||||
self.seed_watchlist_item(
|
||||
show_id="legacy-show-9",
|
||||
@@ -1390,6 +1426,7 @@ class WatchlistCompletionTests(unittest.TestCase):
|
||||
"title": "Queue Show",
|
||||
"auto_download_name": "Queue Show Library",
|
||||
"auto_download_series": "4",
|
||||
"auto_download_quality": "720",
|
||||
"media_type": "movie",
|
||||
}
|
||||
job = {"id": "job-1", "show_id": "show-42", "episodes": "1-12", "mode": "dub"}
|
||||
@@ -1410,7 +1447,7 @@ class WatchlistCompletionTests(unittest.TestCase):
|
||||
"season": "4",
|
||||
"episode_offset": None,
|
||||
"mode": "dub",
|
||||
"quality": "best",
|
||||
"quality": "720",
|
||||
"episodes": "1-12",
|
||||
"download_dir": "/tmp/downloads",
|
||||
}
|
||||
@@ -1418,6 +1455,29 @@ class WatchlistCompletionTests(unittest.TestCase):
|
||||
self.assertEqual(result["job"], job)
|
||||
self.assertIn("Queued Queue Show for dub download.", result["message"])
|
||||
|
||||
def test_remove_from_watchlist_detaches_existing_queue_jobs(self):
|
||||
runtime = APP.ensure_runtime()
|
||||
APP.WATCHLIST.add({"show_id": "show-queue-remove", "title": "Queue Remove Show"})
|
||||
created = runtime["download_queue"].add(
|
||||
{
|
||||
"show_id": "show-queue-remove",
|
||||
"query": "Queue Remove Show",
|
||||
"title": "Queue Remove Show",
|
||||
"anime_name": "Queue Remove Show",
|
||||
"mode": "sub",
|
||||
"quality": "best",
|
||||
"episodes": "1-2",
|
||||
"download_dir": "/tmp/example",
|
||||
"season": "1",
|
||||
}
|
||||
)
|
||||
|
||||
APP.remove_from_watchlist("show-queue-remove")
|
||||
|
||||
detached = runtime["download_queue"].get(created["id"])
|
||||
self.assertEqual(detached["show_id"], "")
|
||||
self.assertTrue(detached["skip_watchlist_sync"])
|
||||
|
||||
def test_download_watchlist_item_does_not_require_search_match(self):
|
||||
item = {
|
||||
"show_id": "show-42",
|
||||
|
||||
Reference in New Issue
Block a user