1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Add 100% coverage to init for Fritz (#161583)

This commit is contained in:
Simone Chemelli
2026-01-25 19:26:42 +01:00
committed by GitHub
parent 121e1f3b71
commit 9fa3f8cfac

View File

@@ -102,3 +102,28 @@ async def test_setup_fail(hass: HomeAssistant, error) -> None:
await hass.async_block_till_done()
assert entry.state is ConfigEntryState.SETUP_RETRY
async def test_upnp_missing(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, fc_class_mock, fh_class_mock
) -> None:
"""Test UPNP configuration is missing."""
entry = MockConfigEntry(domain=DOMAIN, data=MOCK_USER_DATA)
entry.add_to_hass(hass)
with (
patch(
"homeassistant.components.fritz.coordinator.AvmWrapper.async_get_upnp_configuration",
return_value={"NewEnable": False},
),
):
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
assert entry.state is ConfigEntryState.SETUP_ERROR
assert entry.state.recoverable is True
assert (
"Config entry 'Mock Title' for fritz integration could not authenticate: Missing UPnP configuration"
in caplog.text
)