1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add config entry for Sonos + Cast (#14955)

* Add config entry for Sonos

* Lint

* Use add_job

* Add Cast config entry

* Lint

* Rename DOMAIN import

* Mock pychromecast in test
This commit is contained in:
Paulus Schoutsen
2018-06-14 15:17:54 -04:00
committed by GitHub
parent c8e0de19b6
commit 2c6e6c2a6f
20 changed files with 432 additions and 10 deletions

View File

@@ -0,0 +1,22 @@
"""Tests for the Cast config flow."""
from unittest.mock import patch
from homeassistant import data_entry_flow
from homeassistant.components import cast
from tests.common import MockDependency, mock_coro
async def test_creating_entry_sets_up_media_player(hass):
"""Test setting up Cast loads the media player."""
with patch('homeassistant.components.media_player.cast.async_setup_entry',
return_value=mock_coro(True)) as mock_setup, \
MockDependency('pychromecast', 'discovery'), \
patch('pychromecast.discovery.discover_chromecasts',
return_value=True):
result = await hass.config_entries.flow.async_init(cast.DOMAIN)
assert result['type'] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
await hass.async_block_till_done()
assert len(mock_setup.mock_calls) == 1