mirror of
https://github.com/home-assistant/core.git
synced 2025-12-27 14:31:13 +00:00
Use run_job for service helper (#43696)
This commit is contained in:
@@ -63,23 +63,21 @@ async def test_methods(hass):
|
||||
|
||||
assert not is_on(hass, entity_id)
|
||||
|
||||
await hass.services.async_call(DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: entity_id})
|
||||
|
||||
await hass.async_block_till_done()
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
|
||||
assert is_on(hass, entity_id)
|
||||
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}
|
||||
DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert not is_on(hass, entity_id)
|
||||
|
||||
await hass.services.async_call(DOMAIN, SERVICE_TOGGLE, {ATTR_ENTITY_ID: entity_id})
|
||||
|
||||
await hass.async_block_till_done()
|
||||
await hass.services.async_call(
|
||||
DOMAIN, SERVICE_TOGGLE, {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
|
||||
assert is_on(hass, entity_id)
|
||||
|
||||
@@ -246,7 +244,6 @@ async def test_reload(hass, hass_admin_user):
|
||||
blocking=True,
|
||||
context=Context(user_id=hass_admin_user.id),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert count_start + 2 == len(hass.states.async_entity_ids())
|
||||
|
||||
@@ -349,6 +346,5 @@ async def test_setup_no_config(hass, hass_admin_user):
|
||||
blocking=True,
|
||||
context=Context(user_id=hass_admin_user.id),
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert count_start == len(hass.states.async_entity_ids())
|
||||
|
||||
Reference in New Issue
Block a user