Replace Camera STREAM_ constants with StreamType enum (#69871)

This commit is contained in:
Franck Nijhof 2022-04-12 01:27:27 +02:00 committed by GitHub
parent 75fce1f036
commit c93c7e8eff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 56 additions and 36 deletions

View file

@ -4,7 +4,7 @@ from unittest.mock import PropertyMock, patch
import pytest
from homeassistant.components import camera
from homeassistant.components.camera.const import STREAM_TYPE_HLS, STREAM_TYPE_WEB_RTC
from homeassistant.components.camera.const import StreamType
from homeassistant.setup import async_setup_component
from .common import WEBRTC_ANSWER
@ -30,7 +30,7 @@ async def mock_camera_hls_fixture(mock_camera):
"""Initialize a demo camera platform with HLS."""
with patch(
"homeassistant.components.camera.Camera.frontend_stream_type",
new_callable=PropertyMock(return_value=STREAM_TYPE_HLS),
new_callable=PropertyMock(return_value=StreamType.HLS),
):
yield
@ -45,7 +45,7 @@ async def mock_camera_web_rtc_fixture(hass):
with patch(
"homeassistant.components.camera.Camera.frontend_stream_type",
new_callable=PropertyMock(return_value=STREAM_TYPE_WEB_RTC),
new_callable=PropertyMock(return_value=StreamType.WEB_RTC),
), patch(
"homeassistant.components.camera.Camera.async_handle_web_rtc_offer",
return_value=WEBRTC_ANSWER,