100% test coverage in Google Assistant SDK (#148536)

This commit is contained in:
tronikos 2025-07-10 04:21:19 -07:00 committed by GitHub
parent 2829cc1248
commit 7e405d4ddb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -116,6 +116,25 @@ async def test_expired_token_refresh_failure(
assert entries[0].state is expected_state
@pytest.mark.parametrize("expires_at", [time.time() - 3600], ids=["expired"])
async def test_setup_client_error(
hass: HomeAssistant,
setup_integration: ComponentSetup,
aioclient_mock: AiohttpClientMocker,
) -> None:
"""Test setup handling aiohttp.ClientError."""
aioclient_mock.post(
"https://oauth2.googleapis.com/token",
exc=aiohttp.ClientError,
)
await setup_integration()
entries = hass.config_entries.async_entries(DOMAIN)
assert len(entries) == 1
assert entries[0].state is ConfigEntryState.SETUP_RETRY
@pytest.mark.parametrize(
("configured_language_code", "expected_language_code"),
[("", "en-US"), ("en-US", "en-US"), ("es-ES", "es-ES")],