diff --git a/tests/components/sensibo/snapshots/test_climate.ambr b/tests/components/sensibo/snapshots/test_climate.ambr new file mode 100644 index 00000000000..0a5a9d78b1b --- /dev/null +++ b/tests/components/sensibo/snapshots/test_climate.ambr @@ -0,0 +1,33 @@ +# serializer version: 1 +# name: test_climate + ReadOnlyDict({ + 'current_humidity': 32.9, + 'current_temperature': 21.2, + 'fan_mode': 'high', + 'fan_modes': list([ + 'quiet', + 'low', + 'medium', + ]), + 'friendly_name': 'Hallway', + 'hvac_modes': list([ + , + , + , + , + , + , + ]), + 'max_temp': 20, + 'min_temp': 10, + 'supported_features': , + 'swing_mode': 'stopped', + 'swing_modes': list([ + 'stopped', + 'fixedtop', + 'fixedmiddletop', + ]), + 'target_temp_step': 1, + 'temperature': 25, + }) +# --- diff --git a/tests/components/sensibo/snapshots/test_sensor.ambr b/tests/components/sensibo/snapshots/test_sensor.ambr new file mode 100644 index 00000000000..4522071049d --- /dev/null +++ b/tests/components/sensibo/snapshots/test_sensor.ambr @@ -0,0 +1,26 @@ +# serializer version: 1 +# name: test_sensor + ReadOnlyDict({ + 'device_class': 'pm25', + 'friendly_name': 'Kitchen PM2.5', + 'icon': 'mdi:air-filter', + 'state_class': , + 'unit_of_measurement': 'µg/m³', + }) +# --- +# name: test_sensor.1 + ReadOnlyDict({ + 'device_class': 'temperature', + 'fanlevel': 'low', + 'friendly_name': 'Hallway Climate React low temperature threshold', + 'horizontalswing': 'stopped', + 'light': 'on', + 'mode': 'heat', + 'on': True, + 'state_class': , + 'swing': 'stopped', + 'targettemperature': 21, + 'temperatureunit': 'c', + 'unit_of_measurement': , + }) +# --- diff --git a/tests/components/sensibo/test_climate.py b/tests/components/sensibo/test_climate.py index 52b22570957..530034720f2 100644 --- a/tests/components/sensibo/test_climate.py +++ b/tests/components/sensibo/test_climate.py @@ -6,6 +6,7 @@ from unittest.mock import patch from pysensibo.model import SensiboData import pytest +from syrupy.assertion import SnapshotAssertion from voluptuous import MultipleInvalid from homeassistant.components.climate import ( @@ -80,6 +81,7 @@ async def test_climate( caplog: pytest.LogCaptureFixture, get_data: SensiboData, load_int: ConfigEntry, + snapshot: SnapshotAssertion, ) -> None: """Test the Sensibo climate.""" @@ -88,36 +90,7 @@ async def test_climate( state3 = hass.states.get("climate.bedroom") assert state1.state == "heat" - assert state1.attributes == { - "hvac_modes": [ - "cool", - "heat", - "dry", - "heat_cool", - "fan_only", - "off", - ], - "min_temp": 10, - "max_temp": 20, - "target_temp_step": 1, - "fan_modes": [ - "quiet", - "low", - "medium", - ], - "swing_modes": [ - "stopped", - "fixedtop", - "fixedmiddletop", - ], - "current_temperature": 21.2, - "temperature": 25, - "current_humidity": 32.9, - "fan_mode": "high", - "swing_mode": "stopped", - "friendly_name": "Hallway", - "supported_features": 41, - } + assert state1.attributes == snapshot assert state2.state == "off" diff --git a/tests/components/sensibo/test_sensor.py b/tests/components/sensibo/test_sensor.py index 0978b829608..b3089c37e68 100644 --- a/tests/components/sensibo/test_sensor.py +++ b/tests/components/sensibo/test_sensor.py @@ -6,6 +6,7 @@ from unittest.mock import patch from pysensibo.model import SensiboData import pytest +from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import ConfigEntry from homeassistant.core import HomeAssistant @@ -20,6 +21,7 @@ async def test_sensor( load_int: ConfigEntry, monkeypatch: pytest.MonkeyPatch, get_data: SensiboData, + snapshot: SnapshotAssertion, ) -> None: """Test the Sensibo sensor.""" @@ -31,27 +33,8 @@ async def test_sensor( assert state2.state == "1" assert state3.state == "n" assert state4.state == "0.0" - assert state2.attributes == { - "state_class": "measurement", - "unit_of_measurement": "µg/m³", - "device_class": "pm25", - "icon": "mdi:air-filter", - "friendly_name": "Kitchen PM2.5", - } - assert state4.attributes == { - "device_class": "temperature", - "friendly_name": "Hallway Climate React low temperature threshold", - "state_class": "measurement", - "unit_of_measurement": "°C", - "on": True, - "targettemperature": 21, - "temperatureunit": "c", - "mode": "heat", - "fanlevel": "low", - "swing": "stopped", - "horizontalswing": "stopped", - "light": "on", - } + assert state2.attributes == snapshot + assert state4.attributes == snapshot monkeypatch.setattr(get_data.parsed["AAZZAAZZ"], "pm25", 2)