1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00
This commit is contained in:
Paulus Schoutsen
2019-07-31 12:25:30 -07:00
parent da05dfe708
commit 4de97abc3a
2676 changed files with 163166 additions and 140084 deletions

View File

@@ -12,21 +12,21 @@ from tests.common import mock_coro, mock_component
@asyncio.coroutine
def test_config_setup(hass, loop):
"""Test it sets up hassbian."""
yield from async_setup_component(hass, 'config', {})
assert 'config' in hass.config.components
yield from async_setup_component(hass, "config", {})
assert "config" in hass.config.components
@asyncio.coroutine
def test_load_on_demand_already_loaded(hass, aiohttp_client):
"""Test getting suites."""
mock_component(hass, 'zwave')
mock_component(hass, "zwave")
with patch.object(config, 'SECTIONS', []), \
patch.object(config, 'ON_DEMAND', ['zwave']), \
patch('homeassistant.components.config.zwave.async_setup') as stp:
with patch.object(config, "SECTIONS", []), patch.object(
config, "ON_DEMAND", ["zwave"]
), patch("homeassistant.components.config.zwave.async_setup") as stp:
stp.return_value = mock_coro(True)
yield from async_setup_component(hass, 'config', {})
yield from async_setup_component(hass, "config", {})
yield from hass.async_block_till_done()
assert stp.called
@@ -35,15 +35,16 @@ def test_load_on_demand_already_loaded(hass, aiohttp_client):
@asyncio.coroutine
def test_load_on_demand_on_load(hass, aiohttp_client):
"""Test getting suites."""
with patch.object(config, 'SECTIONS', []), \
patch.object(config, 'ON_DEMAND', ['zwave']):
yield from async_setup_component(hass, 'config', {})
with patch.object(config, "SECTIONS", []), patch.object(
config, "ON_DEMAND", ["zwave"]
):
yield from async_setup_component(hass, "config", {})
assert 'config.zwave' not in hass.config.components
assert "config.zwave" not in hass.config.components
with patch('homeassistant.components.config.zwave.async_setup') as stp:
with patch("homeassistant.components.config.zwave.async_setup") as stp:
stp.return_value = mock_coro(True)
hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: 'zwave'})
hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: "zwave"})
yield from hass.async_block_till_done()
assert stp.called