Abort deCONZ config flow if no radio hardware is connected (#40811)
This commit is contained in:
1 parent
df1e910ac7
commit
2922d4675f
4 files changed
+36
No files matched your search
@@ -24,6 +24,8 @@ from .test_gateway import API_KEY, BRIDGEID, setup_deconz_integration
|
||||
|
||||
from tests.async_mock import patch
|
||||
|
||||
BAD_BRIDGEID = "0000000000000000"
|
||||
|
||||
|
||||
async def test_flow_discovered_bridges(hass, aioclient_mock):
|
||||
"""Test that config flow works for discovered bridges."""
|
||||
@@ -391,6 +393,35 @@ async def test_flow_ssdp_discovery(hass, aioclient_mock):
|
||||
}
|
||||
|
||||
|
||||
async def test_flow_ssdp_discovery_bad_bridge_id_aborts(hass, aioclient_mock):
|
||||
"""Test that config flow aborts if deCONZ signals no radio hardware available."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
data={
|
||||
ssdp.ATTR_SSDP_LOCATION: "http://1.2.3.4:80/",
|
||||
ssdp.ATTR_UPNP_MANUFACTURER_URL: DECONZ_MANUFACTURERURL,
|
||||
ssdp.ATTR_UPNP_SERIAL: BAD_BRIDGEID,
|
||||
},
|
||||
context={"source": "ssdp"},
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
|
||||
assert result["step_id"] == "link"
|
||||
|
||||
aioclient_mock.post(
|
||||
"http://1.2.3.4:80/api",
|
||||
json=[{"success": {"username": API_KEY}}],
|
||||
headers={"content-type": CONTENT_TYPE_JSON},
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"], user_input={}
|
||||
)
|
||||
|
||||
assert result["type"] == data_entry_flow.RESULT_TYPE_ABORT
|
||||
assert result["reason"] == "no_hardware_available"
|
||||
|
||||
|
||||
async def test_ssdp_discovery_not_deconz_bridge(hass):
|
||||
"""Test a non deconz bridge being discovered over ssdp."""
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
|
||||
Reference in new issue
Block a user