Bump pyheos to 0.4.1 (#23360)

* Bump pyheos==0.4.1

* Refresh player after reconnection
This commit is contained in:
Andrew Sayre authored and Paulus Schoutsen committed 2019-04-24 21:31:31 -07:00
1 parent 6fb5b8467b
commit e3e7fb5ff6
5 files changed
+41 -6

No files matched your search

+29 -2
View File
@@ -109,13 +109,40 @@ async def test_updates_start_from_signals(
state = hass.states.get('media_player.test_player')
assert state.state == STATE_UNAVAILABLE
# Test heos events update
async def test_updates_from_connection_event(
hass, config_entry, config, controller, input_sources, caplog):
"""Tests player updates from connection event after connection failure."""
# Connected
await setup_platform(hass, config_entry, config)
player = controller.players[1]
player.available = True
player.heos.dispatcher.send(
const.SIGNAL_HEOS_EVENT, const.EVENT_CONNECTED)
await hass.async_block_till_done()
state = hass.states.get('media_player.test_player')
assert state.state == STATE_PLAYING
assert state.state == STATE_IDLE
assert player.refresh.call_count == 1
# Connected handles refresh failure
player.reset_mock()
player.refresh.side_effect = CommandError(None, "Failure", 1)
player.heos.dispatcher.send(
const.SIGNAL_HEOS_EVENT, const.EVENT_CONNECTED)
await hass.async_block_till_done()
state = hass.states.get('media_player.test_player')
assert player.refresh.call_count == 1
assert "Unable to refresh player" in caplog.text
# Disconnected
player.reset_mock()
player.available = False
player.heos.dispatcher.send(
const.SIGNAL_HEOS_EVENT, const.EVENT_DISCONNECTED)
await hass.async_block_till_done()
state = hass.states.get('media_player.test_player')
assert state.state == STATE_UNAVAILABLE
assert player.refresh.call_count == 0
async def test_updates_from_sources_updated(