Avoid mutating entity descriptions in solaredge tests (#105718)

pull/105791/head
Erik Montnemery 2023-12-15 08:10:35 +01:00 committed by GitHub
parent c10b460c6b
commit a2b31a06e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@
from unittest.mock import patch
from freezegun.api import FrozenDateTimeFactory
import pytest
from homeassistant.components.solaredge.const import (
CONF_SITE_ID,
@ -9,7 +10,6 @@ from homeassistant.components.solaredge.const import (
DOMAIN,
OVERVIEW_UPDATE_DELAY,
)
from homeassistant.components.solaredge.sensor import SENSOR_TYPES
from homeassistant.const import CONF_API_KEY, CONF_NAME, STATE_UNKNOWN
from homeassistant.core import HomeAssistant
@ -19,6 +19,11 @@ SITE_ID = "1a2b3c4d5e6f7g8h"
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")
async def test_solaredgeoverviewdataservice_energy_values_validity(
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_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)