diff --git a/tests/components/aladdin_connect/test_config_flow.py b/tests/components/aladdin_connect/test_config_flow.py index 02244420925..1537e0f35da 100644 --- a/tests/components/aladdin_connect/test_config_flow.py +++ b/tests/components/aladdin_connect/test_config_flow.py @@ -80,11 +80,11 @@ async def _oauth_actions( ) +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_setup_entry: AsyncMock, ) -> None: @@ -105,11 +105,11 @@ async def test_full_flow( assert len(mock_setup_entry.mock_calls) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_duplicate_entry( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_config_entry: MockConfigEntry, ) -> None: @@ -125,11 +125,11 @@ async def test_duplicate_entry( assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_config_entry: MockConfigEntry, mock_setup_entry: AsyncMock, @@ -154,11 +154,11 @@ async def test_reauth( assert result["reason"] == "reauth_successful" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_wrong_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_setup_entry: AsyncMock, ) -> None: @@ -189,11 +189,11 @@ async def test_reauth_wrong_account( assert result["reason"] == "wrong_account" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_old_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_setup_entry: AsyncMock, ) -> None: diff --git a/tests/components/cloud/test_account_link.py b/tests/components/cloud/test_account_link.py index 024118eaabf..3f108961bc5 100644 --- a/tests/components/cloud/test_account_link.py +++ b/tests/components/cloud/test_account_link.py @@ -178,9 +178,8 @@ async def test_get_services_error(hass: HomeAssistant) -> None: assert account_link.DATA_SERVICES not in hass.data -async def test_implementation( - hass: HomeAssistant, flow_handler, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_implementation(hass: HomeAssistant, flow_handler) -> None: """Test Cloud OAuth2 implementation.""" hass.data["cloud"] = None diff --git a/tests/components/electric_kiwi/test_config_flow.py b/tests/components/electric_kiwi/test_config_flow.py index d74abab7692..bf248aafb13 100644 --- a/tests/components/electric_kiwi/test_config_flow.py +++ b/tests/components/electric_kiwi/test_config_flow.py @@ -53,11 +53,11 @@ async def test_config_flow_no_credentials(hass: HomeAssistant) -> None: assert result.get("reason") == "missing_credentials" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_setup_entry: AsyncMock, ) -> None: @@ -107,11 +107,11 @@ async def test_full_flow( assert len(mock_setup_entry.mock_calls) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_existing_entry( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, config_entry: MockConfigEntry, ) -> None: @@ -150,10 +150,10 @@ async def test_existing_entry( assert len(hass.config_entries.async_entries(DOMAIN)) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_reauthentication( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, aioclient_mock: AiohttpClientMocker, mock_setup_entry: MagicMock, config_entry: MockConfigEntry, diff --git a/tests/components/fitbit/test_config_flow.py b/tests/components/fitbit/test_config_flow.py index 843a85dec68..d5f3d09abdd 100644 --- a/tests/components/fitbit/test_config_flow.py +++ b/tests/components/fitbit/test_config_flow.py @@ -32,11 +32,11 @@ from tests.typing import ClientSessionGenerator REDIRECT_URL = "https://example.com/auth/external/callback" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, profile: None, setup_credentials: None, ) -> None: @@ -97,11 +97,11 @@ async def test_full_flow( (HTTPStatus.INTERNAL_SERVER_ERROR, "cannot_connect"), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_token_error( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, profile: None, setup_credentials: None, status_code: HTTPStatus, @@ -155,11 +155,11 @@ async def test_token_error( ), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_api_failure( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, requests_mock: Mocker, setup_credentials: None, http_status: HTTPStatus, @@ -207,12 +207,11 @@ async def test_api_failure( assert result.get("reason") == error_reason +@pytest.mark.usefixtures("current_request_with_host") async def test_config_entry_already_exists( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, - requests_mock: Mocker, setup_credentials: None, integration_setup: Callable[[], Awaitable[bool]], config_entry: MockConfigEntry, @@ -457,12 +456,12 @@ async def test_platform_setup_without_import( assert issue.translation_key == "deprecated_yaml_no_import" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_flow( hass: HomeAssistant, config_entry: MockConfigEntry, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, profile: None, setup_credentials: None, ) -> None: @@ -532,12 +531,12 @@ async def test_reauth_flow( @pytest.mark.parametrize("profile_id", ["other-user-id"]) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_wrong_user_id( hass: HomeAssistant, config_entry: MockConfigEntry, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, profile: None, setup_credentials: None, ) -> None: @@ -610,11 +609,11 @@ async def test_reauth_wrong_user_id( ], ids=("full_profile_data", "display_name_only"), ) +@pytest.mark.usefixtures("current_request_with_host") async def test_partial_profile_data( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, profile: None, setup_credentials: None, expected_title: str, diff --git a/tests/components/geocaching/test_config_flow.py b/tests/components/geocaching/test_config_flow.py index f4e8f0c8a96..0c2ce66b513 100644 --- a/tests/components/geocaching/test_config_flow.py +++ b/tests/components/geocaching/test_config_flow.py @@ -40,11 +40,11 @@ async def setup_credentials(hass: HomeAssistant) -> None: ) +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, mock_geocaching_config_flow: MagicMock, mock_setup_entry: MagicMock, ) -> None: @@ -90,11 +90,11 @@ async def test_full_flow( assert len(mock_setup_entry.mock_calls) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_existing_entry( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, mock_geocaching_config_flow: MagicMock, mock_setup_entry: MagicMock, mock_config_entry: MockConfigEntry, @@ -136,11 +136,11 @@ async def test_existing_entry( assert len(hass.config_entries.async_entries(DOMAIN)) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_oauth_error( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, mock_geocaching_config_flow: MagicMock, mock_setup_entry: MagicMock, ) -> None: @@ -183,11 +183,11 @@ async def test_oauth_error( assert len(mock_setup_entry.mock_calls) == 0 +@pytest.mark.usefixtures("current_request_with_host") async def test_reauthentication( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, mock_geocaching_config_flow: MagicMock, mock_setup_entry: MagicMock, mock_config_entry: MockConfigEntry, diff --git a/tests/components/google/test_config_flow.py b/tests/components/google/test_config_flow.py index d75de491baf..53ec06619ac 100644 --- a/tests/components/google/test_config_flow.py +++ b/tests/components/google/test_config_flow.py @@ -656,9 +656,9 @@ async def test_options_flow_no_changes( assert config_entry.options == {"calendar_access": "read_write"} +@pytest.mark.usefixtures("current_request_with_host") async def test_web_auth_compatibility( hass: HomeAssistant, - current_request_with_host: None, mock_code_flow: Mock, aioclient_mock: AiohttpClientMocker, hass_client_no_auth: ClientSessionGenerator, diff --git a/tests/components/google_assistant_sdk/test_config_flow.py b/tests/components/google_assistant_sdk/test_config_flow.py index 4a4931d7bae..d66d12509e8 100644 --- a/tests/components/google_assistant_sdk/test_config_flow.py +++ b/tests/components/google_assistant_sdk/test_config_flow.py @@ -2,6 +2,8 @@ from unittest.mock import patch +import pytest + from homeassistant import config_entries from homeassistant.components.google_assistant_sdk.const import DOMAIN from homeassistant.core import HomeAssistant @@ -19,11 +21,11 @@ GOOGLE_TOKEN_URI = "https://oauth2.googleapis.com/token" TITLE = "Google Assistant SDK" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, ) -> None: """Check full flow.""" @@ -80,11 +82,11 @@ async def test_full_flow( ) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, ) -> None: """Test the reauthentication case updates the existing config entry.""" @@ -155,11 +157,11 @@ async def test_reauth( assert config_entry.data["token"].get("refresh_token") == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_single_instance_allowed( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, ) -> None: """Test case where config flow allows a single test.""" diff --git a/tests/components/google_mail/test_config_flow.py b/tests/components/google_mail/test_config_flow.py index f784b654fba..1e933c8932a 100644 --- a/tests/components/google_mail/test_config_flow.py +++ b/tests/components/google_mail/test_config_flow.py @@ -18,10 +18,9 @@ from tests.test_util.aiohttp import AiohttpClientMocker from tests.typing import ClientSessionGenerator +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( - hass: HomeAssistant, - hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, + hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator ) -> None: """Check full flow.""" result = await hass.config_entries.flow.async_init( @@ -88,11 +87,11 @@ async def test_full_flow( ), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, config_entry: MockConfigEntry, fixture: str, abort_reason: str, @@ -173,10 +172,10 @@ async def test_reauth( assert config_entry.data["token"].get("refresh_token") == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_already_configured( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, config_entry: MockConfigEntry, ) -> None: """Test case where config flow discovers unique id was already configured.""" diff --git a/tests/components/google_sheets/test_config_flow.py b/tests/components/google_sheets/test_config_flow.py index 5d8a19d1b61..1f51c9477b8 100644 --- a/tests/components/google_sheets/test_config_flow.py +++ b/tests/components/google_sheets/test_config_flow.py @@ -49,11 +49,11 @@ async def mock_client() -> Generator[Mock, None, None]: yield mock_client +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, mock_client, ) -> None: @@ -116,11 +116,11 @@ async def test_full_flow( ) +@pytest.mark.usefixtures("current_request_with_host") async def test_create_sheet_error( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, mock_client, ) -> None: @@ -168,11 +168,11 @@ async def test_create_sheet_error( assert result.get("reason") == "create_spreadsheet_failure" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, mock_client, ) -> None: @@ -249,11 +249,11 @@ async def test_reauth( assert config_entry.data["token"].get("refresh_token") == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_abort( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, mock_client, ) -> None: @@ -318,11 +318,11 @@ async def test_reauth_abort( assert result.get("reason") == "open_spreadsheet_failure" +@pytest.mark.usefixtures("current_request_with_host") async def test_already_configured( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, mock_client, ) -> None: diff --git a/tests/components/google_tasks/test_config_flow.py b/tests/components/google_tasks/test_config_flow.py index ba2a0ca8de6..0c56594a966 100644 --- a/tests/components/google_tasks/test_config_flow.py +++ b/tests/components/google_tasks/test_config_flow.py @@ -42,11 +42,11 @@ def setup_userinfo(user_identifier: str) -> Generator[Mock, None, None]: yield mock +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, setup_userinfo, ) -> None: @@ -97,11 +97,11 @@ async def test_full_flow( assert len(mock_setup.mock_calls) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_api_not_enabled( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, setup_userinfo, ) -> None: @@ -158,11 +158,11 @@ async def test_api_not_enabled( ) +@pytest.mark.usefixtures("current_request_with_host") async def test_general_exception( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, setup_userinfo, ) -> None: @@ -235,11 +235,11 @@ async def test_general_exception( ), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, setup_userinfo, user_identifier: str, diff --git a/tests/components/home_connect/test_config_flow.py b/tests/components/home_connect/test_config_flow.py index 2c094c74246..80f53e20b39 100644 --- a/tests/components/home_connect/test_config_flow.py +++ b/tests/components/home_connect/test_config_flow.py @@ -3,6 +3,8 @@ from http import HTTPStatus from unittest.mock import patch +import pytest + from homeassistant import config_entries, setup from homeassistant.components.application_credentials import ( ClientCredential, @@ -24,11 +26,11 @@ CLIENT_ID = "1234" CLIENT_SECRET = "5678" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" assert await setup.async_setup_component(hass, "home_connect", {}) diff --git a/tests/components/husqvarna_automower/test_config_flow.py b/tests/components/husqvarna_automower/test_config_flow.py index efac36b5a7a..31e8a9afcbd 100644 --- a/tests/components/husqvarna_automower/test_config_flow.py +++ b/tests/components/husqvarna_automower/test_config_flow.py @@ -30,11 +30,11 @@ from tests.typing import ClientSessionGenerator ("iam:read", 0), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, jwt: str, new_scope: str, amount: int, @@ -87,10 +87,10 @@ async def test_full_flow( assert len(mock_setup.mock_calls) == amount +@pytest.mark.usefixtures("current_request_with_host") async def test_config_non_unique_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, mock_config_entry: MockConfigEntry, aioclient_mock: AiohttpClientMocker, mock_automower_client: AsyncMock, @@ -148,12 +148,12 @@ async def test_config_non_unique_profile( ("iam:read", "missing_scope", "missing_amc_scope", "iam:read"), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, mock_config_entry: MockConfigEntry, - current_request_with_host: None, mock_automower_client: AsyncMock, jwt: str, step_id: str, @@ -228,12 +228,12 @@ async def test_reauth( ("wrong_user_id", "wrong_account"), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_wrong_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, mock_config_entry: MockConfigEntry, - current_request_with_host: None, mock_automower_client: AsyncMock, jwt, user_id: str, diff --git a/tests/components/lyric/test_config_flow.py b/tests/components/lyric/test_config_flow.py index 73b3aae2d3d..e1a8d1131dc 100644 --- a/tests/components/lyric/test_config_flow.py +++ b/tests/components/lyric/test_config_flow.py @@ -45,11 +45,11 @@ async def test_abort_if_no_configuration(hass: HomeAssistant) -> None: assert result["reason"] == "missing_credentials" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, mock_impl, ) -> None: """Check full flow.""" @@ -112,11 +112,11 @@ async def test_full_flow( assert len(mock_setup.mock_calls) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_reauthentication_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, mock_impl, ) -> None: """Test reauthentication flow.""" diff --git a/tests/components/microbees/test_config_flow.py b/tests/components/microbees/test_config_flow.py index 327d0214f7a..d168dcd5017 100644 --- a/tests/components/microbees/test_config_flow.py +++ b/tests/components/microbees/test_config_flow.py @@ -19,10 +19,10 @@ from tests.test_util.aiohttp import AiohttpClientMocker from tests.typing import ClientSessionGenerator +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, aioclient_mock: AiohttpClientMocker, microbees: AsyncMock, ) -> None: @@ -80,10 +80,10 @@ async def test_full_flow( assert result["result"].data["token"]["refresh_token"] == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_non_unique_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, microbees: AsyncMock, config_entry: MockConfigEntry, aioclient_mock: AiohttpClientMocker, @@ -133,13 +133,13 @@ async def test_config_non_unique_profile( assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_reauth_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, config_entry: MockConfigEntry, microbees: AsyncMock, - current_request_with_host, ) -> None: """Test reauth an existing profile reauthenticates the config entry.""" await setup_integration(hass, config_entry) @@ -194,13 +194,13 @@ async def test_config_reauth_profile( assert result["reason"] == "reauth_successful" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_reauth_wrong_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, config_entry: MockConfigEntry, microbees: AsyncMock, - current_request_with_host, ) -> None: """Test reauth with wrong account.""" await setup_integration(hass, config_entry) @@ -255,12 +255,12 @@ async def test_config_reauth_wrong_account( assert result["reason"] == "wrong_account" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_flow_with_invalid_credentials( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, microbees: AsyncMock, - current_request_with_host, ) -> None: """Test flow with invalid credentials.""" result = await hass.config_entries.flow.async_init( @@ -310,6 +310,7 @@ async def test_config_flow_with_invalid_credentials( (Exception("Unexpected error"), "unknown"), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_unexpected_exceptions( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, @@ -318,7 +319,6 @@ async def test_unexpected_exceptions( microbees: AsyncMock, exception: Exception, error: str, - current_request_with_host, ) -> None: """Test unknown error from server.""" await setup_integration(hass, config_entry) diff --git a/tests/components/monzo/test_config_flow.py b/tests/components/monzo/test_config_flow.py index 7ad4c072723..b7d0de9cdc3 100644 --- a/tests/components/monzo/test_config_flow.py +++ b/tests/components/monzo/test_config_flow.py @@ -5,6 +5,7 @@ from unittest.mock import AsyncMock, patch from freezegun.api import FrozenDateTimeFactory from monzopy import AuthorisationExpiredError +import pytest from homeassistant.components.monzo.application_credentials import ( OAUTH2_AUTHORIZE, @@ -24,10 +25,10 @@ from tests.test_util.aiohttp import AiohttpClientMocker from tests.typing import ClientSessionGenerator +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, aioclient_mock: AiohttpClientMocker, ) -> None: """Check full flow.""" @@ -92,10 +93,10 @@ async def test_full_flow( assert result["result"].data["token"]["refresh_token"] == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_non_unique_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, monzo: AsyncMock, polling_config_entry: MockConfigEntry, aioclient_mock: AiohttpClientMocker, @@ -142,13 +143,13 @@ async def test_config_non_unique_profile( assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_reauth_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, polling_config_entry: MockConfigEntry, monzo: AsyncMock, - current_request_with_host: None, ) -> None: """Test reauth an existing profile reauthenticates the config entry.""" await setup_integration(hass, polling_config_entry) @@ -212,12 +213,12 @@ async def test_config_reauth_profile( assert polling_config_entry.data["token"]["access_token"] == "new-mock-access-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_reauth_wrong_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, polling_config_entry: MockConfigEntry, - current_request_with_host: None, ) -> None: """Test reauth with wrong account.""" await setup_integration(hass, polling_config_entry) diff --git a/tests/components/myuplink/test_config_flow.py b/tests/components/myuplink/test_config_flow.py index 7f94d4af03f..3ae32575257 100644 --- a/tests/components/myuplink/test_config_flow.py +++ b/tests/components/myuplink/test_config_flow.py @@ -2,6 +2,8 @@ from unittest.mock import patch +import pytest + from homeassistant import config_entries from homeassistant.components.myuplink.const import ( DOMAIN, @@ -22,11 +24,11 @@ REDIRECT_URL = "https://example.com/auth/external/callback" CURRENT_SCOPE = "WRITESYSTEM READSYSTEM offline_access" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials, ) -> None: """Check full flow.""" @@ -72,11 +74,11 @@ async def test_full_flow( assert len(mock_setup.mock_calls) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_flow_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, setup_credentials: None, mock_config_entry: MockConfigEntry, expires_at: float, diff --git a/tests/components/neato/test_config_flow.py b/tests/components/neato/test_config_flow.py index 132b23ef157..1b86c4e9980 100644 --- a/tests/components/neato/test_config_flow.py +++ b/tests/components/neato/test_config_flow.py @@ -3,6 +3,7 @@ from unittest.mock import patch from pybotvac.neato import Neato +import pytest from homeassistant import config_entries, setup from homeassistant.components.application_credentials import ( @@ -27,11 +28,11 @@ OAUTH2_AUTHORIZE = VENDOR.auth_endpoint OAUTH2_TOKEN = VENDOR.token_endpoint +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" assert await setup.async_setup_component(hass, "neato", {}) @@ -98,11 +99,11 @@ async def test_abort_if_already_setup(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test initialization of the reauth flow.""" assert await setup.async_setup_component(hass, "neato", {}) diff --git a/tests/components/netatmo/test_config_flow.py b/tests/components/netatmo/test_config_flow.py index 933f782c9d9..29a065c3be3 100644 --- a/tests/components/netatmo/test_config_flow.py +++ b/tests/components/netatmo/test_config_flow.py @@ -4,6 +4,7 @@ from ipaddress import ip_address from unittest.mock import patch from pyatmo.const import ALL_SCOPES +import pytest from homeassistant import config_entries from homeassistant.components import zeroconf @@ -59,11 +60,11 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" @@ -226,11 +227,11 @@ async def test_option_flow_wrong_coordinates(hass: HomeAssistant) -> None: assert config_entry.options[CONF_WEATHER_AREAS]["Home"][k] == v +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test initialization of the reauth flow.""" diff --git a/tests/components/ondilo_ico/test_config_flow.py b/tests/components/ondilo_ico/test_config_flow.py index 6b8fcbeefea..deab2a8e0b9 100644 --- a/tests/components/ondilo_ico/test_config_flow.py +++ b/tests/components/ondilo_ico/test_config_flow.py @@ -2,6 +2,8 @@ from unittest.mock import patch +import pytest + from homeassistant import config_entries, setup from homeassistant.components.ondilo_ico.const import ( DOMAIN, @@ -34,11 +36,11 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: assert result["reason"] == "single_instance_allowed" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" assert await setup.async_setup_component( diff --git a/tests/components/plex/test_config_flow.py b/tests/components/plex/test_config_flow.py index 5f2531992d4..a47ea275ddb 100644 --- a/tests/components/plex/test_config_flow.py +++ b/tests/components/plex/test_config_flow.py @@ -49,9 +49,8 @@ from tests.common import MockConfigEntry from tests.typing import ClientSessionGenerator -async def test_bad_credentials( - hass: HomeAssistant, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_bad_credentials(hass: HomeAssistant) -> None: """Test when provided credentials are rejected.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -81,9 +80,8 @@ async def test_bad_credentials( assert result["errors"][CONF_TOKEN] == "faulty_credentials" -async def test_bad_hostname( - hass: HomeAssistant, mock_plex_calls, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_bad_hostname(hass: HomeAssistant, mock_plex_calls) -> None: """Test when an invalid address is provided.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -114,9 +112,8 @@ async def test_bad_hostname( assert result["errors"][CONF_HOST] == "not_found" -async def test_unknown_exception( - hass: HomeAssistant, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_unknown_exception(hass: HomeAssistant) -> None: """Test when an unknown exception is encountered.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -142,12 +139,12 @@ async def test_unknown_exception( assert result["reason"] == "unknown" +@pytest.mark.usefixtures("current_request_with_host") async def test_no_servers_found( hass: HomeAssistant, mock_plex_calls, requests_mock: requests_mock.Mocker, empty_payload, - current_request_with_host: None, ) -> None: """Test when no servers are on an account.""" requests_mock.get("https://plex.tv/api/v2/resources", text=empty_payload) @@ -176,10 +173,10 @@ async def test_no_servers_found( assert result["errors"]["base"] == "no_servers" +@pytest.mark.usefixtures("current_request_with_host") async def test_single_available_server( hass: HomeAssistant, mock_plex_calls, - current_request_with_host: None, mock_setup_entry: AsyncMock, ) -> None: """Test creating an entry with one server available.""" @@ -218,12 +215,12 @@ async def test_single_available_server( mock_setup_entry.assert_called_once() +@pytest.mark.usefixtures("current_request_with_host") async def test_multiple_servers_with_selection( hass: HomeAssistant, mock_plex_calls, requests_mock: requests_mock.Mocker, plextv_resources_two_servers, - current_request_with_host: None, mock_setup_entry: AsyncMock, ) -> None: """Test creating an entry with multiple servers available.""" @@ -275,12 +272,12 @@ async def test_multiple_servers_with_selection( mock_setup_entry.assert_called_once() +@pytest.mark.usefixtures("current_request_with_host") async def test_adding_last_unconfigured_server( hass: HomeAssistant, mock_plex_calls, requests_mock: requests_mock.Mocker, plextv_resources_two_servers, - current_request_with_host: None, mock_setup_entry: AsyncMock, ) -> None: """Test automatically adding last unconfigured server when multiple servers on account.""" @@ -332,13 +329,13 @@ async def test_adding_last_unconfigured_server( assert mock_setup_entry.call_count == 2 +@pytest.mark.usefixtures("current_request_with_host") async def test_all_available_servers_configured( hass: HomeAssistant, entry, requests_mock: requests_mock.Mocker, plextv_account, plextv_resources_two_servers, - current_request_with_host: None, ) -> None: """Test when all available servers are already configured.""" entry.add_to_hass(hass) @@ -479,9 +476,8 @@ async def test_option_flow_new_users_available( assert "[New]" in multiselect_defaults[user] -async def test_external_timed_out( - hass: HomeAssistant, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_external_timed_out(hass: HomeAssistant) -> None: """Test when external flow times out.""" result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER} @@ -506,10 +502,10 @@ async def test_external_timed_out( assert result["reason"] == "token_request_timeout" +@pytest.mark.usefixtures("current_request_with_host") async def test_callback_view( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, ) -> None: """Test callback view.""" result = await hass.config_entries.flow.async_init( @@ -534,9 +530,8 @@ async def test_callback_view( assert resp.status == HTTPStatus.OK -async def test_manual_config( - hass: HomeAssistant, mock_plex_calls, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_manual_config(hass: HomeAssistant, mock_plex_calls) -> None: """Test creating via manual configuration.""" class WrongCertValidaitionException(requests.exceptions.SSLError): @@ -739,11 +734,11 @@ async def test_integration_discovery(hass: HomeAssistant) -> None: assert flow["step_id"] == "user" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, entry: MockConfigEntry, mock_plex_calls: None, - current_request_with_host: None, mock_setup_entry: AsyncMock, ) -> None: """Test setup and reauthorization of a Plex token.""" @@ -783,11 +778,11 @@ async def test_reauth( mock_setup_entry.assert_called_once() +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_multiple_servers_available( hass: HomeAssistant, entry: MockConfigEntry, mock_plex_calls: None, - current_request_with_host: None, requests_mock: requests_mock.Mocker, plextv_resources_two_servers: str, mock_setup_entry: AsyncMock, @@ -853,9 +848,8 @@ async def test_client_request_missing(hass: HomeAssistant) -> None: ) -async def test_client_header_issues( - hass: HomeAssistant, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_client_header_issues(hass: HomeAssistant) -> None: """Test when client headers are not set properly.""" class MockRequest: diff --git a/tests/components/senz/test_config_flow.py b/tests/components/senz/test_config_flow.py index 04ef1a6de0c..4faf8775a62 100644 --- a/tests/components/senz/test_config_flow.py +++ b/tests/components/senz/test_config_flow.py @@ -3,6 +3,7 @@ from unittest.mock import patch from aiosenz import AUTHORIZATION_ENDPOINT, TOKEN_ENDPOINT +import pytest from homeassistant import config_entries from homeassistant.components.application_credentials import ( @@ -21,11 +22,11 @@ CLIENT_ID = "1234" CLIENT_SECRET = "5678" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" await async_setup_component(hass, DOMAIN, {}) diff --git a/tests/components/smappee/test_config_flow.py b/tests/components/smappee/test_config_flow.py index 82f5baf952f..c06ab551ef6 100644 --- a/tests/components/smappee/test_config_flow.py +++ b/tests/components/smappee/test_config_flow.py @@ -4,6 +4,8 @@ from http import HTTPStatus from ipaddress import ip_address from unittest.mock import patch +import pytest + from homeassistant import setup from homeassistant.components import zeroconf from homeassistant.components.smappee.const import ( @@ -427,11 +429,11 @@ async def test_abort_cloud_flow_if_local_device_exists(hass: HomeAssistant) -> N assert len(hass.config_entries.async_entries(DOMAIN)) == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_full_user_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" assert await setup.async_setup_component( diff --git a/tests/components/spotify/test_config_flow.py b/tests/components/spotify/test_config_flow.py index 6de549c8bc7..6040fcd84f2 100644 --- a/tests/components/spotify/test_config_flow.py +++ b/tests/components/spotify/test_config_flow.py @@ -76,12 +76,12 @@ async def test_zeroconf_abort_if_existing_entry(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, component_setup, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check a full flow.""" result = await hass.config_entries.flow.async_init( @@ -143,12 +143,12 @@ async def test_full_flow( } +@pytest.mark.usefixtures("current_request_with_host") async def test_abort_if_spotify_error( hass: HomeAssistant, component_setup, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check Spotify errors causes flow to abort.""" result = await hass.config_entries.flow.async_init( @@ -185,12 +185,12 @@ async def test_abort_if_spotify_error( assert result["reason"] == "connection_error" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauthentication( hass: HomeAssistant, component_setup, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test Spotify reauthentication.""" old_entry = MockConfigEntry( @@ -253,12 +253,12 @@ async def test_reauthentication( } +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_account_mismatch( hass: HomeAssistant, component_setup, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test Spotify reauthentication with different account.""" old_entry = MockConfigEntry( diff --git a/tests/components/toon/test_config_flow.py b/tests/components/toon/test_config_flow.py index 7bda813e447..588924b416f 100644 --- a/tests/components/toon/test_config_flow.py +++ b/tests/components/toon/test_config_flow.py @@ -3,6 +3,7 @@ from http import HTTPStatus from unittest.mock import patch +import pytest from toonapi import Agreement, ToonError from homeassistant.components.toon.const import CONF_AGREEMENT, CONF_MIGRATE, DOMAIN @@ -45,11 +46,11 @@ async def test_abort_if_no_configuration(hass: HomeAssistant) -> None: assert result["reason"] == "missing_configuration" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow_implementation( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test registering an integration and finishing flow works.""" await setup_component(hass) @@ -111,11 +112,11 @@ async def test_full_flow_implementation( } +@pytest.mark.usefixtures("current_request_with_host") async def test_no_agreements( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test abort when there are no displays.""" await setup_component(hass) @@ -153,11 +154,11 @@ async def test_no_agreements( assert result3["reason"] == "no_agreements" +@pytest.mark.usefixtures("current_request_with_host") async def test_multiple_agreements( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test abort when there are no displays.""" await setup_component(hass) @@ -205,11 +206,11 @@ async def test_multiple_agreements( assert result4["data"]["agreement_id"] == 1 +@pytest.mark.usefixtures("current_request_with_host") async def test_agreement_already_set_up( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test showing display form again if display already exists.""" await setup_component(hass) @@ -248,11 +249,11 @@ async def test_agreement_already_set_up( assert result3["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_toon_abort( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test we abort on Toon error.""" await setup_component(hass) @@ -290,7 +291,8 @@ async def test_toon_abort( assert result2["reason"] == "connection_error" -async def test_import(hass: HomeAssistant, current_request_with_host: None) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_import(hass: HomeAssistant) -> None: """Test if importing step works.""" await setup_component(hass) @@ -304,11 +306,11 @@ async def test_import(hass: HomeAssistant, current_request_with_host: None) -> N assert result["reason"] == "already_in_progress" +@pytest.mark.usefixtures("current_request_with_host") async def test_import_migration( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test if importing step with migration works.""" old_entry = MockConfigEntry(domain=DOMAIN, unique_id=123, version=1) diff --git a/tests/components/twitch/test_config_flow.py b/tests/components/twitch/test_config_flow.py index 7807cd38e1a..7d677df1adb 100644 --- a/tests/components/twitch/test_config_flow.py +++ b/tests/components/twitch/test_config_flow.py @@ -2,6 +2,7 @@ from unittest.mock import AsyncMock +import pytest from twitchAPI.object.api import TwitchUser from homeassistant.components.twitch.const import ( @@ -47,10 +48,10 @@ async def _do_get_token( assert resp.headers["content-type"] == "text/html; charset=utf-8" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, mock_setup_entry, twitch_mock: AsyncMock, scopes: list[str], @@ -75,10 +76,10 @@ async def test_full_flow( assert result["options"] == {CONF_CHANNELS: ["internetofthings", "homeassistant"]} +@pytest.mark.usefixtures("current_request_with_host") async def test_already_configured( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, config_entry: MockConfigEntry, mock_setup_entry, twitch_mock: AsyncMock, @@ -97,10 +98,10 @@ async def test_already_configured( assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, config_entry: MockConfigEntry, mock_setup_entry, twitch_mock: AsyncMock, @@ -129,10 +130,10 @@ async def test_reauth( assert result["reason"] == "reauth_successful" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_from_import( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, mock_setup_entry, twitch_mock: AsyncMock, expires_at, @@ -158,7 +159,6 @@ async def test_reauth_from_import( await test_reauth( hass, hass_client_no_auth, - current_request_with_host, config_entry, mock_setup_entry, twitch_mock, @@ -170,10 +170,10 @@ async def test_reauth_from_import( assert entry.options == {CONF_CHANNELS: ["internetofthings", "homeassistant"]} +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth_wrong_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, config_entry: MockConfigEntry, mock_setup_entry, twitch_mock: AsyncMock, diff --git a/tests/components/withings/test_config_flow.py b/tests/components/withings/test_config_flow.py index 9f4b265ed4f..20bef90a31e 100644 --- a/tests/components/withings/test_config_flow.py +++ b/tests/components/withings/test_config_flow.py @@ -2,6 +2,8 @@ from unittest.mock import AsyncMock, patch +import pytest + from homeassistant.components.withings.const import DOMAIN from homeassistant.config_entries import SOURCE_REAUTH, SOURCE_USER from homeassistant.core import HomeAssistant @@ -16,10 +18,10 @@ from tests.test_util.aiohttp import AiohttpClientMocker from tests.typing import ClientSessionGenerator +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, aioclient_mock: AiohttpClientMocker, ) -> None: """Check full flow.""" @@ -79,10 +81,10 @@ async def test_full_flow( assert result["result"].data["token"]["refresh_token"] == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_non_unique_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, withings: AsyncMock, polling_config_entry: MockConfigEntry, aioclient_mock: AiohttpClientMocker, @@ -132,13 +134,13 @@ async def test_config_non_unique_profile( assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_reauth_profile( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, polling_config_entry: MockConfigEntry, withings: AsyncMock, - current_request_with_host, ) -> None: """Test reauth an existing profile reauthenticates the config entry.""" await setup_integration(hass, polling_config_entry) @@ -194,13 +196,13 @@ async def test_config_reauth_profile( assert result["reason"] == "reauth_successful" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_reauth_wrong_account( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, polling_config_entry: MockConfigEntry, withings: AsyncMock, - current_request_with_host, ) -> None: """Test reauth with wrong account.""" await setup_integration(hass, polling_config_entry) @@ -256,13 +258,13 @@ async def test_config_reauth_wrong_account( assert result["reason"] == "wrong_account" +@pytest.mark.usefixtures("current_request_with_host") async def test_config_flow_with_invalid_credentials( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, polling_config_entry: MockConfigEntry, withings: AsyncMock, - current_request_with_host, ) -> None: """Test flow with invalid credentials.""" result = await hass.config_entries.flow.async_init( diff --git a/tests/components/withings/test_init.py b/tests/components/withings/test_init.py index 3ade0fb7c3a..0375d1869d9 100644 --- a/tests/components/withings/test_init.py +++ b/tests/components/withings/test_init.py @@ -544,6 +544,7 @@ async def test_cloud_disconnect_retry( ), # Success, we ignore the user_id ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_webhook_post( hass: HomeAssistant, withings: AsyncMock, @@ -551,7 +552,6 @@ async def test_webhook_post( hass_client_no_auth: ClientSessionGenerator, body: dict[str, Any], expected_code: int, - current_request_with_host: None, freezer: FrozenDateTimeFactory, ) -> None: """Test webhook callback.""" diff --git a/tests/components/xbox/test_config_flow.py b/tests/components/xbox/test_config_flow.py index e547909f946..8c2e6df6f89 100644 --- a/tests/components/xbox/test_config_flow.py +++ b/tests/components/xbox/test_config_flow.py @@ -3,6 +3,8 @@ from http import HTTPStatus from unittest.mock import patch +import pytest + from homeassistant import config_entries, setup from homeassistant.components.application_credentials import ( ClientCredential, @@ -32,11 +34,11 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: assert result["reason"] == "single_instance_allowed" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" assert await setup.async_setup_component(hass, "application_credentials", {}) diff --git a/tests/components/yolink/test_config_flow.py b/tests/components/yolink/test_config_flow.py index f62bd3ac1ac..d7ba09e4269 100644 --- a/tests/components/yolink/test_config_flow.py +++ b/tests/components/yolink/test_config_flow.py @@ -3,6 +3,7 @@ from http import HTTPStatus from unittest.mock import patch +import pytest from yolink.const import OAUTH2_AUTHORIZE, OAUTH2_TOKEN from homeassistant import config_entries, setup @@ -40,11 +41,11 @@ async def test_abort_if_existing_entry(hass: HomeAssistant) -> None: assert result["reason"] == "already_configured" +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Check full flow.""" assert await setup.async_setup_component( @@ -115,9 +116,8 @@ async def test_full_flow( assert len(mock_setup.mock_calls) == 1 -async def test_abort_if_authorization_timeout( - hass: HomeAssistant, current_request_with_host: None -) -> None: +@pytest.mark.usefixtures("current_request_with_host") +async def test_abort_if_authorization_timeout(hass: HomeAssistant) -> None: """Check yolink authorization timeout.""" assert await setup.async_setup_component( hass, @@ -142,11 +142,11 @@ async def test_abort_if_authorization_timeout( assert result["reason"] == "authorize_url_timeout" +@pytest.mark.usefixtures("current_request_with_host") async def test_reauthentication( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, ) -> None: """Test yolink reauthentication.""" await setup.async_setup_component( diff --git a/tests/components/youtube/test_config_flow.py b/tests/components/youtube/test_config_flow.py index 1f68047b1c5..73652d9b239 100644 --- a/tests/components/youtube/test_config_flow.py +++ b/tests/components/youtube/test_config_flow.py @@ -26,10 +26,10 @@ from tests.test_util.aiohttp import AiohttpClientMocker from tests.typing import ClientSessionGenerator +@pytest.mark.usefixtures("current_request_with_host") async def test_full_flow( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, ) -> None: """Check full flow.""" result = await hass.config_entries.flow.async_init( @@ -85,10 +85,10 @@ async def test_full_flow( assert result["options"] == {CONF_CHANNELS: ["UC_x5XG1OV2P6uZZ5FSM9Ttw"]} +@pytest.mark.usefixtures("current_request_with_host") async def test_flow_abort_without_channel( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, ) -> None: """Check abort flow if user has no channel.""" result = await hass.config_entries.flow.async_init( @@ -126,10 +126,10 @@ async def test_flow_abort_without_channel( assert result["reason"] == "no_channel" +@pytest.mark.usefixtures("current_request_with_host") async def test_flow_abort_without_subscriptions( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, ) -> None: """Check abort flow if user has no subscriptions.""" result = await hass.config_entries.flow.async_init( @@ -167,10 +167,10 @@ async def test_flow_abort_without_subscriptions( assert result["reason"] == "no_subscriptions" +@pytest.mark.usefixtures("current_request_with_host") async def test_flow_http_error( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, ) -> None: """Check full flow.""" result = await hass.config_entries.flow.async_init( @@ -229,11 +229,11 @@ async def test_flow_http_error( ), ], ) +@pytest.mark.usefixtures("current_request_with_host") async def test_reauth( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, aioclient_mock: AiohttpClientMocker, - current_request_with_host: None, config_entry: MockConfigEntry, fixture: str, abort_reason: str, @@ -312,10 +312,10 @@ async def test_reauth( assert config_entry.data["token"]["refresh_token"] == "mock-refresh-token" +@pytest.mark.usefixtures("current_request_with_host") async def test_flow_exception( hass: HomeAssistant, hass_client_no_auth: ClientSessionGenerator, - current_request_with_host: None, ) -> None: """Check full flow.""" result = await hass.config_entries.flow.async_init(