mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 18:27:09 +00:00
Avoid mutating entity descriptions in solaredge tests (#105718)
This commit is contained in:
parent
c10b460c6b
commit
a2b31a06e3
@ -2,6 +2,7 @@
|
|||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components.solaredge.const import (
|
from homeassistant.components.solaredge.const import (
|
||||||
CONF_SITE_ID,
|
CONF_SITE_ID,
|
||||||
@ -9,7 +10,6 @@ from homeassistant.components.solaredge.const import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
OVERVIEW_UPDATE_DELAY,
|
OVERVIEW_UPDATE_DELAY,
|
||||||
)
|
)
|
||||||
from homeassistant.components.solaredge.sensor import SENSOR_TYPES
|
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_NAME, STATE_UNKNOWN
|
from homeassistant.const import CONF_API_KEY, CONF_NAME, STATE_UNKNOWN
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
@ -19,6 +19,11 @@ SITE_ID = "1a2b3c4d5e6f7g8h"
|
|||||||
API_KEY = "a1b2c3d4e5f6g7h8"
|
API_KEY = "a1b2c3d4e5f6g7h8"
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def enable_all_entities(entity_registry_enabled_by_default):
|
||||||
|
"""Make sure all entities are enabled."""
|
||||||
|
|
||||||
|
|
||||||
@patch("homeassistant.components.solaredge.Solaredge")
|
@patch("homeassistant.components.solaredge.Solaredge")
|
||||||
async def test_solaredgeoverviewdataservice_energy_values_validity(
|
async def test_solaredgeoverviewdataservice_energy_values_validity(
|
||||||
mock_solaredge, hass: HomeAssistant, freezer: FrozenDateTimeFactory
|
mock_solaredge, hass: HomeAssistant, freezer: FrozenDateTimeFactory
|
||||||
@ -31,8 +36,6 @@ async def test_solaredgeoverviewdataservice_energy_values_validity(
|
|||||||
)
|
)
|
||||||
mock_solaredge().get_details.return_value = {"details": {"status": "active"}}
|
mock_solaredge().get_details.return_value = {"details": {"status": "active"}}
|
||||||
mock_config_entry.add_to_hass(hass)
|
mock_config_entry.add_to_hass(hass)
|
||||||
for description in SENSOR_TYPES:
|
|
||||||
description.entity_registry_enabled_default = True
|
|
||||||
|
|
||||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user