Fix static/class async mocks on Python 3.8.0 and .1 (#40147)

* forked_daapd

* shelly

* simplipy
This commit is contained in:
Ville Skyttä authored and GitHub committed 2020-09-17 08:20:00 +03:00
1 parent f6584c1866
commit 271ffac4a9
3 files changed
+47 -27

No files matched your search

@@ -16,7 +16,7 @@ from homeassistant.config_entries import (
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
from tests.async_mock import patch
from tests.async_mock import AsyncMock, patch
from tests.common import MockConfigEntry
SAMPLE_CONFIG = {
@@ -69,7 +69,8 @@ async def test_show_form(hass):
async def test_config_flow(hass, config_entry):
"""Test that the user step works."""
with patch(
"homeassistant.components.forked_daapd.config_flow.ForkedDaapdAPI.test_connection"
"homeassistant.components.forked_daapd.config_flow.ForkedDaapdAPI.test_connection",
new=AsyncMock(),
) as mock_test_connection, patch(
"homeassistant.components.forked_daapd.media_player.ForkedDaapdAPI.get_request",
autospec=True,
@@ -119,7 +120,8 @@ async def test_zeroconf_updates_title(hass, config_entry):
async def test_config_flow_no_websocket(hass, config_entry):
"""Test config flow setup without websocket enabled on server."""
with patch(
"homeassistant.components.forked_daapd.config_flow.ForkedDaapdAPI.test_connection"
"homeassistant.components.forked_daapd.config_flow.ForkedDaapdAPI.test_connection",
new=AsyncMock(),
) as mock_test_connection:
# test invalid config data
mock_test_connection.return_value = ["websocket_not_enabled"]