test: add pytest infra and device-dump fixtures
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
pytest>=8.0
|
||||||
@@ -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')
|
||||||
@@ -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']
|
||||||
Reference in New Issue
Block a user