mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Refactor User attribute caching to be safer and more efficient (#96723)
* Cache construction of is_admin This has to be checked for a lot of api calls and the websocket every time the call is made * Cache construction of is_admin This has to be checked for a lot of api calls and the websocket every time the call is made * Cache construction of is_admin This has to be checked for a lot of api calls and the websocket every time the call is made * modernize * coverage * coverage * verify caching * verify caching * fix type * fix mocking
This commit is contained in:
@@ -684,6 +684,8 @@ async def test_get_entity_state_read_perm(
|
||||
) -> None:
|
||||
"""Test getting a state requires read permission."""
|
||||
hass_admin_user.mock_policy({})
|
||||
hass_admin_user.groups = []
|
||||
assert hass_admin_user.is_admin is False
|
||||
resp = await mock_api_client.get("/api/states/light.test")
|
||||
assert resp.status == HTTPStatus.UNAUTHORIZED
|
||||
|
||||
|
||||
Reference in New Issue
Block a user