Show provider tags on watchlist

This commit is contained in:
Codex
2026-08-09 14:04:58 +02:00
parent 219ef1e059
commit 4eb5252d3a
6 changed files with 76 additions and 4 deletions
+26
View File
@@ -1620,6 +1620,28 @@ class WatchlistCompletionTests(unittest.TestCase):
self.assertIn("Sub ready.", message)
self.assertNotIn("Dub ready.", message)
def test_watchlist_item_exposes_provider_label_from_added_provider(self):
with mock.patch.object(APP.WATCHLIST, "schedule_refresh", side_effect=lambda show_id, source="manual": APP.WATCHLIST.get(show_id)):
result = APP.WATCHLIST.add(
{
"show_id": "providerless-show",
"provider": "anineko",
"title": "Provider Show",
"category": "watching",
}
)
self.assertEqual(result["item"]["provider"], "anineko")
self.assertEqual(result["item"]["provider_label"], "AniNeko")
def test_watchlist_item_derives_provider_label_from_prefixed_show_id(self):
self.seed_watchlist_item(show_id="pahe:provider-show", title="Provider Show")
item = APP.WATCHLIST.get("pahe:provider-show")
self.assertEqual(item["provider"], "pahe")
self.assertEqual(item["provider_label"], "AnimePahe")
def test_refresh_persists_expected_episode_total_and_ready_flags(self):
self.seed_watchlist_item()
@@ -4062,6 +4084,10 @@ class TemplateHelperTests(unittest.TestCase):
self.assertIn("const isFullyReady = item.sub_complete && item.dub_complete;", APP.WATCHLIST_HTML)
self.assertIn("card.className = watchlistCardClassName(item);", APP.WATCHLIST_HTML)
def test_watchlist_page_renders_provider_source_tag(self):
self.assertIn("function providerLabel(provider)", APP.WATCHLIST_HTML)
self.assertIn('appendStatusTag(statusRow, `Source: ${item.provider_label || providerLabel(item.provider)}`);', APP.WATCHLIST_HTML)
def test_watchlist_page_download_all_replaces_open_action(self):
self.assertIn("Download all", APP.WATCHLIST_HTML)
self.assertIn('api("/api/watchlist/download-all"', APP.WATCHLIST_HTML)