Handle Oauth2 ImplementationUnavailableError in gentex_homelink (#166646)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Will Moss
2026-03-28 16:51:09 +01:00
committed by GitHub
co-authored by Claude Sonnet 4.6
parent 0ba3a94a3b
commit 0e1663f259
3 changed files with 37 additions and 5 deletions
@@ -8,6 +8,9 @@ from syrupy.assertion import SnapshotAssertion
from homeassistant.components.gentex_homelink.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from homeassistant.helpers.config_entry_oauth2_flow import (
ImplementationUnavailableError,
)
import homeassistant.helpers.device_registry as dr
from . import setup_integration, update_callback
@@ -72,3 +75,21 @@ async def test_load_unload_entry(
await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED
@pytest.mark.usefixtures("aioclient_mock_fixture")
async def test_oauth_implementation_not_available(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test that unavailable OAuth implementation raises ConfigEntryNotReady."""
mock_config_entry.add_to_hass(hass)
with patch(
"homeassistant.helpers.config_entry_oauth2_flow.async_get_config_entry_implementation",
side_effect=ImplementationUnavailableError,
):
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert mock_config_entry.state is ConfigEntryState.SETUP_RETRY