Prevent changes to mutable bmw_connected_drive fixture data (#120600)

pull/120356/head^2
Jan Bouwhuis 2024-06-26 20:57:27 +02:00 committed by GitHub
parent f1a57d69cc
commit 8839a71adc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -92,7 +92,7 @@ async def test_api_error(hass: HomeAssistant) -> None:
result = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data=FIXTURE_USER_INPUT,
data=deepcopy(FIXTURE_USER_INPUT),
)
assert result["type"] is FlowResultType.FORM
@ -116,7 +116,7 @@ async def test_full_user_flow_implementation(hass: HomeAssistant) -> None:
result2 = await hass.config_entries.flow.async_init(
DOMAIN,
context={"source": config_entries.SOURCE_USER},
data=FIXTURE_USER_INPUT,
data=deepcopy(FIXTURE_USER_INPUT),
)
assert result2["type"] is FlowResultType.CREATE_ENTRY
assert result2["title"] == FIXTURE_COMPLETE_ENTRY[CONF_USERNAME]
@ -137,7 +137,8 @@ async def test_options_flow_implementation(hass: HomeAssistant) -> None:
return_value=True,
) as mock_setup_entry,
):
config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY)
config_entry_args = deepcopy(FIXTURE_CONFIG_ENTRY)
config_entry = MockConfigEntry(**config_entry_args)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)

View File

@ -1,5 +1,6 @@
"""Test Axis component setup process."""
from copy import deepcopy
from unittest.mock import patch
import pytest
@ -37,7 +38,7 @@ async def test_migrate_options(
) -> None:
"""Test successful migration of options."""
config_entry = FIXTURE_CONFIG_ENTRY.copy()
config_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
config_entry["options"] = options
mock_config_entry = MockConfigEntry(**config_entry)
@ -55,7 +56,7 @@ async def test_migrate_options(
async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
"""Test successful migration of options."""
config_entry = FIXTURE_CONFIG_ENTRY.copy()
config_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
config_entry["options"] = {}
config_entry["data"].update({CONF_READ_ONLY: False})
@ -107,7 +108,8 @@ async def test_migrate_unique_ids(
entity_registry: er.EntityRegistry,
) -> None:
"""Test successful migration of entity unique_ids."""
mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY)
confg_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
mock_config_entry = MockConfigEntry(**confg_entry)
mock_config_entry.add_to_hass(hass)
entity: er.RegistryEntry = entity_registry.async_get_or_create(
@ -153,7 +155,8 @@ async def test_dont_migrate_unique_ids(
entity_registry: er.EntityRegistry,
) -> None:
"""Test successful migration of entity unique_ids."""
mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY)
confg_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
mock_config_entry = MockConfigEntry(**confg_entry)
mock_config_entry.add_to_hass(hass)
# create existing entry with new_unique_id
@ -196,7 +199,8 @@ async def test_remove_stale_devices(
device_registry: dr.DeviceRegistry,
) -> None:
"""Test remove stale device registry entries."""
mock_config_entry = MockConfigEntry(**FIXTURE_CONFIG_ENTRY)
config_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
mock_config_entry = MockConfigEntry(**config_entry)
mock_config_entry.add_to_hass(hass)
device_registry.async_get_or_create(