Convert homekit to use entry.runtime_data (#122533)

This commit is contained in:
J. Nick Koston 2024-07-25 04:06:55 -05:00 committed by GitHub
parent 8687b438f1
commit 7348a1fd0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 25 deletions

View file

@ -1843,7 +1843,11 @@ async def test_homekit_uses_system_zeroconf(hass: HomeAssistant, hk_driver) -> N
entry.add_to_hass(hass)
assert await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
entry_data: HomeKitEntryData = hass.data[DOMAIN][entry.entry_id]
# New tests should not access runtime data.
# Do not use this pattern for new tests.
entry_data: HomeKitEntryData = hass.config_entries.async_get_entry(
entry.entry_id
).runtime_data
assert entry_data.homekit.driver.advertiser == system_async_zc
assert await hass.config_entries.async_unload(entry.entry_id)
await hass.async_block_till_done()