1
mirror of https://github.com/home-assistant/core synced 2024-09-09 12:51:22 +02:00

Ensure rainmachine creates config entry titles as strings (#70417)

This commit is contained in:
J. Nick Koston 2022-04-22 03:58:19 -10:00 committed by GitHub
parent edffac82e9
commit cc3d6aa247
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -132,7 +132,7 @@ class RainMachineFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
# access token without using the IP address and password, so we have to
# store it:
return self.async_create_entry(
title=controller.name,
title=str(controller.name),
data={
CONF_IP_ADDRESS: user_input[CONF_IP_ADDRESS],
CONF_PASSWORD: user_input[CONF_PASSWORD],

View File

@ -49,7 +49,9 @@ def controller_fixture(
controller = AsyncMock()
controller.api_version = "4.5.0"
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.software_version = "4.0.925"

View File

@ -124,7 +124,7 @@ async def test_step_user(hass, config, setup_rainmachine):
data=config,
)
assert result["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result["title"] == "My RainMachine"
assert result["title"] == "12345"
assert result["data"] == {
CONF_IP_ADDRESS: "192.168.1.100",
CONF_PASSWORD: "password",
@ -232,7 +232,7 @@ async def test_step_homekit_zeroconf_new_controller_when_some_exist(
await hass.async_block_till_done()
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert result2["title"] == "My RainMachine"
assert result2["title"] == "12345"
assert result2["data"] == {
CONF_IP_ADDRESS: "192.168.1.100",
CONF_PASSWORD: "password",

View File

@ -585,7 +585,7 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_rainmach
"controller": {
"api_version": "4.5.0",
"hardware_version": 3,
"name": "My RainMachine",
"name": 12345,
"software_version": "4.0.925",
},
},