Fix slow config_flow test in Twinkly (#60374)
This commit is contained in:
parent
16eb85bfc8
commit
db0c82b88e
1 changed files with 14 additions and 13 deletions
|
@ -11,23 +11,24 @@ from homeassistant.components.twinkly.const import (
|
||||||
DOMAIN as TWINKLY_DOMAIN,
|
DOMAIN as TWINKLY_DOMAIN,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.components.twinkly import TEST_MODEL, ClientMock
|
from . import TEST_MODEL, ClientMock
|
||||||
|
|
||||||
|
|
||||||
async def test_invalid_host(hass):
|
async def test_invalid_host(hass):
|
||||||
"""Test the failure when invalid host provided."""
|
"""Test the failure when invalid host provided."""
|
||||||
result = await hass.config_entries.flow.async_init(
|
client = ClientMock()
|
||||||
TWINKLY_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
client.is_offline = True
|
||||||
)
|
with patch("twinkly_client.TwinklyClient", return_value=client):
|
||||||
|
result = await hass.config_entries.flow.async_init(
|
||||||
assert result["type"] == "form"
|
TWINKLY_DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||||
assert result["step_id"] == "user"
|
)
|
||||||
assert result["errors"] == {}
|
assert result["type"] == "form"
|
||||||
|
assert result["step_id"] == "user"
|
||||||
result = await hass.config_entries.flow.async_configure(
|
assert result["errors"] == {}
|
||||||
result["flow_id"],
|
result = await hass.config_entries.flow.async_configure(
|
||||||
{CONF_ENTRY_HOST: "dummy"},
|
result["flow_id"],
|
||||||
)
|
{CONF_ENTRY_HOST: "dummy"},
|
||||||
|
)
|
||||||
|
|
||||||
assert result["type"] == "form"
|
assert result["type"] == "form"
|
||||||
assert result["step_id"] == "user"
|
assert result["step_id"] == "user"
|
||||||
|
|
Loading…
Add table
Reference in a new issue