Skip to content

Commit 7e405d4

Browse files
authored
100% test coverage in Google Assistant SDK (home-assistant#148536)
1 parent 2829cc1 commit 7e405d4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/components/google_assistant_sdk/test_init.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,25 @@ async def test_expired_token_refresh_failure(
116116
assert entries[0].state is expected_state
117117

118118

119+
@pytest.mark.parametrize("expires_at", [time.time() - 3600], ids=["expired"])
120+
async def test_setup_client_error(
121+
hass: HomeAssistant,
122+
setup_integration: ComponentSetup,
123+
aioclient_mock: AiohttpClientMocker,
124+
) -> None:
125+
"""Test setup handling aiohttp.ClientError."""
126+
aioclient_mock.post(
127+
"https://oauth2.googleapis.com/token",
128+
exc=aiohttp.ClientError,
129+
)
130+
131+
await setup_integration()
132+
133+
entries = hass.config_entries.async_entries(DOMAIN)
134+
assert len(entries) == 1
135+
assert entries[0].state is ConfigEntryState.SETUP_RETRY
136+
137+
119138
@pytest.mark.parametrize(
120139
("configured_language_code", "expected_language_code"),
121140
[("", "en-US"), ("en-US", "en-US"), ("es-ES", "es-ES")],

0 commit comments

Comments
 (0)