mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Improve error handling for WS API trace/get (#48502)
This commit is contained in:
@@ -281,6 +281,25 @@ async def test_get_trace(hass, hass_ws_client, domain, prefix):
|
||||
assert response["result"] == contexts
|
||||
|
||||
|
||||
@pytest.mark.parametrize("domain", ["automation", "script"])
|
||||
async def test_get_invalid_trace(hass, hass_ws_client, domain):
|
||||
"""Test getting a non-existing trace."""
|
||||
assert await async_setup_component(hass, domain, {domain: {}})
|
||||
client = await hass_ws_client()
|
||||
await client.send_json(
|
||||
{
|
||||
"id": 1,
|
||||
"type": "trace/get",
|
||||
"domain": domain,
|
||||
"item_id": "sun",
|
||||
"run_id": "invalid",
|
||||
}
|
||||
)
|
||||
response = await client.receive_json()
|
||||
assert not response["success"]
|
||||
assert response["error"]["code"] == "not_found"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("domain", ["automation", "script"])
|
||||
async def test_trace_overflow(hass, hass_ws_client, domain):
|
||||
"""Test the number of stored traces per script or automation is limited."""
|
||||
|
||||
Reference in New Issue
Block a user