1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Use APPLICATION_CREDENTIALS_DOMAIN constant in tests (#162932)

This commit is contained in:
epenet
2026-02-13 15:47:38 +01:00
committed by GitHub
parent 4e71a38e31
commit 267caf2365
45 changed files with 94 additions and 50 deletions

View File

@@ -6,6 +6,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -25,7 +26,7 @@ CLIENT_SECRET = "5678"
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -4,6 +4,7 @@ import pytest
from homeassistant.components.aladdin_connect import DOMAIN
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -18,7 +19,7 @@ from tests.common import MockConfigEntry
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -93,7 +93,7 @@ async def mock_application_credentials_integration(
):
"""Mock a application_credentials integration."""
with patch("homeassistant.loader.APPLICATION_CREDENTIALS", [TEST_DOMAIN]):
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, DOMAIN, {})
await setup_application_credentials_integration(
hass, TEST_DOMAIN, authorization_server
)
@@ -629,7 +629,7 @@ async def test_websocket_without_platform(
hass: HomeAssistant, ws_client: ClientFixture
) -> None:
"""Test an integration without the application credential platform."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, DOMAIN, {})
hass.config.components.add(TEST_DOMAIN)
client = await ws_client()
@@ -658,7 +658,7 @@ async def test_websocket_without_authorization_server(
hass: HomeAssistant, ws_client: ClientFixture
) -> None:
"""Test platform with incorrect implementation."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, DOMAIN, {})
hass.config.components.add(TEST_DOMAIN)
# Platform does not implemenent async_get_authorization_server
@@ -703,7 +703,7 @@ async def test_platform_with_auth_implementation(
) -> None:
"""Test config flow with custom OAuth2 implementation."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, DOMAIN, {})
hass.config.components.add(TEST_DOMAIN)
async def get_auth_impl(

View File

@@ -6,6 +6,7 @@ import pytest
from yalexs.manager.ratelimit import _RateLimitChecker
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -106,7 +107,7 @@ def load_reauth_jwt_wrong_account_fixture() -> str:
@pytest.fixture(name="client_credentials", autouse=True)
async def mock_client_credentials_fixture(hass: HomeAssistant) -> None:
"""Mock client credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -36,6 +36,7 @@ from yalexs.manager.ratelimit import _RateLimitChecker
from yalexs.pubnub_async import AugustPubNub
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -106,7 +107,7 @@ def mock_config_entry(jwt: str | None = None) -> MockConfigEntry:
async def mock_client_credentials(hass: HomeAssistant) -> ClientCredential:
"""Mock client credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -6,6 +6,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -32,7 +33,7 @@ CLIENT_SECRET = "5678"
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -17,6 +17,7 @@ from electrickiwi_api.model import (
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -34,7 +35,7 @@ REDIRECT_URI = "https://example.com/auth/external/callback"
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup application credentials component."""
await async_setup_component(hass, "application_credentials", {})
await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -11,6 +11,7 @@ import pytest
from requests_mock.mocker import Mocker
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -98,7 +99,7 @@ def mock_config_entry(
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -6,6 +6,7 @@ from unittest.mock import MagicMock
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -32,7 +33,7 @@ CURRENT_ENVIRONMENT_URLS = ENVIRONMENT_URLS[ENVIRONMENT]
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -16,6 +16,7 @@ import pytest
import yaml
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -353,7 +354,7 @@ def component_setup(
"""Fixture for setting up the integration."""
async def _setup_func() -> bool:
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -22,6 +22,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -59,7 +60,7 @@ async def request_setup(current_request_with_host: None) -> None:
@pytest.fixture(autouse=True)
async def setup_app_creds(hass: HomeAssistant) -> None:
"""Fixture to setup application credentials component."""
await async_setup_component(hass, "application_credentials", {})
await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
@pytest.fixture

View File

@@ -8,6 +8,7 @@ from google.oauth2.credentials import Credentials
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -27,7 +28,7 @@ ACCESS_TOKEN = "mock-access-token"
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -7,6 +7,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -30,7 +31,7 @@ CONFIG_ENTRY_TITLE = "Google Drive entry title"
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -9,6 +9,7 @@ from httplib2 import Response
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -44,7 +45,7 @@ def mock_scopes() -> list[str]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,
@@ -99,7 +100,7 @@ async def mock_setup_integration(
"""Fixture for setting up the component."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -16,6 +16,7 @@ from google_photos_library_api.model import (
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -94,7 +95,7 @@ def mock_config_entry(
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -8,6 +8,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -32,7 +33,7 @@ TITLE = "Google Sheets"
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -13,6 +13,7 @@ from requests.models import Response
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -76,7 +77,7 @@ async def mock_setup_integration(
"""Fixture for setting up the component."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -10,6 +10,7 @@ from httplib2 import Response
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -87,7 +88,7 @@ def mock_config_entry(token_entry: dict[str, Any]) -> MockConfigEntry:
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -32,6 +32,7 @@ from aiohomeconnect.model.program import EnumerateProgram
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -123,7 +124,7 @@ def mock_config_entry_v1_2(token_entry: dict[str, Any]) -> MockConfigEntry:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -12,6 +12,7 @@ from aiohttp import ClientWebSocketResponse
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -95,7 +96,7 @@ def mock_config_entry(jwt: str, expires_at: int, scope: str) -> MockConfigEntry:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -8,6 +8,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -27,7 +28,7 @@ from tests.typing import ClientSessionGenerator
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup application credentials component."""
await async_setup_component(hass, "application_credentials", {})
await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -10,6 +10,7 @@ from demetriek import CloudDevice, Device
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -24,7 +25,7 @@ from tests.common import MockConfigEntry, load_fixture, load_json_array_fixture
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass, DOMAIN, ClientCredential("client", "secret"), "credentials"
)

View File

@@ -8,6 +8,7 @@ from unittest.mock import AsyncMock, patch
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -92,7 +93,7 @@ def mock_config_entry(hass: HomeAssistant) -> MockConfigEntry:
@pytest.fixture(name="credential")
async def mock_credential(hass: HomeAssistant) -> None:
"""Fixture that provides the ClientCredential for the test."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -7,6 +7,7 @@ from microBeesPy import Bee, MicroBees, Profile
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -38,7 +39,7 @@ def mock_scopes() -> list[str]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -8,6 +8,7 @@ from unittest.mock import AsyncMock, MagicMock, patch
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -58,7 +59,7 @@ def mock_config_entry(hass: HomeAssistant, expires_at: float) -> MockConfigEntry
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -7,6 +7,7 @@ from monzopy.monzopy import UserAccount
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -50,7 +51,7 @@ USER_ID = 12345
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -10,6 +10,7 @@ import orjson
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -58,7 +59,7 @@ def mock_config_entry(hass: HomeAssistant, expires_at: float) -> MockConfigEntry
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -18,6 +18,7 @@ import pytest
from yarl import URL
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
async_import_client_credential,
)
from homeassistant.components.nest import DOMAIN
@@ -291,7 +292,7 @@ async def credential(hass: HomeAssistant, nest_test_config: NestTestConfig) -> N
"""Fixture that provides the ClientCredential for the test if any."""
if not nest_test_config.credential:
return
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass, DOMAIN, nest_test_config.credential, "imported-cred"
)

View File

@@ -9,6 +9,7 @@ from pyatmo.const import ALL_SCOPES
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -27,7 +28,7 @@ CLIENT_SECRET = "5678"
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -20,6 +20,7 @@ from onedrive_personal_sdk.models.items import (
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -46,7 +47,7 @@ def mock_scopes() -> list[str]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -6,6 +6,7 @@ import pytest
from homeassistant import config_entries
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -28,7 +29,7 @@ REDIRECT_URL = "https://example.com/auth/external/callback"
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -9,6 +9,7 @@ from pysenz import Account, Thermostat
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -101,7 +102,7 @@ def mock_senz_client(account_fixture, device_fixture) -> Generator[MagicMock]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -18,6 +18,7 @@ from pysmartthings.models import HealthStatus, InstalledApp
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -54,7 +55,7 @@ def mock_expires_at() -> int:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -27,6 +27,7 @@ from spotifyaio.models import (
)
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -70,7 +71,7 @@ def mock_config_entry(expires_at: int) -> MockConfigEntry:
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -5,6 +5,7 @@ from unittest.mock import patch
from syrupy.assertion import SnapshotAssertion
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -24,7 +25,7 @@ async def setup_platform(
) -> None:
"""Set up the Tesla Fleet platform."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -11,6 +11,7 @@ from tesla_fleet_api.exceptions import (
)
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -62,7 +63,7 @@ async def access_token(hass: HomeAssistant) -> str:
async def create_credential(hass: HomeAssistant) -> None:
"""Create a user credential."""
# Create user application credential
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -9,6 +9,7 @@ import pytest
import tibber
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -216,7 +217,7 @@ async def mock_tibber_setup(
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Set up application credentials for the OAuth flow."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -8,6 +8,7 @@ import pytest
from twitchAPI.object.api import FollowedChannel, Stream, TwitchUser, UserSubscription
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -43,7 +44,7 @@ def mock_scopes() -> list[str]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -17,6 +17,7 @@ from volvocarsapi.models import (
)
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -163,7 +164,7 @@ async def mock_api(
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -7,6 +7,7 @@ import pytest
from visionpluspython.models import Device, create_device_from_data
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -33,7 +34,7 @@ TEST_EXPIRES_AT = 9999999999
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Ensure the application credentials are registered for each test."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,

View File

@@ -9,6 +9,7 @@ from aiowithings.models import NotificationConfiguration
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -48,7 +49,7 @@ def mock_scopes() -> list[str]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -17,6 +17,7 @@ from pythonxbox.api.provider.smartglass.models import (
from pythonxbox.api.provider.titlehub.models import TitleHubResponse
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -34,7 +35,7 @@ CLIENT_SECRET = "5678"
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass, DOMAIN, ClientCredential(CLIENT_ID, CLIENT_SECRET), "cloud"
)

View File

@@ -36,6 +36,7 @@ from yalexs.manager.ratelimit import _RateLimitChecker
from yalexs.manager.socketio import SocketIORunner
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -120,7 +121,7 @@ def mock_config_entry(jwt: str | None = None) -> MockConfigEntry:
async def mock_client_credentials(hass: HomeAssistant) -> ClientCredential:
"""Mock client credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -9,6 +9,7 @@ import pytest
from yolink.home_manager import YoLinkHome
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -26,7 +27,7 @@ DOMAIN = "yolink"
@pytest.fixture
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,

View File

@@ -8,6 +8,7 @@ from unittest.mock import patch
import pytest
from homeassistant.components.application_credentials import (
DOMAIN as APPLICATION_CREDENTIALS_DOMAIN,
ClientCredential,
async_import_client_credential,
)
@@ -42,7 +43,7 @@ def mock_scopes() -> list[str]:
@pytest.fixture(autouse=True)
async def setup_credentials(hass: HomeAssistant) -> None:
"""Fixture to setup credentials."""
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,
@@ -98,7 +99,7 @@ async def mock_setup_integration(
"""Fixture for setting up the component."""
config_entry.add_to_hass(hass)
assert await async_setup_component(hass, "application_credentials", {})
assert await async_setup_component(hass, APPLICATION_CREDENTIALS_DOMAIN, {})
await async_import_client_credential(
hass,
DOMAIN,