Ensure rainmachine creates config entry titles as strings (#70417)
This commit is contained in:
parent
e389beb1d1
commit
c7ff4baa6b
4 changed files with 7 additions and 5 deletions
|
@ -132,7 +132,7 @@ class RainMachineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
# access token without using the IP address and password, so we have to
|
# access token without using the IP address and password, so we have to
|
||||||
# store it:
|
# store it:
|
||||||
return self.async_create_entry(
|
return self.async_create_entry(
|
||||||
title=controller.name,
|
title=str(controller.name),
|
||||||
data={
|
data={
|
||||||
CONF_IP_ADDRESS: user_input[CONF_IP_ADDRESS],
|
CONF_IP_ADDRESS: user_input[CONF_IP_ADDRESS],
|
||||||
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
CONF_PASSWORD: user_input[CONF_PASSWORD],
|
||||||
|
|
|
@ -49,7 +49,9 @@ def controller_fixture(
|
||||||
controller = AsyncMock()
|
controller = AsyncMock()
|
||||||
controller.api_version = "4.5.0"
|
controller.api_version = "4.5.0"
|
||||||
controller.hardware_version = 3
|
controller.hardware_version = 3
|
||||||
controller.name = "My RainMachine"
|
# The api returns a controller with all numbers as numeric
|
||||||
|
# instead of a string
|
||||||
|
controller.name = 12345
|
||||||
controller.mac = controller_mac
|
controller.mac = controller_mac
|
||||||
controller.software_version = "4.0.925"
|
controller.software_version = "4.0.925"
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ async def test_step_user(hass, config, setup_rainmachine):
|
||||||
data=config,
|
data=config,
|
||||||
)
|
)
|
||||||
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
assert result["title"] == "My RainMachine"
|
assert result["title"] == "12345"
|
||||||
assert result["data"] == {
|
assert result["data"] == {
|
||||||
CONF_IP_ADDRESS: "192.168.1.100",
|
CONF_IP_ADDRESS: "192.168.1.100",
|
||||||
CONF_PASSWORD: "password",
|
CONF_PASSWORD: "password",
|
||||||
|
@ -232,7 +232,7 @@ async def test_step_homekit_zeroconf_new_controller_when_some_exist(
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
|
||||||
assert result2["title"] == "My RainMachine"
|
assert result2["title"] == "12345"
|
||||||
assert result2["data"] == {
|
assert result2["data"] == {
|
||||||
CONF_IP_ADDRESS: "192.168.1.100",
|
CONF_IP_ADDRESS: "192.168.1.100",
|
||||||
CONF_PASSWORD: "password",
|
CONF_PASSWORD: "password",
|
||||||
|
|
|
@ -585,7 +585,7 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_rainmach
|
||||||
"controller": {
|
"controller": {
|
||||||
"api_version": "4.5.0",
|
"api_version": "4.5.0",
|
||||||
"hardware_version": 3,
|
"hardware_version": 3,
|
||||||
"name": "My RainMachine",
|
"name": 12345,
|
||||||
"software_version": "4.0.925",
|
"software_version": "4.0.925",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue