1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-27 12:14:35 +01:00

Extend auth/providers endpoint and add /api/person/list endpoint for local ip requests (#103906)

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Robert Resch
2023-11-24 17:11:54 +01:00
committed by GitHub
parent 512902fc59
commit 852fb58ca8
14 changed files with 370 additions and 75 deletions

View File

@@ -1,8 +1,13 @@
"""Tests for the auth component."""
from typing import Any
from homeassistant import auth
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
from tests.common import ensure_auth_manager_loaded
from tests.test_util import mock_real_ip
from tests.typing import ClientSessionGenerator
BASE_CONFIG = [
{
@@ -18,11 +23,12 @@ EMPTY_CONFIG = []
async def async_setup_auth(
hass,
aiohttp_client,
provider_configs=BASE_CONFIG,
hass: HomeAssistant,
aiohttp_client: ClientSessionGenerator,
provider_configs: list[dict[str, Any]] = BASE_CONFIG,
module_configs=EMPTY_CONFIG,
setup_api=False,
setup_api: bool = False,
custom_ip: str | None = None,
):
"""Set up authentication and create an HTTP client."""
hass.auth = await auth.auth_manager_from_config(
@@ -32,4 +38,6 @@ async def async_setup_auth(
await async_setup_component(hass, "auth", {})
if setup_api:
await async_setup_component(hass, "api", {})
if custom_ip:
mock_real_ip(hass.http.app)(custom_ip)
return await aiohttp_client(hass.http.app)