Update tests

This commit is contained in:
Erik
2025-08-19 19:10:11 +02:00
parent 6a8bff8f02
commit 6401a6fa54
7 changed files with 5 additions and 64 deletions

View File

@@ -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': '',
}),
}),
})

View File

@@ -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)

View File

@@ -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"
},

View File

@@ -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."""

View File

@@ -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"
},

View File

@@ -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': '',
}),
})
# ---

View File

@@ -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()