diff --git a/tests/components/freebox/conftest.py b/tests/components/freebox/conftest.py index b950d44508d..69b250412bd 100644 --- a/tests/components/freebox/conftest.py +++ b/tests/components/freebox/conftest.py @@ -3,6 +3,7 @@ from unittest.mock import AsyncMock, patch import pytest +from homeassistant.core import HomeAssistant from homeassistant.helpers import device_registry as dr from .const import ( @@ -27,9 +28,10 @@ def mock_path(): @pytest.fixture -def mock_device_registry_devices(device_registry): +def mock_device_registry_devices(hass: HomeAssistant, device_registry): """Create device registry devices so the device tracker entities are enabled.""" config_entry = MockConfigEntry(domain="something_else") + config_entry.add_to_hass(hass) for idx, device in enumerate( ( diff --git a/tests/components/freebox/test_button.py b/tests/components/freebox/test_button.py index aabf4682832..de15e90f54f 100644 --- a/tests/components/freebox/test_button.py +++ b/tests/components/freebox/test_button.py @@ -1,5 +1,7 @@ """Tests for the Freebox config flow.""" -from unittest.mock import Mock, patch +from unittest.mock import ANY, Mock, patch + +from pytest_unordered import unordered from homeassistant.components.button import DOMAIN as BUTTON_DOMAIN, SERVICE_PRESS from homeassistant.components.freebox.const import DOMAIN @@ -22,7 +24,7 @@ async def test_reboot_button(hass: HomeAssistant, router: Mock) -> None: entry.add_to_hass(hass) assert await async_setup_component(hass, DOMAIN, {}) await hass.async_block_till_done() - assert hass.config_entries.async_entries() == [entry] + assert hass.config_entries.async_entries() == unordered([entry, ANY]) assert router.call_count == 1 assert router().open.call_count == 1 diff --git a/tests/components/freebox/test_init.py b/tests/components/freebox/test_init.py index 6197f03b0ec..85acfdccc4d 100644 --- a/tests/components/freebox/test_init.py +++ b/tests/components/freebox/test_init.py @@ -1,5 +1,7 @@ """Tests for the Freebox config flow.""" -from unittest.mock import Mock, patch +from unittest.mock import ANY, Mock, patch + +from pytest_unordered import unordered from homeassistant.components.device_tracker import DOMAIN as DT_DOMAIN from homeassistant.components.freebox.const import DOMAIN, SERVICE_REBOOT @@ -25,7 +27,7 @@ async def test_setup(hass: HomeAssistant, router: Mock) -> None: entry.add_to_hass(hass) assert await async_setup_component(hass, DOMAIN, {}) await hass.async_block_till_done() - assert hass.config_entries.async_entries() == [entry] + assert hass.config_entries.async_entries() == unordered([entry, ANY]) assert router.call_count == 1 assert router().open.call_count == 1 @@ -57,7 +59,7 @@ async def test_setup_import(hass: HomeAssistant, router: Mock) -> None: hass, DOMAIN, {DOMAIN: {CONF_HOST: MOCK_HOST, CONF_PORT: MOCK_PORT}} ) await hass.async_block_till_done() - assert hass.config_entries.async_entries() == [entry] + assert hass.config_entries.async_entries() == unordered([entry, ANY]) assert router.call_count == 1 assert router().open.call_count == 1