From 2e6dfd89813932d67705caa8457fc07e89b26ee9 Mon Sep 17 00:00:00 2001 From: James Mackay Date: Fri, 9 Oct 2026 05:49:18 +0100 Subject: [PATCH] test(media_player): entity tier serves below map/manifest per the P5-1 resolution ruling (was map-beats-entity contradiction) --- tests/test_standalone_setup.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_standalone_setup.py b/tests/test_standalone_setup.py index fba19e5..cb5aa95 100644 --- a/tests/test_standalone_setup.py +++ b/tests/test_standalone_setup.py @@ -600,14 +600,16 @@ class TestAppNameMapResolution: assert player.app_name == "com.google.android.youtube.tv" - async def test_entity_tier_still_wins(self): + async def test_entity_tier_serves_when_no_higher_tier_matches(self): + """P5-1: the entity tier is below map/manifest — it serves when the + package has no explicit override and no manifest label yet.""" from types import SimpleNamespace as SimpleNS import entity_stublib modules = entity_stublib.load_entity_modules() player, _s, _i = _cmd_player(modules) - player._entry.options["app_name_map"] = {"ar.tvplayer.tv": "TiviMate"} + player._entry.options["app_name_map"] = {} # no override player._androidtv_entity = "media_player.atv" state = SimpleNS(attributes={"app_id": "ar.tvplayer.tv", "app_name": "ATV Tivi"}) player.hass = SimpleNS(states=SimpleNS(get=lambda eid: state)) @@ -616,4 +618,5 @@ class TestAppNameMapResolution: player._manager._on_current_app("ar.tvplayer.tv") await asyncio.sleep(0.05) - assert player.app_name == "ATV Tivi" # entity tier, map untouched + # no cached label yet → falls through to the entity tier + assert player.app_name == "ATV Tivi"