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
647 B
Python
20 lines
647 B
Python
from custom_components.localthings.registry.capability import Capability
|
|
from custom_components.localthings.registry.entities import BinarySensorDesc
|
|
|
|
|
|
def test_capability_defaults():
|
|
c = Capability(href='/kidslock/vs/0',
|
|
entities=(BinarySensorDesc(key='child_lock', field='x.com.samsung.da.kidsLock'),))
|
|
assert c.poll_tier == 'cold'
|
|
assert c.active_when is None
|
|
assert len(c.entities) == 1
|
|
|
|
|
|
def test_capability_is_frozen():
|
|
c = Capability(href='/kidslock/vs/0', entities=())
|
|
try:
|
|
c.href = '/other/vs/0'
|
|
except Exception:
|
|
return
|
|
raise AssertionError("expected frozen dataclass")
|