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
+10
-6
@@ -1,11 +1,15 @@
|
||||
def test_dishwasher_resources_carry_rt(dishwasher_resources):
|
||||
def test_dishwasher_resources_loaded(dishwasher_resources):
|
||||
assert dishwasher_resources, "no resources loaded"
|
||||
# Every rep must expose its resource type so discovery can key on it.
|
||||
missing = [h for h, rep in dishwasher_resources.items()
|
||||
if not rep.get('rt')]
|
||||
assert not missing, f"resources without rt: {missing}"
|
||||
# Resources are sourced from the /device/0 batch; rt is not present in
|
||||
# batch responses (OCF carries rt at the collection-entry level only).
|
||||
# Verify the fixture contains dict values (including empty reps which are
|
||||
# valid batch entries for resources that temporarily have no state).
|
||||
non_dicts = [h for h, rep in dishwasher_resources.items()
|
||||
if not isinstance(rep, dict)]
|
||||
assert not non_dicts, f"resources with non-dict rep: {non_dicts}"
|
||||
|
||||
|
||||
def test_fridge_has_autofill(fridge_resources):
|
||||
assert '/autofill/vs/0' in fridge_resources
|
||||
assert 'x.com.samsung.da.autofill' in fridge_resources['/autofill/vs/0']['rt']
|
||||
# Batch reps do not carry 'rt'; check for the actual autofill field.
|
||||
assert 'x.com.samsung.da.autofill' in fridge_resources['/autofill/vs/0']
|
||||
Reference in new issue
Block a user