Ensure frontier_silicon config flow title_placeholders items are [str, str] (#127197)
This commit is contained in:
parent
375d47ee3a
commit
47985a589e
2 changed files with 10 additions and 2 deletions
|
@ -101,8 +101,9 @@ class FrontierSiliconConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||||
if device_hostname == hostname_from_url(entry.data[CONF_WEBFSAPI_URL]):
|
if device_hostname == hostname_from_url(entry.data[CONF_WEBFSAPI_URL]):
|
||||||
return self.async_abort(reason="already_configured")
|
return self.async_abort(reason="already_configured")
|
||||||
|
|
||||||
speaker_name = discovery_info.ssdp_headers.get(SSDP_ATTR_SPEAKER_NAME)
|
if speaker_name := discovery_info.ssdp_headers.get(SSDP_ATTR_SPEAKER_NAME):
|
||||||
self.context["title_placeholders"] = {"name": speaker_name}
|
# If we have a name, use it as flow title
|
||||||
|
self.context["title_placeholders"] = {"name": speaker_name}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._webfsapi_url = await AFSAPI.get_webfsapi_endpoint(device_url)
|
self._webfsapi_url = await AFSAPI.get_webfsapi_endpoint(device_url)
|
||||||
|
|
|
@ -26,6 +26,7 @@ MOCK_DISCOVERY = ssdp.SsdpServiceInfo(
|
||||||
ssdp_udn="uuid:3dcc7100-f76c-11dd-87af-00226124ca30",
|
ssdp_udn="uuid:3dcc7100-f76c-11dd-87af-00226124ca30",
|
||||||
ssdp_st="mock_st",
|
ssdp_st="mock_st",
|
||||||
ssdp_location="http://1.1.1.1/device",
|
ssdp_location="http://1.1.1.1/device",
|
||||||
|
ssdp_headers={"SPEAKER-NAME": "Speaker Name"},
|
||||||
upnp={"SPEAKER-NAME": "Speaker Name"},
|
upnp={"SPEAKER-NAME": "Speaker Name"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ INVALID_MOCK_DISCOVERY = ssdp.SsdpServiceInfo(
|
||||||
ssdp_udn="uuid:3dcc7100-f76c-11dd-87af-00226124ca30",
|
ssdp_udn="uuid:3dcc7100-f76c-11dd-87af-00226124ca30",
|
||||||
ssdp_st="mock_st",
|
ssdp_st="mock_st",
|
||||||
ssdp_location=None,
|
ssdp_location=None,
|
||||||
|
ssdp_headers={"SPEAKER-NAME": "Speaker Name"},
|
||||||
upnp={"SPEAKER-NAME": "Speaker Name"},
|
upnp={"SPEAKER-NAME": "Speaker Name"},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -268,6 +270,11 @@ async def test_ssdp(
|
||||||
assert result["type"] is FlowResultType.FORM
|
assert result["type"] is FlowResultType.FORM
|
||||||
assert result["step_id"] == "confirm"
|
assert result["step_id"] == "confirm"
|
||||||
|
|
||||||
|
flows = hass.config_entries.flow.async_progress()
|
||||||
|
assert len(flows) == 1
|
||||||
|
flow = flows[0]
|
||||||
|
assert flow["context"]["title_placeholders"] == {"name": "Speaker Name"}
|
||||||
|
|
||||||
result2 = await hass.config_entries.flow.async_configure(
|
result2 = await hass.config_entries.flow.async_configure(
|
||||||
result["flow_id"],
|
result["flow_id"],
|
||||||
{},
|
{},
|
||||||
|
|
Loading…
Add table
Reference in a new issue