Use a future for mock coro (#34989)

This commit is contained in:
Paulus Schoutsen 2020-04-30 16:31:00 -07:00 committed by GitHub
parent ba7391528f
commit 76f392476b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 154 additions and 262 deletions

View file

@ -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()