parent
c68149c75b
commit
3738135e0b
|
@ -6,16 +6,27 @@ from homeassistant.helpers.typing import ConfigType
|
|||
|
||||
from . import issue_handler, websocket_api
|
||||
from .const import DOMAIN
|
||||
from .issue_handler import ConfirmRepairFlow
|
||||
from .issue_handler import ConfirmRepairFlow, RepairsFlowManager
|
||||
from .models import RepairsFlow
|
||||
|
||||
__all__ = [
|
||||
"DOMAIN",
|
||||
"ConfirmRepairFlow",
|
||||
"DOMAIN",
|
||||
"repairs_flow_manager",
|
||||
"RepairsFlow",
|
||||
"RepairsFlowManager",
|
||||
]
|
||||
|
||||
|
||||
def repairs_flow_manager(hass: HomeAssistant) -> RepairsFlowManager | None:
|
||||
"""Return the repairs flow manager."""
|
||||
if (domain_data := hass.data.get(DOMAIN)) is None:
|
||||
return None
|
||||
|
||||
flow_manager: RepairsFlowManager | None = domain_data.get("flow_manager")
|
||||
return flow_manager
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Set up Repairs."""
|
||||
hass.data[DOMAIN] = {}
|
||||
|
|
|
@ -6,8 +6,10 @@ from aiohttp import ClientWebSocketResponse
|
|||
from freezegun import freeze_time
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.repairs import repairs_flow_manager
|
||||
from homeassistant.components.repairs.const import DOMAIN
|
||||
from homeassistant.components.repairs.issue_handler import (
|
||||
RepairsFlowManager,
|
||||
async_process_repairs_platforms,
|
||||
)
|
||||
from homeassistant.const import __version__ as ha_version
|
||||
|
@ -538,3 +540,14 @@ async def test_sync_methods(
|
|||
|
||||
assert msg["success"]
|
||||
assert msg["result"] == {"issues": []}
|
||||
|
||||
|
||||
async def test_flow_manager_helper(hass: HomeAssistant) -> None:
|
||||
"""Test accessing the repairs flow manager with the helper."""
|
||||
assert repairs_flow_manager(hass) is None
|
||||
|
||||
assert await async_setup_component(hass, DOMAIN, {})
|
||||
|
||||
flow_manager = repairs_flow_manager(hass)
|
||||
assert flow_manager is not None
|
||||
assert isinstance(flow_manager, RepairsFlowManager)
|
||||
|
|
Loading…
Reference in New Issue