1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

AlarmDecoder config flow fixes (#40037)

This commit is contained in:
AJ Schmidt
2020-09-15 18:11:29 -04:00
committed by GitHub
parent 000d2047fb
commit 66bb6a6ffa
7 changed files with 37 additions and 40 deletions

View File

@@ -34,7 +34,7 @@ from tests.common import MockConfigEntry
@pytest.mark.parametrize(
"protocol,connection,baud,title",
"protocol,connection,title",
[
(
PROTOCOL_SOCKET,
@@ -42,7 +42,6 @@ from tests.common import MockConfigEntry
CONF_HOST: "alarmdecoder123",
CONF_PORT: 10001,
},
None,
"alarmdecoder123:10001",
),
(
@@ -51,12 +50,11 @@ from tests.common import MockConfigEntry
CONF_DEVICE_PATH: "/dev/ttyUSB123",
CONF_DEVICE_BAUD: 115000,
},
115000,
"/dev/ttyUSB123",
),
],
)
async def test_setups(hass: HomeAssistant, protocol, connection, baud, title):
async def test_setups(hass: HomeAssistant, protocol, connection, title):
"""Test flow for setting up the available AlarmDecoder protocols."""
result = await hass.config_entries.flow.async_init(
@@ -90,7 +88,6 @@ async def test_setups(hass: HomeAssistant, protocol, connection, baud, title):
assert result["data"] == {
**connection,
CONF_PROTOCOL: protocol,
CONF_DEVICE_BAUD: baud,
}
await hass.async_block_till_done()
@@ -142,6 +139,9 @@ async def test_options_arm_flow(hass: HomeAssistant):
entry = MockConfigEntry(domain=DOMAIN)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
@@ -177,6 +177,9 @@ async def test_options_zone_flow(hass: HomeAssistant):
entry = MockConfigEntry(domain=DOMAIN)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM
@@ -250,6 +253,9 @@ async def test_options_zone_flow_validation(hass: HomeAssistant):
entry = MockConfigEntry(domain=DOMAIN)
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
result = await hass.config_entries.options.async_init(entry.entry_id)
assert result["type"] == data_entry_flow.RESULT_TYPE_FORM