Fix flaky huawei test (#41204)

This commit is contained in:
Paulus Schoutsen 2020-10-04 15:24:07 +02:00 committed by GitHub
parent e97792adf0
commit e2921475e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@ from homeassistant.const import (
CONF_USERNAME,
)
from tests.async_mock import patch
from tests.common import MockConfigEntry
FIXTURE_USER_INPUT = {
@ -140,9 +141,15 @@ async def test_success(hass, login_requests_mock):
f"{FIXTURE_USER_INPUT[CONF_URL]}api/user/login",
text="<response>OK</response>",
)
result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT
)
with patch("homeassistant.components.huawei_lte.async_setup"), patch(
"homeassistant.components.huawei_lte.async_setup_entry"
):
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data=FIXTURE_USER_INPUT,
)
await hass.async_block_till_done()
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["data"][CONF_URL] == FIXTURE_USER_INPUT[CONF_URL]