test(media_player): entity tier serves below map/manifest per the P5-1 resolution ruling (was map-beats-entity contradiction)
This commit is contained in:
1 parent
cd0e634a76
commit
2e6dfd8981
1 file changed
+6
-3
@@ -600,14 +600,16 @@ class TestAppNameMapResolution:
|
|||||||
|
|
||||||
assert player.app_name == "com.google.android.youtube.tv"
|
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
|
from types import SimpleNamespace as SimpleNS
|
||||||
|
|
||||||
import entity_stublib
|
import entity_stublib
|
||||||
|
|
||||||
modules = entity_stublib.load_entity_modules()
|
modules = entity_stublib.load_entity_modules()
|
||||||
player, _s, _i = _cmd_player(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"
|
player._androidtv_entity = "media_player.atv"
|
||||||
state = SimpleNS(attributes={"app_id": "ar.tvplayer.tv", "app_name": "ATV Tivi"})
|
state = SimpleNS(attributes={"app_id": "ar.tvplayer.tv", "app_name": "ATV Tivi"})
|
||||||
player.hass = SimpleNS(states=SimpleNS(get=lambda eid: state))
|
player.hass = SimpleNS(states=SimpleNS(get=lambda eid: state))
|
||||||
@@ -616,4 +618,5 @@ class TestAppNameMapResolution:
|
|||||||
player._manager._on_current_app("ar.tvplayer.tv")
|
player._manager._on_current_app("ar.tvplayer.tv")
|
||||||
await asyncio.sleep(0.05)
|
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"
|
||||||
Reference in new issue
Block a user