File tree 2 files changed +26
-2
lines changed
homeassistant/components/repairs
2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 6
6
7
7
from . import issue_handler , websocket_api
8
8
from .const import DOMAIN
9
- from .issue_handler import ConfirmRepairFlow
9
+ from .issue_handler import ConfirmRepairFlow , RepairsFlowManager
10
10
from .models import RepairsFlow
11
11
12
12
__all__ = [
13
- "DOMAIN" ,
14
13
"ConfirmRepairFlow" ,
14
+ "DOMAIN" ,
15
+ "repairs_flow_manager" ,
15
16
"RepairsFlow" ,
17
+ "RepairsFlowManager" ,
16
18
]
17
19
18
20
21
+ def repairs_flow_manager (hass : HomeAssistant ) -> RepairsFlowManager | None :
22
+ """Return the repairs flow manager."""
23
+ if (domain_data := hass .data .get (DOMAIN )) is None :
24
+ return None
25
+
26
+ flow_manager : RepairsFlowManager | None = domain_data .get ("flow_manager" )
27
+ return flow_manager
28
+
29
+
19
30
async def async_setup (hass : HomeAssistant , config : ConfigType ) -> bool :
20
31
"""Set up Repairs."""
21
32
hass .data [DOMAIN ] = {}
Original file line number Diff line number Diff line change 6
6
from freezegun import freeze_time
7
7
import pytest
8
8
9
+ from homeassistant .components .repairs import repairs_flow_manager
9
10
from homeassistant .components .repairs .const import DOMAIN
10
11
from homeassistant .components .repairs .issue_handler import (
12
+ RepairsFlowManager ,
11
13
async_process_repairs_platforms ,
12
14
)
13
15
from homeassistant .const import __version__ as ha_version
@@ -538,3 +540,14 @@ def _create_issue() -> None:
538
540
539
541
assert msg ["success" ]
540
542
assert msg ["result" ] == {"issues" : []}
543
+
544
+
545
+ async def test_flow_manager_helper (hass : HomeAssistant ) -> None :
546
+ """Test accessing the repairs flow manager with the helper."""
547
+ assert repairs_flow_manager (hass ) is None
548
+
549
+ assert await async_setup_component (hass , DOMAIN , {})
550
+
551
+ flow_manager = repairs_flow_manager (hass )
552
+ assert flow_manager is not None
553
+ assert isinstance (flow_manager , RepairsFlowManager )
You can’t perform that action at this time.
0 commit comments