From 010a5d2829d03c864278a940308a4fe69d173bbc Mon Sep 17 00:00:00 2001 From: "Steven B." <51370195+sdb9696@users.noreply.github.com> Date: Tue, 24 Sep 2024 09:53:19 +0100 Subject: [PATCH] Add snapshots to all ring platform tests (#126560) Add test snapshots to all ring platform tests --- tests/components/ring/device_mocks.py | 2 + .../ring/snapshots/test_binary_sensor.ambr | 241 ++++ .../ring/snapshots/test_button.ambr | 48 + .../ring/snapshots/test_camera.ambr | 159 +++ .../components/ring/snapshots/test_event.ambr | 337 +++++ .../components/ring/snapshots/test_light.ambr | 113 ++ .../ring/snapshots/test_sensor.ambr | 1149 +++++++++++++++++ tests/components/ring/test_binary_sensor.py | 55 +- tests/components/ring/test_button.py | 21 +- tests/components/ring/test_camera.py | 27 +- tests/components/ring/test_event.py | 20 +- tests/components/ring/test_light.py | 23 +- tests/components/ring/test_sensor.py | 85 +- tests/components/ring/test_switch.py | 16 - 14 files changed, 2197 insertions(+), 99 deletions(-) create mode 100644 tests/components/ring/snapshots/test_binary_sensor.ambr create mode 100644 tests/components/ring/snapshots/test_button.ambr create mode 100644 tests/components/ring/snapshots/test_camera.ambr create mode 100644 tests/components/ring/snapshots/test_event.ambr create mode 100644 tests/components/ring/snapshots/test_light.ambr create mode 100644 tests/components/ring/snapshots/test_sensor.ambr diff --git a/tests/components/ring/device_mocks.py b/tests/components/ring/device_mocks.py index 4c475c0be87..a1833aaa8bd 100644 --- a/tests/components/ring/device_mocks.py +++ b/tests/components/ring/device_mocks.py @@ -34,6 +34,8 @@ CHIME_HEALTH = load_json_value_fixture("chime_health_attrs.json", DOMAIN) FRONT_DOOR_DEVICE_ID = 987654 INGRESS_DEVICE_ID = 185036587 FRONT_DEVICE_ID = 765432 +INTERNAL_DEVICE_ID = 345678 +DOWNSTAIRS_DEVICE_ID = 123456 def get_mock_devices(): diff --git a/tests/components/ring/snapshots/test_binary_sensor.ambr b/tests/components/ring/snapshots/test_binary_sensor.ambr new file mode 100644 index 00000000000..2f8e4d8a219 --- /dev/null +++ b/tests/components/ring/snapshots/test_binary_sensor.ambr @@ -0,0 +1,241 @@ +# serializer version: 1 +# name: test_states[binary_sensor.front_door_ding-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.front_door_ding', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Ding', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'ding', + 'unique_id': '987654-ding', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[binary_sensor.front_door_ding-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'occupancy', + 'friendly_name': 'Front Door Ding', + }), + 'context': , + 'entity_id': 'binary_sensor.front_door_ding', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_states[binary_sensor.front_door_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.front_door_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Motion', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'motion', + 'unique_id': '987654-motion', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[binary_sensor.front_door_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'motion', + 'friendly_name': 'Front Door Motion', + }), + 'context': , + 'entity_id': 'binary_sensor.front_door_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_states[binary_sensor.front_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.front_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Motion', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'motion', + 'unique_id': '765432-motion', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[binary_sensor.front_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'motion', + 'friendly_name': 'Front Motion', + }), + 'context': , + 'entity_id': 'binary_sensor.front_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_states[binary_sensor.ingress_ding-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.ingress_ding', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Ding', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'ding', + 'unique_id': '185036587-ding', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[binary_sensor.ingress_ding-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'occupancy', + 'friendly_name': 'Ingress Ding', + }), + 'context': , + 'entity_id': 'binary_sensor.ingress_ding', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_states[binary_sensor.internal_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'binary_sensor', + 'entity_category': None, + 'entity_id': 'binary_sensor.internal_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Motion', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'motion', + 'unique_id': '345678-motion', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[binary_sensor.internal_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'motion', + 'friendly_name': 'Internal Motion', + }), + 'context': , + 'entity_id': 'binary_sensor.internal_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- diff --git a/tests/components/ring/snapshots/test_button.ambr b/tests/components/ring/snapshots/test_button.ambr new file mode 100644 index 00000000000..01f6525450b --- /dev/null +++ b/tests/components/ring/snapshots/test_button.ambr @@ -0,0 +1,48 @@ +# serializer version: 1 +# name: test_states[button.ingress_open_door-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'button', + 'entity_category': None, + 'entity_id': 'button.ingress_open_door', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Open door', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'open_door', + 'unique_id': '185036587-open_door', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[button.ingress_open_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Ingress Open door', + }), + 'context': , + 'entity_id': 'button.ingress_open_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- diff --git a/tests/components/ring/snapshots/test_camera.ambr b/tests/components/ring/snapshots/test_camera.ambr new file mode 100644 index 00000000000..4347f302c72 --- /dev/null +++ b/tests/components/ring/snapshots/test_camera.ambr @@ -0,0 +1,159 @@ +# serializer version: 1 +# name: test_states[camera.front-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'camera', + 'entity_category': None, + 'entity_id': 'camera.front', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '765432', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[camera.front-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'access_token': '1caab5c3b3', + 'attribution': 'Data provided by Ring.com', + 'entity_picture': '/api/camera_proxy/camera.front?token=1caab5c3b3', + 'friendly_name': 'Front', + 'last_video_id': None, + 'supported_features': , + 'video_url': None, + }), + 'context': , + 'entity_id': 'camera.front', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'idle', + }) +# --- +# name: test_states[camera.front_door-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'camera', + 'entity_category': None, + 'entity_id': 'camera.front_door', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '987654', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[camera.front_door-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'access_token': '1caab5c3b3', + 'attribution': 'Data provided by Ring.com', + 'entity_picture': '/api/camera_proxy/camera.front_door?token=1caab5c3b3', + 'friendly_name': 'Front Door', + 'last_video_id': None, + 'motion_detection': True, + 'supported_features': , + 'video_url': None, + }), + 'context': , + 'entity_id': 'camera.front_door', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'idle', + }) +# --- +# name: test_states[camera.internal-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'camera', + 'entity_category': None, + 'entity_id': 'camera.internal', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': None, + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '345678', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[camera.internal-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'access_token': '1caab5c3b3', + 'attribution': 'Data provided by Ring.com', + 'entity_picture': '/api/camera_proxy/camera.internal?token=1caab5c3b3', + 'friendly_name': 'Internal', + 'last_video_id': None, + 'motion_detection': True, + 'supported_features': , + 'video_url': None, + }), + 'context': , + 'entity_id': 'camera.internal', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'idle', + }) +# --- diff --git a/tests/components/ring/snapshots/test_event.ambr b/tests/components/ring/snapshots/test_event.ambr new file mode 100644 index 00000000000..e97a01516bb --- /dev/null +++ b/tests/components/ring/snapshots/test_event.ambr @@ -0,0 +1,337 @@ +# serializer version: 1 +# name: test_states[event.front_door_ding-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'event_types': list([ + 'ding', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.front_door_ding', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Ding', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'ding', + 'unique_id': '987654-ding', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[event.front_door_ding-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'doorbell', + 'event_type': None, + 'event_types': list([ + 'ding', + ]), + 'friendly_name': 'Front Door Ding', + }), + 'context': , + 'entity_id': 'event.front_door_ding', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[event.front_door_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'event_types': list([ + 'motion', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.front_door_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Motion', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'motion', + 'unique_id': '987654-motion', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[event.front_door_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'motion', + 'event_type': None, + 'event_types': list([ + 'motion', + ]), + 'friendly_name': 'Front Door Motion', + }), + 'context': , + 'entity_id': 'event.front_door_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[event.front_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'event_types': list([ + 'motion', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.front_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Motion', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'motion', + 'unique_id': '765432-motion', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[event.front_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'motion', + 'event_type': None, + 'event_types': list([ + 'motion', + ]), + 'friendly_name': 'Front Motion', + }), + 'context': , + 'entity_id': 'event.front_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[event.ingress_ding-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'event_types': list([ + 'ding', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.ingress_ding', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Ding', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'ding', + 'unique_id': '185036587-ding', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[event.ingress_ding-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'doorbell', + 'event_type': None, + 'event_types': list([ + 'ding', + ]), + 'friendly_name': 'Ingress Ding', + }), + 'context': , + 'entity_id': 'event.ingress_ding', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[event.ingress_intercom_unlock-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'event_types': list([ + 'intercom_unlock', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.ingress_intercom_unlock', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Intercom unlock', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'intercom_unlock', + 'unique_id': '185036587-intercom_unlock', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[event.ingress_intercom_unlock-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'button', + 'event_type': None, + 'event_types': list([ + 'intercom_unlock', + ]), + 'friendly_name': 'Ingress Intercom unlock', + }), + 'context': , + 'entity_id': 'event.ingress_intercom_unlock', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[event.internal_motion-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'event_types': list([ + 'motion', + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'event', + 'entity_category': None, + 'entity_id': 'event.internal_motion', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Motion', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'motion', + 'unique_id': '345678-motion', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[event.internal_motion-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'motion', + 'event_type': None, + 'event_types': list([ + 'motion', + ]), + 'friendly_name': 'Internal Motion', + }), + 'context': , + 'entity_id': 'event.internal_motion', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- diff --git a/tests/components/ring/snapshots/test_light.ambr b/tests/components/ring/snapshots/test_light.ambr new file mode 100644 index 00000000000..73874fda259 --- /dev/null +++ b/tests/components/ring/snapshots/test_light.ambr @@ -0,0 +1,113 @@ +# serializer version: 1 +# name: test_states[light.front_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.front_light', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Light', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'light', + 'unique_id': '765432', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[light.front_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'color_mode': None, + 'friendly_name': 'Front Light', + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.front_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'off', + }) +# --- +# name: test_states[light.internal_light-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'supported_color_modes': list([ + , + ]), + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'light', + 'entity_category': None, + 'entity_id': 'light.internal_light', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Light', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'light', + 'unique_id': '345678', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[light.internal_light-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'color_mode': , + 'friendly_name': 'Internal Light', + 'supported_color_modes': list([ + , + ]), + 'supported_features': , + }), + 'context': , + 'entity_id': 'light.internal_light', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'on', + }) +# --- diff --git a/tests/components/ring/snapshots/test_sensor.ambr b/tests/components/ring/snapshots/test_sensor.ambr new file mode 100644 index 00000000000..063675ce214 --- /dev/null +++ b/tests/components/ring/snapshots/test_sensor.ambr @@ -0,0 +1,1149 @@ +# serializer version: 1 +# name: test_states[sensor.downstairs_volume-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.downstairs_volume', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Volume', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'volume', + 'unique_id': '123456-volume', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.downstairs_volume-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Downstairs Volume', + }), + 'context': , + 'entity_id': 'sensor.downstairs_volume', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '2', + }) +# --- +# name: test_states[sensor.downstairs_wifi_signal_category-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.downstairs_wifi_signal_category', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Wi-Fi signal category', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_category', + 'unique_id': '123456-wifi_signal_category', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.downstairs_wifi_signal_category-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Downstairs Wi-Fi signal category', + }), + 'context': , + 'entity_id': 'sensor.downstairs_wifi_signal_category', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.downstairs_wifi_signal_strength-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.downstairs_wifi_signal_strength', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wi-Fi signal strength', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_strength', + 'unique_id': '123456-wifi_signal_strength', + 'unit_of_measurement': 'dBm', + }) +# --- +# name: test_states[sensor.downstairs_wifi_signal_strength-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'signal_strength', + 'friendly_name': 'Downstairs Wi-Fi signal strength', + 'unit_of_measurement': 'dBm', + }), + 'context': , + 'entity_id': 'sensor.downstairs_wifi_signal_strength', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.front_battery-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '765432-battery', + 'unit_of_measurement': '%', + }) +# --- +# name: test_states[sensor.front_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'battery', + 'friendly_name': 'Front Battery', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.front_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '80', + }) +# --- +# name: test_states[sensor.front_door_battery-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_door_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '987654-battery', + 'unit_of_measurement': '%', + }) +# --- +# name: test_states[sensor.front_door_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'battery', + 'friendly_name': 'Front Door Battery', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.front_door_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '100', + }) +# --- +# name: test_states[sensor.front_door_last_activity-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_door_last_activity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Last activity', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'last_activity', + 'unique_id': '987654-last_activity', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.front_door_last_activity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'timestamp', + 'friendly_name': 'Front Door Last activity', + }), + 'context': , + 'entity_id': 'sensor.front_door_last_activity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.front_door_volume-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_door_volume', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Volume', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'volume', + 'unique_id': '765432-volume', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.front_door_volume-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Front Volume', + }), + 'context': , + 'entity_id': 'sensor.front_door_volume', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '11', + }) +# --- +# name: test_states[sensor.front_door_wi_fi_signal_category-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': , + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_door_wi_fi_signal_category', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Wi-Fi signal category', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_category', + 'unique_id': '987654-wifi_signal_category', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.front_door_wifi_signal_category-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_door_wifi_signal_category', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Wi-Fi signal category', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_category', + 'unique_id': '987654-wifi_signal_category', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.front_door_wifi_signal_category-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Front Door Wi-Fi signal category', + }), + 'context': , + 'entity_id': 'sensor.front_door_wifi_signal_category', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.front_door_wifi_signal_strength-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_door_wifi_signal_strength', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wi-Fi signal strength', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_strength', + 'unique_id': '987654-wifi_signal_strength', + 'unit_of_measurement': 'dBm', + }) +# --- +# name: test_states[sensor.front_door_wifi_signal_strength-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'signal_strength', + 'friendly_name': 'Front Door Wi-Fi signal strength', + 'unit_of_measurement': 'dBm', + }), + 'context': , + 'entity_id': 'sensor.front_door_wifi_signal_strength', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.front_last_activity-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.front_last_activity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Last activity', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'last_activity', + 'unique_id': '765432-last_activity', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.front_last_activity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'timestamp', + 'friendly_name': 'Front Last activity', + }), + 'context': , + 'entity_id': 'sensor.front_last_activity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.front_wifi_signal_category-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_wifi_signal_category', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Wi-Fi signal category', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_category', + 'unique_id': '765432-wifi_signal_category', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.front_wifi_signal_category-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Front Wi-Fi signal category', + }), + 'context': , + 'entity_id': 'sensor.front_wifi_signal_category', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.front_wifi_signal_strength-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.front_wifi_signal_strength', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wi-Fi signal strength', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_strength', + 'unique_id': '765432-wifi_signal_strength', + 'unit_of_measurement': 'dBm', + }) +# --- +# name: test_states[sensor.front_wifi_signal_strength-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'signal_strength', + 'friendly_name': 'Front Wi-Fi signal strength', + 'unit_of_measurement': 'dBm', + }), + 'context': , + 'entity_id': 'sensor.front_wifi_signal_strength', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.ingress_battery-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.ingress_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '185036587-battery', + 'unit_of_measurement': '%', + }) +# --- +# name: test_states[sensor.ingress_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'battery', + 'friendly_name': 'Ingress Battery', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.ingress_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '52', + }) +# --- +# name: test_states[sensor.ingress_doorbell_volume-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.ingress_doorbell_volume', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Doorbell volume', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'doorbell_volume', + 'unique_id': '185036587-doorbell_volume', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.ingress_doorbell_volume-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Ingress Doorbell volume', + }), + 'context': , + 'entity_id': 'sensor.ingress_doorbell_volume', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '8', + }) +# --- +# name: test_states[sensor.ingress_last_activity-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.ingress_last_activity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Last activity', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'last_activity', + 'unique_id': '185036587-last_activity', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.ingress_last_activity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'timestamp', + 'friendly_name': 'Ingress Last activity', + }), + 'context': , + 'entity_id': 'sensor.ingress_last_activity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.ingress_mic_volume-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.ingress_mic_volume', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Mic volume', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'mic_volume', + 'unique_id': '185036587-mic_volume', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.ingress_mic_volume-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Ingress Mic volume', + }), + 'context': , + 'entity_id': 'sensor.ingress_mic_volume', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '11', + }) +# --- +# name: test_states[sensor.ingress_voice_volume-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.ingress_voice_volume', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Voice volume', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'voice_volume', + 'unique_id': '185036587-voice_volume', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.ingress_voice_volume-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Ingress Voice volume', + }), + 'context': , + 'entity_id': 'sensor.ingress_voice_volume', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '11', + }) +# --- +# name: test_states[sensor.ingress_wifi_signal_category-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.ingress_wifi_signal_category', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Wi-Fi signal category', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_category', + 'unique_id': '185036587-wifi_signal_category', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.ingress_wifi_signal_category-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Ingress Wi-Fi signal category', + }), + 'context': , + 'entity_id': 'sensor.ingress_wifi_signal_category', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.ingress_wifi_signal_strength-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.ingress_wifi_signal_strength', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wi-Fi signal strength', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_strength', + 'unique_id': '185036587-wifi_signal_strength', + 'unit_of_measurement': 'dBm', + }) +# --- +# name: test_states[sensor.ingress_wifi_signal_strength-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'signal_strength', + 'friendly_name': 'Ingress Wi-Fi signal strength', + 'unit_of_measurement': 'dBm', + }), + 'context': , + 'entity_id': 'sensor.ingress_wifi_signal_strength', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.internal_battery-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': dict({ + 'state_class': , + }), + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.internal_battery', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Battery', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': None, + 'unique_id': '345678-battery', + 'unit_of_measurement': '%', + }) +# --- +# name: test_states[sensor.internal_battery-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'battery', + 'friendly_name': 'Internal Battery', + 'state_class': , + 'unit_of_measurement': '%', + }), + 'context': , + 'entity_id': 'sensor.internal_battery', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': '80', + }) +# --- +# name: test_states[sensor.internal_last_activity-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': None, + 'entity_id': 'sensor.internal_last_activity', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Last activity', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'last_activity', + 'unique_id': '345678-last_activity', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.internal_last_activity-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'timestamp', + 'friendly_name': 'Internal Last activity', + }), + 'context': , + 'entity_id': 'sensor.internal_last_activity', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.internal_wifi_signal_category-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.internal_wifi_signal_category', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': None, + 'original_icon': None, + 'original_name': 'Wi-Fi signal category', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_category', + 'unique_id': '345678-wifi_signal_category', + 'unit_of_measurement': None, + }) +# --- +# name: test_states[sensor.internal_wifi_signal_category-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'friendly_name': 'Internal Wi-Fi signal category', + }), + 'context': , + 'entity_id': 'sensor.internal_wifi_signal_category', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- +# name: test_states[sensor.internal_wifi_signal_strength-entry] + EntityRegistryEntrySnapshot({ + 'aliases': set({ + }), + 'area_id': None, + 'capabilities': None, + 'config_entry_id': , + 'device_class': None, + 'device_id': , + 'disabled_by': None, + 'domain': 'sensor', + 'entity_category': , + 'entity_id': 'sensor.internal_wifi_signal_strength', + 'has_entity_name': True, + 'hidden_by': None, + 'icon': None, + 'id': , + 'labels': set({ + }), + 'name': None, + 'options': dict({ + }), + 'original_device_class': , + 'original_icon': None, + 'original_name': 'Wi-Fi signal strength', + 'platform': 'ring', + 'previous_unique_id': None, + 'supported_features': 0, + 'translation_key': 'wifi_signal_strength', + 'unique_id': '345678-wifi_signal_strength', + 'unit_of_measurement': 'dBm', + }) +# --- +# name: test_states[sensor.internal_wifi_signal_strength-state] + StateSnapshot({ + 'attributes': ReadOnlyDict({ + 'attribution': 'Data provided by Ring.com', + 'device_class': 'signal_strength', + 'friendly_name': 'Internal Wi-Fi signal strength', + 'unit_of_measurement': 'dBm', + }), + 'context': , + 'entity_id': 'sensor.internal_wifi_signal_strength', + 'last_changed': , + 'last_reported': , + 'last_updated': , + 'state': 'unknown', + }) +# --- diff --git a/tests/components/ring/test_binary_sensor.py b/tests/components/ring/test_binary_sensor.py index 6a4ce652573..81d7d6e6687 100644 --- a/tests/components/ring/test_binary_sensor.py +++ b/tests/components/ring/test_binary_sensor.py @@ -1,11 +1,12 @@ """The tests for the Ring binary sensor platform.""" import time -from unittest.mock import patch +from unittest.mock import Mock, patch from freezegun.api import FrozenDateTimeFactory import pytest from ring_doorbell import Ring +from syrupy.assertion import SnapshotAssertion from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN from homeassistant.components.ring.binary_sensor import RingEvent @@ -17,10 +18,56 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er, issue_registry as ir from homeassistant.setup import async_setup_component -from .common import setup_automation -from .device_mocks import FRONT_DOOR_DEVICE_ID, INGRESS_DEVICE_ID +from .common import MockConfigEntry, setup_automation, setup_platform +from .device_mocks import ( + FRONT_DEVICE_ID, + FRONT_DOOR_DEVICE_ID, + INGRESS_DEVICE_ID, + INTERNAL_DEVICE_ID, +) -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform + + +@pytest.fixture +def create_deprecated_binary_sensor_entities( + hass: HomeAssistant, + mock_config_entry: ConfigEntry, + entity_registry: er.EntityRegistry, +): + """Create the entity so it is not ignored by the deprecation check.""" + mock_config_entry.add_to_hass(hass) + + def create_entry(device_name, device_id, key): + unique_id = f"{device_id}-{key}" + + entity_registry.async_get_or_create( + domain=BINARY_SENSOR_DOMAIN, + platform=DOMAIN, + unique_id=unique_id, + suggested_object_id=f"{device_name}_{key}", + config_entry=mock_config_entry, + ) + + create_entry("front", FRONT_DEVICE_ID, "motion") + create_entry("front_door", FRONT_DOOR_DEVICE_ID, "motion") + create_entry("internal", INTERNAL_DEVICE_ID, "motion") + + create_entry("ingress", INGRESS_DEVICE_ID, "ding") + create_entry("front_door", FRONT_DOOR_DEVICE_ID, "ding") + + +async def test_states( + hass: HomeAssistant, + mock_ring_client: Mock, + mock_config_entry: MockConfigEntry, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, + create_deprecated_binary_sensor_entities, +) -> None: + """Test states.""" + await setup_platform(hass, Platform.BINARY_SENSOR) + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) @pytest.mark.parametrize( diff --git a/tests/components/ring/test_button.py b/tests/components/ring/test_button.py index 946a893c8ad..ada02f206f5 100644 --- a/tests/components/ring/test_button.py +++ b/tests/components/ring/test_button.py @@ -1,22 +1,29 @@ """The tests for the Ring button platform.""" +from unittest.mock import Mock + +from syrupy.assertion import SnapshotAssertion + from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er -from .common import setup_platform +from .common import MockConfigEntry, setup_platform + +from tests.common import snapshot_platform -async def test_entity_registry( +async def test_states( hass: HomeAssistant, - mock_ring_client, + mock_ring_client: Mock, + mock_config_entry: MockConfigEntry, entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" + """Test states.""" + mock_config_entry.add_to_hass(hass) await setup_platform(hass, Platform.BUTTON) - - entry = entity_registry.async_get("button.ingress_open_door") - assert entry.unique_id == "185036587-open_door" + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) async def test_button_opens_door( diff --git a/tests/components/ring/test_camera.py b/tests/components/ring/test_camera.py index 245c4ce6228..94ddc335dac 100644 --- a/tests/components/ring/test_camera.py +++ b/tests/components/ring/test_camera.py @@ -1,11 +1,12 @@ """The tests for the Ring switch platform.""" -from unittest.mock import AsyncMock, patch +from unittest.mock import AsyncMock, Mock, patch from aiohttp.test_utils import make_mocked_request from freezegun.api import FrozenDateTimeFactory import pytest import ring_doorbell +from syrupy.assertion import SnapshotAssertion from homeassistant.components import camera from homeassistant.components.ring.camera import FORCE_REFRESH_INTERVAL @@ -17,9 +18,9 @@ from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity_registry as er from homeassistant.util.aiohttp import MockStreamReader -from .common import setup_platform +from .common import MockConfigEntry, setup_platform -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform SMALLEST_VALID_JPEG = ( "ffd8ffe000104a46494600010101004800480000ffdb00430003020202020203020202030303030406040404040408060" @@ -29,19 +30,19 @@ SMALLEST_VALID_JPEG = ( SMALLEST_VALID_JPEG_BYTES = bytes.fromhex(SMALLEST_VALID_JPEG) -async def test_entity_registry( +async def test_states( hass: HomeAssistant, + mock_ring_client: Mock, + mock_config_entry: MockConfigEntry, entity_registry: er.EntityRegistry, - mock_ring_client, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, Platform.CAMERA) - - entry = entity_registry.async_get("camera.front") - assert entry.unique_id == "765432" - - entry = entity_registry.async_get("camera.internal") - assert entry.unique_id == "345678" + """Test states.""" + mock_config_entry.add_to_hass(hass) + # Patch getrandbits so the access_token doesn't change on camera attributes + with patch("random.SystemRandom.getrandbits", return_value=123123123123): + await setup_platform(hass, Platform.CAMERA) + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) @pytest.mark.parametrize( diff --git a/tests/components/ring/test_event.py b/tests/components/ring/test_event.py index c546f9ea136..5cd60382a97 100644 --- a/tests/components/ring/test_event.py +++ b/tests/components/ring/test_event.py @@ -2,19 +2,37 @@ from datetime import datetime import time +from unittest.mock import Mock from freezegun.api import FrozenDateTimeFactory import pytest from ring_doorbell import Ring +from syrupy.assertion import SnapshotAssertion from homeassistant.components.ring.binary_sensor import RingEvent from homeassistant.components.ring.coordinator import RingEventListener from homeassistant.const import Platform from homeassistant.core import HomeAssistant +from homeassistant.helpers import entity_registry as er -from .common import setup_platform +from .common import MockConfigEntry, setup_platform from .device_mocks import FRONT_DOOR_DEVICE_ID, INGRESS_DEVICE_ID +from tests.common import snapshot_platform + + +async def test_states( + hass: HomeAssistant, + mock_ring_client: Mock, + mock_config_entry: MockConfigEntry, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, +) -> None: + """Test states.""" + mock_config_entry.add_to_hass(hass) + await setup_platform(hass, Platform.EVENT) + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) + @pytest.mark.parametrize( ("device_id", "device_name", "alert_kind", "device_class"), diff --git a/tests/components/ring/test_light.py b/tests/components/ring/test_light.py index 8ac47ac2f1d..0be314c3135 100644 --- a/tests/components/ring/test_light.py +++ b/tests/components/ring/test_light.py @@ -1,7 +1,10 @@ """The tests for the Ring light platform.""" +from unittest.mock import Mock + import pytest import ring_doorbell +from syrupy.assertion import SnapshotAssertion from homeassistant.config_entries import SOURCE_REAUTH from homeassistant.const import Platform @@ -9,22 +12,22 @@ from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers import entity_registry as er -from .common import setup_platform +from .common import MockConfigEntry, setup_platform + +from tests.common import snapshot_platform -async def test_entity_registry( +async def test_states( hass: HomeAssistant, + mock_ring_client: Mock, + mock_config_entry: MockConfigEntry, entity_registry: er.EntityRegistry, - mock_ring_client, + snapshot: SnapshotAssertion, ) -> None: - """Tests that the devices are registered in the entity registry.""" + """Test states.""" + mock_config_entry.add_to_hass(hass) await setup_platform(hass, Platform.LIGHT) - - entry = entity_registry.async_get("light.front_light") - assert entry.unique_id == "765432" - - entry = entity_registry.async_get("light.internal_light") - assert entry.unique_id == "345678" + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) async def test_light_off_reports_correctly( diff --git a/tests/components/ring/test_sensor.py b/tests/components/ring/test_sensor.py index 07f35a3ff79..48f679c4524 100644 --- a/tests/components/ring/test_sensor.py +++ b/tests/components/ring/test_sensor.py @@ -1,32 +1,35 @@ """The tests for the Ring sensor platform.""" import logging -from unittest.mock import patch +from unittest.mock import Mock, patch from freezegun.api import FrozenDateTimeFactory import pytest from ring_doorbell import Ring +from syrupy.assertion import SnapshotAssertion from homeassistant.components.ring.const import DOMAIN, SCAN_INTERVAL -from homeassistant.components.sensor import ( - ATTR_STATE_CLASS, - DOMAIN as SENSOR_DOMAIN, - SensorStateClass, -) +from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.config_entries import ConfigEntry from homeassistant.const import Platform from homeassistant.core import HomeAssistant from homeassistant.helpers import entity_registry as er from homeassistant.setup import async_setup_component -from .common import setup_platform -from .device_mocks import FRONT_DEVICE_ID, FRONT_DOOR_DEVICE_ID, INGRESS_DEVICE_ID +from .common import MockConfigEntry, setup_platform +from .device_mocks import ( + DOWNSTAIRS_DEVICE_ID, + FRONT_DEVICE_ID, + FRONT_DOOR_DEVICE_ID, + INGRESS_DEVICE_ID, + INTERNAL_DEVICE_ID, +) -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, snapshot_platform @pytest.fixture -def create_deprecated_sensor_entities( +def create_deprecated_and_disabled_sensor_entities( hass: HomeAssistant, mock_config_entry: ConfigEntry, entity_registry: er.EntityRegistry, @@ -48,48 +51,34 @@ def create_deprecated_sensor_entities( config_entry=mock_config_entry, ) - create_entry("downstairs", "volume", 123456) - create_entry("front_door", "volume", 987654) - create_entry("ingress", "doorbell_volume", 185036587) - create_entry("ingress", "mic_volume", 185036587) - create_entry("ingress", "voice_volume", 185036587) + # Deprecated + create_entry("downstairs", "volume", DOWNSTAIRS_DEVICE_ID) + create_entry("front_door", "volume", FRONT_DEVICE_ID) + create_entry("ingress", "doorbell_volume", INGRESS_DEVICE_ID) + create_entry("ingress", "mic_volume", INGRESS_DEVICE_ID) + create_entry("ingress", "voice_volume", INGRESS_DEVICE_ID) + + # Disabled + for desc in ("wifi_signal_category", "wifi_signal_strength"): + create_entry("downstairs", desc, DOWNSTAIRS_DEVICE_ID) + create_entry("front", desc, FRONT_DEVICE_ID) + create_entry("ingress", desc, INGRESS_DEVICE_ID) + create_entry("front_door", desc, FRONT_DOOR_DEVICE_ID) + create_entry("internal", desc, INTERNAL_DEVICE_ID) -async def test_sensor( +async def test_states( hass: HomeAssistant, - mock_ring_client, - create_deprecated_sensor_entities, + mock_ring_client: Mock, + mock_config_entry: MockConfigEntry, + entity_registry: er.EntityRegistry, + snapshot: SnapshotAssertion, + create_deprecated_and_disabled_sensor_entities, ) -> None: - """Test the Ring sensors.""" - await setup_platform(hass, "sensor") - - front_battery_state = hass.states.get("sensor.front_battery") - assert front_battery_state is not None - assert front_battery_state.state == "80" - assert ( - front_battery_state.attributes[ATTR_STATE_CLASS] == SensorStateClass.MEASUREMENT - ) - - front_door_battery_state = hass.states.get("sensor.front_door_battery") - assert front_door_battery_state is not None - assert front_door_battery_state.state == "100" - assert ( - front_door_battery_state.attributes[ATTR_STATE_CLASS] - == SensorStateClass.MEASUREMENT - ) - - downstairs_volume_state = hass.states.get("sensor.downstairs_volume") - assert downstairs_volume_state is not None - assert downstairs_volume_state.state == "2" - - ingress_mic_volume_state = hass.states.get("sensor.ingress_mic_volume") - assert ingress_mic_volume_state.state == "11" - - ingress_doorbell_volume_state = hass.states.get("sensor.ingress_doorbell_volume") - assert ingress_doorbell_volume_state.state == "8" - - ingress_voice_volume_state = hass.states.get("sensor.ingress_voice_volume") - assert ingress_voice_volume_state.state == "11" + """Test states.""" + mock_config_entry.add_to_hass(hass) + await setup_platform(hass, Platform.SENSOR) + await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id) @pytest.mark.parametrize( diff --git a/tests/components/ring/test_switch.py b/tests/components/ring/test_switch.py index d18add827ec..22b90253c23 100644 --- a/tests/components/ring/test_switch.py +++ b/tests/components/ring/test_switch.py @@ -50,22 +50,6 @@ def create_deprecated_siren_entity( create_entry("internal", 345678) -async def test_entity_registry( - hass: HomeAssistant, - entity_registry: er.EntityRegistry, - mock_ring_client, - create_deprecated_siren_entity, -) -> None: - """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, Platform.SWITCH) - - entry = entity_registry.async_get("switch.front_siren") - assert entry.unique_id == "765432-siren" - - entry = entity_registry.async_get("switch.internal_siren") - assert entry.unique_id == "345678-siren" - - async def test_states( hass: HomeAssistant, mock_ring_client: Mock,