Add missing string to tedee plus test (#130081)
parent
3062bad19e
commit
5d5908a03f
|
@ -38,7 +38,8 @@
|
|||
"abort": {
|
||||
"already_configured": "[%key:common::config_flow::abort::already_configured_device%]",
|
||||
"reauth_successful": "[%key:common::config_flow::abort::reauth_successful%]",
|
||||
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]"
|
||||
"reconfigure_successful": "[%key:common::config_flow::abort::reconfigure_successful%]",
|
||||
"unique_id_mismatch": "You selected a different bridge than the one this config entry was configured with, this is not allowed."
|
||||
},
|
||||
"error": {
|
||||
"invalid_api_key": "[%key:common::config_flow::error::invalid_api_key%]",
|
||||
|
|
|
@ -7,10 +7,11 @@ from pytedee_async import (
|
|||
TedeeDataUpdateException,
|
||||
TedeeLocalAuthException,
|
||||
)
|
||||
from pytedee_async.bridge import TedeeBridge
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.tedee.const import CONF_LOCAL_ACCESS_TOKEN, DOMAIN
|
||||
from homeassistant.config_entries import SOURCE_USER
|
||||
from homeassistant.config_entries import SOURCE_USER, ConfigFlowResult
|
||||
from homeassistant.const import CONF_HOST, CONF_WEBHOOK_ID
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
@ -134,11 +135,10 @@ async def test_reauth_flow(
|
|||
assert result["reason"] == "reauth_successful"
|
||||
|
||||
|
||||
async def test_reconfigure_flow(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_tedee: MagicMock
|
||||
) -> None:
|
||||
"""Test that the reconfigure flow works."""
|
||||
|
||||
async def __do_reconfigure_flow(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||
) -> ConfigFlowResult:
|
||||
"""Initialize a reconfigure flow."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
reconfigure_result = await mock_config_entry.start_reconfigure_flow(hass)
|
||||
|
@ -146,11 +146,19 @@ async def test_reconfigure_flow(
|
|||
assert reconfigure_result["type"] is FlowResultType.FORM
|
||||
assert reconfigure_result["step_id"] == "reconfigure"
|
||||
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
return await hass.config_entries.flow.async_configure(
|
||||
reconfigure_result["flow_id"],
|
||||
{CONF_LOCAL_ACCESS_TOKEN: LOCAL_ACCESS_TOKEN, CONF_HOST: "192.168.1.43"},
|
||||
)
|
||||
|
||||
|
||||
async def test_reconfigure_flow(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_tedee: MagicMock
|
||||
) -> None:
|
||||
"""Test that the reconfigure flow works."""
|
||||
|
||||
result = await __do_reconfigure_flow(hass, mock_config_entry)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "reconfigure_successful"
|
||||
|
||||
|
@ -162,3 +170,18 @@ async def test_reconfigure_flow(
|
|||
CONF_LOCAL_ACCESS_TOKEN: LOCAL_ACCESS_TOKEN,
|
||||
CONF_WEBHOOK_ID: WEBHOOK_ID,
|
||||
}
|
||||
|
||||
|
||||
async def test_reconfigure_unique_id_mismatch(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_tedee: MagicMock
|
||||
) -> None:
|
||||
"""Ensure reconfigure flow aborts when the bride changes."""
|
||||
|
||||
mock_tedee.get_local_bridge.return_value = TedeeBridge(
|
||||
0, "1111-1111", "Bridge-R2D2"
|
||||
)
|
||||
|
||||
result = await __do_reconfigure_flow(hass, mock_config_entry)
|
||||
|
||||
assert result["type"] is FlowResultType.ABORT
|
||||
assert result["reason"] == "unique_id_mismatch"
|
||||
|
|
Loading…
Reference in New Issue