1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Add media_player.repeat_set service (#41435)

This commit is contained in:
Anders Melchiorsen
2020-10-12 23:29:28 +02:00
committed by GitHub
parent a6393fb36c
commit d00655810f
6 changed files with 78 additions and 0 deletions

View File

@@ -60,6 +60,27 @@ async def test_source_select(hass):
assert state.attributes.get(mp.ATTR_INPUT_SOURCE) == "xbox"
async def test_repeat_set(hass):
"""Test the repeat set service."""
entity_id = "media_player.walkman"
assert await async_setup_component(
hass, mp.DOMAIN, {"media_player": {"platform": "demo"}}
)
await hass.async_block_till_done()
state = hass.states.get(entity_id)
assert state.attributes.get(mp.ATTR_MEDIA_REPEAT) == mp.const.REPEAT_MODE_OFF
await hass.services.async_call(
mp.DOMAIN,
mp.SERVICE_REPEAT_SET,
{ATTR_ENTITY_ID: entity_id, mp.ATTR_MEDIA_REPEAT: mp.const.REPEAT_MODE_ALL},
blocking=True,
)
state = hass.states.get(entity_id)
assert state.attributes.get(mp.ATTR_MEDIA_REPEAT) == mp.const.REPEAT_MODE_ALL
async def test_clear_playlist(hass):
"""Test clear playlist."""
assert await async_setup_component(