Alexa typing part 5 (smart_home) (#97918)

* smart_home

* Fix test_disabled

* Remove unused type ignore
This commit is contained in:
Jan Bouwhuis 2023-08-08 11:48:50 +02:00 committed by GitHub
parent 1ee0c907b0
commit 0614702f98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 35 deletions

View file

@ -2798,20 +2798,13 @@ async def test_disabled(hass: HomeAssistant) -> None:
hass.states.async_set("switch.test", "on", {"friendly_name": "Test switch"})
request = get_new_request("Alexa.PowerController", "TurnOn", "switch#test")
call_switch = async_mock_service(hass, "switch", "turn_on")
async_mock_service(hass, "switch", "turn_on")
msg = await smart_home.async_handle_message(
hass, get_default_config(hass), request, enabled=False
)
await hass.async_block_till_done()
assert "event" in msg
msg = msg["event"]
assert not call_switch
assert msg["header"]["name"] == "ErrorResponse"
assert msg["header"]["namespace"] == "Alexa"
assert msg["payload"]["type"] == "BRIDGE_UNREACHABLE"
with pytest.raises(AssertionError):
await smart_home.async_handle_message(
hass, get_default_config(hass), request, enabled=False
)
await hass.async_block_till_done()
async def test_endpoint_good_health(hass: HomeAssistant) -> None: