Bump velbus-aio to 2022.12.0 (#83278)
* Add support for fututre config entry migrations * Add testcase * dir check bug * rework the migrate testcase * implement comments * Missed this part of the file * Fix and clean tests * add more into the testcase * push sugestions * Upgrade velbusaio to add version 2 support * more comments Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
d51f483855
commit
fdf2f8a2ea
8 changed files with 70 additions and 15 deletions
|
@ -1,4 +1,5 @@
|
|||
"""Tests for the Velbus config flow."""
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
@ -36,8 +37,18 @@ def com_port():
|
|||
return port
|
||||
|
||||
|
||||
@pytest.fixture(name="controller")
|
||||
def mock_controller() -> Generator[MagicMock, None, None]:
|
||||
"""Mock a successful velbus controller."""
|
||||
with patch(
|
||||
"homeassistant.components.velbus.config_flow.velbusaio.controller.Velbus",
|
||||
autospec=True,
|
||||
) as controller:
|
||||
yield controller
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def override_async_setup_entry() -> AsyncMock:
|
||||
def override_async_setup_entry() -> Generator[AsyncMock, None, None]:
|
||||
"""Override async_setup_entry."""
|
||||
with patch(
|
||||
"homeassistant.components.velbus.async_setup_entry", return_value=True
|
||||
|
@ -74,6 +85,7 @@ async def test_user(hass: HomeAssistant):
|
|||
assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == "velbus_test_serial"
|
||||
data = result.get("data")
|
||||
assert data
|
||||
assert data[CONF_PORT] == PORT_SERIAL
|
||||
|
||||
# try with a ip:port combination
|
||||
|
@ -86,6 +98,7 @@ async def test_user(hass: HomeAssistant):
|
|||
assert result.get("type") == data_entry_flow.FlowResultType.CREATE_ENTRY
|
||||
assert result.get("title") == "velbus_test_tcp"
|
||||
data = result.get("data")
|
||||
assert data
|
||||
assert data[CONF_PORT] == PORT_TCP
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue