Improve type hints in config tests (#120346)

This commit is contained in:
epenet 2024-06-24 18:36:57 +02:00 committed by GitHub
parent 4089b808c3
commit 8bad421a04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 109 additions and 80 deletions

View File

@ -5,9 +5,11 @@ from copy import deepcopy
import json
import logging
from os.path import basename
from typing import Any
from unittest.mock import patch
import pytest
from typing_extensions import Generator
from homeassistant.core import HomeAssistant
@ -17,7 +19,7 @@ _LOGGER = logging.getLogger(__name__)
@contextmanager
def mock_config_store(data=None):
def mock_config_store(data: dict[str, Any] | None = None) -> Generator[dict[str, Any]]:
"""Mock config yaml store.
Data is a dict {'key': {'version': version, 'data': data}}
@ -72,7 +74,7 @@ def mock_config_store(data=None):
@pytest.fixture
def hass_config_store():
def hass_config_store() -> Generator[dict[str, Any]]:
"""Fixture to mock config yaml store."""
with mock_config_store() as stored_data:
yield stored_data

View File

@ -38,7 +38,9 @@ async def owner_access_token(hass: HomeAssistant, hass_owner_user: MockUser) ->
@pytest.fixture
async def hass_admin_credential(hass, auth_provider):
async def hass_admin_credential(
hass: HomeAssistant, auth_provider: prov_ha.HassAuthProvider
):
"""Overload credentials to admin user."""
await hass.async_add_executor_job(
auth_provider.data.add_auth, "test-user", "test-pass"
@ -284,7 +286,9 @@ async def test_delete_unknown_auth(
async def test_change_password(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, auth_provider
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
auth_provider: prov_ha.HassAuthProvider,
) -> None:
"""Test that change password succeeds with valid password."""
client = await hass_ws_client(hass)
@ -306,7 +310,7 @@ async def test_change_password_wrong_pw(
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
hass_admin_user: MockUser,
auth_provider,
auth_provider: prov_ha.HassAuthProvider,
) -> None:
"""Test that change password fails with invalid password."""
@ -349,7 +353,9 @@ async def test_change_password_no_creds(
async def test_admin_change_password_not_owner(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, auth_provider
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
auth_provider: prov_ha.HassAuthProvider,
) -> None:
"""Test that change password fails when not owner."""
client = await hass_ws_client(hass)
@ -372,7 +378,7 @@ async def test_admin_change_password_not_owner(
async def test_admin_change_password_no_user(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, owner_access_token
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, owner_access_token: str
) -> None:
"""Test that change password fails with unknown user."""
client = await hass_ws_client(hass, owner_access_token)
@ -394,7 +400,7 @@ async def test_admin_change_password_no_user(
async def test_admin_change_password_no_cred(
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
owner_access_token,
owner_access_token: str,
hass_admin_user: MockUser,
) -> None:
"""Test that change password fails with unknown credential."""
@ -419,8 +425,8 @@ async def test_admin_change_password_no_cred(
async def test_admin_change_password(
hass: HomeAssistant,
hass_ws_client: WebSocketGenerator,
owner_access_token,
auth_provider,
owner_access_token: str,
auth_provider: prov_ha.HassAuthProvider,
hass_admin_user: MockUser,
) -> None:
"""Test that owners can change any password."""

View File

@ -26,7 +26,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
@pytest.fixture
async def setup_automation(
hass: HomeAssistant,
automation_config,
automation_config: dict[str, Any],
stub_blueprint_populate: None,
) -> None:
"""Set up automation integration."""
@ -36,11 +36,11 @@ async def setup_automation(
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.usefixtures("setup_automation")
async def test_get_automation_config(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
) -> None:
"""Test getting automation config."""
with patch.object(config, "SECTIONS", [automation]):
@ -59,11 +59,11 @@ async def test_get_automation_config(
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.usefixtures("setup_automation")
async def test_update_automation_config(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
) -> None:
"""Test updating automation config."""
with patch.object(config, "SECTIONS", [automation]):
@ -143,11 +143,11 @@ async def test_update_automation_config(
),
],
)
@pytest.mark.usefixtures("setup_automation")
async def test_update_automation_config_with_error(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
caplog: pytest.LogCaptureFixture,
updated_config: Any,
validation_error: str,
@ -196,11 +196,11 @@ async def test_update_automation_config_with_error(
),
],
)
@pytest.mark.usefixtures("setup_automation")
async def test_update_automation_config_with_blueprint_substitution_error(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
caplog: pytest.LogCaptureFixture,
updated_config: Any,
validation_error: str,
@ -235,11 +235,11 @@ async def test_update_automation_config_with_blueprint_substitution_error(
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.usefixtures("setup_automation")
async def test_update_remove_key_automation_config(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
) -> None:
"""Test updating automation config while removing a key."""
with patch.object(config, "SECTIONS", [automation]):
@ -272,11 +272,11 @@ async def test_update_remove_key_automation_config(
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.usefixtures("setup_automation")
async def test_bad_formatted_automations(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
) -> None:
"""Test that we handle automations without ID."""
with patch.object(config, "SECTIONS", [automation]):
@ -332,12 +332,12 @@ async def test_bad_formatted_automations(
],
],
)
@pytest.mark.usefixtures("setup_automation")
async def test_delete_automation(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
entity_registry: er.EntityRegistry,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
) -> None:
"""Test deleting an automation."""
@ -373,12 +373,12 @@ async def test_delete_automation(
@pytest.mark.parametrize("automation_config", [{}])
@pytest.mark.usefixtures("setup_automation")
async def test_api_calls_require_admin(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_read_only_access_token: str,
hass_config_store,
setup_automation,
hass_config_store: dict[str, Any],
) -> None:
"""Test cloud APIs endpoints do not work as a normal user."""
with patch.object(config, "SECTIONS", [automation]):

View File

@ -6,6 +6,7 @@ from unittest.mock import ANY, AsyncMock, patch
from aiohttp.test_utils import TestClient
import pytest
from typing_extensions import Generator
import voluptuous as vol
from homeassistant import config_entries as core_ce, data_entry_flow, loader
@ -30,14 +31,14 @@ from tests.typing import ClientSessionGenerator, WebSocketGenerator
@pytest.fixture
def clear_handlers():
def clear_handlers() -> Generator[None]:
"""Clear config entry handlers."""
with patch.dict(HANDLERS, clear=True):
yield
@pytest.fixture(autouse=True)
def mock_test_component(hass):
def mock_test_component(hass: HomeAssistant) -> None:
"""Ensure a component called 'test' exists."""
mock_integration(hass, MockModule("test"))
@ -53,7 +54,7 @@ async def client(
@pytest.fixture
async def mock_flow():
def mock_flow() -> Generator[None]:
"""Mock a config flow."""
class Comp1ConfigFlow(ConfigFlow):
@ -68,9 +69,8 @@ async def mock_flow():
yield
async def test_get_entries(
hass: HomeAssistant, client, clear_handlers, mock_flow
) -> None:
@pytest.mark.usefixtures("clear_handlers", "mock_flow")
async def test_get_entries(hass: HomeAssistant, client: TestClient) -> None:
"""Test get entries."""
mock_integration(hass, MockModule("comp1"))
mock_integration(
@ -238,7 +238,7 @@ async def test_get_entries(
assert data[0]["domain"] == "comp5"
async def test_remove_entry(hass: HomeAssistant, client) -> None:
async def test_remove_entry(hass: HomeAssistant, client: TestClient) -> None:
"""Test removing an entry via the API."""
entry = MockConfigEntry(
domain="kitchen_sink", state=core_ce.ConfigEntryState.LOADED
@ -251,7 +251,7 @@ async def test_remove_entry(hass: HomeAssistant, client) -> None:
assert len(hass.config_entries.async_entries()) == 0
async def test_reload_entry(hass: HomeAssistant, client) -> None:
async def test_reload_entry(hass: HomeAssistant, client: TestClient) -> None:
"""Test reloading an entry via the API."""
entry = MockConfigEntry(
domain="kitchen_sink", state=core_ce.ConfigEntryState.LOADED
@ -267,14 +267,14 @@ async def test_reload_entry(hass: HomeAssistant, client) -> None:
assert len(hass.config_entries.async_entries()) == 1
async def test_reload_invalid_entry(hass: HomeAssistant, client) -> None:
async def test_reload_invalid_entry(hass: HomeAssistant, client: TestClient) -> None:
"""Test reloading an invalid entry via the API."""
resp = await client.post("/api/config/config_entries/entry/invalid/reload")
assert resp.status == HTTPStatus.NOT_FOUND
async def test_remove_entry_unauth(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test removing an entry via the API."""
hass_admin_user.groups = []
@ -286,7 +286,7 @@ async def test_remove_entry_unauth(
async def test_reload_entry_unauth(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test reloading an entry via the API."""
hass_admin_user.groups = []
@ -300,7 +300,7 @@ async def test_reload_entry_unauth(
async def test_reload_entry_in_failed_state(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test reloading an entry via the API that has already failed to unload."""
entry = MockConfigEntry(domain="demo", state=core_ce.ConfigEntryState.FAILED_UNLOAD)
@ -314,7 +314,7 @@ async def test_reload_entry_in_failed_state(
async def test_reload_entry_in_setup_retry(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test reloading an entry via the API that is in setup retry."""
mock_setup_entry = AsyncMock(return_value=True)
@ -356,7 +356,7 @@ async def test_reload_entry_in_setup_retry(
],
)
async def test_available_flows(
hass: HomeAssistant, client, type_filter, result
hass: HomeAssistant, client: TestClient, type_filter: str | None, result: set[str]
) -> None:
"""Test querying the available flows."""
with patch.object(
@ -378,7 +378,7 @@ async def test_available_flows(
############################
async def test_initialize_flow(hass: HomeAssistant, client) -> None:
async def test_initialize_flow(hass: HomeAssistant, client: TestClient) -> None:
"""Test we can initialize a flow."""
mock_platform(hass, "test.config_flow", None)
@ -427,7 +427,9 @@ async def test_initialize_flow(hass: HomeAssistant, client) -> None:
}
async def test_initialize_flow_unmet_dependency(hass: HomeAssistant, client) -> None:
async def test_initialize_flow_unmet_dependency(
hass: HomeAssistant, client: TestClient
) -> None:
"""Test unmet dependencies are listed."""
mock_platform(hass, "test.config_flow", None)
@ -457,7 +459,7 @@ async def test_initialize_flow_unmet_dependency(hass: HomeAssistant, client) ->
async def test_initialize_flow_unauth(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test we can initialize a flow."""
hass_admin_user.groups = []
@ -483,7 +485,7 @@ async def test_initialize_flow_unauth(
assert resp.status == HTTPStatus.UNAUTHORIZED
async def test_abort(hass: HomeAssistant, client) -> None:
async def test_abort(hass: HomeAssistant, client: TestClient) -> None:
"""Test a flow that aborts."""
mock_platform(hass, "test.config_flow", None)
@ -508,7 +510,7 @@ async def test_abort(hass: HomeAssistant, client) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_create_account(hass: HomeAssistant, client) -> None:
async def test_create_account(hass: HomeAssistant, client: TestClient) -> None:
"""Test a flow that creates an account."""
mock_platform(hass, "test.config_flow", None)
@ -566,7 +568,7 @@ async def test_create_account(hass: HomeAssistant, client) -> None:
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_two_step_flow(hass: HomeAssistant, client) -> None:
async def test_two_step_flow(hass: HomeAssistant, client: TestClient) -> None:
"""Test we can finish a two step flow."""
mock_integration(
hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True))
@ -646,7 +648,7 @@ async def test_two_step_flow(hass: HomeAssistant, client) -> None:
async def test_continue_flow_unauth(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test we can't finish a two step flow."""
mock_integration(
@ -745,7 +747,7 @@ async def test_get_progress_index_unauth(
assert response["error"]["code"] == "unauthorized"
async def test_get_progress_flow(hass: HomeAssistant, client) -> None:
async def test_get_progress_flow(hass: HomeAssistant, client: TestClient) -> None:
"""Test we can query the API for same result as we get from init a flow."""
mock_platform(hass, "test.config_flow", None)
@ -780,7 +782,7 @@ async def test_get_progress_flow(hass: HomeAssistant, client) -> None:
async def test_get_progress_flow_unauth(
hass: HomeAssistant, client, hass_admin_user: MockUser
hass: HomeAssistant, client: TestClient, hass_admin_user: MockUser
) -> None:
"""Test we can can't query the API for result of flow."""
mock_platform(hass, "test.config_flow", None)
@ -814,7 +816,7 @@ async def test_get_progress_flow_unauth(
assert resp2.status == HTTPStatus.UNAUTHORIZED
async def test_options_flow(hass: HomeAssistant, client) -> None:
async def test_options_flow(hass: HomeAssistant, client: TestClient) -> None:
"""Test we can change options."""
class TestFlow(core_ce.ConfigFlow):
@ -874,7 +876,11 @@ async def test_options_flow(hass: HomeAssistant, client) -> None:
],
)
async def test_options_flow_unauth(
hass: HomeAssistant, client, hass_admin_user: MockUser, endpoint: str, method: str
hass: HomeAssistant,
client: TestClient,
hass_admin_user: MockUser,
endpoint: str,
method: str,
) -> None:
"""Test unauthorized on options flow."""
@ -911,7 +917,7 @@ async def test_options_flow_unauth(
assert resp.status == HTTPStatus.UNAUTHORIZED
async def test_two_step_options_flow(hass: HomeAssistant, client) -> None:
async def test_two_step_options_flow(hass: HomeAssistant, client: TestClient) -> None:
"""Test we can finish a two step options flow."""
mock_integration(
hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True))
@ -977,7 +983,9 @@ async def test_two_step_options_flow(hass: HomeAssistant, client) -> None:
}
async def test_options_flow_with_invalid_data(hass: HomeAssistant, client) -> None:
async def test_options_flow_with_invalid_data(
hass: HomeAssistant, client: TestClient
) -> None:
"""Test an options flow with invalid_data."""
mock_integration(
hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True))
@ -1358,8 +1366,9 @@ async def test_ignore_flow_nonexisting(
assert response["error"]["code"] == "not_found"
@pytest.mark.usefixtures("clear_handlers")
async def test_get_matching_entries_ws(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, clear_handlers
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
"""Test get entries with the websocket api."""
assert await async_setup_component(hass, "config", {})
@ -1748,8 +1757,9 @@ async def test_get_matching_entries_ws(
assert response["success"] is False
@pytest.mark.usefixtures("clear_handlers")
async def test_subscribe_entries_ws(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, clear_handlers
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
"""Test subscribe entries with the websocket api."""
assert await async_setup_component(hass, "config", {})
@ -1934,8 +1944,9 @@ async def test_subscribe_entries_ws(
]
@pytest.mark.usefixtures("clear_handlers")
async def test_subscribe_entries_ws_filtered(
hass: HomeAssistant, hass_ws_client: WebSocketGenerator, clear_handlers
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
) -> None:
"""Test subscribe entries with the websocket api with a type filter."""
assert await async_setup_component(hass, "config", {})
@ -2139,7 +2150,9 @@ async def test_subscribe_entries_ws_filtered(
]
async def test_flow_with_multiple_schema_errors(hass: HomeAssistant, client) -> None:
async def test_flow_with_multiple_schema_errors(
hass: HomeAssistant, client: TestClient
) -> None:
"""Test an config flow with multiple schema errors."""
mock_integration(
hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True))
@ -2182,7 +2195,7 @@ async def test_flow_with_multiple_schema_errors(hass: HomeAssistant, client) ->
async def test_flow_with_multiple_schema_errors_base(
hass: HomeAssistant, client
hass: HomeAssistant, client: TestClient
) -> None:
"""Test an config flow with multiple schema errors where fields are not in the schema."""
mock_integration(
@ -2226,7 +2239,7 @@ async def test_flow_with_multiple_schema_errors_base(
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_supports_reconfigure(hass: HomeAssistant, client) -> None:
async def test_supports_reconfigure(hass: HomeAssistant, client: TestClient) -> None:
"""Test a flow that support reconfigure step."""
mock_platform(hass, "test.config_flow", None)

View File

@ -2,6 +2,7 @@
from http import HTTPStatus
import json
from typing import Any
from unittest.mock import ANY, patch
import pytest
@ -16,18 +17,18 @@ from tests.typing import ClientSessionGenerator
@pytest.fixture
async def setup_scene(hass, scene_config):
async def setup_scene(hass: HomeAssistant, scene_config: dict[str, Any]) -> None:
"""Set up scene integration."""
assert await async_setup_component(hass, "scene", {"scene": scene_config})
await hass.async_block_till_done()
@pytest.mark.parametrize("scene_config", [{}])
@pytest.mark.usefixtures("setup_scene")
async def test_create_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_scene,
hass_config_store: dict[str, Any],
) -> None:
"""Test creating a scene."""
with patch.object(config, "SECTIONS", [scene]):
@ -70,11 +71,11 @@ async def test_create_scene(
@pytest.mark.parametrize("scene_config", [{}])
@pytest.mark.usefixtures("setup_scene")
async def test_update_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_scene,
hass_config_store: dict[str, Any],
) -> None:
"""Test updating a scene."""
with patch.object(config, "SECTIONS", [scene]):
@ -118,11 +119,11 @@ async def test_update_scene(
@pytest.mark.parametrize("scene_config", [{}])
@pytest.mark.usefixtures("setup_scene")
async def test_bad_formatted_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
setup_scene,
hass_config_store: dict[str, Any],
) -> None:
"""Test that we handle scene without ID."""
with patch.object(config, "SECTIONS", [scene]):
@ -184,12 +185,12 @@ async def test_bad_formatted_scene(
],
],
)
@pytest.mark.usefixtures("setup_scene")
async def test_delete_scene(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
entity_registry: er.EntityRegistry,
hass_config_store,
setup_scene,
hass_config_store: dict[str, Any],
) -> None:
"""Test deleting a scene."""
@ -227,12 +228,12 @@ async def test_delete_scene(
@pytest.mark.parametrize("scene_config", [{}])
@pytest.mark.usefixtures("setup_scene")
async def test_api_calls_require_admin(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_read_only_access_token: str,
hass_config_store,
setup_scene,
hass_config_store: dict[str, Any],
) -> None:
"""Test scene APIs endpoints do not work as a normal user."""
with patch.object(config, "SECTIONS", [scene]):

View File

@ -31,7 +31,9 @@ async def setup_script(hass: HomeAssistant, script_config: dict[str, Any]) -> No
@pytest.mark.parametrize("script_config", [{}])
async def test_get_script_config(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store: dict[str, Any],
) -> None:
"""Test getting script config."""
with patch.object(config, "SECTIONS", [script]):
@ -54,7 +56,9 @@ async def test_get_script_config(
@pytest.mark.parametrize("script_config", [{}])
async def test_update_script_config(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store: dict[str, Any],
) -> None:
"""Test updating script config."""
with patch.object(config, "SECTIONS", [script]):
@ -90,7 +94,9 @@ async def test_update_script_config(
@pytest.mark.parametrize("script_config", [{}])
async def test_invalid_object_id(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store: dict[str, Any],
) -> None:
"""Test creating a script with an invalid object_id."""
with patch.object(config, "SECTIONS", [script]):
@ -152,7 +158,7 @@ async def test_invalid_object_id(
async def test_update_script_config_with_error(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
hass_config_store: dict[str, Any],
caplog: pytest.LogCaptureFixture,
updated_config: Any,
validation_error: str,
@ -202,8 +208,7 @@ async def test_update_script_config_with_error(
async def test_update_script_config_with_blueprint_substitution_error(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store,
# setup_automation,
hass_config_store: dict[str, Any],
caplog: pytest.LogCaptureFixture,
updated_config: Any,
validation_error: str,
@ -239,7 +244,9 @@ async def test_update_script_config_with_blueprint_substitution_error(
@pytest.mark.parametrize("script_config", [{}])
async def test_update_remove_key_script_config(
hass: HomeAssistant, hass_client: ClientSessionGenerator, hass_config_store
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_config_store: dict[str, Any],
) -> None:
"""Test updating script config while removing a key."""
with patch.object(config, "SECTIONS", [script]):
@ -286,7 +293,7 @@ async def test_delete_script(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
entity_registry: er.EntityRegistry,
hass_config_store,
hass_config_store: dict[str, Any],
) -> None:
"""Test deleting a script."""
with patch.object(config, "SECTIONS", [script]):
@ -325,7 +332,7 @@ async def test_api_calls_require_admin(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
hass_read_only_access_token: str,
hass_config_store,
hass_config_store: dict[str, Any],
) -> None:
"""Test script APIs endpoints do not work as a normal user."""
with patch.object(config, "SECTIONS", [script]):