Fix modern_forms config flow test logic (#130491)
parent
3c3a6dff04
commit
821f9b8a41
|
@ -62,7 +62,9 @@ async def init_integration(
|
|||
)
|
||||
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN, data={CONF_HOST: "192.168.1.123", CONF_MAC: "AA:BB:CC:DD:EE:FF"}
|
||||
domain=DOMAIN,
|
||||
data={CONF_HOST: "192.168.1.123", CONF_MAC: "AA:BB:CC:DD:EE:FF"},
|
||||
unique_id="AA:BB:CC:DD:EE:FF",
|
||||
)
|
||||
|
||||
entry.add_to_hass(hass)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
'pref_disable_polling': False,
|
||||
'source': 'user',
|
||||
'title': 'Mock Title',
|
||||
'unique_id': None,
|
||||
'unique_id': 'AA:BB:CC:DD:EE:FF',
|
||||
'version': 1,
|
||||
}),
|
||||
'device': dict({
|
||||
|
|
|
@ -113,7 +113,11 @@ async def test_connection_error(
|
|||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={CONF_HOST: "example.com"},
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_HOST: "example.com"},
|
||||
)
|
||||
|
||||
assert result.get("type") is FlowResultType.FORM
|
||||
|
@ -193,24 +197,14 @@ async def test_user_device_exists_abort(
|
|||
|
||||
await init_integration(hass, aioclient_mock, skip_setup=True)
|
||||
|
||||
await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={
|
||||
"host": "192.168.1.123",
|
||||
"hostname": "example.local.",
|
||||
"properties": {CONF_MAC: "AA:BB:CC:DD:EE:FF"},
|
||||
},
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={
|
||||
"host": "192.168.1.123",
|
||||
"hostname": "example.local.",
|
||||
"properties": {CONF_MAC: "AA:BB:CC:DD:EE:FF"},
|
||||
},
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={CONF_HOST: "192.168.1.123"},
|
||||
)
|
||||
|
||||
assert result.get("type") is FlowResultType.ABORT
|
||||
|
@ -223,16 +217,6 @@ async def test_zeroconf_with_mac_device_exists_abort(
|
|||
"""Test we abort zeroconf flow if a Modern Forms device already configured."""
|
||||
await init_integration(hass, aioclient_mock, skip_setup=True)
|
||||
|
||||
await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_USER},
|
||||
data={
|
||||
"host": "192.168.1.123",
|
||||
"hostname": "example.local.",
|
||||
"properties": {CONF_MAC: "AA:BB:CC:DD:EE:FF"},
|
||||
},
|
||||
)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={"source": SOURCE_ZEROCONF},
|
||||
|
|
Loading…
Reference in New Issue