hass-core/tests/components/risco/test_init.py
FredericMa d4c5a93b63
Add Risco communication delay (#101349)
* Add optional communication delay in case a panel responds slow.

* Add migration test

* Connect by increasing the communication delay

* Update init to use option instead of config

* Updated strings

* Fix migration and tests

* Review changes

* Update connect strategy

* Update tests

* Changes after review

* Change typing from object to Any.

* Add test to validate communication delay update.

* Move test to separate file

* Change filename.
2023-11-13 12:24:20 +01:00

21 lines
807 B
Python

"""Tests for the Risco initialization."""
import pytest
from homeassistant.components.risco import CannotConnectError
from homeassistant.components.risco.const import CONF_COMMUNICATION_DELAY
from homeassistant.core import HomeAssistant
@pytest.mark.parametrize("exception", [CannotConnectError])
async def test_single_error_on_connect(
hass: HomeAssistant, connect_with_single_error, local_config_entry
) -> None:
"""Test single error on connect to validate communication delay update from 0 (default) to 1."""
expected_data = {
**local_config_entry.data,
**{"type": "local", CONF_COMMUNICATION_DELAY: 1},
}
await hass.config_entries.async_setup(local_config_entry.entry_id)
await hass.async_block_till_done()
assert local_config_entry.data == expected_data