hass-core/tests/components/august/test_button.py
Allen Porter 12129e9d21
Update service call return values and error handling (#94657)
* Update return signature of service calls

* Add timeout error handling in websocket api for service calls

* Update recorder tests to remove assertion on service call

* Remove timeout behavior and update callers that depend on it today

* Fix tests

* Add missing else

* await coro directly

* Fix more tests

* Update the intent task to use wait instead of timeout

* Remove script service call limits and limit constants

* Update tests that depend on service call limits

* Use wait instead of wait_for and add test

* Update homeassistant/helpers/intent.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-06-16 07:01:40 -07:00

23 lines
1 KiB
Python

"""The button tests for the august platform."""
from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.core import HomeAssistant
from .mocks import _create_august_api_with_devices, _mock_lock_from_fixture
async def test_wake_lock(hass: HomeAssistant) -> None:
"""Test creation of a lock and wake it."""
lock_one = await _mock_lock_from_fixture(
hass, "get_lock.online_with_doorsense.json"
)
_, api_instance = await _create_august_api_with_devices(hass, [lock_one])
entity_id = "button.online_with_doorsense_name_wake"
binary_sensor_online_with_doorsense_name = hass.states.get(entity_id)
assert binary_sensor_online_with_doorsense_name is not None
api_instance.async_status_async.reset_mock()
await hass.services.async_call(
BUTTON_DOMAIN, SERVICE_PRESS, {ATTR_ENTITY_ID: entity_id}, blocking=True
)
await hass.async_block_till_done()
api_instance.async_status_async.assert_called_once()