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.
29 lines
974 B
Python
29 lines
974 B
Python
import pytest
|
|
from tests.conftest import _load_device
|
|
from custom_components.localthings.registry.by_type import for_device, _type_key
|
|
from custom_components.localthings.registry.discovery import discover
|
|
from custom_components.localthings.registry.adapter import flatten, is_active
|
|
|
|
|
|
@pytest.mark.parametrize('name,expected_type_key', [
|
|
('dishwasher', 'dishwasher'),
|
|
('refrigerator', 'refrigerator'),
|
|
])
|
|
def test_full_pipeline_v2(name, expected_type_key):
|
|
resources = _load_device(name)
|
|
|
|
otn = resources.get('/otninformation/vs/0', {})
|
|
one_ui = otn.get('swVersionInfo', {}).get('oneUiVersion', '')
|
|
assert _type_key(one_ui) == expected_type_key
|
|
|
|
reg = for_device(one_ui)
|
|
assert reg is not None
|
|
|
|
bound = discover(resources, reg.capabilities, reg.pattern_capabilities)
|
|
assert bound
|
|
|
|
state = flatten(bound, resources)
|
|
assert state
|
|
# is_active returns bool; just verify it runs without error
|
|
is_active(bound, resources)
|