mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Replace Camera STREAM_ constants with StreamType enum (#69871)
This commit is contained in:
@@ -14,12 +14,7 @@ from google_nest_sdm.event import EventMessage
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import camera
|
||||
from homeassistant.components.camera import (
|
||||
STATE_IDLE,
|
||||
STATE_STREAMING,
|
||||
STREAM_TYPE_HLS,
|
||||
STREAM_TYPE_WEB_RTC,
|
||||
)
|
||||
from homeassistant.components.camera import STATE_IDLE, STATE_STREAMING, StreamType
|
||||
from homeassistant.components.nest.const import DOMAIN
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -243,7 +238,7 @@ async def test_camera_stream(
|
||||
cam = hass.states.get("camera.my_camera")
|
||||
assert cam is not None
|
||||
assert cam.state == STATE_STREAMING
|
||||
assert cam.attributes["frontend_stream_type"] == STREAM_TYPE_HLS
|
||||
assert cam.attributes["frontend_stream_type"] == StreamType.HLS
|
||||
|
||||
stream_source = await camera.async_get_stream_source(hass, "camera.my_camera")
|
||||
assert stream_source == "rtsp://some/url?auth=g.0.streamingToken"
|
||||
@@ -267,7 +262,7 @@ async def test_camera_ws_stream(
|
||||
cam = hass.states.get("camera.my_camera")
|
||||
assert cam is not None
|
||||
assert cam.state == STATE_STREAMING
|
||||
assert cam.attributes["frontend_stream_type"] == STREAM_TYPE_HLS
|
||||
assert cam.attributes["frontend_stream_type"] == StreamType.HLS
|
||||
|
||||
client = await hass_ws_client(hass)
|
||||
await client.send_json(
|
||||
@@ -591,7 +586,7 @@ async def test_camera_web_rtc(
|
||||
cam = hass.states.get("camera.my_camera")
|
||||
assert cam is not None
|
||||
assert cam.state == STATE_STREAMING
|
||||
assert cam.attributes["frontend_stream_type"] == STREAM_TYPE_WEB_RTC
|
||||
assert cam.attributes["frontend_stream_type"] == StreamType.WEB_RTC
|
||||
|
||||
client = await hass_ws_client(hass)
|
||||
await client.send_json(
|
||||
@@ -624,7 +619,7 @@ async def test_camera_web_rtc_unsupported(
|
||||
cam = hass.states.get("camera.my_camera")
|
||||
assert cam is not None
|
||||
assert cam.state == STATE_STREAMING
|
||||
assert cam.attributes["frontend_stream_type"] == STREAM_TYPE_HLS
|
||||
assert cam.attributes["frontend_stream_type"] == StreamType.HLS
|
||||
|
||||
client = await hass_ws_client(hass)
|
||||
await client.send_json(
|
||||
@@ -718,7 +713,7 @@ async def test_camera_multiple_streams(
|
||||
assert cam is not None
|
||||
assert cam.state == STATE_STREAMING
|
||||
# Prefer WebRTC over RTSP/HLS
|
||||
assert cam.attributes["frontend_stream_type"] == STREAM_TYPE_WEB_RTC
|
||||
assert cam.attributes["frontend_stream_type"] == StreamType.WEB_RTC
|
||||
|
||||
# RTSP stream
|
||||
stream_source = await camera.async_get_stream_source(hass, "camera.my_camera")
|
||||
|
||||
Reference in New Issue
Block a user