Fix flaky SRP_Energy test (#45471)

This commit is contained in:
Paulus Schoutsen 2021-01-23 19:53:45 +01:00 committed by GitHub
parent 0930aae208
commit eb339b9793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,7 +18,14 @@ async def test_form(hass):
assert result["errors"] == {}
# Fill submit form data for config entry
with patch("homeassistant.components.srp_energy.config_flow.SrpEnergyClient"):
with patch(
"homeassistant.components.srp_energy.config_flow.SrpEnergyClient"
), patch(
"homeassistant.components.srp_energy.async_setup", return_value=True
) as mock_setup, patch(
"homeassistant.components.srp_energy.async_setup_entry",
return_value=True,
) as mock_setup_entry:
result = await hass.config_entries.flow.async_configure(
result["flow_id"],
@ -29,6 +36,9 @@ async def test_form(hass):
assert result["title"] == "Test"
assert result["data"][CONF_IS_TOU] is False
assert len(mock_setup.mock_calls) == 1
assert len(mock_setup_entry.mock_calls) == 1
async def test_form_invalid_auth(hass):
"""Test user config with invalid auth."""