Files
project-work/home-assistant/tests/components/homeassistant_sky_connect/test_const.py
2026-11-19 15:15:32 -05:00

28 lines
892 B
Python

"""Test the Home Assistant SkyConnect constants."""
import pytest
from homeassistant.components.homeassistant_sky_connect.const import HardwareVariant
@pytest.mark.parametrize(
("usb_product_name", "expected_variant"),
[
("SkyConnect v1.0", HardwareVariant.SKYCONNECT),
("Home Assistant Connect ZBT-1", HardwareVariant.CONNECT_ZBT1),
],
)
def test_hardware_variant(
usb_product_name: str, expected_variant: HardwareVariant
) -> None:
"""Test hardware variant parsing."""
assert HardwareVariant.from_usb_product_name(usb_product_name) == expected_variant
def test_hardware_variant_invalid() -> None:
"""Test hardware variant parsing with an invalid product."""
with pytest.raises(
ValueError, match=r"^Unknown SkyConnect product name: Some other product$"
):
HardwareVariant.from_usb_product_name("Some other product")