mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Migrate group tests from coroutine to async/await (#30389)
This commit is contained in:
parent
332cbbd8b1
commit
1e3822bdd7
@ -1,6 +1,5 @@
|
|||||||
"""The tests for the Group components."""
|
"""The tests for the Group components."""
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
import asyncio
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
import unittest
|
import unittest
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
@ -481,25 +480,23 @@ class TestComponentsGroup(unittest.TestCase):
|
|||||||
assert group_state.attributes.get(ATTR_FRIENDLY_NAME) == "friendly_name"
|
assert group_state.attributes.get(ATTR_FRIENDLY_NAME) == "friendly_name"
|
||||||
|
|
||||||
|
|
||||||
@asyncio.coroutine
|
async def test_service_group_services(hass):
|
||||||
def test_service_group_services(hass):
|
|
||||||
"""Check if service are available."""
|
"""Check if service are available."""
|
||||||
with assert_setup_component(0, "group"):
|
with assert_setup_component(0, "group"):
|
||||||
yield from async_setup_component(hass, "group", {"group": {}})
|
await async_setup_component(hass, "group", {"group": {}})
|
||||||
|
|
||||||
assert hass.services.has_service("group", group.SERVICE_SET)
|
assert hass.services.has_service("group", group.SERVICE_SET)
|
||||||
assert hass.services.has_service("group", group.SERVICE_REMOVE)
|
assert hass.services.has_service("group", group.SERVICE_REMOVE)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=invalid-name
|
# pylint: disable=invalid-name
|
||||||
@asyncio.coroutine
|
async def test_service_group_set_group_remove_group(hass):
|
||||||
def test_service_group_set_group_remove_group(hass):
|
|
||||||
"""Check if service are available."""
|
"""Check if service are available."""
|
||||||
with assert_setup_component(0, "group"):
|
with assert_setup_component(0, "group"):
|
||||||
yield from async_setup_component(hass, "group", {"group": {}})
|
await async_setup_component(hass, "group", {"group": {}})
|
||||||
|
|
||||||
common.async_set_group(hass, "user_test_group", name="Test")
|
common.async_set_group(hass, "user_test_group", name="Test")
|
||||||
yield from hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
group_state = hass.states.get("group.user_test_group")
|
group_state = hass.states.get("group.user_test_group")
|
||||||
assert group_state
|
assert group_state
|
||||||
@ -513,7 +510,7 @@ def test_service_group_set_group_remove_group(hass):
|
|||||||
visible=False,
|
visible=False,
|
||||||
entity_ids=["test.entity_bla1"],
|
entity_ids=["test.entity_bla1"],
|
||||||
)
|
)
|
||||||
yield from hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
group_state = hass.states.get("group.user_test_group")
|
group_state = hass.states.get("group.user_test_group")
|
||||||
assert group_state
|
assert group_state
|
||||||
@ -531,7 +528,7 @@ def test_service_group_set_group_remove_group(hass):
|
|||||||
control="hidden",
|
control="hidden",
|
||||||
add=["test.entity_id2"],
|
add=["test.entity_id2"],
|
||||||
)
|
)
|
||||||
yield from hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
group_state = hass.states.get("group.user_test_group")
|
group_state = hass.states.get("group.user_test_group")
|
||||||
assert group_state
|
assert group_state
|
||||||
@ -546,7 +543,7 @@ def test_service_group_set_group_remove_group(hass):
|
|||||||
)
|
)
|
||||||
|
|
||||||
common.async_remove(hass, "user_test_group")
|
common.async_remove(hass, "user_test_group")
|
||||||
yield from hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
group_state = hass.states.get("group.user_test_group")
|
group_state = hass.states.get("group.user_test_group")
|
||||||
assert group_state is None
|
assert group_state is None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user