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
6 changed files with 109 additions and 80 deletions

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]):