1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-26 14:08:21 +00:00

Always setup demo platforms with device support from config entry (#94601)

* Always setup demo platforms with device support from config entry

* Update tests depending on the demo integration
This commit is contained in:
Erik Montnemery
2023-06-14 21:03:07 +02:00
committed by GitHub
parent c5fccffbb3
commit f68ed8b7a0
9 changed files with 94 additions and 87 deletions

View File

@@ -1,4 +1,6 @@
"""The tests for the demo switch component."""
from unittest.mock import patch
import pytest
from homeassistant.components.demo import DOMAIN
@@ -7,15 +9,25 @@ from homeassistant.components.switch import (
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
)
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON
from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON, Platform
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
SWITCH_ENTITY_IDS = ["switch.decorative_lights", "switch.ac"]
@pytest.fixture
async def switch_only() -> None:
"""Enable only the switch platform."""
with patch(
"homeassistant.components.demo.COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM",
[Platform.SWITCH],
):
yield
@pytest.fixture(autouse=True)
async def setup_comp(hass, disable_platforms):
async def setup_comp(hass, switch_only):
"""Set up demo component."""
assert await async_setup_component(
hass, SWITCH_DOMAIN, {SWITCH_DOMAIN: {"platform": DOMAIN}}