mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 22:10:09 +00:00
Do async_setup_platform in background (#36244)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
@@ -39,6 +39,7 @@ async def test_apply_service(hass):
|
||||
"""Test the apply service."""
|
||||
assert await async_setup_component(hass, "scene", {})
|
||||
assert await async_setup_component(hass, "light", {"light": {"platform": "demo"}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert await hass.services.async_call(
|
||||
"scene", "apply", {"entities": {"light.bed_light": "off"}}, blocking=True
|
||||
@@ -83,6 +84,7 @@ async def test_create_service(hass, caplog):
|
||||
"scene",
|
||||
{"scene": {"name": "hallo_2", "entities": {"light.kitchen": "on"}}},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert hass.states.get("scene.hallo") is None
|
||||
assert hass.states.get("scene.hallo_2") is not None
|
||||
|
||||
@@ -155,6 +157,7 @@ async def test_create_service(hass, caplog):
|
||||
async def test_snapshot_service(hass, caplog):
|
||||
"""Test the snapshot option."""
|
||||
assert await async_setup_component(hass, "scene", {"scene": {}})
|
||||
await hass.async_block_till_done()
|
||||
hass.states.async_set("light.my_light", "on", {"hs_color": (345, 75)})
|
||||
assert hass.states.get("scene.hallo") is None
|
||||
|
||||
@@ -212,6 +215,7 @@ async def test_snapshot_service(hass, caplog):
|
||||
async def test_ensure_no_intersection(hass):
|
||||
"""Test that entities and snapshot_entities do not overlap."""
|
||||
assert await async_setup_component(hass, "scene", {"scene": {}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
with pytest.raises(vol.MultipleInvalid) as ex:
|
||||
assert await hass.services.async_call(
|
||||
@@ -245,6 +249,7 @@ async def test_scenes_with_entity(hass):
|
||||
]
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert sorted(ha_scene.scenes_with_entity(hass, "light.kitchen")) == [
|
||||
"scene.scene_1",
|
||||
@@ -268,6 +273,7 @@ async def test_entities_in_scene(hass):
|
||||
]
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
for scene_id, entities in (
|
||||
("scene.scene_1", ["light.kitchen"]),
|
||||
@@ -297,6 +303,7 @@ async def test_config(hass):
|
||||
]
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
icon = hass.states.get("scene.scene_icon")
|
||||
assert icon is not None
|
||||
|
||||
Reference in New Issue
Block a user