Complete removal of auto_start, zeroconf_default_interface, and safe_mode from HomeKit (#58320)

This commit is contained in:
J. Nick Koston
2021-10-23 23:46:35 -10:00
committed by GitHub
parent 31aa168bbb
commit 438ca73aba
5 changed files with 17 additions and 122 deletions

View File

@@ -1,8 +1,6 @@
"""Test the HomeKit config flow."""
from unittest.mock import patch
import pytest
from homeassistant import config_entries, data_entry_flow
from homeassistant.components.homekit.const import DOMAIN, SHORT_BRIDGE_NAME
from homeassistant.config_entries import SOURCE_IGNORE, SOURCE_IMPORT
@@ -273,8 +271,7 @@ async def test_import(hass, mock_get_source_ip):
assert len(mock_setup_entry.mock_calls) == 2
@pytest.mark.parametrize("auto_start", [True, False])
async def test_options_flow_exclude_mode_advanced(auto_start, hass, mock_get_source_ip):
async def test_options_flow_exclude_mode_advanced(hass, mock_get_source_ip):
"""Test config flow options in exclude mode with advanced options."""
config_entry = _mock_config_entry_with_options_populated()
@@ -308,12 +305,11 @@ async def test_options_flow_exclude_mode_advanced(auto_start, hass, mock_get_sou
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result3 = await hass.config_entries.options.async_configure(
result2["flow_id"],
user_input={"auto_start": auto_start},
user_input={},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": auto_start,
"devices": [],
"mode": "bridge",
"filter": {
@@ -355,7 +351,6 @@ async def test_options_flow_exclude_mode_basic(hass, mock_get_source_ip):
)
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
"filter": {
"exclude_domains": [],
@@ -412,12 +407,11 @@ async def test_options_flow_devices(
with patch("homeassistant.components.homekit.async_setup_entry", return_value=True):
result3 = await hass.config_entries.options.async_configure(
result2["flow_id"],
user_input={"auto_start": True, "devices": [device_id]},
user_input={"devices": [device_id]},
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"devices": [device_id],
"mode": "bridge",
"filter": {
@@ -486,7 +480,6 @@ async def test_options_flow_devices_preserved_when_advanced_off(
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"devices": ["1fabcabcabcabcabcabcabcabcabc"],
"mode": "bridge",
"filter": {
@@ -530,7 +523,6 @@ async def test_options_flow_include_mode_basic(hass, mock_get_source_ip):
)
assert result2["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
"filter": {
"exclude_domains": [],
@@ -586,7 +578,6 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
"filter": {
"exclude_domains": [],
@@ -632,7 +623,6 @@ async def test_options_flow_exclude_mode_with_cameras(hass, mock_get_source_ip):
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
"filter": {
"exclude_domains": [],
@@ -689,7 +679,6 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
"filter": {
"exclude_domains": [],
@@ -762,7 +751,6 @@ async def test_options_flow_include_mode_with_cameras(hass, mock_get_source_ip):
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"entity_config": {"camera.native_h264": {}},
"filter": {
"exclude_domains": [],
@@ -819,7 +807,6 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "bridge",
"filter": {
"exclude_domains": [],
@@ -892,7 +879,6 @@ async def test_options_flow_with_camera_audio(hass, mock_get_source_ip):
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"entity_config": {"camera.audio": {}},
"filter": {
"exclude_domains": [],
@@ -911,7 +897,6 @@ async def test_options_flow_blocked_when_from_yaml(hass, mock_get_source_ip):
domain=DOMAIN,
data={CONF_NAME: "mock_name", CONF_PORT: 12345},
options={
"auto_start": True,
"devices": [],
"filter": {
"include_domains": [
@@ -988,7 +973,6 @@ async def test_options_flow_include_mode_basic_accessory(hass, mock_get_source_i
)
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"mode": "accessory",
"filter": {
"exclude_domains": [],
@@ -1093,7 +1077,6 @@ async def test_converting_bridge_to_accessory_mode(hass, hk_driver, mock_get_sou
assert result3["type"] == data_entry_flow.RESULT_TYPE_CREATE_ENTRY
assert config_entry.options == {
"auto_start": True,
"entity_config": {"camera.tv": {"video_codec": "copy"}},
"mode": "accessory",
"filter": {