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,6 +1,4 @@
"""Test the cloud.iot module."""
from unittest.mock import MagicMock, patch
from aiohttp import web
import pytest
@ -12,8 +10,7 @@ from homeassistant.setup import async_setup_component
from . import mock_cloud, mock_cloud_prefs
from tests.async_mock import AsyncMock
from tests.common import mock_coro
from tests.async_mock import AsyncMock, MagicMock, patch
from tests.components.alexa import test_smart_home as test_alexa
@ -131,7 +128,7 @@ async def test_handler_google_actions_disabled(hass, mock_cloud_fixture):
"""Test handler Google Actions when user has disabled it."""
mock_cloud_fixture._prefs[PREF_ENABLE_GOOGLE] = False
with patch("hass_nabucasa.Cloud.start", return_value=mock_coro()):
with patch("hass_nabucasa.Cloud.start"):
assert await async_setup_component(hass, "cloud", {})
reqid = "5711642932632160983"
@ -146,7 +143,7 @@ async def test_handler_google_actions_disabled(hass, mock_cloud_fixture):
async def test_webhook_msg(hass):
"""Test webhook msg."""
with patch("hass_nabucasa.Cloud.start", return_value=mock_coro()):
with patch("hass_nabucasa.Cloud.start"):
setup = await async_setup_component(hass, "cloud", {"cloud": {}})
assert setup
cloud = hass.data["cloud"]