Bump zeroconf to 0.37.0 (#59932)
This commit is contained in:
parent
4598353315
commit
347c4ea137
14 changed files with 106 additions and 60 deletions
|
@ -2,7 +2,7 @@
|
||||||
"domain": "zeroconf",
|
"domain": "zeroconf",
|
||||||
"name": "Zero-configuration networking (zeroconf)",
|
"name": "Zero-configuration networking (zeroconf)",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/zeroconf",
|
"documentation": "https://www.home-assistant.io/integrations/zeroconf",
|
||||||
"requirements": ["zeroconf==0.36.13"],
|
"requirements": ["zeroconf==0.37.0"],
|
||||||
"dependencies": ["network", "api"],
|
"dependencies": ["network", "api"],
|
||||||
"codeowners": ["@bdraco"],
|
"codeowners": ["@bdraco"],
|
||||||
"quality_scale": "internal",
|
"quality_scale": "internal",
|
||||||
|
|
|
@ -33,7 +33,7 @@ sqlalchemy==1.4.26
|
||||||
voluptuous-serialize==2.4.0
|
voluptuous-serialize==2.4.0
|
||||||
voluptuous==0.12.2
|
voluptuous==0.12.2
|
||||||
yarl==1.6.3
|
yarl==1.6.3
|
||||||
zeroconf==0.36.13
|
zeroconf==0.37.0
|
||||||
|
|
||||||
pycryptodome>=3.6.6
|
pycryptodome>=3.6.6
|
||||||
|
|
||||||
|
|
|
@ -2471,7 +2471,7 @@ youtube_dl==2021.06.06
|
||||||
zengge==0.2
|
zengge==0.2
|
||||||
|
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.36.13
|
zeroconf==0.37.0
|
||||||
|
|
||||||
# homeassistant.components.zha
|
# homeassistant.components.zha
|
||||||
zha-quirks==0.0.63
|
zha-quirks==0.0.63
|
||||||
|
|
|
@ -1451,7 +1451,7 @@ yeelight==0.7.8
|
||||||
youless-api==0.15
|
youless-api==0.15
|
||||||
|
|
||||||
# homeassistant.components.zeroconf
|
# homeassistant.components.zeroconf
|
||||||
zeroconf==0.36.13
|
zeroconf==0.37.0
|
||||||
|
|
||||||
# homeassistant.components.zha
|
# homeassistant.components.zha
|
||||||
zha-quirks==0.0.63
|
zha-quirks==0.0.63
|
||||||
|
|
8
tests/components/bosch_shc/conftest.py
Normal file
8
tests/components/bosch_shc/conftest.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
"""bosch_shc session fixtures."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def bosch_shc_mock_async_zeroconf(mock_async_zeroconf):
|
||||||
|
"""Auto mock zeroconf."""
|
8
tests/components/default_config/conftest.py
Normal file
8
tests/components/default_config/conftest.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
"""default_config session fixtures."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def default_config_mock_async_zeroconf(mock_async_zeroconf):
|
||||||
|
"""Auto mock zeroconf."""
|
|
@ -31,3 +31,8 @@ def patch_mydevolo(request):
|
||||||
return_value=["1400000000000001", "1400000000000002"],
|
return_value=["1400000000000001", "1400000000000002"],
|
||||||
):
|
):
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def devolo_home_control_mock_async_zeroconf(mock_async_zeroconf):
|
||||||
|
"""Auto mock zeroconf."""
|
||||||
|
|
|
@ -39,3 +39,8 @@ def mock_validate_input():
|
||||||
return_value=info,
|
return_value=info,
|
||||||
):
|
):
|
||||||
yield info
|
yield info
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def devolo_home_network_mock_async_zeroconf(mock_async_zeroconf):
|
||||||
|
"""Auto mock zeroconf."""
|
||||||
|
|
8
tests/components/esphome/conftest.py
Normal file
8
tests/components/esphome/conftest.py
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
"""esphome session fixtures."""
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def esphome_mock_async_zeroconf(mock_async_zeroconf):
|
||||||
|
"""Auto mock zeroconf."""
|
|
@ -362,7 +362,13 @@ async def test_options_flow_exclude_mode_basic(hass, mock_get_source_ip):
|
||||||
|
|
||||||
|
|
||||||
async def test_options_flow_devices(
|
async def test_options_flow_devices(
|
||||||
mock_hap, hass, demo_cleanup, device_reg, entity_reg, mock_get_source_ip
|
mock_hap,
|
||||||
|
hass,
|
||||||
|
demo_cleanup,
|
||||||
|
device_reg,
|
||||||
|
entity_reg,
|
||||||
|
mock_get_source_ip,
|
||||||
|
mock_async_zeroconf,
|
||||||
):
|
):
|
||||||
"""Test devices can be bridged."""
|
"""Test devices can be bridged."""
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
|
@ -441,7 +447,7 @@ async def test_options_flow_devices(
|
||||||
|
|
||||||
|
|
||||||
async def test_options_flow_devices_preserved_when_advanced_off(
|
async def test_options_flow_devices_preserved_when_advanced_off(
|
||||||
mock_hap, hass, mock_get_source_ip
|
mock_hap, hass, mock_get_source_ip, mock_async_zeroconf
|
||||||
):
|
):
|
||||||
"""Test devices are preserved if they were added in advanced mode but it was turned off."""
|
"""Test devices are preserved if they were added in advanced mode but it was turned off."""
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
|
|
|
@ -142,7 +142,7 @@ def _mock_pyhap_bridge():
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_setup_min(hass, mock_zeroconf):
|
async def test_setup_min(hass, mock_async_zeroconf):
|
||||||
"""Test async_setup with min config options."""
|
"""Test async_setup with min config options."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -181,7 +181,7 @@ async def test_setup_min(hass, mock_zeroconf):
|
||||||
assert mock_homekit().async_start.called is True
|
assert mock_homekit().async_start.called is True
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_setup(hass, hk_driver, mock_zeroconf):
|
async def test_homekit_setup(hass, hk_driver, mock_async_zeroconf):
|
||||||
"""Test setup of bridge and driver."""
|
"""Test setup of bridge and driver."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
|
@ -226,7 +226,7 @@ async def test_homekit_setup(hass, hk_driver, mock_zeroconf):
|
||||||
assert homekit.driver.safe_mode is False
|
assert homekit.driver.safe_mode is False
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_setup_ip_address(hass, hk_driver, mock_zeroconf):
|
async def test_homekit_setup_ip_address(hass, hk_driver, mock_async_zeroconf):
|
||||||
"""Test setup with given IP address."""
|
"""Test setup with given IP address."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
|
@ -247,11 +247,10 @@ async def test_homekit_setup_ip_address(hass, hk_driver, mock_zeroconf):
|
||||||
entry_title=entry.title,
|
entry_title=entry.title,
|
||||||
)
|
)
|
||||||
|
|
||||||
mock_zeroconf = MagicMock()
|
|
||||||
path = get_persist_fullpath_for_entry_id(hass, entry.entry_id)
|
path = get_persist_fullpath_for_entry_id(hass, entry.entry_id)
|
||||||
uuid = await hass.helpers.instance_id.async_get()
|
uuid = await hass.helpers.instance_id.async_get()
|
||||||
with patch(f"{PATH_HOMEKIT}.HomeDriver", return_value=hk_driver) as mock_driver:
|
with patch(f"{PATH_HOMEKIT}.HomeDriver", return_value=hk_driver) as mock_driver:
|
||||||
await hass.async_add_executor_job(homekit.setup, mock_zeroconf, uuid)
|
await hass.async_add_executor_job(homekit.setup, mock_async_zeroconf, uuid)
|
||||||
mock_driver.assert_called_with(
|
mock_driver.assert_called_with(
|
||||||
hass,
|
hass,
|
||||||
entry.entry_id,
|
entry.entry_id,
|
||||||
|
@ -262,12 +261,12 @@ async def test_homekit_setup_ip_address(hass, hk_driver, mock_zeroconf):
|
||||||
port=DEFAULT_PORT,
|
port=DEFAULT_PORT,
|
||||||
persist_file=path,
|
persist_file=path,
|
||||||
advertised_address=None,
|
advertised_address=None,
|
||||||
async_zeroconf_instance=mock_zeroconf,
|
async_zeroconf_instance=mock_async_zeroconf,
|
||||||
zeroconf_server=f"{uuid}-hap.local.",
|
zeroconf_server=f"{uuid}-hap.local.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_zeroconf):
|
async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_async_zeroconf):
|
||||||
"""Test setup with given IP address to advertise."""
|
"""Test setup with given IP address to advertise."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
|
@ -308,7 +307,7 @@ async def test_homekit_setup_advertise_ip(hass, hk_driver, mock_zeroconf):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_add_accessory(hass, mock_zeroconf):
|
async def test_homekit_add_accessory(hass, mock_async_zeroconf):
|
||||||
"""Add accessory if config exists and get_acc returns an accessory."""
|
"""Add accessory if config exists and get_acc returns an accessory."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -345,7 +344,7 @@ async def test_homekit_add_accessory(hass, mock_zeroconf):
|
||||||
|
|
||||||
@pytest.mark.parametrize("acc_category", [CATEGORY_TELEVISION, CATEGORY_CAMERA])
|
@pytest.mark.parametrize("acc_category", [CATEGORY_TELEVISION, CATEGORY_CAMERA])
|
||||||
async def test_homekit_warn_add_accessory_bridge(
|
async def test_homekit_warn_add_accessory_bridge(
|
||||||
hass, acc_category, mock_zeroconf, caplog
|
hass, acc_category, mock_async_zeroconf, caplog
|
||||||
):
|
):
|
||||||
"""Test we warn when adding cameras or tvs to a bridge."""
|
"""Test we warn when adding cameras or tvs to a bridge."""
|
||||||
|
|
||||||
|
@ -373,7 +372,7 @@ async def test_homekit_warn_add_accessory_bridge(
|
||||||
assert "accessory mode" in caplog.text
|
assert "accessory mode" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_remove_accessory(hass, mock_zeroconf):
|
async def test_homekit_remove_accessory(hass, mock_async_zeroconf):
|
||||||
"""Remove accessory from bridge."""
|
"""Remove accessory from bridge."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
|
||||||
|
@ -391,7 +390,7 @@ async def test_homekit_remove_accessory(hass, mock_zeroconf):
|
||||||
assert len(homekit.bridge.accessories) == 0
|
assert len(homekit.bridge.accessories) == 0
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_entity_filter(hass, mock_zeroconf):
|
async def test_homekit_entity_filter(hass, mock_async_zeroconf):
|
||||||
"""Test the entity filter."""
|
"""Test the entity filter."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
|
||||||
|
@ -410,7 +409,7 @@ async def test_homekit_entity_filter(hass, mock_zeroconf):
|
||||||
assert hass.states.get("light.demo") not in filtered_states
|
assert hass.states.get("light.demo") not in filtered_states
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_entity_glob_filter(hass, mock_zeroconf):
|
async def test_homekit_entity_glob_filter(hass, mock_async_zeroconf):
|
||||||
"""Test the entity filter."""
|
"""Test the entity filter."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
|
||||||
|
@ -434,7 +433,7 @@ async def test_homekit_entity_glob_filter(hass, mock_zeroconf):
|
||||||
assert hass.states.get("light.included_test") in filtered_states
|
assert hass.states.get("light.included_test") in filtered_states
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_start(hass, hk_driver, mock_zeroconf, device_reg):
|
async def test_homekit_start(hass, hk_driver, mock_async_zeroconf, device_reg):
|
||||||
"""Test HomeKit start method."""
|
"""Test HomeKit start method."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
|
||||||
|
@ -509,7 +508,9 @@ async def test_homekit_start(hass, hk_driver, mock_zeroconf, device_reg):
|
||||||
assert homekit.driver.state.config_version == 1
|
assert homekit.driver.state.config_version == 1
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, mock_zeroconf):
|
async def test_homekit_start_with_a_broken_accessory(
|
||||||
|
hass, hk_driver, mock_async_zeroconf
|
||||||
|
):
|
||||||
"""Test HomeKit start method."""
|
"""Test HomeKit start method."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
|
domain=DOMAIN, data={CONF_NAME: "mock_name", CONF_PORT: 12345}
|
||||||
|
@ -549,7 +550,7 @@ async def test_homekit_start_with_a_broken_accessory(hass, hk_driver, mock_zeroc
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_start_with_a_device(
|
async def test_homekit_start_with_a_device(
|
||||||
hass, hk_driver, mock_zeroconf, demo_cleanup, device_reg, entity_reg
|
hass, hk_driver, mock_async_zeroconf, demo_cleanup, device_reg, entity_reg
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method with a device."""
|
"""Test HomeKit start method with a device."""
|
||||||
|
|
||||||
|
@ -611,7 +612,7 @@ async def test_homekit_stop(hass):
|
||||||
assert homekit.driver.async_stop.called is True
|
assert homekit.driver.async_stop.called is True
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_accessories(hass, mock_zeroconf):
|
async def test_homekit_reset_accessories(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit accessories."""
|
"""Test resetting HomeKit accessories."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -656,7 +657,7 @@ async def test_homekit_reset_accessories(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_READY
|
homekit.status = STATUS_READY
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_unpair(hass, device_reg, mock_zeroconf):
|
async def test_homekit_unpair(hass, device_reg, mock_async_zeroconf):
|
||||||
"""Test unpairing HomeKit accessories."""
|
"""Test unpairing HomeKit accessories."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -698,7 +699,7 @@ async def test_homekit_unpair(hass, device_reg, mock_zeroconf):
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_unpair_missing_device_id(hass, device_reg, mock_zeroconf):
|
async def test_homekit_unpair_missing_device_id(hass, device_reg, mock_async_zeroconf):
|
||||||
"""Test unpairing HomeKit accessories with invalid device id."""
|
"""Test unpairing HomeKit accessories with invalid device id."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -736,7 +737,7 @@ async def test_homekit_unpair_missing_device_id(hass, device_reg, mock_zeroconf)
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_unpair_not_homekit_device(hass, device_reg, mock_zeroconf):
|
async def test_homekit_unpair_not_homekit_device(hass, device_reg, mock_async_zeroconf):
|
||||||
"""Test unpairing HomeKit accessories with a non-homekit device id."""
|
"""Test unpairing HomeKit accessories with a non-homekit device id."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -784,7 +785,7 @@ async def test_homekit_unpair_not_homekit_device(hass, device_reg, mock_zeroconf
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_accessories_not_supported(hass, mock_zeroconf):
|
async def test_homekit_reset_accessories_not_supported(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit accessories with an unsupported entity."""
|
"""Test resetting HomeKit accessories with an unsupported entity."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -828,7 +829,7 @@ async def test_homekit_reset_accessories_not_supported(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_accessories_state_missing(hass, mock_zeroconf):
|
async def test_homekit_reset_accessories_state_missing(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit accessories when the state goes missing."""
|
"""Test resetting HomeKit accessories when the state goes missing."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -870,7 +871,7 @@ async def test_homekit_reset_accessories_state_missing(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_accessories_not_bridged(hass, mock_zeroconf):
|
async def test_homekit_reset_accessories_not_bridged(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit accessories when the state is not bridged."""
|
"""Test resetting HomeKit accessories when the state is not bridged."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -912,7 +913,7 @@ async def test_homekit_reset_accessories_not_bridged(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_single_accessory(hass, mock_zeroconf):
|
async def test_homekit_reset_single_accessory(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit single accessory."""
|
"""Test resetting HomeKit single accessory."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -951,7 +952,7 @@ async def test_homekit_reset_single_accessory(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_READY
|
homekit.status = STATUS_READY
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_single_accessory_unsupported(hass, mock_zeroconf):
|
async def test_homekit_reset_single_accessory_unsupported(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit single accessory with an unsupported entity."""
|
"""Test resetting HomeKit single accessory with an unsupported entity."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -988,7 +989,7 @@ async def test_homekit_reset_single_accessory_unsupported(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_single_accessory_state_missing(hass, mock_zeroconf):
|
async def test_homekit_reset_single_accessory_state_missing(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit single accessory when the state goes missing."""
|
"""Test resetting HomeKit single accessory when the state goes missing."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -1024,7 +1025,7 @@ async def test_homekit_reset_single_accessory_state_missing(hass, mock_zeroconf)
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_reset_single_accessory_no_match(hass, mock_zeroconf):
|
async def test_homekit_reset_single_accessory_no_match(hass, mock_async_zeroconf):
|
||||||
"""Test resetting HomeKit single accessory when the entity id does not match."""
|
"""Test resetting HomeKit single accessory when the entity id does not match."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -1060,7 +1061,9 @@ async def test_homekit_reset_single_accessory_no_match(hass, mock_zeroconf):
|
||||||
homekit.status = STATUS_STOPPED
|
homekit.status = STATUS_STOPPED
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_too_many_accessories(hass, hk_driver, caplog, mock_zeroconf):
|
async def test_homekit_too_many_accessories(
|
||||||
|
hass, hk_driver, caplog, mock_async_zeroconf
|
||||||
|
):
|
||||||
"""Test adding too many accessories to HomeKit."""
|
"""Test adding too many accessories to HomeKit."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
|
||||||
|
@ -1090,7 +1093,7 @@ async def test_homekit_too_many_accessories(hass, hk_driver, caplog, mock_zeroco
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_finds_linked_batteries(
|
async def test_homekit_finds_linked_batteries(
|
||||||
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
|
hass, hk_driver, device_reg, entity_reg, mock_async_zeroconf
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method."""
|
"""Test HomeKit start method."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1161,7 +1164,7 @@ async def test_homekit_finds_linked_batteries(
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_async_get_integration_fails(
|
async def test_homekit_async_get_integration_fails(
|
||||||
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
|
hass, hk_driver, device_reg, entity_reg, mock_async_zeroconf
|
||||||
):
|
):
|
||||||
"""Test that we continue if async_get_integration fails."""
|
"""Test that we continue if async_get_integration fails."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1230,7 +1233,7 @@ async def test_homekit_async_get_integration_fails(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_yaml_updates_update_config_entry_for_name(hass, mock_zeroconf):
|
async def test_yaml_updates_update_config_entry_for_name(hass, mock_async_zeroconf):
|
||||||
"""Test async_setup with imported config."""
|
"""Test async_setup with imported config."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -1274,7 +1277,7 @@ async def test_yaml_updates_update_config_entry_for_name(hass, mock_zeroconf):
|
||||||
mock_homekit().async_start.assert_called()
|
mock_homekit().async_start.assert_called()
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_zeroconf):
|
async def test_homekit_uses_system_zeroconf(hass, hk_driver, mock_async_zeroconf):
|
||||||
"""Test HomeKit uses system zeroconf."""
|
"""Test HomeKit uses system zeroconf."""
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
|
@ -1306,7 +1309,7 @@ def _write_data(path: str, data: dict) -> None:
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_ignored_missing_devices(
|
async def test_homekit_ignored_missing_devices(
|
||||||
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
|
hass, hk_driver, device_reg, entity_reg, mock_async_zeroconf
|
||||||
):
|
):
|
||||||
"""Test HomeKit handles a device in the entity registry but missing from the device registry."""
|
"""Test HomeKit handles a device in the entity registry but missing from the device registry."""
|
||||||
|
|
||||||
|
@ -1376,7 +1379,7 @@ async def test_homekit_ignored_missing_devices(
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_finds_linked_motion_sensors(
|
async def test_homekit_finds_linked_motion_sensors(
|
||||||
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
|
hass, hk_driver, device_reg, entity_reg, mock_async_zeroconf
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method."""
|
"""Test HomeKit start method."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1438,7 +1441,7 @@ async def test_homekit_finds_linked_motion_sensors(
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_finds_linked_humidity_sensors(
|
async def test_homekit_finds_linked_humidity_sensors(
|
||||||
hass, hk_driver, device_reg, entity_reg, mock_zeroconf
|
hass, hk_driver, device_reg, entity_reg, mock_async_zeroconf
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method."""
|
"""Test HomeKit start method."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1502,7 +1505,7 @@ async def test_homekit_finds_linked_humidity_sensors(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_reload(hass, mock_zeroconf):
|
async def test_reload(hass, mock_async_zeroconf):
|
||||||
"""Test we can reload from yaml."""
|
"""Test we can reload from yaml."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
@ -1574,7 +1577,7 @@ async def test_reload(hass, mock_zeroconf):
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_start_in_accessory_mode(
|
async def test_homekit_start_in_accessory_mode(
|
||||||
hass, hk_driver, mock_zeroconf, device_reg
|
hass, hk_driver, mock_async_zeroconf, device_reg
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method in accessory mode."""
|
"""Test HomeKit start method in accessory mode."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1605,7 +1608,7 @@ async def test_homekit_start_in_accessory_mode(
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_start_in_accessory_mode_unsupported_entity(
|
async def test_homekit_start_in_accessory_mode_unsupported_entity(
|
||||||
hass, hk_driver, mock_zeroconf, device_reg, caplog
|
hass, hk_driver, mock_async_zeroconf, device_reg, caplog
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method in accessory mode with an unsupported entity."""
|
"""Test HomeKit start method in accessory mode with an unsupported entity."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1635,7 +1638,7 @@ async def test_homekit_start_in_accessory_mode_unsupported_entity(
|
||||||
|
|
||||||
|
|
||||||
async def test_homekit_start_in_accessory_mode_missing_entity(
|
async def test_homekit_start_in_accessory_mode_missing_entity(
|
||||||
hass, hk_driver, mock_zeroconf, device_reg, caplog
|
hass, hk_driver, mock_async_zeroconf, device_reg, caplog
|
||||||
):
|
):
|
||||||
"""Test HomeKit start method in accessory mode when entity is not available."""
|
"""Test HomeKit start method in accessory mode when entity is not available."""
|
||||||
entry = await async_init_integration(hass)
|
entry = await async_init_integration(hass)
|
||||||
|
@ -1659,7 +1662,7 @@ async def test_homekit_start_in_accessory_mode_missing_entity(
|
||||||
assert "entity not available" in caplog.text
|
assert "entity not available" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_wait_for_port_to_free(hass, hk_driver, mock_zeroconf, caplog):
|
async def test_wait_for_port_to_free(hass, hk_driver, mock_async_zeroconf, caplog):
|
||||||
"""Test we wait for the port to free before declaring unload success."""
|
"""Test we wait for the port to free before declaring unload success."""
|
||||||
|
|
||||||
entry = MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
|
|
|
@ -30,5 +30,5 @@ def controller(hass):
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def homekit_mock_zeroconf(mock_zeroconf):
|
def hk_mock_async_zeroconf(mock_async_zeroconf):
|
||||||
"""Mock zeroconf in all homekit tests."""
|
"""Auto mock zeroconf."""
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
"""Tests for the Zeroconf component."""
|
"""Tests for the Zeroconf component."""
|
||||||
from unittest.mock import AsyncMock, patch
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -8,14 +7,3 @@ import pytest
|
||||||
def zc_mock_get_source_ip(mock_get_source_ip):
|
def zc_mock_get_source_ip(mock_get_source_ip):
|
||||||
"""Enable the mock_get_source_ip fixture for all zeroconf tests."""
|
"""Enable the mock_get_source_ip fixture for all zeroconf tests."""
|
||||||
return mock_get_source_ip
|
return mock_get_source_ip
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def mock_async_zeroconf(mock_zeroconf):
|
|
||||||
"""Mock AsyncZeroconf."""
|
|
||||||
with patch("homeassistant.components.zeroconf.HaAsyncZeroconf") as mock_aiozc:
|
|
||||||
zc = mock_aiozc.return_value
|
|
||||||
zc.async_register_service = AsyncMock()
|
|
||||||
zc.zeroconf.async_wait_for_start = AsyncMock()
|
|
||||||
zc.ha_async_close = AsyncMock()
|
|
||||||
yield zc
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import logging
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
import threading
|
import threading
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import AsyncMock, MagicMock, patch
|
||||||
|
|
||||||
from aiohttp.test_utils import make_mocked_request
|
from aiohttp.test_utils import make_mocked_request
|
||||||
import freezegun
|
import freezegun
|
||||||
|
@ -617,6 +617,21 @@ def mock_zeroconf():
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def mock_async_zeroconf(mock_zeroconf):
|
||||||
|
"""Mock AsyncZeroconf."""
|
||||||
|
with patch("homeassistant.components.zeroconf.HaAsyncZeroconf") as mock_aiozc:
|
||||||
|
zc = mock_aiozc.return_value
|
||||||
|
zc.async_unregister_service = AsyncMock()
|
||||||
|
zc.async_register_service = AsyncMock()
|
||||||
|
zc.async_update_service = AsyncMock()
|
||||||
|
zc.zeroconf.async_wait_for_start = AsyncMock()
|
||||||
|
zc.zeroconf.done = False
|
||||||
|
zc.async_close = AsyncMock()
|
||||||
|
zc.ha_async_close = AsyncMock()
|
||||||
|
yield zc
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def legacy_patchable_time():
|
def legacy_patchable_time():
|
||||||
"""Allow time to be patchable by using event listeners instead of asyncio loop."""
|
"""Allow time to be patchable by using event listeners instead of asyncio loop."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue