Don't hang forever if manually added cast is down (#21565)

* Don't hang forever if manually added cast is down

* Adapt to pychromecast

* Do not set available until connected

* Update __init__.py

* Update requirements

* Lint, tests

* Fix tests
This commit is contained in:
emontnemery authored and Paulus Schoutsen committed 2019-03-10 19:57:30 -07:00
1 parent fe1840f901
commit fc85b3fc5f
4 files changed
+16 -20

No files matched your search

+4 -7
View File
@@ -222,13 +222,6 @@ async def test_normal_chromecast_not_starting_discovery(hass):
assert setup_discovery.call_count == 1
async def test_normal_raises_platform_not_ready(hass):
"""Test cast platform raises PlatformNotReady if HTTP dial fails."""
with patch('pychromecast.dial.get_device_status', return_value=None):
with pytest.raises(PlatformNotReady):
await async_setup_cast(hass, {'host': 'host1'})
async def test_replay_past_chromecasts(hass):
"""Test cast platform re-playing past chromecasts when adding new one."""
cast_group1 = get_fake_chromecast_info(host='host1', port=42)
@@ -262,6 +255,10 @@ async def test_entity_media_states(hass: HomeAssistantType):
return_value=full_info):
chromecast, entity = await async_setup_media_player_cast(hass, info)
entity._available = True
entity.schedule_update_ha_state()
await hass.async_block_till_done()
state = hass.states.get('media_player.speaker')
assert state is not None
assert state.name == 'Speaker'