Use send_json_auto_id in conversation tests (#109354)

This commit is contained in:
Erik Montnemery 2024-02-02 15:46:59 +01:00 committed by GitHub
parent 0c3541c194
commit 9d22f07fc6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 9 deletions

View File

@ -733,7 +733,7 @@ async def test_ws_api(
assert await async_setup_component(hass, "conversation", {}) assert await async_setup_component(hass, "conversation", {})
client = await hass_ws_client(hass) client = await hass_ws_client(hass)
await client.send_json({"id": 5, "type": "conversation/process", **payload}) await client.send_json_auto_id({"type": "conversation/process", **payload})
msg = await client.receive_json() msg = await client.receive_json()
@ -757,18 +757,14 @@ async def test_ws_prepare(
client = await hass_ws_client(hass) client = await hass_ws_client(hass)
msg = { msg = {"type": "conversation/prepare"}
"id": 5,
"type": "conversation/prepare",
}
if agent_id is not None: if agent_id is not None:
msg["agent_id"] = agent_id msg["agent_id"] = agent_id
await client.send_json(msg) await client.send_json_auto_id(msg)
msg = await client.receive_json() msg = await client.receive_json()
assert msg["success"] assert msg["success"]
assert msg["id"] == 5
# Intents should now be load # Intents should now be load
assert agent._lang_intents.get(hass.config.language) assert agent._lang_intents.get(hass.config.language)

View File

@ -105,9 +105,8 @@ async def test_subscribe_trigger_does_not_interfere_with_responses(
) -> None: ) -> None:
"""Test that subscribing to a trigger from the websocket API does not interfere with responses.""" """Test that subscribing to a trigger from the websocket API does not interfere with responses."""
websocket_client = await hass_ws_client() websocket_client = await hass_ws_client()
await websocket_client.send_json( await websocket_client.send_json_auto_id(
{ {
"id": 5,
"type": "subscribe_trigger", "type": "subscribe_trigger",
"trigger": {"platform": "conversation", "command": ["test sentence"]}, "trigger": {"platform": "conversation", "command": ["test sentence"]},
} }