mirror of
https://github.com/home-assistant/core.git
synced 2026-10-07 06:50:41 -04:00
Use freezer in Portainer new endpoint test (#183334)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user