Update ffmpeg tests to async (#124058)
This commit is contained in:
parent
56b4a7f291
commit
e07768412a
1 changed files with 12 additions and 16 deletions
|
@ -16,9 +16,9 @@ from homeassistant.const import (
|
|||
EVENT_HOMEASSISTANT_STOP,
|
||||
)
|
||||
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
|
||||
|
@ -82,26 +82,22 @@ class MockFFmpegDev(ffmpeg.FFmpegBase):
|
|||
self.called_entities = entity_ids
|
||||
|
||||
|
||||
def test_setup_component() -> None:
|
||||
async def test_setup_component(hass: HomeAssistant) -> None:
|
||||
"""Set up ffmpeg component."""
|
||||
with get_test_home_assistant() as hass:
|
||||
with assert_setup_component(1):
|
||||
setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
|
||||
with assert_setup_component(1):
|
||||
await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
|
||||
|
||||
assert hass.data[ffmpeg.DATA_FFMPEG].binary == "ffmpeg"
|
||||
hass.stop()
|
||||
assert hass.data[ffmpeg.DATA_FFMPEG].binary == "ffmpeg"
|
||||
|
||||
|
||||
def test_setup_component_test_service() -> None:
|
||||
async def test_setup_component_test_service(hass: HomeAssistant) -> None:
|
||||
"""Set up ffmpeg component test services."""
|
||||
with get_test_home_assistant() as hass:
|
||||
with assert_setup_component(1):
|
||||
setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
|
||||
with assert_setup_component(1):
|
||||
await async_setup_component(hass, ffmpeg.DOMAIN, {ffmpeg.DOMAIN: {}})
|
||||
|
||||
assert hass.services.has_service(ffmpeg.DOMAIN, "start")
|
||||
assert hass.services.has_service(ffmpeg.DOMAIN, "stop")
|
||||
assert hass.services.has_service(ffmpeg.DOMAIN, "restart")
|
||||
hass.stop()
|
||||
assert hass.services.has_service(ffmpeg.DOMAIN, "start")
|
||||
assert hass.services.has_service(ffmpeg.DOMAIN, "stop")
|
||||
assert hass.services.has_service(ffmpeg.DOMAIN, "restart")
|
||||
|
||||
|
||||
async def test_setup_component_test_register(hass: HomeAssistant) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue