feat: switch conftest + golden tests to batch-first resource loading
conftest: _resources_from_dump() prefers /device/0 batch reps; falls
back to flat resources dict. Fixes _parse_device0_batch to include
stub reps (rep={href:...}) as {} so capabilities still bind on
resources with no current data (e.g. /alarms/vs/0 when no alarm active).
test_golden_regression: _new_state_and_uids now uses by_type.for_device
to select per-device-type capabilities + pattern caps.
This commit is contained in:
1 parent
2b22673210
commit
d4ff29d797
6 files changed
+55
-15
No files matched your search
@@ -49,8 +49,12 @@ def _parse_device0_batch(device0: list) -> dict[str, dict]:
|
||||
continue
|
||||
href = entry.get('href')
|
||||
rep = entry.get('rep')
|
||||
if href and isinstance(rep, dict) and set(rep.keys()) != {'href'}:
|
||||
out[href] = rep
|
||||
if not href:
|
||||
continue
|
||||
# rep == {"href": "..."} is a stub (resource present, no current data).
|
||||
# Include it as {} so capabilities still bind and the entity exists.
|
||||
if isinstance(rep, dict):
|
||||
out[href] = {} if set(rep.keys()) == {'href'} else rep
|
||||
return out
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user