1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Cache serialize of manifest for loaded integrations (#117965)

* Cache serialize of manifest for loaded integrations

The manifest/list and manifest/get websocket apis
are called frequently when moving around in the UI.
Since the manifest does not change we can make
the the serialized version a cached property

* reduce

* reduce
This commit is contained in:
J. Nick Koston
2024-05-23 04:52:05 -10:00
committed by GitHub
parent 09e7156d2d
commit c5cc9801a6
3 changed files with 26 additions and 12 deletions

View File

@@ -15,6 +15,8 @@ from homeassistant.components import http, hue
from homeassistant.components.hue import light as hue_light
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import frame
from homeassistant.helpers.json import json_dumps
from homeassistant.util.json import json_loads
from .common import MockModule, async_get_persistent_notifications, mock_integration
@@ -1959,3 +1961,12 @@ async def test_hass_helpers_use_reported(
"Detected that custom integration 'test_integration_frame' "
"accesses hass.helpers.aiohttp_client. This is deprecated"
) in caplog.text
async def test_manifest_json_fragment_round_trip(hass: HomeAssistant) -> None:
"""Test json_fragment roundtrip."""
integration = await loader.async_get_integration(hass, "hue")
assert (
json_loads(json_dumps(integration.manifest_json_fragment))
== integration.manifest
)