From 6401a6fa542a1ac5c2b6a369f685bb45de0da285 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 19 Aug 2025 19:10:11 +0200 Subject: [PATCH] Update tests --- tests/components/api/snapshots/test_init.ambr | 24 ------------------- tests/components/api/test_init.py | 4 ---- tests/components/number/test_init.py | 4 ++-- tests/components/script/test_init.py | 3 --- tests/components/sensor/test_init.py | 6 ++--- .../snapshots/test_commands.ambr | 24 ------------------- .../components/websocket_api/test_commands.py | 4 ---- 7 files changed, 5 insertions(+), 64 deletions(-) diff --git a/tests/components/api/snapshots/test_init.ambr b/tests/components/api/snapshots/test_init.ambr index 05b6bf31638..1be5c036f3f 100644 --- a/tests/components/api/snapshots/test_init.ambr +++ b/tests/components/api/snapshots/test_init.ambr @@ -5,18 +5,13 @@ 'domain': 'group', 'services': dict({ 'reload': dict({ - 'description': 'Reloads group configuration, entities, and notify services from YAML-configuration.', 'fields': dict({ }), - 'name': 'Reload', }), 'remove': dict({ - 'description': 'Removes a group.', 'fields': dict({ 'object_id': dict({ - 'description': 'Object ID of this group. This object ID is used as part of the entity ID. Entity ID format: [domain].[object_id].', 'example': 'test_group', - 'name': 'Object ID', 'required': True, 'selector': dict({ 'object': dict({ @@ -24,15 +19,11 @@ }), }), }), - 'name': 'Remove', }), 'set': dict({ - 'description': 'Creates/Updates a group.', 'fields': dict({ 'add_entities': dict({ - 'description': 'List of members to be added to the group. Cannot be used in combination with `Entities` or `Remove entities`.', 'example': 'domain.entity_id1, domain.entity_id2', - 'name': 'Add entities', 'selector': dict({ 'entity': dict({ 'multiple': True, @@ -41,17 +32,13 @@ }), }), 'all': dict({ - 'description': 'Enable this option if the group should only be used when all entities are in state `on`.', - 'name': 'All', 'selector': dict({ 'boolean': dict({ }), }), }), 'entities': dict({ - 'description': 'List of all members in the group. Cannot be used in combination with `Add entities` or `Remove entities`.', 'example': 'domain.entity_id1, domain.entity_id2', - 'name': 'Entities', 'selector': dict({ 'entity': dict({ 'multiple': True, @@ -60,27 +47,21 @@ }), }), 'icon': dict({ - 'description': 'Name of the icon for the group.', 'example': 'mdi:camera', - 'name': 'Icon', 'selector': dict({ 'icon': dict({ }), }), }), 'name': dict({ - 'description': 'Name of the group.', 'example': 'My test group', - 'name': 'Name', 'selector': dict({ 'text': dict({ }), }), }), 'object_id': dict({ - 'description': 'Object ID of this group. This object ID is used as part of the entity ID. Entity ID format: [domain].[object_id].', 'example': 'test_group', - 'name': 'Object ID', 'required': True, 'selector': dict({ 'text': dict({ @@ -88,9 +69,7 @@ }), }), 'remove_entities': dict({ - 'description': 'List of members to be removed from a group. Cannot be used in combination with `Entities` or `Add entities`.', 'example': 'domain.entity_id1, domain.entity_id2', - 'name': 'Remove entities', 'selector': dict({ 'entity': dict({ 'multiple': True, @@ -99,7 +78,6 @@ }), }), }), - 'name': 'Set', }), }), }), @@ -134,10 +112,8 @@ 'name': 'Translated name', }), 'set_level': dict({ - 'description': '', 'fields': dict({ }), - 'name': '', }), }), }) diff --git a/tests/components/api/test_init.py b/tests/components/api/test_init.py index 382b88b89ea..e64de15d68d 100644 --- a/tests/components/api/test_init.py +++ b/tests/components/api/test_init.py @@ -375,10 +375,6 @@ async def test_api_get_services( "homeassistant.helpers.service._load_services_file", side_effect=_load_services_file, ), - patch( - "homeassistant.helpers.service.translation.async_get_translations", - return_value={}, - ), ): resp = await mock_api_client.get(const.URL_API_SERVICES) diff --git a/tests/components/number/test_init.py b/tests/components/number/test_init.py index 4ccf8f69c42..be121f39517 100644 --- a/tests/components/number/test_init.py +++ b/tests/components/number/test_init.py @@ -843,7 +843,7 @@ async def test_translated_unit( """Test translated unit.""" with patch( - "homeassistant.helpers.service.translation.async_get_translations", + "homeassistant.helpers.entity_platform.translation.async_get_translations", return_value={ "component.test.entity.number.test_translation_key.unit_of_measurement": "Tests" }, @@ -875,7 +875,7 @@ async def test_translated_unit_with_native_unit_raises( """Test that translated unit.""" with patch( - "homeassistant.helpers.service.translation.async_get_translations", + "homeassistant.helpers.entity_platform.translation.async_get_translations", return_value={ "component.test.entity.number.test_translation_key.unit_of_measurement": "Tests" }, diff --git a/tests/components/script/test_init.py b/tests/components/script/test_init.py index 3b0bff7e82e..e93bceb59bf 100644 --- a/tests/components/script/test_init.py +++ b/tests/components/script/test_init.py @@ -627,9 +627,6 @@ async def test_service_descriptions(hass: HomeAssistant) -> None: assert descriptions[DOMAIN]["test_name"]["name"] == "ABC" - # Test 4: verify that names from YAML are taken into account as well - assert descriptions[DOMAIN]["turn_on"]["name"] == "Turn on" - async def test_shared_context(hass: HomeAssistant) -> None: """Test that the shared context is passed down the chain.""" diff --git a/tests/components/sensor/test_init.py b/tests/components/sensor/test_init.py index 62141186b55..b8aca438da6 100644 --- a/tests/components/sensor/test_init.py +++ b/tests/components/sensor/test_init.py @@ -503,7 +503,7 @@ async def test_translated_unit( """Test translated unit.""" with patch( - "homeassistant.helpers.service.translation.async_get_translations", + "homeassistant.helpers.entity_platform.translation.async_get_translations", return_value={ "component.test.entity.sensor.test_translation_key.unit_of_measurement": "Tests" }, @@ -535,7 +535,7 @@ async def test_translated_unit_with_native_unit_raises( """Test that translated unit.""" with patch( - "homeassistant.helpers.service.translation.async_get_translations", + "homeassistant.helpers.entity_platform.translation.async_get_translations", return_value={ "component.test.entity.sensor.test_translation_key.unit_of_measurement": "Tests" }, @@ -566,7 +566,7 @@ async def test_unit_translation_key_without_platform_raises( """Test that unit translation key property raises if the entity has no platform yet.""" with patch( - "homeassistant.helpers.service.translation.async_get_translations", + "homeassistant.helpers.entity_platform.translation.async_get_translations", return_value={ "component.test.entity.sensor.test_translation_key.unit_of_measurement": "Tests" }, diff --git a/tests/components/websocket_api/snapshots/test_commands.ambr b/tests/components/websocket_api/snapshots/test_commands.ambr index e8ac80e0e24..d21328c346d 100644 --- a/tests/components/websocket_api/snapshots/test_commands.ambr +++ b/tests/components/websocket_api/snapshots/test_commands.ambr @@ -2,18 +2,13 @@ # name: test_get_services dict({ 'reload': dict({ - 'description': 'Reloads group configuration, entities, and notify services from YAML-configuration.', 'fields': dict({ }), - 'name': 'Reload', }), 'remove': dict({ - 'description': 'Removes a group.', 'fields': dict({ 'object_id': dict({ - 'description': 'Object ID of this group. This object ID is used as part of the entity ID. Entity ID format: [domain].[object_id].', 'example': 'test_group', - 'name': 'Object ID', 'required': True, 'selector': dict({ 'object': dict({ @@ -21,15 +16,11 @@ }), }), }), - 'name': 'Remove', }), 'set': dict({ - 'description': 'Creates/Updates a group.', 'fields': dict({ 'add_entities': dict({ - 'description': 'List of members to be added to the group. Cannot be used in combination with `Entities` or `Remove entities`.', 'example': 'domain.entity_id1, domain.entity_id2', - 'name': 'Add entities', 'selector': dict({ 'entity': dict({ 'multiple': True, @@ -38,17 +29,13 @@ }), }), 'all': dict({ - 'description': 'Enable this option if the group should only be used when all entities are in state `on`.', - 'name': 'All', 'selector': dict({ 'boolean': dict({ }), }), }), 'entities': dict({ - 'description': 'List of all members in the group. Cannot be used in combination with `Add entities` or `Remove entities`.', 'example': 'domain.entity_id1, domain.entity_id2', - 'name': 'Entities', 'selector': dict({ 'entity': dict({ 'multiple': True, @@ -57,27 +44,21 @@ }), }), 'icon': dict({ - 'description': 'Name of the icon for the group.', 'example': 'mdi:camera', - 'name': 'Icon', 'selector': dict({ 'icon': dict({ }), }), }), 'name': dict({ - 'description': 'Name of the group.', 'example': 'My test group', - 'name': 'Name', 'selector': dict({ 'text': dict({ }), }), }), 'object_id': dict({ - 'description': 'Object ID of this group. This object ID is used as part of the entity ID. Entity ID format: [domain].[object_id].', 'example': 'test_group', - 'name': 'Object ID', 'required': True, 'selector': dict({ 'text': dict({ @@ -85,9 +66,7 @@ }), }), 'remove_entities': dict({ - 'description': 'List of members to be removed from a group. Cannot be used in combination with `Entities` or `Add entities`.', 'example': 'domain.entity_id1, domain.entity_id2', - 'name': 'Remove entities', 'selector': dict({ 'entity': dict({ 'multiple': True, @@ -96,7 +75,6 @@ }), }), }), - 'name': 'Set', }), }) # --- @@ -127,10 +105,8 @@ 'name': 'Translated name', }), 'set_level': dict({ - 'description': '', 'fields': dict({ }), - 'name': '', }), }) # --- diff --git a/tests/components/websocket_api/test_commands.py b/tests/components/websocket_api/test_commands.py index bffb2959b31..882286ba480 100644 --- a/tests/components/websocket_api/test_commands.py +++ b/tests/components/websocket_api/test_commands.py @@ -755,10 +755,6 @@ async def test_get_services( "homeassistant.helpers.service._load_services_file", side_effect=_load_services_file, ), - patch( - "homeassistant.helpers.service.translation.async_get_translations", - return_value={}, - ), ): await websocket_client.send_json_auto_id({"type": "get_services"}) msg = await websocket_client.receive_json()