Raise repairs issue if automation calls unknown service (#76949)
This commit is contained in:
parent
d7724235ff
commit
5f0cca9b26
7 changed files with 60 additions and 2 deletions
|
@ -1,9 +1,11 @@
|
|||
"""The tests for the automation component."""
|
||||
import asyncio
|
||||
from collections.abc import Awaitable, Callable
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from aiohttp import ClientWebSocketResponse
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
|
@ -53,6 +55,7 @@ from tests.common import (
|
|||
mock_restore_cache,
|
||||
)
|
||||
from tests.components.logbook.common import MockRow, mock_humanify
|
||||
from tests.components.repairs import get_repairs
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -983,7 +986,11 @@ async def test_automation_bad_trigger(hass, caplog):
|
|||
assert "Integration 'automation' does not provide trigger support." in caplog.text
|
||||
|
||||
|
||||
async def test_automation_with_error_in_script(hass, caplog):
|
||||
async def test_automation_with_error_in_script(
|
||||
hass: HomeAssistant,
|
||||
caplog: pytest.LogCaptureFixture,
|
||||
hass_ws_client: Callable[[HomeAssistant], Awaitable[ClientWebSocketResponse]],
|
||||
) -> None:
|
||||
"""Test automation with an error in script."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
|
@ -1002,6 +1009,10 @@ async def test_automation_with_error_in_script(hass, caplog):
|
|||
assert "Service not found" in caplog.text
|
||||
assert "Traceback" not in caplog.text
|
||||
|
||||
issues = await get_repairs(hass, hass_ws_client)
|
||||
assert len(issues) == 1
|
||||
assert issues[0]["issue_id"] == "automation.hello_service_not_found_test.automation"
|
||||
|
||||
|
||||
async def test_automation_with_error_in_script_2(hass, caplog):
|
||||
"""Test automation with an error in script."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue