Use freezer in Portainer new endpoint test (#183334)

This commit is contained in:
Erwin Douna
2026-09-28 23:31:18 +02:00
committed by GitHub
parent 7fc8f1d519
commit d0ad2df30e
+6 -3
View File
@@ -371,6 +371,7 @@ async def test_new_endpoint_callback(
mock_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
device_registry: dr.DeviceRegistry,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test new endpoint creates entities after refresh."""
mock_portainer_client.get_endpoints.return_value = []
@@ -389,9 +390,11 @@ async def test_new_endpoint_callback(
if endpoint["Status"] == EndpointStatus.UP
]
coordinator = mock_config_entry.runtime_data
await coordinator.async_refresh()
await hass.async_block_till_done()
# Without entities nothing listens to the coordinator, so it wouldn't poll.
mock_config_entry.runtime_data.async_add_listener(lambda: None)
freezer.tick(DEFAULT_SCAN_INTERVAL)
async_fire_time_changed(hass)
await hass.async_block_till_done(wait_background_tasks=True)
entities = er.async_entries_for_config_entry(
entity_registry, mock_config_entry.entry_id