mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Paramaterize test for on/off for Squeezebox (#149048)
This commit is contained in:
parent
a50d926e2a
commit
7dfb54c8e8
@ -145,30 +145,21 @@ async def test_squeezebox_player_rediscovery(
|
|||||||
assert hass.states.get("media_player.test_player").state == MediaPlayerState.IDLE
|
assert hass.states.get("media_player.test_player").state == MediaPlayerState.IDLE
|
||||||
|
|
||||||
|
|
||||||
async def test_squeezebox_turn_on(
|
@pytest.mark.parametrize(
|
||||||
hass: HomeAssistant, configured_player: MagicMock
|
("service", "state"),
|
||||||
|
[(SERVICE_TURN_ON, True), (SERVICE_TURN_OFF, False)],
|
||||||
|
)
|
||||||
|
async def test_squeezebox_turn_on_off(
|
||||||
|
hass: HomeAssistant, configured_player: MagicMock, service: str, state: bool
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test turn on service call."""
|
"""Test turn on service call."""
|
||||||
await hass.services.async_call(
|
await hass.services.async_call(
|
||||||
MEDIA_PLAYER_DOMAIN,
|
MEDIA_PLAYER_DOMAIN,
|
||||||
SERVICE_TURN_ON,
|
service,
|
||||||
{ATTR_ENTITY_ID: "media_player.test_player"},
|
{ATTR_ENTITY_ID: "media_player.test_player"},
|
||||||
blocking=True,
|
blocking=True,
|
||||||
)
|
)
|
||||||
configured_player.async_set_power.assert_called_once_with(True)
|
configured_player.async_set_power.assert_called_once_with(state)
|
||||||
|
|
||||||
|
|
||||||
async def test_squeezebox_turn_off(
|
|
||||||
hass: HomeAssistant, configured_player: MagicMock
|
|
||||||
) -> None:
|
|
||||||
"""Test turn off service call."""
|
|
||||||
await hass.services.async_call(
|
|
||||||
MEDIA_PLAYER_DOMAIN,
|
|
||||||
SERVICE_TURN_OFF,
|
|
||||||
{ATTR_ENTITY_ID: "media_player.test_player"},
|
|
||||||
blocking=True,
|
|
||||||
)
|
|
||||||
configured_player.async_set_power.assert_called_once_with(False)
|
|
||||||
|
|
||||||
|
|
||||||
async def test_squeezebox_state(
|
async def test_squeezebox_state(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user