Fix hidden default (#70699)

pull/70714/head
Paulus Schoutsen 2022-04-25 10:10:42 -07:00 committed by GitHub
parent 791138eb8b
commit 5317bf02e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -230,7 +230,7 @@ class EntityDescription:
device_class: str | None = None
entity_category: EntityCategory | None = None
entity_registry_enabled_default: bool = True
entity_registry_visible_default: bool = False
entity_registry_visible_default: bool = True
force_update: bool = False
icon: str | None = None
name: str | None = None

View File

@ -1,6 +1,7 @@
"""Test the entity helper."""
# pylint: disable=protected-access
import asyncio
import dataclasses
from datetime import timedelta
import threading
from unittest.mock import MagicMock, PropertyMock, patch
@ -932,3 +933,16 @@ def test_entity_category_schema_error(value):
match=r"expected EntityCategory or one of 'config', 'diagnostic', 'system'",
):
schema(value)
async def test_entity_description_fallback():
"""Test entity description has same defaults as entity."""
ent = entity.Entity()
ent_with_description = entity.Entity()
ent_with_description.entity_description = entity.EntityDescription(key="test")
for field in dataclasses.fields(entity.EntityDescription):
if field.name == "key":
continue
assert getattr(ent, field.name) == getattr(ent_with_description, field.name)