Use config entry to setup platforms (#13752)

* Use config entry to setup platforms

* Rename to async_forward_entry

* Add tests

* Catch if platform not exists for entry
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-04-09 10:09:08 -04:00
1 parent cb51553c2d
commit 73de749411
12 files changed
+271 -45

No files matched your search

+5 -2
View File
@@ -9,6 +9,7 @@ from aiohue.lights import Lights
from aiohue.groups import Groups
import pytest
from homeassistant import config_entries
from homeassistant.components import hue
import homeassistant.components.light.hue as hue_light
from homeassistant.util import color
@@ -196,9 +197,11 @@ async def setup_bridge(hass, mock_bridge):
"""Load the Hue light platform with the provided bridge."""
hass.config.components.add(hue.DOMAIN)
hass.data[hue.DOMAIN] = {'mock-host': mock_bridge}
await hass.helpers.discovery.async_load_platform('light', 'hue', {
config_entry = config_entries.ConfigEntry(1, hue.DOMAIN, 'Mock Title', {
'host': 'mock-host'
})
}, 'test')
await hass.config_entries.async_forward_entry(config_entry, 'light')
# To flush out the service call to update the group
await hass.async_block_till_done()