Fix slow config_flow test in Twinkly (#60374)

This commit is contained in:
Michael 2021-11-26 00:00:37 +01:00 committed by GitHub
parent 16eb85bfc8
commit db0c82b88e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"