From 27783210189872e4b2ac7d14ce2a9db4df88e22f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 9 Sep 2026 13:23:03 +0200 Subject: [PATCH] Use snapshot_platform in abode (#181732) --- .../snapshots/test_alarm_control_panel.ambr | 59 +++++ .../abode/snapshots/test_binary_sensor.ambr | 169 ++++++++++++++ .../abode/snapshots/test_camera.ambr | 59 +++++ .../abode/snapshots/test_cover.ambr | 58 +++++ .../abode/snapshots/test_light.ambr | 215 ++++++++++++++++++ .../components/abode/snapshots/test_lock.ambr | 57 +++++ .../abode/snapshots/test_sensor.ambr | 184 +++++++++++++++ .../abode/snapshots/test_switch.ambr | 108 +++++++++ .../abode/test_alarm_control_panel.py | 34 +-- tests/components/abode/test_binary_sensor.py | 45 +--- tests/components/abode/test_camera.py | 38 ++-- tests/components/abode/test_cover.py | 40 ++-- tests/components/abode/test_light.py | 59 ++--- tests/components/abode/test_lock.py | 37 +-- tests/components/abode/test_sensor.py | 59 +---- tests/components/abode/test_switch.py | 47 +--- 16 files changed, 1014 insertions(+), 254 deletions(-) create mode 100644 tests/components/abode/snapshots/test_alarm_control_panel.ambr create mode 100644 tests/components/abode/snapshots/test_binary_sensor.ambr create mode 100644 tests/components/abode/snapshots/test_camera.ambr create mode 100644 tests/components/abode/snapshots/test_cover.ambr create mode 100644 tests/components/abode/snapshots/test_light.ambr create mode 100644 tests/components/abode/snapshots/test_lock.ambr create mode 100644 tests/components/abode/snapshots/test_sensor.ambr create mode 100644 tests/components/abode/snapshots/test_switch.ambr diff --git a/tests/components/abode/snapshots/test_alarm_control_panel.ambr b/tests/components/abode/snapshots/test_alarm_control_panel.ambr new file mode 100644 index 000000000000..f2157a4b229d --- /dev/null +++ b/tests/components/abode/snapshots/test_alarm_control_panel.ambr @@ -0,0 +1,59 @@ +# serializer version: 1 +# name: test_all_entities[alarm_control_panel.abode_alarm-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'alarm_control_panel', + 'entity_category': None, + 'entity_id': 'alarm_control_panel.abode_alarm', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '001122334455', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[alarm_control_panel.abode_alarm-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_backup': False, + 'cellular_backup': False, + : None, + : False, + : None, + 'device_id': 'area_1', + : 'Abode Alarm', + : , + }), + 'context': , + 'entity_id': 'alarm_control_panel.abode_alarm', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'disarmed', + }) +# --- diff --git a/tests/components/abode/snapshots/test_binary_sensor.ambr b/tests/components/abode/snapshots/test_binary_sensor.ambr new file mode 100644 index 000000000000..84d90d947ed1 --- /dev/null +++ b/tests/components/abode/snapshots/test_binary_sensor.ambr @@ -0,0 +1,169 @@ +# serializer version: 1 +# name: test_all_entities[binary_sensor.front_door-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.front_door', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '2834013428b6035fba7d4054aa7b25a3', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[binary_sensor.front_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 'window', + 'device_id': 'RF:01430030', + 'device_type': 'Door Contact', + : 'Front Door', + 'no_response': False, + }), + 'context': , + 'entity_id': 'binary_sensor.front_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_all_entities[binary_sensor.hallway_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.hallway_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'ba2c7e8d4430da8d34c31425a2823fe0', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[binary_sensor.hallway_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 'motion', + 'device_id': 'RF:01c34a30', + 'device_type': 'Occupancy', + : 'Hallway Motion', + 'no_response': False, + }), + 'context': , + 'entity_id': 'binary_sensor.hallway_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_all_entities[binary_sensor.living_room_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.living_room_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '2f1bc34ceadac032af4fc9189ef821a8', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[binary_sensor.living_room_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 'motion', + 'device_id': 'SR:PIR', + 'device_type': 'Motion Sensor', + : 'Living Room Motion', + 'no_response': False, + }), + 'context': , + 'entity_id': 'binary_sensor.living_room_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- diff --git a/tests/components/abode/snapshots/test_camera.ambr b/tests/components/abode/snapshots/test_camera.ambr new file mode 100644 index 000000000000..5fbef93be3cd --- /dev/null +++ b/tests/components/abode/snapshots/test_camera.ambr @@ -0,0 +1,59 @@ +# serializer version: 1 +# name: test_all_entities[camera.test_cam-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'camera', + 'entity_category': None, + 'entity_id': 'camera.test_cam', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': 'd0a3a1c316891ceb00c20118aae2a133', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[camera.test_cam-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : '1', + : 'Data provided by goabode.com', + 'battery_low': False, + 'device_id': 'XF:b0c5ba27592a', + 'device_type': 'IP Cam', + : '/api/camera_proxy/camera.test_cam?token=1', + : 'Test Cam', + 'no_response': False, + : , + }), + 'context': , + 'entity_id': 'camera.test_cam', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'idle', + }) +# --- diff --git a/tests/components/abode/snapshots/test_cover.ambr b/tests/components/abode/snapshots/test_cover.ambr new file mode 100644 index 000000000000..c21ef46457e0 --- /dev/null +++ b/tests/components/abode/snapshots/test_cover.ambr @@ -0,0 +1,58 @@ +# serializer version: 1 +# name: test_all_entities[cover.garage_door-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'cover', + 'entity_category': None, + 'entity_id': 'cover.garage_door', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': , + 'translation_key': None, + 'unique_id': '61cbz3b542d2o33ed2fz02721bda3324', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[cover.garage_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + 'device_id': 'ZW:00000007', + 'device_type': 'Secure Barrier', + : 'Garage Door', + : True, + 'no_response': False, + : , + }), + 'context': , + 'entity_id': 'cover.garage_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'closed', + }) +# --- diff --git a/tests/components/abode/snapshots/test_light.ambr b/tests/components/abode/snapshots/test_light.ambr new file mode 100644 index 000000000000..0b1e3e6a2eef --- /dev/null +++ b/tests/components/abode/snapshots/test_light.ambr @@ -0,0 +1,215 @@ +# serializer version: 1 +# name: test_all_entities[light.living_room_lamp-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : 6535, + : 2000, + : list([ + , + , + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.living_room_lamp', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '741385f4388b2637df4c6b398fe50581', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[light.living_room_lamp-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 204, + : , + : None, + 'device_id': 'ZB:db5b1a', + 'device_type': 'RGB Dimmer', + : 'Living Room Lamp', + : tuple( + 225, + 100, + ), + : 6535, + : 2000, + 'no_response': False, + : tuple( + 0, + 64, + 255, + ), + : list([ + , + , + ]), + : , + : tuple( + 0.137, + 0.066, + ), + }), + 'context': , + 'entity_id': 'light.living_room_lamp', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_all_entities[light.test_dimmer_only_device-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + , + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.test_dimmer_only_device', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '641385f4388b2637df4c6b398fe50581', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[light.test_dimmer_only_device-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 255, + : , + 'device_id': 'ZB:db5b1b', + 'device_type': 'Dimmer', + : 'Test Dimmer Only Device', + 'no_response': False, + : list([ + , + ]), + : , + }), + 'context': , + 'entity_id': 'light.test_dimmer_only_device', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_all_entities[light.test_non_dimmer_device-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : list([ + , + ]), + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.test_non_dimmer_device', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '641385f4388b2637df4c6b398fe50583', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[light.test_non_dimmer_device-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : , + 'device_id': 'ZB:db5b1c', + 'device_type': 'Light', + : 'Test Non-dimmer Device', + 'no_response': False, + : list([ + , + ]), + : , + }), + 'context': , + 'entity_id': 'light.test_non_dimmer_device', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- diff --git a/tests/components/abode/snapshots/test_lock.ambr b/tests/components/abode/snapshots/test_lock.ambr new file mode 100644 index 000000000000..ab735b16061e --- /dev/null +++ b/tests/components/abode/snapshots/test_lock.ambr @@ -0,0 +1,57 @@ +# serializer version: 1 +# name: test_all_entities[lock.test_lock-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'lock', + 'entity_category': None, + 'entity_id': 'lock.test_lock', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '51cab3b545d2o34ed7fz02731bda5324', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[lock.test_lock-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + 'device_id': 'ZW:00000004', + 'device_type': 'Door Lock', + : 'Test Lock', + 'no_response': False, + : , + }), + 'context': , + 'entity_id': 'lock.test_lock', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'locked', + }) +# --- diff --git a/tests/components/abode/snapshots/test_sensor.ambr b/tests/components/abode/snapshots/test_sensor.ambr new file mode 100644 index 000000000000..63cadb4f72a8 --- /dev/null +++ b/tests/components/abode/snapshots/test_sensor.ambr @@ -0,0 +1,184 @@ +# serializer version: 1 +# name: test_all_entities[sensor.environment_sensor_humidity-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.environment_sensor_humidity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Humidity', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Humidity', + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13545b21f4bdcd33d9abd461f8443e65-humidity', + 'unit_of_measurement': '%', + }) +# --- +# name: test_all_entities[sensor.environment_sensor_humidity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 'humidity', + 'device_id': 'RF:02148e70', + 'device_type': 'LM', + : 'Environment Sensor Humidity', + 'no_response': False, + : , + : '%', + }), + 'context': , + 'entity_id': 'sensor.environment_sensor_humidity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '32.0', + }) +# --- +# name: test_all_entities[sensor.environment_sensor_illuminance-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.environment_sensor_illuminance', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Illuminance', + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Illuminance', + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13545b21f4bdcd33d9abd461f8443e65-lux', + 'unit_of_measurement': 'lx', + }) +# --- +# name: test_all_entities[sensor.environment_sensor_illuminance-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 'illuminance', + 'device_id': 'RF:02148e70', + 'device_type': 'LM', + : 'Environment Sensor Illuminance', + 'no_response': False, + : , + : 'lx', + }), + 'context': , + 'entity_id': 'sensor.environment_sensor_illuminance', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '1.0', + }) +# --- +# name: test_all_entities[sensor.environment_sensor_temperature-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': dict({ + : , + }), + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.environment_sensor_temperature', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Temperature', + 'options': dict({ + 'sensor': dict({ + 'suggested_display_precision': 1, + }), + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Temperature', + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '13545b21f4bdcd33d9abd461f8443e65-temperature', + 'unit_of_measurement': , + }) +# --- +# name: test_all_entities[sensor.environment_sensor_temperature-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + : 'temperature', + 'device_id': 'RF:02148e70', + 'device_type': 'LM', + : 'Environment Sensor Temperature', + 'no_response': False, + : , + : , + }), + 'context': , + 'entity_id': 'sensor.environment_sensor_temperature', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '19.4444444444444', + }) +# --- diff --git a/tests/components/abode/snapshots/test_switch.ambr b/tests/components/abode/snapshots/test_switch.ambr new file mode 100644 index 000000000000..5c490d96eafa --- /dev/null +++ b/tests/components/abode/snapshots/test_switch.ambr @@ -0,0 +1,108 @@ +# serializer version: 1 +# name: test_all_entities[switch.test_automation-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': None, + 'entity_id': 'switch.test_automation', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': 'Test Automation', + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Test Automation', + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': 'automation', + 'unique_id': '47fae27488f74f55b964a81a066c3a01', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[switch.test_automation-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + : 'Test Automation', + 'type': 'CUE automation', + }), + 'context': , + 'entity_id': 'switch.test_automation', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- +# name: test_all_entities[switch.test_switch-entry] + EntityRegistryEntrySnapshot({ + 'aliases': list([ + None, + ]), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'config_subentry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'switch', + 'entity_category': None, + 'entity_id': 'switch.test_switch', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'object_id_base': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'abode', + 'previous_unique_id': None, + 'suggested_object_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '0012a4d3614cb7e2b8c9abea31d2fb2a', + 'unit_of_measurement': None, + }) +# --- +# name: test_all_entities[switch.test_switch-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + : 'Data provided by goabode.com', + 'battery_low': False, + 'device_id': 'ZW:0000000b', + 'device_type': 'Power Switch Sensor', + : 'Test Switch', + 'no_response': False, + }), + 'context': , + 'entity_id': 'switch.test_switch', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- diff --git a/tests/components/abode/test_alarm_control_panel.py b/tests/components/abode/test_alarm_control_panel.py index 025afa74b806..6301de4b2654 100644 --- a/tests/components/abode/test_alarm_control_panel.py +++ b/tests/components/abode/test_alarm_control_panel.py @@ -2,15 +2,14 @@ from unittest.mock import PropertyMock, patch -from homeassistant.components.abode import ATTR_DEVICE_ID +from syrupy.assertion import SnapshotAssertion + from homeassistant.components.alarm_control_panel import ( DOMAIN as ALARM_DOMAIN, AlarmControlPanelState, ) from homeassistant.const import ( ATTR_ENTITY_ID, - ATTR_FRIENDLY_NAME, - ATTR_SUPPORTED_FEATURES, SERVICE_ALARM_ARM_AWAY, SERVICE_ALARM_ARM_HOME, SERVICE_ALARM_DISARM, @@ -20,31 +19,20 @@ from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform + DEVICE_ID = "alarm_control_panel.abode_alarm" -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, ALARM_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, ALARM_DOMAIN) - entry = entity_registry.async_get(DEVICE_ID) - # Abode alarm device unique_id is the MAC address - assert entry.unique_id == "001122334455" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the alarm control panel attributes are correct.""" - await setup_platform(hass, ALARM_DOMAIN) - - state = hass.states.get(DEVICE_ID) - assert state.state == AlarmControlPanelState.DISARMED - assert state.attributes.get(ATTR_DEVICE_ID) == "area_1" - assert not state.attributes.get("battery_backup") - assert not state.attributes.get("cellular_backup") - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Abode Alarm" - assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == 3 + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) async def test_set_alarm_away(hass: HomeAssistant) -> None: diff --git a/tests/components/abode/test_binary_sensor.py b/tests/components/abode/test_binary_sensor.py index 1fcc032c48de..f61c2cead9e9 100644 --- a/tests/components/abode/test_binary_sensor.py +++ b/tests/components/abode/test_binary_sensor.py @@ -1,43 +1,22 @@ """Tests for the Abode binary sensor device.""" -from homeassistant.components.abode import ATTR_DEVICE_ID -from homeassistant.components.abode.const import ATTRIBUTION -from homeassistant.components.binary_sensor import ( - DOMAIN as BINARY_SENSOR_DOMAIN, - BinarySensorDeviceClass, -) -from homeassistant.const import ( - ATTR_ATTRIBUTION, - ATTR_DEVICE_CLASS, - ATTR_FRIENDLY_NAME, - STATE_OFF, -) +from syrupy.assertion import SnapshotAssertion + +from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry + +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, BINARY_SENSOR_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, BINARY_SENSOR_DOMAIN) - entry = entity_registry.async_get("binary_sensor.front_door") - assert entry.unique_id == "2834013428b6035fba7d4054aa7b25a3" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the binary sensor attributes are correct.""" - await setup_platform(hass, BINARY_SENSOR_DOMAIN) - - state = hass.states.get("binary_sensor.front_door") - assert state.state == STATE_OFF - assert state.attributes.get(ATTR_ATTRIBUTION) == ATTRIBUTION - assert state.attributes.get(ATTR_DEVICE_ID) == "RF:01430030" - assert not state.attributes.get("battery_low") - assert not state.attributes.get("no_response") - assert state.attributes.get("device_type") == "Door Contact" - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Front Door" - assert state.attributes.get(ATTR_DEVICE_CLASS) == BinarySensorDeviceClass.WINDOW + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) diff --git a/tests/components/abode/test_camera.py b/tests/components/abode/test_camera.py index 5b55e7e6a630..100da6c3ced2 100644 --- a/tests/components/abode/test_camera.py +++ b/tests/components/abode/test_camera.py @@ -2,31 +2,39 @@ from unittest.mock import patch +import pytest +from syrupy.assertion import SnapshotAssertion + from homeassistant.components.abode.const import DOMAIN -from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN, CameraState +from homeassistant.components.camera import DOMAIN as CAMERA_DOMAIN from homeassistant.const import ATTR_ENTITY_ID from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry + +@pytest.fixture(autouse=True) +def mock_getrandbits(): + """Mock camera access token which normally is randomized.""" + with patch( + "homeassistant.components.camera.SystemRandom.getrandbits", + return_value=1, + ): + yield + + +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, CAMERA_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, CAMERA_DOMAIN) - entry = entity_registry.async_get("camera.test_cam") - assert entry.unique_id == "d0a3a1c316891ceb00c20118aae2a133" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the camera attributes are correct.""" - await setup_platform(hass, CAMERA_DOMAIN) - - state = hass.states.get("camera.test_cam") - assert state.state == CameraState.IDLE + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) async def test_capture_image(hass: HomeAssistant) -> None: diff --git a/tests/components/abode/test_cover.py b/tests/components/abode/test_cover.py index 4a49648516de..c95ad89a3d22 100644 --- a/tests/components/abode/test_cover.py +++ b/tests/components/abode/test_cover.py @@ -2,43 +2,29 @@ from unittest.mock import patch -from homeassistant.components.abode import ATTR_DEVICE_ID -from homeassistant.components.cover import DOMAIN as COVER_DOMAIN, CoverState -from homeassistant.const import ( - ATTR_ENTITY_ID, - ATTR_FRIENDLY_NAME, - SERVICE_CLOSE_COVER, - SERVICE_OPEN_COVER, -) +from syrupy.assertion import SnapshotAssertion + +from homeassistant.components.cover import DOMAIN as COVER_DOMAIN +from homeassistant.const import ATTR_ENTITY_ID, SERVICE_CLOSE_COVER, SERVICE_OPEN_COVER from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform + DEVICE_ID = "cover.garage_door" -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, COVER_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, COVER_DOMAIN) - entry = entity_registry.async_get(DEVICE_ID) - assert entry.unique_id == "61cbz3b542d2o33ed2fz02721bda3324" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the cover attributes are correct.""" - await setup_platform(hass, COVER_DOMAIN) - - state = hass.states.get(DEVICE_ID) - assert state.state == CoverState.CLOSED - assert state.attributes.get(ATTR_DEVICE_ID) == "ZW:00000007" - assert not state.attributes.get("battery_low") - assert not state.attributes.get("no_response") - assert state.attributes.get("device_type") == "Secure Barrier" - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Garage Door" + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) async def test_open(hass: HomeAssistant) -> None: diff --git a/tests/components/abode/test_light.py b/tests/components/abode/test_light.py index fd5b8d0bcdac..77d21faf6799 100644 --- a/tests/components/abode/test_light.py +++ b/tests/components/abode/test_light.py @@ -2,62 +2,29 @@ from unittest.mock import patch -from homeassistant.components.abode import ATTR_DEVICE_ID -from homeassistant.components.light import ( - ATTR_BRIGHTNESS, - ATTR_COLOR_MODE, - ATTR_COLOR_TEMP_KELVIN, - ATTR_RGB_COLOR, - ATTR_SUPPORTED_COLOR_MODES, - DOMAIN as LIGHT_DOMAIN, - ColorMode, -) -from homeassistant.const import ( - ATTR_ENTITY_ID, - ATTR_FRIENDLY_NAME, - ATTR_SUPPORTED_FEATURES, - SERVICE_TURN_OFF, - SERVICE_TURN_ON, - STATE_ON, -) +from syrupy.assertion import SnapshotAssertion + +from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN +from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform + DEVICE_ID = "light.living_room_lamp" -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, LIGHT_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, LIGHT_DOMAIN) - entry = entity_registry.async_get(DEVICE_ID) - assert entry.unique_id == "741385f4388b2637df4c6b398fe50581" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the light attributes are correct.""" - await setup_platform(hass, LIGHT_DOMAIN) - - state = hass.states.get(DEVICE_ID) - assert state.state == STATE_ON - assert state.attributes.get(ATTR_BRIGHTNESS) == 204 - assert state.attributes.get(ATTR_RGB_COLOR) == (0, 64, 255) - assert state.attributes.get(ATTR_COLOR_TEMP_KELVIN) is None - assert state.attributes.get(ATTR_DEVICE_ID) == "ZB:db5b1a" - assert not state.attributes.get("battery_low") - assert not state.attributes.get("no_response") - assert state.attributes.get("device_type") == "RGB Dimmer" - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Living Room Lamp" - assert state.attributes.get(ATTR_SUPPORTED_FEATURES) == 0 - assert state.attributes.get(ATTR_COLOR_MODE) == ColorMode.HS - assert state.attributes.get(ATTR_SUPPORTED_COLOR_MODES) == [ - ColorMode.COLOR_TEMP, - ColorMode.HS, - ] + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) async def test_switch_off(hass: HomeAssistant) -> None: diff --git a/tests/components/abode/test_lock.py b/tests/components/abode/test_lock.py index bb041fe9ff19..7b26b6412083 100644 --- a/tests/components/abode/test_lock.py +++ b/tests/components/abode/test_lock.py @@ -5,46 +5,29 @@ from unittest.mock import patch from jaraco.abode.helpers import urls as URL from requests_mock import Mocker +from syrupy.assertion import SnapshotAssertion -from homeassistant.components.abode import ATTR_DEVICE_ID from homeassistant.components.lock import DOMAIN as LOCK_DOMAIN, LockState -from homeassistant.const import ( - ATTR_ENTITY_ID, - ATTR_FRIENDLY_NAME, - SERVICE_LOCK, - SERVICE_UNLOCK, -) +from homeassistant.const import ATTR_ENTITY_ID, SERVICE_LOCK, SERVICE_UNLOCK from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform -from tests.common import async_load_json_array_fixture +from tests.common import async_load_json_array_fixture, snapshot_platform DEVICE_ID = "lock.test_lock" -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, LOCK_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, LOCK_DOMAIN) - entry = entity_registry.async_get(DEVICE_ID) - assert entry.unique_id == "51cab3b545d2o34ed7fz02731bda5324" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the lock attributes are correct.""" - await setup_platform(hass, LOCK_DOMAIN) - - state = hass.states.get(DEVICE_ID) - assert state.state == LockState.LOCKED - assert state.attributes.get(ATTR_DEVICE_ID) == "ZW:00000004" - assert not state.attributes.get("battery_low") - assert not state.attributes.get("no_response") - assert state.attributes.get("device_type") == "Door Lock" - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Test Lock" + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) async def test_lock(hass: HomeAssistant) -> None: diff --git a/tests/components/abode/test_sensor.py b/tests/components/abode/test_sensor.py index 43f3033ab2b4..f706392f075a 100644 --- a/tests/components/abode/test_sensor.py +++ b/tests/components/abode/test_sensor.py @@ -1,59 +1,22 @@ """Tests for the Abode sensor device.""" -import pytest +from syrupy.assertion import SnapshotAssertion -from homeassistant.components.abode import ATTR_DEVICE_ID -from homeassistant.components.sensor import ( - ATTR_STATE_CLASS, - DOMAIN as SENSOR_DOMAIN, - SensorDeviceClass, - SensorStateClass, -) -from homeassistant.const import ( - ATTR_DEVICE_CLASS, - ATTR_FRIENDLY_NAME, - ATTR_UNIT_OF_MEASUREMENT, - PERCENTAGE, - UnitOfTemperature, -) +from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry + +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, SENSOR_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, SENSOR_DOMAIN) - entry = entity_registry.async_get("sensor.environment_sensor_humidity") - assert entry.unique_id == "13545b21f4bdcd33d9abd461f8443e65-humidity" - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the sensor attributes are correct.""" - await setup_platform(hass, SENSOR_DOMAIN) - - state = hass.states.get("sensor.environment_sensor_humidity") - assert state.state == "32.0" - assert state.attributes.get(ATTR_DEVICE_ID) == "RF:02148e70" - assert not state.attributes.get("battery_low") - assert not state.attributes.get("no_response") - assert state.attributes.get("device_type") == "LM" - assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == PERCENTAGE - assert state.attributes.get(ATTR_FRIENDLY_NAME) == "Environment Sensor Humidity" - assert state.attributes.get(ATTR_DEVICE_CLASS) == SensorDeviceClass.HUMIDITY - assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - - state = hass.states.get("sensor.environment_sensor_illuminance") - assert state.state == "1.0" - assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == "lx" - assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT - - state = hass.states.get("sensor.environment_sensor_temperature") - # Abodepy device JSON reports 19.5, but Home Assistant shows 19.4 - assert float(state.state) == pytest.approx(19.44444) - assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfTemperature.CELSIUS - assert state.attributes.get(ATTR_STATE_CLASS) == SensorStateClass.MEASUREMENT + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) diff --git a/tests/components/abode/test_switch.py b/tests/components/abode/test_switch.py index 5e661402bb4b..673eff58285f 100644 --- a/tests/components/abode/test_switch.py +++ b/tests/components/abode/test_switch.py @@ -2,45 +2,31 @@ from unittest.mock import patch +from syrupy.assertion import SnapshotAssertion + from homeassistant.components.abode.const import DOMAIN from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN -from homeassistant.const import ( - ATTR_ENTITY_ID, - SERVICE_TURN_OFF, - SERVICE_TURN_ON, - STATE_OFF, - STATE_ON, -) +from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from .common import setup_platform +from tests.common import snapshot_platform + AUTOMATION_ID = "switch.test_automation" -AUTOMATION_UID = "47fae27488f74f55b964a81a066c3a01" DEVICE_ID = "switch.test_switch" -DEVICE_UID = "0012a4d3614cb7e2b8c9abea31d2fb2a" -async def test_entity_registry( - hass: HomeAssistant, entity_registry: er.EntityRegistry +async def test_all_entities( + hass: HomeAssistant, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, SWITCH_DOMAIN) + """Test all entities.""" + config_entry = await setup_platform(hass, SWITCH_DOMAIN) - entry = entity_registry.async_get(AUTOMATION_ID) - assert entry.unique_id == AUTOMATION_UID - - entry = entity_registry.async_get(DEVICE_ID) - assert entry.unique_id == DEVICE_UID - - -async def test_attributes(hass: HomeAssistant) -> None: - """Test the switch attributes are correct.""" - await setup_platform(hass, SWITCH_DOMAIN) - - state = hass.states.get(DEVICE_ID) - assert state.state == STATE_OFF + await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id) async def test_switch_on(hass: HomeAssistant) -> None: @@ -69,15 +55,6 @@ async def test_switch_off(hass: HomeAssistant) -> None: mock_switch_off.assert_called_once() -async def test_automation_attributes(hass: HomeAssistant) -> None: - """Test the automation attributes are correct.""" - await setup_platform(hass, SWITCH_DOMAIN) - - state = hass.states.get(AUTOMATION_ID) - # State is set based on "enabled" key in automation JSON. - assert state.state == STATE_ON - - async def test_turn_automation_off(hass: HomeAssistant) -> None: """Test the automation can be turned off.""" with patch("jaraco.abode.automation.Automation.enable") as mock_trigger: