Use a future for mock coro (#34989)
This commit is contained in:
parent
ba7391528f
commit
76f392476b
26 changed files with 154 additions and 262 deletions
|
@ -1,18 +1,17 @@
|
|||
"""Tests for the cloud component."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components import cloud
|
||||
from homeassistant.components.cloud import const
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import mock_coro
|
||||
from tests.async_mock import AsyncMock, patch
|
||||
|
||||
|
||||
async def mock_cloud(hass, config=None):
|
||||
"""Mock cloud."""
|
||||
assert await async_setup_component(hass, cloud.DOMAIN, {"cloud": config or {}})
|
||||
cloud_inst = hass.data["cloud"]
|
||||
with patch("hass_nabucasa.Cloud.run_executor", return_value=mock_coro()):
|
||||
with patch("hass_nabucasa.Cloud.run_executor", AsyncMock(return_value=None)):
|
||||
await cloud_inst.start()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue