Change KEY_HASS to be an aiohttp AppKey (#111954)

This commit is contained in:
Marc Mueller 2024-03-07 13:37:48 +01:00 committed by GitHub
parent 82efb3d35b
commit 531e25cbc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 39 additions and 25 deletions

View file

@ -17,6 +17,7 @@ from homeassistant.auth.providers.legacy_api_password import (
LegacyApiPasswordAuthProvider,
)
from homeassistant.components import websocket_api
from homeassistant.components.http import KEY_HASS
from homeassistant.components.http.auth import (
CONTENT_USER_NAME,
DATA_SIGN_SECRET,
@ -78,7 +79,7 @@ async def get_legacy_user(auth):
def app(hass):
"""Fixture to set up a web.Application."""
app = web.Application()
app["hass"] = hass
app[KEY_HASS] = hass
app.router.add_get("/", mock_handler)
async_setup_forwarded(app, True, [])
return app
@ -88,7 +89,7 @@ def app(hass):
def app2(hass):
"""Fixture to set up a web.Application without real_ip middleware."""
app = web.Application()
app["hass"] = hass
app[KEY_HASS] = hass
app.router.add_get("/", mock_handler)
return app