Add test helper mock_config_flow (#90103)

This commit is contained in:
Erik Montnemery 2023-03-22 13:59:35 +01:00 committed by GitHub
parent 0ca6723378
commit 0ecd043cb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 16 deletions

View file

@ -28,7 +28,7 @@ from homeassistant.core import HomeAssistant
from homeassistant.helpers import config_entry_oauth2_flow
from homeassistant.setup import async_setup_component
from tests.common import MockConfigEntry, mock_platform
from tests.common import MockConfigEntry, mock_config_flow, mock_platform
from tests.test_util.aiohttp import AiohttpClientMocker
from tests.typing import ClientSessionGenerator, WebSocketGenerator
@ -98,7 +98,7 @@ async def mock_application_credentials_integration(
yield
class FakeConfigFlow(config_entry_oauth2_flow.AbstractOAuth2FlowHandler, domain=DOMAIN):
class FakeConfigFlow(config_entry_oauth2_flow.AbstractOAuth2FlowHandler):
"""Config flow used during tests."""
DOMAIN = TEST_DOMAIN
@ -115,8 +115,8 @@ def config_flow_handler(
) -> Generator[FakeConfigFlow, None, None]:
"""Fixture for a test config flow."""
mock_platform(hass, f"{TEST_DOMAIN}.config_flow")
with patch.dict(config_entries.HANDLERS, {TEST_DOMAIN: FakeConfigFlow}):
yield FakeConfigFlow
with mock_config_flow(TEST_DOMAIN, FakeConfigFlow):
yield
class OAuthFixture: