1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-18 07:56:03 +01:00

Fix enable/disable device tracking feature during setup of FRITZ!Box Tools (#166027)

This commit is contained in:
Michael
2026-03-20 17:29:33 +01:00
committed by GitHub
parent 0c98bf2676
commit 184d834a91
2 changed files with 24 additions and 6 deletions

View File

@@ -283,6 +283,7 @@ class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
self._username = user_input[CONF_USERNAME] self._username = user_input[CONF_USERNAME]
self._password = user_input[CONF_PASSWORD] self._password = user_input[CONF_PASSWORD]
self._use_tls = user_input[CONF_SSL] self._use_tls = user_input[CONF_SSL]
self._feature_device_discovery = user_input[CONF_FEATURE_DEVICE_TRACKING]
self._port = self._determine_port(user_input) self._port = self._determine_port(user_input)

View File

@@ -57,7 +57,7 @@ from tests.common import MockConfigEntry
@pytest.mark.parametrize( @pytest.mark.parametrize(
("show_advanced_options", "user_input", "expected_config"), ("show_advanced_options", "user_input", "expected_config", "expected_options"),
[ [
( (
True, True,
@@ -69,6 +69,11 @@ from tests.common import MockConfigEntry
CONF_PORT: 1234, CONF_PORT: 1234,
CONF_SSL: False, CONF_SSL: False,
}, },
{
CONF_OLD_DISCOVERY: False,
CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME.total_seconds(),
CONF_FEATURE_DEVICE_TRACKING: True,
},
), ),
( (
False, False,
@@ -80,10 +85,19 @@ from tests.common import MockConfigEntry
CONF_PORT: 49000, CONF_PORT: 49000,
CONF_SSL: False, CONF_SSL: False,
}, },
{
CONF_OLD_DISCOVERY: False,
CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME.total_seconds(),
CONF_FEATURE_DEVICE_TRACKING: True,
},
), ),
( (
False, False,
{**MOCK_USER_INPUT_SIMPLE, CONF_SSL: True}, {
**MOCK_USER_INPUT_SIMPLE,
CONF_SSL: True,
CONF_FEATURE_DEVICE_TRACKING: False,
},
{ {
CONF_HOST: "fake_host", CONF_HOST: "fake_host",
CONF_PASSWORD: "fake_pass", CONF_PASSWORD: "fake_pass",
@@ -91,6 +105,11 @@ from tests.common import MockConfigEntry
CONF_PORT: 49443, CONF_PORT: 49443,
CONF_SSL: True, CONF_SSL: True,
}, },
{
CONF_OLD_DISCOVERY: False,
CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME.total_seconds(),
CONF_FEATURE_DEVICE_TRACKING: False,
},
), ),
], ],
) )
@@ -100,6 +119,7 @@ async def test_user(
show_advanced_options: bool, show_advanced_options: bool,
user_input: dict, user_input: dict,
expected_config: dict, expected_config: dict,
expected_options: dict,
) -> None: ) -> None:
"""Test starting a flow by user.""" """Test starting a flow by user."""
with ( with (
@@ -143,10 +163,7 @@ async def test_user(
) )
assert result["type"] is FlowResultType.CREATE_ENTRY assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["data"] == expected_config assert result["data"] == expected_config
assert ( assert result["options"] == expected_options
result["options"][CONF_CONSIDER_HOME]
== DEFAULT_CONSIDER_HOME.total_seconds()
)
assert not result["result"].unique_id assert not result["result"].unique_id
assert mock_setup_entry.called assert mock_setup_entry.called