Bump pyheos to 0.4.1 (#23360)
* Bump pyheos==0.4.1 * Refresh player after reconnection
This commit is contained in:
1 parent
3bfb5b119a
commit
dd1e352d1d
5 files changed
+41
-6
No files matched your search
@@ -108,13 +108,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(
|
||||
|
||||
Reference in new issue
Block a user