Language: Python
Label: vulnerable
CWE: NVD-CWE-noinfo \u2014 

Code:
async def _test_fetch_auth_providers_home_assistant(
    hass: HomeAssistant,
    aiohttp_client: ClientSessionGenerator,
    ip: str,
    additional_expected_fn: Callable[[User], dict[str, Any]],
) -> None:
    """Test fetching auth providers for homeassistant auth provider."""
    client = await async_setup_auth(
        hass, aiohttp_client, [{"type": "homeassistant"}], custom_ip=ip
    )

    provider = hass.auth.auth_providers[0]
    credentials = await provider.async_get_or_create_credentials({"username": "hello"})
    user = await hass.auth.async_get_or_create_user(credentials)

    expected = {
        "name": "Home Assistant Local",
        "type": "homeassistant",
        "id": None,
        **additional_expected_fn(user),
    }

    resp = await client.get("/auth/providers")
    assert resp.status == HTTPStatus.OK
    assert await resp.json() == [expected]