mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Make Alexa custom ID unique (#44839)
* Make Alexa custom ID unique * Lint * Lint
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.alexa import smart_home
|
||||
from homeassistant.const import __version__
|
||||
|
||||
from . import DEFAULT_CONFIG, get_new_request
|
||||
|
||||
@@ -20,6 +21,26 @@ async def test_unsupported_domain(hass):
|
||||
assert not msg["payload"]["endpoints"]
|
||||
|
||||
|
||||
async def test_serialize_discovery(hass):
|
||||
"""Test we handle an interface raising unexpectedly during serialize discovery."""
|
||||
request = get_new_request("Alexa.Discovery", "Discover")
|
||||
|
||||
hass.states.async_set("switch.bla", "on", {"friendly_name": "Boop Woz"})
|
||||
|
||||
msg = await smart_home.async_handle_message(hass, DEFAULT_CONFIG, request)
|
||||
|
||||
assert "event" in msg
|
||||
msg = msg["event"]
|
||||
endpoint = msg["payload"]["endpoints"][0]
|
||||
|
||||
assert endpoint["additionalAttributes"] == {
|
||||
"manufacturer": "Home Assistant",
|
||||
"model": "switch",
|
||||
"softwareVersion": __version__,
|
||||
"customIdentifier": "mock-user-id-switch.bla",
|
||||
}
|
||||
|
||||
|
||||
async def test_serialize_discovery_recovers(hass, caplog):
|
||||
"""Test we handle an interface raising unexpectedly during serialize discovery."""
|
||||
request = get_new_request("Alexa.Discovery", "Discover")
|
||||
|
||||
Reference in New Issue
Block a user