Update ffmpeg tests to async (#124058)

This commit is contained in:
Erik Montnemery 2024-08-16 17:16:56 +02:00 committed by GitHub
parent 56b4a7f291
commit e07768412a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,9 +16,9 @@ from homeassistant.const import (
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
) )
from homeassistant.core import HomeAssistant, callback from homeassistant.core import HomeAssistant, callback
from homeassistant.setup import async_setup_component, setup_component from homeassistant.setup import async_setup_component
from tests.common import assert_setup_component, get_test_home_assistant from tests.common import assert_setup_component
@callback @callback
@ -82,26 +82,22 @@ class MockFFmpegDev(ffmpeg.FFmpegBase):
self.called_entities = entity_ids self.called_entities = entity_ids
def test_setup_component() -> None: async def test_setup_component(hass: HomeAssistant) -> None:
"""Set up ffmpeg component.""" """Set up ffmpeg component."""
with get_test_home_assistant() as hass: with assert_setup_component(1):
with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
assert hass.data[ffmpeg.DATA_FFMPEG].binary == "ffmpeg" assert hass.data[ffmpeg.DATA_FFMPEG].binary == "ffmpeg"
hass.stop()
def test_setup_component_test_service() -> None: async def test_setup_component_test_service(hass: HomeAssistant) -> None:
"""Set up ffmpeg component test services.""" """Set up ffmpeg component test services."""
with get_test_home_assistant() as hass: with assert_setup_component(1):
with assert_setup_component(1): await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
assert hass.services.has_service(ffmpeg.DOMAIN, "start") assert hass.services.has_service(ffmpeg.DOMAIN, "start")
assert hass.services.has_service(ffmpeg.DOMAIN, "stop") assert hass.services.has_service(ffmpeg.DOMAIN, "stop")
assert hass.services.has_service(ffmpeg.DOMAIN, "restart") assert hass.services.has_service(ffmpeg.DOMAIN, "restart")
hass.stop()
async def test_setup_component_test_register(hass: HomeAssistant) -> None: async def test_setup_component_test_register(hass: HomeAssistant) -> None: