mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
test(mediaserver): cover stale tv item id fallback
This commit is contained in:
@@ -5,12 +5,18 @@ from app.modules.plex.plex import Plex
|
||||
|
||||
|
||||
class PlexImageLookupTest(unittest.TestCase):
|
||||
def test_get_remote_image_by_id_uses_item_arts_for_children_key(self):
|
||||
@staticmethod
|
||||
def _build_plex():
|
||||
"""构造绕过真实连接的Plex实例,便于单测直接注入plexapi mock。"""
|
||||
plex = Plex.__new__(Plex)
|
||||
plex._host = "http://192.168.8.254:32400/"
|
||||
plex._playhost = None
|
||||
plex._token = "plex-token"
|
||||
plex._plex = Mock()
|
||||
return plex
|
||||
|
||||
def test_get_remote_image_by_id_uses_item_arts_for_children_key(self):
|
||||
plex = self._build_plex()
|
||||
plex._plex.fetchItems.side_effect = AssertionError("should not use raw fetchItems with /children key")
|
||||
|
||||
item = Mock()
|
||||
@@ -31,11 +37,7 @@ class PlexImageLookupTest(unittest.TestCase):
|
||||
plex._plex.fetchItem.assert_called_once_with(ekey="/library/metadata/29242/children")
|
||||
|
||||
def test_get_remote_image_by_id_falls_back_to_local_art_url(self):
|
||||
plex = Plex.__new__(Plex)
|
||||
plex._host = "http://192.168.8.254:32400/"
|
||||
plex._playhost = None
|
||||
plex._token = "plex-token"
|
||||
plex._plex = Mock()
|
||||
plex = self._build_plex()
|
||||
|
||||
item = Mock()
|
||||
item.TYPE = "show"
|
||||
|
||||
Reference in New Issue
Block a user