From a53fc7e5fb53a57e878335e27516403b81df177d Mon Sep 17 00:00:00 2001 From: Elahd Bar-Shai <466460+elahd@users.noreply.github.com> Date: Fri, 27 Oct 2023 15:40:40 +0000 Subject: [PATCH] Added scenes to tests. --- tests/conftest.py | 7 +++++++ tests/responses/__init__.py | 4 ++-- tests/test_controller.py | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index a728125..8285279 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -92,6 +92,13 @@ def _load_mocks(repeat: bool = True) -> None: repeat=repeat, ) + response_mocker.get( + url=AttributeRegistry.get_endpoints(DeviceType.SCENE)["primary"].format(c.URL_BASE, ""), + status=200, + body=get_http_body_json("scenes_ok"), + repeat=repeat, + ) + response_mocker.get( url=AlarmController.ALL_DEVICES_URL_TEMPLATE.format(c.URL_BASE, "id-system"), status=200, diff --git a/tests/responses/__init__.py b/tests/responses/__init__.py index e65ad17..fe1d2ea 100644 --- a/tests/responses/__init__.py +++ b/tests/responses/__init__.py @@ -6,10 +6,10 @@ def get_http_body_json(name: str) -> str: """Get server/client response/request body from JSON file.""" - return resources.read_text(__package__, f"{name}.json") + return resources.files(__package__).joinpath(f"{name}.json").read_text() def get_http_body_html(name: str) -> str: """Get server/client response/request body from HTML file.""" - return resources.read_text(__package__, f"{name}.html") + return resources.files(__package__).joinpath(f"{name}.html").read_text() diff --git a/tests/test_controller.py b/tests/test_controller.py index 2273d15..e4d2f13 100644 --- a/tests/test_controller.py +++ b/tests/test_controller.py @@ -41,6 +41,7 @@ async def test__device_storage( assert adc_client.devices.lights.values() assert adc_client.devices.thermostats.values() assert adc_client.devices.water_sensors.values() + assert adc_client.devices.scenes.values() @pytest.mark.asyncio