Fix tests for Python 3.8 (#34672)
This commit is contained in:
1 parent
d53cb951e7
commit
0d700f6a63
40 files changed
+248
-285
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""The tests for the microsoft face platform."""
|
||||
import asyncio
|
||||
from unittest.mock import patch
|
||||
|
||||
from asynctest import patch
|
||||
|
||||
from homeassistant.components import camera, microsoft_face as mf
|
||||
from homeassistant.components.microsoft_face import (
|
||||
@@ -18,12 +19,7 @@ from homeassistant.components.microsoft_face import (
|
||||
from homeassistant.const import ATTR_NAME
|
||||
from homeassistant.setup import setup_component
|
||||
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
get_test_home_assistant,
|
||||
load_fixture,
|
||||
mock_coro,
|
||||
)
|
||||
from tests.common import assert_setup_component, get_test_home_assistant, load_fixture
|
||||
|
||||
|
||||
def create_group(hass, name):
|
||||
@@ -97,7 +93,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_setup_component(self, mock_update):
|
||||
"""Set up component."""
|
||||
@@ -106,7 +102,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_setup_component_wrong_api_key(self, mock_update):
|
||||
"""Set up component without api key."""
|
||||
@@ -115,7 +111,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_setup_component_test_service(self, mock_update):
|
||||
"""Set up component."""
|
||||
@@ -171,7 +167,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_service_groups(self, mock_update, aioclient_mock):
|
||||
"""Set up component, test groups services."""
|
||||
@@ -258,7 +254,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_service_train(self, mock_update, aioclient_mock):
|
||||
"""Set up component, test train groups services."""
|
||||
@@ -278,7 +274,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.camera.async_get_image",
|
||||
return_value=mock_coro(camera.Image("image/jpeg", b"Test")),
|
||||
return_value=camera.Image("image/jpeg", b"Test"),
|
||||
)
|
||||
def test_service_face(self, camera_mock, aioclient_mock):
|
||||
"""Set up component, test person face services."""
|
||||
@@ -318,7 +314,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_service_status_400(self, mock_update, aioclient_mock):
|
||||
"""Set up component, test groups services with error."""
|
||||
@@ -340,7 +336,7 @@ class TestMicrosoftFaceSetup:
|
||||
|
||||
@patch(
|
||||
"homeassistant.components.microsoft_face.MicrosoftFace.update_store",
|
||||
return_value=mock_coro(),
|
||||
return_value=None,
|
||||
)
|
||||
def test_service_status_timeout(self, mock_update, aioclient_mock):
|
||||
"""Set up component, test groups services with timeout."""
|
||||
|
||||
Reference in new issue
Block a user