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

* Always setup demo platforms with device support from config entry

* Adjust test fixutres

* Update tests depending on the demo integration
This commit is contained in:
Erik Montnemery 2023-06-14 16:50:35 +02:00 committed by GitHub
parent 1b8c72e644
commit 9a3077d64a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 491 additions and 351 deletions

View file

@ -1,16 +1,28 @@
"""The tests for the demo datetime component."""
from unittest.mock import patch
import pytest
from homeassistant.components.datetime import ATTR_DATETIME, DOMAIN, SERVICE_SET_VALUE
from homeassistant.const import ATTR_ENTITY_ID
from homeassistant.const import ATTR_ENTITY_ID, Platform
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
ENTITY_DATETIME = "datetime.date_and_time"
@pytest.fixture
async def datetime_only() -> None:
"""Enable only the datetime platform."""
with patch(
"homeassistant.components.demo.COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM",
[Platform.DATETIME],
):
yield
@pytest.fixture(autouse=True)
async def setup_demo_datetime(hass: HomeAssistant) -> None:
async def setup_demo_datetime(hass: HomeAssistant, datetime_only) -> None:
"""Initialize setup demo datetime."""
assert await async_setup_component(hass, DOMAIN, {"datetime": {"platform": "demo"}})
await hass.async_block_till_done()