Use a future for mock coro (#34989)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2020-04-30 16:31:00 -07:00
1 parent ba7391528f
commit 76f392476b
26 files changed
+154 -262

No files matched your search

+4 -7
View File
@@ -11,7 +11,7 @@ import requests_mock
from homeassistant.components.darksky import sensor as darksky
from homeassistant.setup import setup_component
from tests.common import MockDependency, get_test_home_assistant, load_fixture
from tests.common import get_test_home_assistant, load_fixture
VALID_CONFIG_MINIMAL = {
"sensor": {
@@ -110,12 +110,11 @@ class TestDarkSkySetup(unittest.TestCase):
"""Stop everything that was started."""
self.hass.stop()
@MockDependency("forecastio")
@patch(
"homeassistant.components.darksky.sensor.forecastio.load_forecast",
new=load_forecastMock,
)
def test_setup_with_config(self, mock_forecastio):
def test_setup_with_config(self):
"""Test the platform setup with configuration."""
setup_component(self.hass, "sensor", VALID_CONFIG_MINIMAL)
@@ -129,12 +128,11 @@ class TestDarkSkySetup(unittest.TestCase):
state = self.hass.states.get("sensor.dark_sky_summary")
assert state is None
@MockDependency("forecastio")
@patch(
"homeassistant.components.darksky.sensor.forecastio.load_forecast",
new=load_forecastMock,
)
def test_setup_with_language_config(self, mock_forecastio):
def test_setup_with_language_config(self):
"""Test the platform setup with language configuration."""
setup_component(self.hass, "sensor", VALID_CONFIG_LANG_DE)
@@ -164,12 +162,11 @@ class TestDarkSkySetup(unittest.TestCase):
)
assert not response
@MockDependency("forecastio")
@patch(
"homeassistant.components.darksky.sensor.forecastio.load_forecast",
new=load_forecastMock,
)
def test_setup_with_alerts_config(self, mock_forecastio):
def test_setup_with_alerts_config(self):
"""Test the platform setup with alert configuration."""
setup_component(self.hass, "sensor", VALID_CONFIG_ALERTS)