mirror of
https://github.com/home-assistant/core.git
synced 2025-11-13 21:10:25 +00:00
Fix homeassistant/expose_entity/list (#138872)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
@@ -497,28 +497,48 @@ async def test_list_exposed_entities(
|
||||
|
||||
entry1 = entity_registry.async_get_or_create("test", "test", "unique1")
|
||||
entry2 = entity_registry.async_get_or_create("test", "test", "unique2")
|
||||
entity_registry.async_get_or_create("test", "test", "unique3")
|
||||
|
||||
# Set options for registered entities
|
||||
await ws_client.send_json_auto_id(
|
||||
{
|
||||
"type": "homeassistant/expose_entity",
|
||||
"assistants": ["cloud.alexa", "cloud.google_assistant"],
|
||||
"entity_ids": [entry1.entity_id, entry2.entity_id],
|
||||
"entity_ids": [entry1.entity_id],
|
||||
"should_expose": True,
|
||||
}
|
||||
)
|
||||
response = await ws_client.receive_json()
|
||||
assert response["success"]
|
||||
|
||||
await ws_client.send_json_auto_id(
|
||||
{
|
||||
"type": "homeassistant/expose_entity",
|
||||
"assistants": ["cloud.alexa", "cloud.google_assistant"],
|
||||
"entity_ids": [entry2.entity_id],
|
||||
"should_expose": False,
|
||||
}
|
||||
)
|
||||
response = await ws_client.receive_json()
|
||||
assert response["success"]
|
||||
|
||||
# Set options for entities not in the entity registry
|
||||
await ws_client.send_json_auto_id(
|
||||
{
|
||||
"type": "homeassistant/expose_entity",
|
||||
"assistants": ["cloud.alexa", "cloud.google_assistant"],
|
||||
"entity_ids": [
|
||||
"test.test",
|
||||
"test.test2",
|
||||
],
|
||||
"entity_ids": ["test.test"],
|
||||
"should_expose": True,
|
||||
}
|
||||
)
|
||||
response = await ws_client.receive_json()
|
||||
assert response["success"]
|
||||
|
||||
await ws_client.send_json_auto_id(
|
||||
{
|
||||
"type": "homeassistant/expose_entity",
|
||||
"assistants": ["cloud.alexa", "cloud.google_assistant"],
|
||||
"entity_ids": ["test.test2"],
|
||||
"should_expose": False,
|
||||
}
|
||||
)
|
||||
@@ -531,10 +551,8 @@ async def test_list_exposed_entities(
|
||||
assert response["success"]
|
||||
assert response["result"] == {
|
||||
"exposed_entities": {
|
||||
"test.test": {"cloud.alexa": False, "cloud.google_assistant": False},
|
||||
"test.test2": {"cloud.alexa": False, "cloud.google_assistant": False},
|
||||
"test.test": {"cloud.alexa": True, "cloud.google_assistant": True},
|
||||
"test.test_unique1": {"cloud.alexa": True, "cloud.google_assistant": True},
|
||||
"test.test_unique2": {"cloud.alexa": True, "cloud.google_assistant": True},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user