mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Use helper for testing an event change (#71579)
This commit is contained in:
parent
bb4a5ccc2c
commit
5d9dc8252b
@ -24,6 +24,7 @@ from homeassistant.setup import async_setup_component
|
|||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
|
async_capture_events,
|
||||||
async_fire_mqtt_message,
|
async_fire_mqtt_message,
|
||||||
mock_device_registry,
|
mock_device_registry,
|
||||||
mock_entity_platform,
|
mock_entity_platform,
|
||||||
@ -438,14 +439,7 @@ async def test_rediscover(hass, mqtt_mock, caplog):
|
|||||||
async def test_rapid_rediscover(hass, mqtt_mock, caplog):
|
async def test_rapid_rediscover(hass, mqtt_mock, caplog):
|
||||||
"""Test immediate rediscover of removed component."""
|
"""Test immediate rediscover of removed component."""
|
||||||
|
|
||||||
events = []
|
events = async_capture_events(hass, EVENT_STATE_CHANGED)
|
||||||
|
|
||||||
@ha.callback
|
|
||||||
def callback(event):
|
|
||||||
"""Verify event got called."""
|
|
||||||
events.append(event)
|
|
||||||
|
|
||||||
hass.bus.async_listen(EVENT_STATE_CHANGED, callback)
|
|
||||||
|
|
||||||
async_fire_mqtt_message(
|
async_fire_mqtt_message(
|
||||||
hass,
|
hass,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user