The DTLS/CoAP transport code that made "ocf" an accurate name moved out to the smartthings-local package. What's left here (capability.py, entities.py, discovery.py, adapter.py, identity.py, capabilities/, by_type/, plus the /device/0 batch parser) is entirely the device capability registry, so name the package for what it does. Flattened the redundant ocf/registry/ nesting into a single top-level registry/ package and updated every import across the platform modules and test suite accordingly. Verified: full test suite (80/80) passes, and the Docker dev container reconnects to both live appliances and rediscovers their entities cleanly after the rename.
20 lines
649 B
Python
20 lines
649 B
Python
"""Tests for the CAPABILITIES registry."""
|
|
from custom_components.localthings.registry.registry import CAPABILITIES
|
|
|
|
|
|
def test_registry_is_keyed_by_href():
|
|
"""Registry keys should match capability hrefs for all caps in the group."""
|
|
for href, caps in CAPABILITIES.items():
|
|
for cap in caps:
|
|
assert cap.href == href
|
|
|
|
|
|
def test_registry_has_no_duplicate_href():
|
|
"""Building succeeded => no duplicates raised at import."""
|
|
assert len(CAPABILITIES) >= 7
|
|
|
|
|
|
def test_operational_state_present():
|
|
"""At least one capability should have 'state' in its href."""
|
|
assert any('state' in href for href in CAPABILITIES)
|