1
0
mirror of https://github.com/home-assistant/core.git synced 2026-03-03 00:00:58 +00:00
Files
core/tests/components/mta/test_sensor.py
On Freund 7adfb0a40b Add bus support to MTA integration (#163220)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Joostlek <joostlek@outlook.com>
2026-02-24 16:11:13 +01:00

56 lines
1.7 KiB
Python

"""Test the MTA sensor platform."""
from unittest.mock import MagicMock
import pytest
from syrupy.assertion import SnapshotAssertion
from homeassistant.core import HomeAssistant
from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry, snapshot_platform
@pytest.mark.freeze_time("2023-10-21")
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_subway_sensor(
hass: HomeAssistant,
mock_config_entry_with_subway_subentry: MockConfigEntry,
mock_subway_feed: MagicMock,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test the subway sensor entities."""
await hass.config.async_set_time_zone("UTC")
mock_config_entry_with_subway_subentry.add_to_hass(hass)
await hass.config_entries.async_setup(
mock_config_entry_with_subway_subentry.entry_id
)
await hass.async_block_till_done()
await snapshot_platform(
hass, entity_registry, snapshot, mock_config_entry_with_subway_subentry.entry_id
)
@pytest.mark.freeze_time("2023-10-21")
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
async def test_bus_sensor(
hass: HomeAssistant,
mock_config_entry_with_bus_subentry: MockConfigEntry,
mock_bus_feed: MagicMock,
entity_registry: er.EntityRegistry,
snapshot: SnapshotAssertion,
) -> None:
"""Test the bus sensor entities."""
await hass.config.async_set_time_zone("UTC")
mock_config_entry_with_bus_subentry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry_with_bus_subentry.entry_id)
await hass.async_block_till_done()
await snapshot_platform(
hass, entity_registry, snapshot, mock_config_entry_with_bus_subentry.entry_id
)