mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Fix stream test aiohttp DeprecationWarning (#98962)
This commit is contained in:
parent
7d35dcfa65
commit
089f76099d
@ -7,6 +7,7 @@ import math
|
||||
import re
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from aiohttp import web
|
||||
from dateutil import parser
|
||||
import pytest
|
||||
|
||||
@ -394,6 +395,9 @@ async def test_ll_hls_playlist_bad_msn_part(
|
||||
) -> None:
|
||||
"""Test some playlist requests with invalid _HLS_msn/_HLS_part."""
|
||||
|
||||
async def _handler_bad_request(request):
|
||||
raise web.HTTPBadRequest()
|
||||
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"stream",
|
||||
@ -413,6 +417,12 @@ async def test_ll_hls_playlist_bad_msn_part(
|
||||
|
||||
hls_client = await hls_stream(stream)
|
||||
|
||||
# All GET calls to '/.../playlist.m3u8' should raise a HTTPBadRequest exception
|
||||
hls_client.http_client.app.router._frozen = False
|
||||
parsed_url = urlparse(stream.endpoint_url(HLS_PROVIDER))
|
||||
url = "/".join(parsed_url.path.split("/")[:-1]) + "/playlist.m3u8"
|
||||
hls_client.http_client.app.router.add_route("GET", url, _handler_bad_request)
|
||||
|
||||
# If the Playlist URI contains an _HLS_part directive but no _HLS_msn
|
||||
# directive, the Server MUST return Bad Request, such as HTTP 400.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user