From 852a73267f6124d9f25f8646ab4c629492f0af9a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 13 Jan 2024 09:34:49 -1000 Subject: [PATCH] Fix atag test mutating config entry after its adding to hass (#107603) --- tests/components/atag/__init__.py | 3 ++- tests/components/atag/test_config_flow.py | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/components/atag/__init__.py b/tests/components/atag/__init__.py index c41632b9715..adea1e07be7 100644 --- a/tests/components/atag/__init__.py +++ b/tests/components/atag/__init__.py @@ -92,10 +92,11 @@ async def init_integration( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker, skip_setup: bool = False, + unique_id: str = UID, ) -> MockConfigEntry: """Set up the Atag integration in Home Assistant.""" mock_connection(aioclient_mock) - entry = MockConfigEntry(domain=DOMAIN, data=USER_INPUT) + entry = MockConfigEntry(domain=DOMAIN, data=USER_INPUT, unique_id=unique_id) entry.add_to_hass(hass) if not skip_setup: diff --git a/tests/components/atag/test_config_flow.py b/tests/components/atag/test_config_flow.py index 8dc73741e90..69e2327c616 100644 --- a/tests/components/atag/test_config_flow.py +++ b/tests/components/atag/test_config_flow.py @@ -31,8 +31,7 @@ async def test_adding_second_device( hass: HomeAssistant, aioclient_mock: AiohttpClientMocker ) -> None: """Test that only one Atag configuration is allowed.""" - entry = await init_integration(hass, aioclient_mock) - entry.unique_id = UID + await init_integration(hass, aioclient_mock, unique_id=UID) result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": config_entries.SOURCE_USER}, data=USER_INPUT