0.106 Beta - provide correctly formatted placeholders (#32119)

This commit is contained in:
Kit Klein authored and GitHub committed 2020-02-23 13:54:18 -08:00
1 parent 524a1a7587
commit d2d788631e
3 files changed
+92 -5

No files matched your search

@@ -597,6 +597,9 @@ async def test_option_flow(hass, mock_panel):
)
assert result["type"] == "form"
assert result["step_id"] == "options_binary"
assert result["description_placeholders"] == {
"zone": "Zone 2",
}
# zone 2
result = await hass.config_entries.options.async_configure(
@@ -604,6 +607,9 @@ async def test_option_flow(hass, mock_panel):
)
assert result["type"] == "form"
assert result["step_id"] == "options_binary"
assert result["description_placeholders"] == {
"zone": "Zone 6",
}
# zone 6
result = await hass.config_entries.options.async_configure(
@@ -612,6 +618,9 @@ async def test_option_flow(hass, mock_panel):
)
assert result["type"] == "form"
assert result["step_id"] == "options_digital"
assert result["description_placeholders"] == {
"zone": "Zone 3",
}
# zone 3
result = await hass.config_entries.options.async_configure(
@@ -619,6 +628,9 @@ async def test_option_flow(hass, mock_panel):
)
assert result["type"] == "form"
assert result["step_id"] == "options_switch"
assert result["description_placeholders"] == {
"zone": "Zone 4",
}
# zone 4
result = await hass.config_entries.options.async_configure(
@@ -626,6 +638,9 @@ async def test_option_flow(hass, mock_panel):
)
assert result["type"] == "form"
assert result["step_id"] == "options_switch"
assert result["description_placeholders"] == {
"zone": "OUT",
}
# zone out
result = await hass.config_entries.options.async_configure(
+68
View File
@@ -250,6 +250,74 @@ async def test_setup_defined_hosts_no_known_auth(hass):
assert len(hass.config_entries.flow.async_progress()) == 1
async def test_setup_multiple(hass):
"""Test we initiate config entry for multiple panels."""
assert (
await async_setup_component(
hass,
konnected.DOMAIN,
{
konnected.DOMAIN: {
konnected.CONF_ACCESS_TOKEN: "arandomstringvalue",
konnected.CONF_API_HOST: "http://192.168.86.32:8123",
konnected.CONF_DEVICES: [
{
konnected.CONF_ID: "aabbccddeeff",
"binary_sensors": [
{
"zone": 4,
"type": "motion",
"name": "Hallway Motion",
},
{
"zone": 5,
"type": "window",
"name": "Master Bedroom Window",
},
{
"zone": 6,
"type": "window",
"name": "Downstairs Windows",
},
],
"switches": [{"zone": "out", "name": "siren"}],
},
{
konnected.CONF_ID: "445566778899",
"binary_sensors": [
{"zone": 1, "type": "motion", "name": "Front"},
{"zone": 2, "type": "window", "name": "Back"},
],
"switches": [
{
"zone": "out",
"name": "Buzzer",
"momentary": 65,
"pause": 55,
"repeat": 4,
},
],
},
],
}
},
)
is True
)
# Flow started for discovered bridge
assert len(hass.config_entries.flow.async_progress()) == 2
# Globals saved
assert (
hass.data[konnected.DOMAIN][konnected.CONF_ACCESS_TOKEN] == "arandomstringvalue"
)
assert (
hass.data[konnected.DOMAIN][konnected.CONF_API_HOST]
== "http://192.168.86.32:8123"
)
async def test_config_passed_to_config_entry(hass):
"""Test that configured options for a host are loaded via config entry."""
entry = MockConfigEntry(