Fix remote calendar downloading and parsing its feed twice at setup (#182630)

This commit is contained in:
Franck Nijhof
2026-09-20 17:29:30 +02:00
committed by GitHub
parent 3593b874e0
commit ea8ca3fe7e
2 changed files with 4 additions and 2 deletions
@@ -39,7 +39,7 @@ async def async_setup_entry(
"""Set up the remote calendar platform."""
coordinator = entry.runtime_data
entity = RemoteCalendarEntity(coordinator, entry)
async_add_entities([entity], True)
async_add_entities([entity])
class RemoteCalendarEntity(
@@ -26,7 +26,7 @@ async def test_load_unload(
hass: HomeAssistant, config_entry: MockConfigEntry, ics_content: str
) -> None:
"""Test loading and unloading a config entry."""
respx.get(CALENDER_URL).mock(
route = respx.get(CALENDER_URL).mock(
return_value=Response(
status_code=200,
text=ics_content,
@@ -34,6 +34,8 @@ async def test_load_unload(
)
await setup_integration(hass, config_entry)
assert config_entry.state is ConfigEntryState.LOADED
# the calendar is downloaded and parsed once for the whole setup
assert route.call_count == 1
state = hass.states.get(TEST_ENTITY)
assert state