mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Simplify wake_word/info + improve test coverage (#100902)
* Simplify wake_word/info + improve test coverage * Fix test * Revert unrelated changes
This commit is contained in:
parent
4028596977
commit
b281fa17fc
@ -3,7 +3,6 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from collections.abc import AsyncIterable
|
from collections.abc import AsyncIterable
|
||||||
import dataclasses
|
|
||||||
import logging
|
import logging
|
||||||
from typing import final
|
from typing import final
|
||||||
|
|
||||||
@ -150,5 +149,5 @@ def websocket_entity_info(
|
|||||||
|
|
||||||
connection.send_result(
|
connection.send_result(
|
||||||
msg["id"],
|
msg["id"],
|
||||||
{"wake_words": [dataclasses.asdict(ww) for ww in entity.supported_wake_words]},
|
{"wake_words": entity.supported_wake_words},
|
||||||
)
|
)
|
||||||
|
@ -287,3 +287,24 @@ async def test_list_wake_words(
|
|||||||
{"id": "test_ww_2", "name": "Test Wake Word 2"},
|
{"id": "test_ww_2", "name": "Test Wake Word 2"},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def test_list_wake_words_unknown_entity(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
setup: MockProviderEntity,
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
) -> None:
|
||||||
|
"""Test that the list_wake_words websocket command works."""
|
||||||
|
client = await hass_ws_client(hass)
|
||||||
|
await client.send_json(
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"type": "wake_word/info",
|
||||||
|
"entity_id": "wake_word.blah",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
msg = await client.receive_json()
|
||||||
|
|
||||||
|
assert not msg["success"]
|
||||||
|
assert msg["error"] == {"code": "not_found", "message": "Entity not found"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user