Move imports to top for soundtouch (#29546)

* Move imports to top for soundtouch

* Format with black

* Fix pyling error by renaming variable

* Rename entity instances to include entity instead of device
This commit is contained in:
springstan 2019-12-06 21:11:02 +01:00 committed by Martin Hjelmare
parent 6af30bc232
commit 74d86dfff9
2 changed files with 116 additions and 35 deletions

View File

@ -2,6 +2,7 @@
import logging import logging
import re import re
from libsoundtouch import soundtouch_device
import voluptuous as vol import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerDevice
@ -100,9 +101,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
return return
remote_config = {"id": "ha.component.soundtouch", "host": host, "port": port} remote_config = {"id": "ha.component.soundtouch", "host": host, "port": port}
soundtouch_device = SoundTouchDevice(None, remote_config) bose_soundtouch_entity = SoundTouchDevice(None, remote_config)
hass.data[DATA_SOUNDTOUCH].append(soundtouch_device) hass.data[DATA_SOUNDTOUCH].append(bose_soundtouch_entity)
add_entities([soundtouch_device]) add_entities([bose_soundtouch_entity])
else: else:
name = config.get(CONF_NAME) name = config.get(CONF_NAME)
remote_config = { remote_config = {
@ -110,9 +111,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
"port": config.get(CONF_PORT), "port": config.get(CONF_PORT),
"host": config.get(CONF_HOST), "host": config.get(CONF_HOST),
} }
soundtouch_device = SoundTouchDevice(name, remote_config) bose_soundtouch_entity = SoundTouchDevice(name, remote_config)
hass.data[DATA_SOUNDTOUCH].append(soundtouch_device) hass.data[DATA_SOUNDTOUCH].append(bose_soundtouch_entity)
add_entities([soundtouch_device]) add_entities([bose_soundtouch_entity])
def service_handle(service): def service_handle(service):
"""Handle the applying of a service.""" """Handle the applying of a service."""
@ -184,7 +185,6 @@ class SoundTouchDevice(MediaPlayerDevice):
def __init__(self, name, config): def __init__(self, name, config):
"""Create Soundtouch Entity.""" """Create Soundtouch Entity."""
from libsoundtouch import soundtouch_device
self._device = soundtouch_device(config["host"], config["port"]) self._device = soundtouch_device(config["host"], config["port"])
if name is None: if name is None:

View File

@ -148,7 +148,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
logging.disable(logging.NOTSET) logging.disable(logging.NOTSET)
self.hass.stop() self.hass.stop()
@mock.patch("libsoundtouch.soundtouch_device", side_effect=None) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=None,
)
def test_ensure_setup_config(self, mocked_soundtouch_device): def test_ensure_setup_config(self, mocked_soundtouch_device):
"""Test setup OK with custom config.""" """Test setup OK with custom config."""
soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock()) soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock())
@ -158,7 +161,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
assert all_devices[0].config["port"] == 8090 assert all_devices[0].config["port"] == 8090
assert mocked_soundtouch_device.call_count == 1 assert mocked_soundtouch_device.call_count == 1
@mock.patch("libsoundtouch.soundtouch_device", side_effect=None) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=None,
)
def test_ensure_setup_discovery(self, mocked_soundtouch_device): def test_ensure_setup_discovery(self, mocked_soundtouch_device):
"""Test setup with discovery.""" """Test setup with discovery."""
new_device = { new_device = {
@ -174,7 +180,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
assert all_devices[0].config["host"] == "192.168.1.1" assert all_devices[0].config["host"] == "192.168.1.1"
assert mocked_soundtouch_device.call_count == 1 assert mocked_soundtouch_device.call_count == 1
@mock.patch("libsoundtouch.soundtouch_device", side_effect=None) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=None,
)
def test_ensure_setup_discovery_no_duplicate(self, mocked_soundtouch_device): def test_ensure_setup_discovery_no_duplicate(self, mocked_soundtouch_device):
"""Test setup OK if device already exists.""" """Test setup OK if device already exists."""
soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock()) soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock())
@ -203,7 +212,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_update(self, mocked_soundtouch_device, mocked_status, mocked_volume): def test_update(self, mocked_soundtouch_device, mocked_status, mocked_volume):
"""Test update device state.""" """Test update device state."""
soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock()) soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock())
@ -218,7 +230,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch( @mock.patch(
"libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusPlaying "libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusPlaying
) )
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_playing_media( def test_playing_media(
self, mocked_soundtouch_device, mocked_status, mocked_volume self, mocked_soundtouch_device, mocked_status, mocked_volume
): ):
@ -240,7 +255,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch( @mock.patch(
"libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusUnknown "libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusUnknown
) )
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_playing_unknown_media( def test_playing_unknown_media(
self, mocked_soundtouch_device, mocked_status, mocked_volume self, mocked_soundtouch_device, mocked_status, mocked_volume
): ):
@ -257,7 +275,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
"libsoundtouch.device.SoundTouchDevice.status", "libsoundtouch.device.SoundTouchDevice.status",
side_effect=MockStatusPlayingRadio, side_effect=MockStatusPlayingRadio,
) )
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_playing_radio( def test_playing_radio(
self, mocked_soundtouch_device, mocked_status, mocked_volume self, mocked_soundtouch_device, mocked_status, mocked_volume
): ):
@ -277,7 +298,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume", side_effect=MockVolume) @mock.patch("libsoundtouch.device.SoundTouchDevice.volume", side_effect=MockVolume)
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_get_volume_level( def test_get_volume_level(
self, mocked_soundtouch_device, mocked_status, mocked_volume self, mocked_soundtouch_device, mocked_status, mocked_volume
): ):
@ -293,7 +317,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch( @mock.patch(
"libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusStandby "libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusStandby
) )
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_get_state_off( def test_get_state_off(
self, mocked_soundtouch_device, mocked_status, mocked_volume self, mocked_soundtouch_device, mocked_status, mocked_volume
): ):
@ -309,7 +336,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch( @mock.patch(
"libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusPause "libsoundtouch.device.SoundTouchDevice.status", side_effect=MockStatusPause
) )
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_get_state_pause( def test_get_state_pause(
self, mocked_soundtouch_device, mocked_status, mocked_volume self, mocked_soundtouch_device, mocked_status, mocked_volume
): ):
@ -325,7 +355,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
"libsoundtouch.device.SoundTouchDevice.volume", side_effect=MockVolumeMuted "libsoundtouch.device.SoundTouchDevice.volume", side_effect=MockVolumeMuted
) )
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_is_muted(self, mocked_soundtouch_device, mocked_status, mocked_volume): def test_is_muted(self, mocked_soundtouch_device, mocked_status, mocked_volume):
"""Test device volume is muted.""" """Test device volume is muted."""
soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock()) soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock())
@ -335,7 +368,7 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH] all_devices = self.hass.data[soundtouch.DATA_SOUNDTOUCH]
assert all_devices[0].is_volume_muted is True assert all_devices[0].is_volume_muted is True
@mock.patch("libsoundtouch.soundtouch_device") @mock.patch("homeassistant.components.soundtouch.media_player.soundtouch_device")
def test_media_commands(self, mocked_soundtouch_device): def test_media_commands(self, mocked_soundtouch_device):
"""Test supported media commands.""" """Test supported media commands."""
soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock()) soundtouch.setup_platform(self.hass, default_component(), mock.MagicMock())
@ -346,7 +379,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.power_off") @mock.patch("libsoundtouch.device.SoundTouchDevice.power_off")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_should_turn_off( def test_should_turn_off(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_power_off self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_power_off
): ):
@ -362,7 +398,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.power_on") @mock.patch("libsoundtouch.device.SoundTouchDevice.power_on")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_should_turn_on( def test_should_turn_on(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_power_on self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_power_on
): ):
@ -378,7 +417,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume_up") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume_up")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_volume_up( def test_volume_up(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_volume_up self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_volume_up
): ):
@ -394,7 +436,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume_down") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume_down")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_volume_down( def test_volume_down(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_volume_down self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_volume_down
): ):
@ -410,7 +455,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.set_volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.set_volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_set_volume_level( def test_set_volume_level(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_set_volume self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_set_volume
): ):
@ -426,7 +474,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.mute") @mock.patch("libsoundtouch.device.SoundTouchDevice.mute")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_mute( def test_mute(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_mute self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_mute
): ):
@ -442,7 +493,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.play") @mock.patch("libsoundtouch.device.SoundTouchDevice.play")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_play( def test_play(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_play self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_play
): ):
@ -458,7 +512,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.pause") @mock.patch("libsoundtouch.device.SoundTouchDevice.pause")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_pause( def test_pause(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_pause self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_pause
): ):
@ -474,7 +531,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.play_pause") @mock.patch("libsoundtouch.device.SoundTouchDevice.play_pause")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_play_pause_play( def test_play_pause_play(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_play_pause self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_play_pause
): ):
@ -491,7 +551,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.next_track") @mock.patch("libsoundtouch.device.SoundTouchDevice.next_track")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_next_previous_track( def test_next_previous_track(
self, self,
mocked_soundtouch_device, mocked_soundtouch_device,
@ -519,7 +582,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
) )
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_play_media( def test_play_media(
self, self,
mocked_soundtouch_device, mocked_soundtouch_device,
@ -544,7 +610,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.play_url") @mock.patch("libsoundtouch.device.SoundTouchDevice.play_url")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_play_media_url( def test_play_media_url(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_play_url self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_play_url
): ):
@ -560,7 +629,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.create_zone") @mock.patch("libsoundtouch.device.SoundTouchDevice.create_zone")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_play_everywhere( def test_play_everywhere(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_create_zone self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_create_zone
): ):
@ -605,7 +677,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.create_zone") @mock.patch("libsoundtouch.device.SoundTouchDevice.create_zone")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_create_zone( def test_create_zone(
self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_create_zone self, mocked_soundtouch_device, mocked_status, mocked_volume, mocked_create_zone
): ):
@ -649,7 +724,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.remove_zone_slave") @mock.patch("libsoundtouch.device.SoundTouchDevice.remove_zone_slave")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_remove_zone_slave( def test_remove_zone_slave(
self, self,
mocked_soundtouch_device, mocked_soundtouch_device,
@ -697,7 +775,10 @@ class TestSoundtouchMediaPlayer(unittest.TestCase):
@mock.patch("libsoundtouch.device.SoundTouchDevice.add_zone_slave") @mock.patch("libsoundtouch.device.SoundTouchDevice.add_zone_slave")
@mock.patch("libsoundtouch.device.SoundTouchDevice.volume") @mock.patch("libsoundtouch.device.SoundTouchDevice.volume")
@mock.patch("libsoundtouch.device.SoundTouchDevice.status") @mock.patch("libsoundtouch.device.SoundTouchDevice.status")
@mock.patch("libsoundtouch.soundtouch_device", side_effect=_mock_soundtouch_device) @mock.patch(
"homeassistant.components.soundtouch.media_player.soundtouch_device",
side_effect=_mock_soundtouch_device,
)
def test_add_zone_slave( def test_add_zone_slave(
self, self,
mocked_soundtouch_device, mocked_soundtouch_device,