diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..039d26e --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1 @@ +pytest>=8.0 diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..9b30725 --- /dev/null +++ b/tests/conftest.py @@ -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 "") + 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') diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py new file mode 100644 index 0000000..4c1ec03 --- /dev/null +++ b/tests/test_fixtures.py @@ -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']