2021-07-12 16:24:12 +00:00
|
|
|
"""Test the sonos config flow."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
2021-11-11 06:31:08 +00:00
|
|
|
import pytest
|
|
|
|
|
2021-09-24 03:39:20 +00:00
|
|
|
from homeassistant.components.sonos.helpers import hostname_to_uid
|
2021-07-12 16:24:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def test_uid_to_hostname():
|
|
|
|
"""Test we can convert a hostname to a uid."""
|
|
|
|
assert hostname_to_uid("Sonos-347E5C0CF1E3.local.") == "RINCON_347E5C0CF1E301400"
|
2021-11-11 06:31:08 +00:00
|
|
|
assert hostname_to_uid("sonos5CAAFDE47AC8.local.") == "RINCON_5CAAFDE47AC801400"
|
|
|
|
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
assert hostname_to_uid("notsonos5CAAFDE47AC8.local.")
|