Adapt Axis integration to async HTTPx calls (#42095)

This commit is contained in:
Robert Svensson authored and GitHub committed 2020-10-20 09:31:04 +02:00
1 parent fcdb54d878
commit 1303d20064
9 files changed
+41 -40

No files matched your search

+5 -3
View File
@@ -38,7 +38,7 @@ from homeassistant.const import (
CONF_USERNAME,
)
from tests.async_mock import Mock, patch
from tests.async_mock import AsyncMock, Mock, patch
from tests.common import MockConfigEntry, async_fire_mqtt_message
MAC = "00408C12345"
@@ -196,7 +196,7 @@ root.StreamProfile.S1.Parameters=videocodec=h265
"""
def vapix_request(self, session, url, **kwargs):
async def vapix_request(self, session, url, **kwargs):
"""Return data based on url."""
if API_DISCOVERY_URL in url:
return API_DISCOVERY_RESPONSE
@@ -384,10 +384,12 @@ async def test_shutdown():
axis_device = axis.device.AxisNetworkDevice(hass, entry)
axis_device.api = Mock()
axis_device.api.vapix.close = AsyncMock()
axis_device.shutdown(None)
await axis_device.shutdown(None)
assert len(axis_device.api.stream.stop.mock_calls) == 1
assert len(axis_device.api.vapix.close.mock_calls) == 1
async def test_get_device_fails(hass):