Add snapshots to all ring platform tests (#126560)
Add test snapshots to all ring platform tests
This commit is contained in:
parent
5186605cec
commit
010a5d2829
14 changed files with 2197 additions and 99 deletions
|
@ -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():
|
||||
|
|
241
tests/components/ring/snapshots/test_binary_sensor.ambr
Normal file
241
tests/components/ring/snapshots/test_binary_sensor.ambr
Normal file
|
@ -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': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.OCCUPANCY: 'occupancy'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'binary_sensor.front_door_ding',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[binary_sensor.front_door_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'binary_sensor.front_door_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[binary_sensor.front_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'binary_sensor.front_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[binary_sensor.ingress_ding-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.OCCUPANCY: 'occupancy'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'binary_sensor.ingress_ding',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[binary_sensor.internal_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <BinarySensorDeviceClass.MOTION: 'motion'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'binary_sensor.internal_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
48
tests/components/ring/snapshots/test_button.ambr
Normal file
48
tests/components/ring/snapshots/test_button.ambr
Normal file
|
@ -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': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.ingress_open_door',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'button.ingress_open_door',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
159
tests/components/ring/snapshots/test_camera.ambr
Normal file
159
tests/components/ring/snapshots/test_camera.ambr
Normal file
|
@ -0,0 +1,159 @@
|
|||
# serializer version: 1
|
||||
# name: test_states[camera.front-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'camera',
|
||||
'entity_category': None,
|
||||
'entity_id': 'camera.front',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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': <CameraEntityFeature: 0>,
|
||||
'video_url': None,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'camera.front',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'idle',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[camera.front_door-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'camera',
|
||||
'entity_category': None,
|
||||
'entity_id': 'camera.front_door',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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': <CameraEntityFeature: 0>,
|
||||
'video_url': None,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'camera.front_door',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'idle',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[camera.internal-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'camera',
|
||||
'entity_category': None,
|
||||
'entity_id': 'camera.internal',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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': <CameraEntityFeature: 0>,
|
||||
'video_url': None,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'camera.internal',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'idle',
|
||||
})
|
||||
# ---
|
337
tests/components/ring/snapshots/test_event.ambr
Normal file
337
tests/components/ring/snapshots/test_event.ambr
Normal file
|
@ -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': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.front_door_ding',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <EventDeviceClass.DOORBELL: 'doorbell'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'event.front_door_ding',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'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': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.front_door_motion',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <EventDeviceClass.MOTION: 'motion'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'event.front_door_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[event.front_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'event_types': list([
|
||||
'motion',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.front_motion',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <EventDeviceClass.MOTION: 'motion'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'event.front_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[event.ingress_ding-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'event_types': list([
|
||||
'ding',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.ingress_ding',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <EventDeviceClass.DOORBELL: 'doorbell'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'event.ingress_ding',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'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': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.ingress_intercom_unlock',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <EventDeviceClass.BUTTON: 'button'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'event.ingress_intercom_unlock',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[event.internal_motion-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'event_types': list([
|
||||
'motion',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.internal_motion',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': <EventDeviceClass.MOTION: 'motion'>,
|
||||
'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': <ANY>,
|
||||
'entity_id': 'event.internal_motion',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
113
tests/components/ring/snapshots/test_light.ambr
Normal file
113
tests/components/ring/snapshots/test_light.ambr
Normal file
|
@ -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([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.front_light',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.front_light',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_states[light.internal_light-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.internal_light',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'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': <ColorMode.ONOFF: 'onoff'>,
|
||||
'friendly_name': 'Internal Light',
|
||||
'supported_color_modes': list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
'supported_features': <LightEntityFeature: 0>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.internal_light',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
1149
tests/components/ring/snapshots/test_sensor.ambr
Normal file
1149
tests/components/ring/snapshots/test_sensor.ambr
Normal file
File diff suppressed because it is too large
Load diff
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue