Add type hints to integration tests (part 19) (#88178)

This commit is contained in:
epenet 2023-02-15 18:07:40 +01:00 committed by GitHub
parent f5a05c1bd2
commit 80ee196fd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
50 changed files with 974 additions and 526 deletions

View file

@ -63,7 +63,7 @@ async def test_config_not_valid_service_names(hass: HomeAssistant) -> None:
@patch("homeassistant.components.shell_command.asyncio.create_subprocess_shell")
async def test_template_render_no_template(mock_call, hass):
async def test_template_render_no_template(mock_call, hass: HomeAssistant) -> None:
"""Ensure shell_commands without templates get rendered properly."""
mock_call.return_value = mock_process_creator(error=False)
@ -83,7 +83,7 @@ async def test_template_render_no_template(mock_call, hass):
@patch("homeassistant.components.shell_command.asyncio.create_subprocess_exec")
async def test_template_render(mock_call, hass):
async def test_template_render(mock_call, hass: HomeAssistant) -> None:
"""Ensure shell_commands with templates get rendered properly."""
hass.states.async_set("sensor.test_state", "Works")
mock_call.return_value = mock_process_creator(error=False)
@ -108,7 +108,7 @@ async def test_template_render(mock_call, hass):
@patch("homeassistant.components.shell_command.asyncio.create_subprocess_shell")
@patch("homeassistant.components.shell_command._LOGGER.error")
async def test_subprocess_error(mock_error, mock_call, hass):
async def test_subprocess_error(mock_error, mock_call, hass: HomeAssistant) -> None:
"""Test subprocess that returns an error."""
mock_call.return_value = mock_process_creator(error=True)
with tempfile.TemporaryDirectory() as tempdirname:
@ -127,7 +127,7 @@ async def test_subprocess_error(mock_error, mock_call, hass):
@patch("homeassistant.components.shell_command._LOGGER.debug")
async def test_stdout_captured(mock_output, hass):
async def test_stdout_captured(mock_output, hass: HomeAssistant) -> None:
"""Test subprocess that has stdout."""
test_phrase = "I have output"
assert await async_setup_component(
@ -144,7 +144,7 @@ async def test_stdout_captured(mock_output, hass):
@patch("homeassistant.components.shell_command._LOGGER.debug")
async def test_stderr_captured(mock_output, hass):
async def test_stderr_captured(mock_output, hass: HomeAssistant) -> None:
"""Test subprocess that has stderr."""
test_phrase = "I have error"
assert await async_setup_component(