mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Use snapshot tests for remaining myuplink platforms (#132915)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
This commit is contained in:
parent
dc8b7cfede
commit
7103b7fd80
@ -7,7 +7,7 @@ rules:
|
||||
appropriate-polling: done
|
||||
brands: done
|
||||
common-modules: done
|
||||
config-flow-test-coverage: todo
|
||||
config-flow-test-coverage: done
|
||||
config-flow: done
|
||||
dependency-transparency: done
|
||||
docs-actions:
|
||||
@ -47,9 +47,7 @@ rules:
|
||||
status: exempt
|
||||
comment: Handled by coordinator
|
||||
reauthentication-flow: done
|
||||
test-coverage:
|
||||
status: todo
|
||||
comment: PR is pending review
|
||||
test-coverage: done
|
||||
|
||||
# Gold
|
||||
devices: done
|
||||
|
335
tests/components/myuplink/snapshots/test_number.ambr
Normal file
335
tests/components/myuplink/snapshots/test_number.ambr
Normal file
@ -0,0 +1,335 @@
|
||||
# serializer version: 1
|
||||
# name: test_number_states[platforms0][number.gotham_city_degree_minutes-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 3000.0,
|
||||
'min': -3000.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.gotham_city_degree_minutes',
|
||||
'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': 'Degree minutes',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'degree_minutes',
|
||||
'unique_id': 'robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-40940',
|
||||
'unit_of_measurement': 'DM',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_degree_minutes-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City Degree minutes',
|
||||
'max': 3000.0,
|
||||
'min': -3000.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': 'DM',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.gotham_city_degree_minutes',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '-875.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_degree_minutes_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 3000.0,
|
||||
'min': -3000.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.gotham_city_degree_minutes_2',
|
||||
'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': 'Degree minutes',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'degree_minutes',
|
||||
'unique_id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-40940',
|
||||
'unit_of_measurement': 'DM',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_degree_minutes_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City Degree minutes',
|
||||
'max': 3000.0,
|
||||
'min': -3000.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': 'DM',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.gotham_city_degree_minutes_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '-875.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_heating_offset_climate_system_1-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 10.0,
|
||||
'min': -10.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.gotham_city_heating_offset_climate_system_1',
|
||||
'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': 'Heating offset climate system 1',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47011',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_heating_offset_climate_system_1-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City Heating offset climate system 1',
|
||||
'max': 10.0,
|
||||
'min': -10.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.gotham_city_heating_offset_climate_system_1',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '1.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_heating_offset_climate_system_1_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 10.0,
|
||||
'min': -10.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.gotham_city_heating_offset_climate_system_1_2',
|
||||
'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': 'Heating offset climate system 1',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47011',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_heating_offset_climate_system_1_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City Heating offset climate system 1',
|
||||
'max': 10.0,
|
||||
'min': -10.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.gotham_city_heating_offset_climate_system_1_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '1.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_start_diff_additional_heat-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 2000.0,
|
||||
'min': 100.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.gotham_city_start_diff_additional_heat',
|
||||
'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': 'start diff additional heat',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'degree_minutes',
|
||||
'unique_id': 'robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-148072',
|
||||
'unit_of_measurement': 'DM',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_start_diff_additional_heat-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City start diff additional heat',
|
||||
'max': 2000.0,
|
||||
'min': 100.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': 'DM',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.gotham_city_start_diff_additional_heat',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '700.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_start_diff_additional_heat_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'max': 2000.0,
|
||||
'min': 100.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'number',
|
||||
'entity_category': None,
|
||||
'entity_id': 'number.gotham_city_start_diff_additional_heat_2',
|
||||
'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': 'start diff additional heat',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'degree_minutes',
|
||||
'unique_id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-148072',
|
||||
'unit_of_measurement': 'DM',
|
||||
})
|
||||
# ---
|
||||
# name: test_number_states[platforms0][number.gotham_city_start_diff_additional_heat_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City start diff additional heat',
|
||||
'max': 2000.0,
|
||||
'min': 100.0,
|
||||
'mode': <NumberMode.AUTO: 'auto'>,
|
||||
'step': 1.0,
|
||||
'unit_of_measurement': 'DM',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'number.gotham_city_start_diff_additional_heat_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '700.0',
|
||||
})
|
||||
# ---
|
119
tests/components/myuplink/snapshots/test_select.ambr
Normal file
119
tests/components/myuplink/snapshots/test_select.ambr
Normal file
@ -0,0 +1,119 @@
|
||||
# serializer version: 1
|
||||
# name: test_select_states[platforms0][select.gotham_city_comfort_mode-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'Smart control',
|
||||
'Economy',
|
||||
'Normal',
|
||||
'Luxury',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': None,
|
||||
'entity_id': 'select.gotham_city_comfort_mode',
|
||||
'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': 'comfort mode',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47041',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_select_states[platforms0][select.gotham_city_comfort_mode-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City comfort mode',
|
||||
'options': list([
|
||||
'Smart control',
|
||||
'Economy',
|
||||
'Normal',
|
||||
'Luxury',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.gotham_city_comfort_mode',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Economy',
|
||||
})
|
||||
# ---
|
||||
# name: test_select_states[platforms0][select.gotham_city_comfort_mode_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'options': list([
|
||||
'Smart control',
|
||||
'Economy',
|
||||
'Normal',
|
||||
'Luxury',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'select',
|
||||
'entity_category': None,
|
||||
'entity_id': 'select.gotham_city_comfort_mode_2',
|
||||
'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': 'comfort mode',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': None,
|
||||
'unique_id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47041',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_select_states[platforms0][select.gotham_city_comfort_mode_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City comfort mode',
|
||||
'options': list([
|
||||
'Smart control',
|
||||
'Economy',
|
||||
'Normal',
|
||||
'Luxury',
|
||||
]),
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'select.gotham_city_comfort_mode_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'Economy',
|
||||
})
|
||||
# ---
|
185
tests/components/myuplink/snapshots/test_switch.ambr
Normal file
185
tests/components/myuplink/snapshots/test_switch.ambr
Normal file
@ -0,0 +1,185 @@
|
||||
# serializer version: 1
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_increased_ventilation-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.gotham_city_increased_ventilation',
|
||||
'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': 'In\xadcreased venti\xadlation',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'boost_ventilation',
|
||||
'unique_id': 'robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-50005',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_increased_ventilation-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City In\xadcreased venti\xadlation',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.gotham_city_increased_ventilation',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_increased_ventilation_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.gotham_city_increased_ventilation_2',
|
||||
'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': 'In\xadcreased venti\xadlation',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'boost_ventilation',
|
||||
'unique_id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-50005',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_increased_ventilation_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City In\xadcreased venti\xadlation',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.gotham_city_increased_ventilation_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_temporary_lux-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.gotham_city_temporary_lux',
|
||||
'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': 'Tempo\xadrary lux',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'temporary_lux',
|
||||
'unique_id': 'robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-50004',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_temporary_lux-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City Tempo\xadrary lux',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.gotham_city_temporary_lux',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_temporary_lux_2-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.gotham_city_temporary_lux_2',
|
||||
'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': 'Tempo\xadrary lux',
|
||||
'platform': 'myuplink',
|
||||
'previous_unique_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'temporary_lux',
|
||||
'unique_id': 'batman-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-50004',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_switch_states[platforms0][switch.gotham_city_temporary_lux_2-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Gotham City Tempo\xadrary lux',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.gotham_city_temporary_lux_2',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'off',
|
||||
})
|
||||
# ---
|
@ -4,6 +4,7 @@ from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientError
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.number import SERVICE_SET_VALUE
|
||||
from homeassistant.const import ATTR_ENTITY_ID, Platform
|
||||
@ -11,6 +12,8 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
TEST_PLATFORM = Platform.NUMBER
|
||||
pytestmark = pytest.mark.parametrize("platforms", [(TEST_PLATFORM,)])
|
||||
|
||||
@ -31,24 +34,6 @@ async def test_entity_registry(
|
||||
assert entry.unique_id == ENTITY_UID
|
||||
|
||||
|
||||
async def test_attributes(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test the entity attributes are correct."""
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == "1.0"
|
||||
assert state.attributes == {
|
||||
"friendly_name": ENTITY_FRIENDLY_NAME,
|
||||
"min": -10.0,
|
||||
"max": 10.0,
|
||||
"mode": "auto",
|
||||
"step": 1.0,
|
||||
}
|
||||
|
||||
|
||||
async def test_set_value(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
@ -98,3 +83,16 @@ async def test_entity_registry_smo20(
|
||||
|
||||
entry = entity_registry.async_get("number.gotham_city_change_in_curve")
|
||||
assert entry.unique_id == "robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47028"
|
||||
|
||||
|
||||
async def test_number_states(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
entity_registry: er.EntityRegistry,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test number entity state."""
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
@ -4,6 +4,7 @@ from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientError
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
@ -15,6 +16,8 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
TEST_PLATFORM = Platform.SELECT
|
||||
pytestmark = pytest.mark.parametrize("platforms", [(TEST_PLATFORM,)])
|
||||
|
||||
@ -23,27 +26,6 @@ ENTITY_FRIENDLY_NAME = "Gotham City comfort mode"
|
||||
ENTITY_UID = "robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47041"
|
||||
|
||||
|
||||
async def test_select_entity(
|
||||
hass: HomeAssistant,
|
||||
entity_registry: er.EntityRegistry,
|
||||
mock_myuplink_client: MagicMock,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test that the entities are registered in the entity registry."""
|
||||
|
||||
entry = entity_registry.async_get(ENTITY_ID)
|
||||
assert entry.unique_id == ENTITY_UID
|
||||
|
||||
# Test the select attributes are correct.
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == "Economy"
|
||||
assert state.attributes == {
|
||||
"options": ["Smart control", "Economy", "Normal", "Luxury"],
|
||||
"friendly_name": ENTITY_FRIENDLY_NAME,
|
||||
}
|
||||
|
||||
|
||||
async def test_selecting(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
@ -87,3 +69,16 @@ async def test_entity_registry_smo20(
|
||||
|
||||
entry = entity_registry.async_get("select.gotham_city_all")
|
||||
assert entry.unique_id == "robin-r-1234-20240201-123456-aa-bb-cc-dd-ee-ff-47660"
|
||||
|
||||
|
||||
async def test_select_states(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
entity_registry: er.EntityRegistry,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test select entity state."""
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
@ -4,18 +4,20 @@ from unittest.mock import MagicMock
|
||||
|
||||
from aiohttp import ClientError
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_OFF,
|
||||
Platform,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
TEST_PLATFORM = Platform.SWITCH
|
||||
pytestmark = pytest.mark.parametrize("platforms", [(TEST_PLATFORM,)])
|
||||
|
||||
@ -36,20 +38,6 @@ async def test_entity_registry(
|
||||
assert entry.unique_id == ENTITY_UID
|
||||
|
||||
|
||||
async def test_attributes(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test the switch attributes are correct."""
|
||||
|
||||
state = hass.states.get(ENTITY_ID)
|
||||
assert state.state == STATE_OFF
|
||||
assert state.attributes == {
|
||||
"friendly_name": ENTITY_FRIENDLY_NAME,
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("service"),
|
||||
[
|
||||
@ -109,3 +97,16 @@ async def test_entity_registry_smo20(
|
||||
|
||||
entry = entity_registry.async_get(ENTITY_ID)
|
||||
assert entry.unique_id == ENTITY_UID
|
||||
|
||||
|
||||
async def test_switch_states(
|
||||
hass: HomeAssistant,
|
||||
mock_myuplink_client: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
snapshot: SnapshotAssertion,
|
||||
entity_registry: er.EntityRegistry,
|
||||
setup_platform: None,
|
||||
) -> None:
|
||||
"""Test switch entity state."""
|
||||
|
||||
await snapshot_platform(hass, entity_registry, snapshot, mock_config_entry.entry_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user