diff --git a/tests/components/overkiz/conftest.py b/tests/components/overkiz/conftest.py index a18aff6bd7e..3c8ec166d89 100644 --- a/tests/components/overkiz/conftest.py +++ b/tests/components/overkiz/conftest.py @@ -2,6 +2,7 @@ from collections.abc import Awaitable, Callable, Generator from dataclasses import dataclass, field +from typing import NamedTuple from unittest.mock import AsyncMock, patch from pyoverkiz.client import OverkizClient @@ -20,6 +21,14 @@ from tests.common import MockConfigEntry type SetupOverkizIntegration = Callable[..., Awaitable[MockConfigEntry]] +class FixtureDevice(NamedTuple): + """Test device binding a fixture file to a device URL and entity id.""" + + fixture: str + device_url: str + entity_id: str + + @dataclass class MockOverkizClient(OverkizClient): """Mock Overkiz client used by integration tests.""" diff --git a/tests/components/overkiz/fixtures/setup/setup_tahoma_switch.json b/tests/components/overkiz/fixtures/diagnostics/cloud_somfy_tahoma_switch_europe.json similarity index 100% rename from tests/components/overkiz/fixtures/setup/setup_tahoma_switch.json rename to tests/components/overkiz/fixtures/diagnostics/cloud_somfy_tahoma_switch_europe.json diff --git a/tests/components/overkiz/test_cover.py b/tests/components/overkiz/test_cover.py index dc8902dc03e..061d7b64f09 100644 --- a/tests/components/overkiz/test_cover.py +++ b/tests/components/overkiz/test_cover.py @@ -4,7 +4,7 @@ from __future__ import annotations from collections.abc import Generator from pathlib import Path -from typing import Any, NamedTuple +from typing import Any from unittest.mock import patch from freezegun.api import FrozenDateTimeFactory @@ -33,20 +33,11 @@ from homeassistant.const import ATTR_ENTITY_ID, STATE_UNAVAILABLE, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er -from .conftest import MockOverkizClient, SetupOverkizIntegration +from .conftest import FixtureDevice, MockOverkizClient, SetupOverkizIntegration from .helpers import assert_command_call, async_deliver_events, build_event from tests.common import snapshot_platform - -class FixtureDevice(NamedTuple): - """Test device binding a fixture file to a device URL and entity id.""" - - fixture: str - device_url: str - entity_id: str - - AWNING = FixtureDevice( "setup/local_somfy_connexoon_europe.json", "io://1234-1234-1234/5928357", diff --git a/tests/components/overkiz/test_diagnostics.py b/tests/components/overkiz/test_diagnostics.py index f421a567242..889653f02cd 100644 --- a/tests/components/overkiz/test_diagnostics.py +++ b/tests/components/overkiz/test_diagnostics.py @@ -24,7 +24,7 @@ async def test_diagnostics( ) -> None: """Test diagnostics.""" diagnostic_data = await async_load_json_object_fixture( - hass, "setup/setup_tahoma_switch.json", DOMAIN + hass, "diagnostics/cloud_somfy_tahoma_switch_europe.json", DOMAIN ) with patch.multiple( @@ -47,7 +47,7 @@ async def test_device_diagnostics( ) -> None: """Test device diagnostics.""" diagnostic_data = await async_load_json_object_fixture( - hass, "setup/setup_tahoma_switch.json", DOMAIN + hass, "diagnostics/cloud_somfy_tahoma_switch_europe.json", DOMAIN ) device = device_registry.async_get_device( @@ -75,9 +75,8 @@ async def test_device_diagnostics_execution_history_subsystem( device_registry: dr.DeviceRegistry, ) -> None: """Test execution history matching ignores subsystem suffix.""" - diagnostic_data = await async_load_json_object_fixture( - hass, "setup/setup_tahoma_switch.json", DOMAIN + hass, "diagnostics/cloud_somfy_tahoma_switch_europe.json", DOMAIN ) device = device_registry.async_get_device( diff --git a/tests/components/overkiz/test_sensor.py b/tests/components/overkiz/test_sensor.py index 7c5a91fa599..9283a4a58f4 100644 --- a/tests/components/overkiz/test_sensor.py +++ b/tests/components/overkiz/test_sensor.py @@ -4,7 +4,6 @@ from __future__ import annotations from collections.abc import Generator from pathlib import Path -from typing import NamedTuple from unittest.mock import patch from freezegun.api import FrozenDateTimeFactory @@ -16,20 +15,11 @@ from homeassistant.const import STATE_UNAVAILABLE, Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er -from .conftest import MockOverkizClient, SetupOverkizIntegration +from .conftest import FixtureDevice, MockOverkizClient, SetupOverkizIntegration from .helpers import async_deliver_events, build_event from tests.common import snapshot_platform - -class FixtureDevice(NamedTuple): - """Test device binding a fixture file to a device URL and entity id.""" - - fixture: str - device_url: str - entity_id: str - - TEMPERATURE_SENSOR = FixtureDevice( "setup/cloud_nexity_rail_din_europe.json", "io://1234-5678-1698/15702199#2", @@ -53,8 +43,8 @@ HOMEKIT_STACK = FixtureDevice( # Device with core:MeasuredValueType attribute (test for dynamic unit resolution) COZYTOUCH_DHW = FixtureDevice( "setup/cloud_atlantic_cozytouch.json", - "io://1234-5678-5643/109286#1", - "sensor.patio_water_heating_temperature", + "io://1234-5678-5643/109286#2", + "sensor.patio_water_heating_office_energy_meter_electric_energy_consumption", ) SNAPSHOT_FIXTURES = [