mirror of
https://github.com/home-assistant/core.git
synced 2025-11-15 14:00:24 +00:00
Google Assistant SDK: use setup_credentials in setup_integration (#153793)
This commit is contained in:
@@ -66,19 +66,13 @@ def mock_config_entry(expires_at: int, scopes: list[str]) -> MockConfigEntry:
|
|||||||
|
|
||||||
@pytest.fixture(name="setup_integration")
|
@pytest.fixture(name="setup_integration")
|
||||||
async def mock_setup_integration(
|
async def mock_setup_integration(
|
||||||
hass: HomeAssistant, config_entry: MockConfigEntry
|
hass: HomeAssistant,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
setup_credentials: None,
|
||||||
) -> Callable[[], Coroutine[Any, Any, None]]:
|
) -> Callable[[], Coroutine[Any, Any, None]]:
|
||||||
"""Fixture for setting up the component."""
|
"""Fixture for setting up the component."""
|
||||||
config_entry.add_to_hass(hass)
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
assert await async_setup_component(hass, "application_credentials", {})
|
|
||||||
await async_import_client_credential(
|
|
||||||
hass,
|
|
||||||
DOMAIN,
|
|
||||||
ClientCredential("client-id", "client-secret"),
|
|
||||||
DOMAIN,
|
|
||||||
)
|
|
||||||
|
|
||||||
async def func() -> None:
|
async def func() -> None:
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
assert await async_setup_component(hass, DOMAIN, {})
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ async def test_full_flow(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_client_no_auth: ClientSessionGenerator,
|
hass_client_no_auth: ClientSessionGenerator,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
setup_credentials,
|
setup_credentials: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Check full flow."""
|
"""Check full flow."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
@@ -87,7 +87,7 @@ async def test_reauth(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_client_no_auth: ClientSessionGenerator,
|
hass_client_no_auth: ClientSessionGenerator,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
setup_credentials,
|
setup_credentials: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the reauthentication case updates the existing config entry."""
|
"""Test the reauthentication case updates the existing config entry."""
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ async def test_single_instance_allowed(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_client_no_auth: ClientSessionGenerator,
|
hass_client_no_auth: ClientSessionGenerator,
|
||||||
aioclient_mock: AiohttpClientMocker,
|
aioclient_mock: AiohttpClientMocker,
|
||||||
setup_credentials,
|
setup_credentials: None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test case where config flow allows a single test."""
|
"""Test case where config flow allows a single test."""
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
|
|||||||
Reference in New Issue
Block a user