Fix Sonos speaker lookup for Plex (#37942)

This commit is contained in:
jjlawren authored and Paulus Schoutsen committed 2020-07-18 23:37:48 +00:00
1 parent 757d05a74e
commit a3429848a2
4 files changed
+19 -17

No files matched your search

+6 -6
View File
@@ -39,7 +39,7 @@ async def test_sonos_playback(hass):
# Test Sonos integration lookup failure
with patch.object(
hass.components.sonos, "get_coordinator_id", side_effect=HomeAssistantError
hass.components.sonos, "get_coordinator_name", side_effect=HomeAssistantError
):
assert await hass.services.async_call(
DOMAIN,
@@ -55,7 +55,7 @@ async def test_sonos_playback(hass):
# Test success with dict
with patch.object(
hass.components.sonos,
"get_coordinator_id",
"get_coordinator_name",
return_value="media_player.sonos_kitchen",
), patch("plexapi.playqueue.PlayQueue.create"):
assert await hass.services.async_call(
@@ -72,7 +72,7 @@ async def test_sonos_playback(hass):
# Test success with plex_key
with patch.object(
hass.components.sonos,
"get_coordinator_id",
"get_coordinator_name",
return_value="media_player.sonos_kitchen",
), patch("plexapi.playqueue.PlayQueue.create"):
assert await hass.services.async_call(
@@ -89,7 +89,7 @@ async def test_sonos_playback(hass):
# Test invalid Plex server requested
with patch.object(
hass.components.sonos,
"get_coordinator_id",
"get_coordinator_name",
return_value="media_player.sonos_kitchen",
):
assert await hass.services.async_call(
@@ -105,10 +105,10 @@ async def test_sonos_playback(hass):
# Test no speakers available
with patch.object(
loaded_server.account, "sonos_speaker_by_id", return_value=None
loaded_server.account, "sonos_speaker", return_value=None
), patch.object(
hass.components.sonos,
"get_coordinator_id",
"get_coordinator_name",
return_value="media_player.sonos_kitchen",
):
assert await hass.services.async_call(