Test Jellyfin item query compatibility path

This commit is contained in:
Sleeps
2026-10-06 15:59:12 +01:00
parent 35ea0e710e
commit 859983e3c1
+29
View File
@@ -17,6 +17,35 @@ from scene_search.jellyfin import (
class JellyfinIntegrationTests(unittest.TestCase):
def test_item_detail_uses_items_query_not_direct_item_route(self) -> None:
client = JellyfinClient("http://jellyfin.test", "token")
response = Mock()
response.ok = True
response.json.return_value = {
"Items": [
{
"Id": "item-1",
"Name": "Example",
"Tags": ["Tag"],
"MediaSources": [],
"Trickplay": {},
"Etag": "etag-1",
}
]
}
client._get = Mock(return_value=response)
result = client.item("item-1")
self.assertEqual(result["Id"], "item-1")
call = client._get.call_args
self.assertEqual(call.args[0], "/Items")
self.assertEqual(call.kwargs["params"]["Ids"], "item-1")
self.assertIn("Tags", call.kwargs["params"]["Fields"])
self.assertIn("MediaSources", call.kwargs["params"]["Fields"])
self.assertIn("Trickplay", call.kwargs["params"]["Fields"])
self.assertIn("Etag", call.kwargs["params"]["Fields"])
def test_select_trickplay_prefers_nearest_width(self) -> None:
item = {
"Trickplay": {