test: add pytest infra and device-dump fixtures

This commit is contained in:
Marc Billow
2026-06-30 16:32:37 -05:00
parent 00ff961d33
commit c6f08ea340
4 changed files with 34 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
pytest>=8.0
View File
+22
View File
@@ -0,0 +1,22 @@
import json
from pathlib import Path
import pytest
DUMPS = Path(__file__).resolve().parent.parent / 'local-tools' / 'dumps'
def _load_resources(ip: str) -> dict[str, dict]:
data = json.loads((DUMPS / f'{ip}.json').read_text())
# Filter to only dict values (skip non-dict representations like "<timeout>")
return {k: v for k, v in data['resources'].items() if isinstance(v, dict)}
@pytest.fixture
def dishwasher_resources() -> dict[str, dict]:
return _load_resources('10.0.0.129')
@pytest.fixture
def fridge_resources() -> dict[str, dict]:
return _load_resources('10.0.0.254')
+11
View File
@@ -0,0 +1,11 @@
def test_dishwasher_resources_carry_rt(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}"
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']