Files
core/tests/components/control4/test_media_player.py
2025-10-24 19:41:02 +02:00

34 lines
1.1 KiB
Python

"""Test Control4 Media Player."""
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from . import setup_integration
from tests.common import MockConfigEntry, snapshot_platform
@pytest.fixture
def platforms() -> list[Platform]:
"""Platforms which should be loaded during the test."""
return [Platform.MEDIA_PLAYER]
@pytest.mark.usefixtures("mock_c4_account", "mock_c4_director", "mock_update_variables")
async def test_media_player_with_and_without_sources(
hass: HomeAssistant,
mock_config_entry: MockConfigEntry,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test that rooms with sources create entities and rooms without are skipped."""
# The default mock_c4_director fixture provides multi-room data:
# Room 1 has video source, Room 2 has no sources (thermostat-only room)
await setup_integration(hass, mock_config_entry)
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)