core/tests/components/iotty/snapshots/test_switch.ambr

127 lines
3.1 KiB
Plaintext
Raw Normal View History

Add integration for iotty Smart Home (#103073) * Initial import 0.0.2 * Fixes to URL, and removed commits * Initial import 0.0.2 * Fixes to URL, and removed commits * Added first test for iotty * First release * Reviewers request #1 - Removed clutter - Added support for new naming convention for IottySmartSwitch entity * Removed commmented code * Some modifications * Modified REST EP for iotty CloudApi * Initial import 0.0.2 * Fixes to URL, and removed commits * Added first test for iotty * First release * Rebased and resolved conflicts * Reviewers request #1 - Removed clutter - Added support for new naming convention for IottySmartSwitch entity * Removed commmented code * Some modifications * Modified REST EP for iotty CloudApi * Removed empty entries in manifest.json * Added test_config_flow * Fix as requested by @edenhaus * Added test_init * Removed comments, added one assert * Added TEST_CONFIG_FLOW * Added test for STORE_ENTITY * Increased code coverage * Full coverage for api.py * Added tests for switch component * Converted INFO logs onto DEBUG logs * Removed .gitignore from commits * Modifications to SWITCH.PY * Initial import 0.0.2 * Fixes to URL, and removed commits * Added first test for iotty * First release * Rebased and resolved conflicts * Fixed conflicts * Reviewers request #1 - Removed clutter - Added support for new naming convention for IottySmartSwitch entity * Removed commmented code * Some modifications * Modified REST EP for iotty CloudApi * Removed empty entries in manifest.json * Added test_config_flow * Some modifications * Fix as requested by @edenhaus * Added test_init * Removed comments, added one assert * Added TEST_CONFIG_FLOW * Added test for STORE_ENTITY * Increased code coverage * Full coverage for api.py * Added tests for switch component * Converted INFO logs onto DEBUG logs * Removed .gitignore from commits * Modifications to SWITCH.PY * Fixed tests for SWITCH * First working implementation of Coordinator * Increased code coverage * Full code coverage * Missing a line in testing * Update homeassistant/components/iotty/__init__.py Co-authored-by: Robert Resch <robert@resch.dev> * Update homeassistant/components/iotty/__init__.py Co-authored-by: Robert Resch <robert@resch.dev> * Modified coordinator as per request by edenhaus * use coordinator entities for switches * move platforms to constants * fix whitespace with ruff-format * correct iotty entry in application_credentials list * minor style improvements * refactor function name * handle new and deleted devices * improve code for adding devices after first initialization * use typed config entry instead of adding known devices to hass.data * improve iotty entity removal * test listeners update cycle * handle iotty as devices and not only as entities * fix test typing for mock config entry * test with fewer mocks for an integration test style opposed to the previous unit test style * remove useless tests and add more integration style tests * check if device_to_remove is None * integration style tests for turning switches on and off * remove redundant coordinator tests * check device status after issuing command in tests * remove unused fixtures * add strict typing for iotty * additional asserts and named snapshots in tests * fix mypy issues after enabling strict typing * upgrade iottycloud version to 0.1.3 * move coordinator to runtime_data * remove entity name * fix typing issues * coding style fixes * improve tests coding style and assertion targets * test edge cases when apis are not working * improve tests comments and assertions --------- Co-authored-by: Robert Resch <robert@resch.dev> Co-authored-by: Shapour Nemati <shapour.nemati@iotty.com> Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: shapournemati-iotty <130070037+shapournemati-iotty@users.noreply.github.com>
2024-07-19 10:10:39 +00:00
# serializer version: 1
# name: test_api_not_ok_entities_stay_the_same_as_before
list([
'switch.test_light_switch_0_test_serial_0',
'switch.test_light_switch_1_test_serial_1',
])
# ---
# name: test_api_throws_response_entities_stay_the_same_as_before
list([
'switch.test_light_switch_0_test_serial_0',
'switch.test_light_switch_1_test_serial_1',
])
# ---
# name: test_devices_creaction_ok[device]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'iotty',
'TestLS',
),
}),
'is_new': False,
'labels': set({
}),
'manufacturer': 'iotty',
'model': None,
'model_id': None,
'name': '[TEST] Light switch 0 (TEST_SERIAL_0)',
'name_by_user': None,
'primary_config_entry': <ANY>,
'serial_number': None,
'suggested_area': None,
'sw_version': None,
'via_device_id': None,
})
# ---
# name: test_devices_creaction_ok[entity-ids]
list([
'switch.test_light_switch_0_test_serial_0',
'switch.test_light_switch_1_test_serial_1',
])
# ---
# name: test_devices_creaction_ok[entity]
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.test_light_switch_0_test_serial_0',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'options': dict({
}),
'original_device_class': <SwitchDeviceClass.SWITCH: 'switch'>,
'original_icon': None,
'original_name': None,
'platform': 'iotty',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': None,
'unique_id': 'TestLS',
'unit_of_measurement': None,
})
# ---
# name: test_devices_creaction_ok[state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'switch',
'friendly_name': '[TEST] Light switch 0 (TEST_SERIAL_0)',
}),
'context': <ANY>,
'entity_id': 'switch.test_light_switch_0_test_serial_0',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_devices_deletion_ok
list([
'switch.test_light_switch_0_test_serial_0',
'switch.test_light_switch_1_test_serial_1',
])
# ---
# name: test_devices_deletion_ok.1
list([
'switch.test_light_switch_0_test_serial_0',
])
# ---
# name: test_devices_insertion_ok
list([
'switch.test_light_switch_0_test_serial_0',
'switch.test_light_switch_1_test_serial_1',
])
# ---
# name: test_devices_insertion_ok.1
list([
'switch.test_light_switch_0_test_serial_0',
'switch.test_light_switch_1_test_serial_1',
'switch.test_light_switch_2_test_serial_2',
])
# ---
# name: test_setup_entry_ok_nodevices
list([
])
# ---