mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 02:19:31 +00:00
Address post-merge coolmaster config flow code review (#28163)
* Address post-merge code review comments * Use component path for 3rd party lib
This commit is contained in:
committed by
Martin Hjelmare
parent
43c7b57d1e
commit
0656f0c62b
@@ -4,8 +4,6 @@ from unittest.mock import patch
|
||||
from homeassistant import config_entries, setup
|
||||
from homeassistant.components.coolmaster.const import DOMAIN, AVAILABLE_MODES
|
||||
|
||||
# from homeassistant.components.coolmaster.config_flow import validate_connection
|
||||
|
||||
from tests.common import mock_coro
|
||||
|
||||
|
||||
@@ -26,8 +24,8 @@ async def test_form(hass):
|
||||
assert result["errors"] is None
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.coolmaster.config_flow.validate_connection",
|
||||
return_value=mock_coro(True),
|
||||
"homeassistant.components.coolmaster.config_flow.CoolMasterNet.devices",
|
||||
return_value=[1],
|
||||
), patch(
|
||||
"homeassistant.components.coolmaster.async_setup", return_value=mock_coro(True)
|
||||
) as mock_setup, patch(
|
||||
@@ -57,7 +55,7 @@ async def test_form_timeout(hass):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.coolmaster.config_flow.validate_connection",
|
||||
"homeassistant.components.coolmaster.config_flow.CoolMasterNet.devices",
|
||||
side_effect=TimeoutError(),
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -75,7 +73,7 @@ async def test_form_connection_refused(hass):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.coolmaster.config_flow.validate_connection",
|
||||
"homeassistant.components.coolmaster.config_flow.CoolMasterNet.devices",
|
||||
side_effect=ConnectionRefusedError(),
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
@@ -93,8 +91,8 @@ async def test_form_no_units(hass):
|
||||
)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.coolmaster.config_flow.validate_connection",
|
||||
return_value=mock_coro(False),
|
||||
"homeassistant.components.coolmaster.config_flow.CoolMasterNet.devices",
|
||||
return_value=[],
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], _flow_data()
|
||||
|
||||
Reference in New Issue
Block a user