Files
localthings/tests/test_fixtures.py
T
Marc Billow d4ff29d797 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.
2026-06-30 16:33:36 -05:00

16 lines
843 B
Python

def test_dishwasher_resources_loaded(dishwasher_resources):
assert dishwasher_resources, "no resources loaded"
# 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
# Batch reps do not carry 'rt'; check for the actual autofill field.
assert 'x.com.samsung.da.autofill' in fridge_resources['/autofill/vs/0']