Cleanup log style and tests for ElkM1 (#42353)
This commit is contained in:
parent
8f74a0c2e6
commit
6645cb2637
2 changed files with 5 additions and 7 deletions
|
@ -313,10 +313,10 @@ async def async_wait_for_elk_to_sync(elk, timeout, conf_host):
|
|||
|
||||
success = succeeded
|
||||
if succeeded:
|
||||
_LOGGER.info("ElkM1 login succeeded.")
|
||||
_LOGGER.debug("ElkM1 login succeeded")
|
||||
else:
|
||||
elk.disconnect()
|
||||
_LOGGER.error("ElkM1 login failed; invalid username or password.")
|
||||
_LOGGER.error("ElkM1 login failed; invalid username or password")
|
||||
event.set()
|
||||
|
||||
def sync_complete():
|
||||
|
@ -332,7 +332,7 @@ async def async_wait_for_elk_to_sync(elk, timeout, conf_host):
|
|||
except asyncio.TimeoutError:
|
||||
_LOGGER.error(
|
||||
"Timed out after %d seconds while trying to sync with ElkM1 at %s",
|
||||
SYNC_TIMEOUT,
|
||||
timeout,
|
||||
conf_host,
|
||||
)
|
||||
elk.disconnect()
|
||||
|
|
|
@ -163,8 +163,6 @@ async def test_form_user_with_serial_elk(hass):
|
|||
|
||||
async def test_form_cannot_connect(hass):
|
||||
"""Test we handle cannot connect error."""
|
||||
from asyncio import TimeoutError
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
|
@ -175,8 +173,8 @@ async def test_form_cannot_connect(hass):
|
|||
"homeassistant.components.elkm1.config_flow.elkm1.Elk",
|
||||
return_value=mocked_elk,
|
||||
), patch(
|
||||
"homeassistant.components.elkm1.async_timeout.timeout",
|
||||
side_effect=TimeoutError,
|
||||
"homeassistant.components.elkm1.config_flow.VALIDATE_TIMEOUT",
|
||||
0,
|
||||
):
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
|
|
Loading…
Add table
Reference in a new issue