Update Alexa discovery description (#26933)
* Update Alexa discovery description * Update description * Fix test * Filter special chars
This commit is contained in:
1 parent
eeffd090a3
commit
80bc15e24b
3 files changed
+27
-13
No files matched your search
@@ -1162,14 +1162,16 @@ async def test_entity_config(hass):
|
||||
request = get_new_request("Alexa.Discovery", "Discover")
|
||||
|
||||
hass.states.async_set("light.test_1", "on", {"friendly_name": "Test light 1"})
|
||||
hass.states.async_set("scene.test_1", "scening", {"friendly_name": "Test 1"})
|
||||
|
||||
alexa_config = MockConfig(hass)
|
||||
alexa_config.entity_config = {
|
||||
"light.test_1": {
|
||||
"name": "Config name",
|
||||
"name": "Config *name*",
|
||||
"display_categories": "SWITCH",
|
||||
"description": "Config description",
|
||||
}
|
||||
"description": "Config >!<description",
|
||||
},
|
||||
"scene.test_1": {"description": "Config description"},
|
||||
}
|
||||
|
||||
msg = await smart_home.async_handle_message(hass, alexa_config, request)
|
||||
@@ -1177,17 +1179,23 @@ async def test_entity_config(hass):
|
||||
assert "event" in msg
|
||||
msg = msg["event"]
|
||||
|
||||
assert len(msg["payload"]["endpoints"]) == 1
|
||||
assert len(msg["payload"]["endpoints"]) == 2
|
||||
|
||||
appliance = msg["payload"]["endpoints"][0]
|
||||
assert appliance["endpointId"] == "light#test_1"
|
||||
assert appliance["displayCategories"][0] == "SWITCH"
|
||||
assert appliance["friendlyName"] == "Config name"
|
||||
assert appliance["description"] == "Config description"
|
||||
assert appliance["description"] == "Config description via Home Assistant"
|
||||
assert_endpoint_capabilities(
|
||||
appliance, "Alexa.PowerController", "Alexa.EndpointHealth"
|
||||
)
|
||||
|
||||
scene = msg["payload"]["endpoints"][1]
|
||||
assert scene["endpointId"] == "scene#test_1"
|
||||
assert scene["displayCategories"][0] == "SCENE_TRIGGER"
|
||||
assert scene["friendlyName"] == "Test 1"
|
||||
assert scene["description"] == "Config description via Home Assistant (Scene)"
|
||||
|
||||
|
||||
async def test_logging_request(hass, events):
|
||||
"""Test that we log requests."""
|
||||
|
||||
@@ -53,7 +53,7 @@ async def test_handler_alexa(hass):
|
||||
assert len(endpoints) == 1
|
||||
device = endpoints[0]
|
||||
|
||||
assert device["description"] == "Config description"
|
||||
assert device["description"] == "Config description via Home Assistant"
|
||||
assert device["friendlyName"] == "Config name"
|
||||
assert device["displayCategories"] == ["LIGHT"]
|
||||
assert device["manufacturerName"] == "Home Assistant"
|
||||
|
||||
Reference in new issue
Block a user