mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Force int value on port in P1Monitor (#130084)
This commit is contained in:
parent
c4762f3ff4
commit
2dc81ed866
@ -57,10 +57,13 @@ class P1MonitorFlowHandler(ConfigFlow, domain=DOMAIN):
|
|||||||
data_schema=vol.Schema(
|
data_schema=vol.Schema(
|
||||||
{
|
{
|
||||||
vol.Required(CONF_HOST): TextSelector(),
|
vol.Required(CONF_HOST): TextSelector(),
|
||||||
vol.Required(CONF_PORT, default=80): NumberSelector(
|
vol.Required(CONF_PORT, default=80): vol.All(
|
||||||
NumberSelectorConfig(
|
NumberSelector(
|
||||||
mode=NumberSelectorMode.BOX,
|
NumberSelectorConfig(
|
||||||
)
|
min=1, max=65535, mode=NumberSelectorMode.BOX
|
||||||
|
),
|
||||||
|
),
|
||||||
|
vol.Coerce(int),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
@ -36,6 +36,7 @@ async def test_full_user_flow(hass: HomeAssistant) -> None:
|
|||||||
assert result2.get("type") is FlowResultType.CREATE_ENTRY
|
assert result2.get("type") is FlowResultType.CREATE_ENTRY
|
||||||
assert result2.get("title") == "P1 Monitor"
|
assert result2.get("title") == "P1 Monitor"
|
||||||
assert result2.get("data") == {CONF_HOST: "example.com", CONF_PORT: 80}
|
assert result2.get("data") == {CONF_HOST: "example.com", CONF_PORT: 80}
|
||||||
|
assert isinstance(result2["data"][CONF_PORT], int)
|
||||||
|
|
||||||
assert len(mock_setup_entry.mock_calls) == 1
|
assert len(mock_setup_entry.mock_calls) == 1
|
||||||
assert len(mock_p1monitor.mock_calls) == 1
|
assert len(mock_p1monitor.mock_calls) == 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user