Ensure entity platform in alert tests (#135714)

This commit is contained in:
G Johansson 2025-01-17 08:44:40 +01:00 committed by GitHub
parent 566f514a75
commit 0f8785d8bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,7 +30,7 @@ from homeassistant.const import (
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.setup import async_setup_component
from tests.common import async_mock_service
from tests.common import MockEntityPlatform, async_mock_service
NAME = "alert_test"
DONE_MESSAGE = "alert_gone"
@ -338,6 +338,7 @@ async def test_skipfirst(hass: HomeAssistant, mock_notifier: list[ServiceCall])
async def test_done_message_state_tracker_reset_on_cancel(hass: HomeAssistant) -> None:
"""Test that the done message is reset when canceled."""
entity = alert.AlertEntity(hass, *TEST_NOACK)
entity.platform = MockEntityPlatform(hass)
entity._cancel = lambda *args: None
assert entity._send_done_message is False
entity._send_done_message = True