Shuffle support in Sonos (#10875)
* initial commit of shuffle option for sonos * added test * Small adjustments to adhere to review requests * Removed unnessesary setting of variable. Use shuffle state from soco instead
This commit is contained in:
1 parent
3c1f8cd882
commit
929d49ed6f
2 files changed
+34
-4
No files matched your search
@@ -281,6 +281,20 @@ class TestSonosMediaPlayer(unittest.TestCase):
|
||||
self.assertEqual(unjoinMock.call_count, 1)
|
||||
self.assertEqual(unjoinMock.call_args, mock.call())
|
||||
|
||||
@mock.patch('soco.SoCo', new=SoCoMock)
|
||||
@mock.patch('socket.create_connection', side_effect=socket.error())
|
||||
def test_set_shuffle(self, shuffle_set_mock, *args):
|
||||
"""Ensuring soco methods called for sonos_snapshot service."""
|
||||
sonos.setup_platform(self.hass, {}, fake_add_device, {
|
||||
'host': '192.0.2.1'
|
||||
})
|
||||
device = self.hass.data[sonos.DATA_SONOS][-1]
|
||||
device.hass = self.hass
|
||||
|
||||
device.set_shuffle(True)
|
||||
self.assertEqual(shuffle_set_mock.call_count, 1)
|
||||
self.assertEqual(device._player.play_mode, 'SHUFFLE')
|
||||
|
||||
@mock.patch('soco.SoCo', new=SoCoMock)
|
||||
@mock.patch('socket.create_connection', side_effect=socket.error())
|
||||
@mock.patch.object(SoCoMock, 'set_sleep_timer')
|
||||
|
||||
Reference in new issue
Block a user