mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Prevent changes to mutable bmw_connected_drive fixture data (#120600)
This commit is contained in:
parent
f1a57d69cc
commit
8839a71adc
@ -92,7 +92,7 @@ async def test_api_error(hass: HomeAssistant) -> None:
|
|||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_USER},
|
context={"source": config_entries.SOURCE_USER},
|
||||||
data=FIXTURE_USER_INPUT,
|
data=deepcopy(FIXTURE_USER_INPUT),
|
||||||
)
|
)
|
||||||
|
|
||||||
assert result["type"] is FlowResultType.FORM
|
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(
|
result2 = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={"source": config_entries.SOURCE_USER},
|
context={"source": config_entries.SOURCE_USER},
|
||||||
data=FIXTURE_USER_INPUT,
|
data=deepcopy(FIXTURE_USER_INPUT),
|
||||||
)
|
)
|
||||||
assert result2["type"] is FlowResultType.CREATE_ENTRY
|
assert result2["type"] is FlowResultType.CREATE_ENTRY
|
||||||
assert result2["title"] == FIXTURE_COMPLETE_ENTRY[CONF_USERNAME]
|
assert result2["title"] == FIXTURE_COMPLETE_ENTRY[CONF_USERNAME]
|
||||||
@ -137,7 +137,8 @@ async def test_options_flow_implementation(hass: HomeAssistant) -> None:
|
|||||||
return_value=True,
|
return_value=True,
|
||||||
) as mock_setup_entry,
|
) 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)
|
config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Test Axis component setup process."""
|
"""Test Axis component setup process."""
|
||||||
|
|
||||||
|
from copy import deepcopy
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -37,7 +38,7 @@ async def test_migrate_options(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test successful migration of options."""
|
"""Test successful migration of options."""
|
||||||
|
|
||||||
config_entry = FIXTURE_CONFIG_ENTRY.copy()
|
config_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
|
||||||
config_entry["options"] = options
|
config_entry["options"] = options
|
||||||
|
|
||||||
mock_config_entry = MockConfigEntry(**config_entry)
|
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:
|
async def test_migrate_options_from_data(hass: HomeAssistant) -> None:
|
||||||
"""Test successful migration of options."""
|
"""Test successful migration of options."""
|
||||||
|
|
||||||
config_entry = FIXTURE_CONFIG_ENTRY.copy()
|
config_entry = deepcopy(FIXTURE_CONFIG_ENTRY)
|
||||||
config_entry["options"] = {}
|
config_entry["options"] = {}
|
||||||
config_entry["data"].update({CONF_READ_ONLY: False})
|
config_entry["data"].update({CONF_READ_ONLY: False})
|
||||||
|
|
||||||
@ -107,7 +108,8 @@ async def test_migrate_unique_ids(
|
|||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test successful migration of entity unique_ids."""
|
"""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)
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
entity: er.RegistryEntry = entity_registry.async_get_or_create(
|
entity: er.RegistryEntry = entity_registry.async_get_or_create(
|
||||||
@ -153,7 +155,8 @@ async def test_dont_migrate_unique_ids(
|
|||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test successful migration of entity unique_ids."""
|
"""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)
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
# create existing entry with new_unique_id
|
# create existing entry with new_unique_id
|
||||||
@ -196,7 +199,8 @@ async def test_remove_stale_devices(
|
|||||||
device_registry: dr.DeviceRegistry,
|
device_registry: dr.DeviceRegistry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test remove stale device registry entries."""
|
"""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)
|
mock_config_entry.add_to_hass(hass)
|
||||||
|
|
||||||
device_registry.async_get_or_create(
|
device_registry.async_get_or_create(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user