Rename MediaPlayerDevice to MediaPlayerEntity (#34592)
This commit is contained in:
1 parent
56f7c3b55c
commit
62bc02fdda
75 files changed
+178
-156
No files matched your search
@@ -3,6 +3,7 @@ import base64
|
||||
|
||||
from asynctest import patch
|
||||
|
||||
from homeassistant.components import media_player
|
||||
from homeassistant.components.websocket_api.const import TYPE_RESULT
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@@ -18,7 +19,7 @@ async def test_get_image(hass, hass_ws_client, caplog):
|
||||
client = await hass_ws_client(hass)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
||||
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||
"async_get_media_image",
|
||||
return_value=mock_coro((b"image", "image/jpeg")),
|
||||
):
|
||||
@@ -53,7 +54,7 @@ async def test_get_image_http(hass, aiohttp_client):
|
||||
client = await aiohttp_client(hass.http.app)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
||||
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||
"async_get_media_image",
|
||||
return_value=(b"image", "image/jpeg"),
|
||||
):
|
||||
@@ -66,7 +67,7 @@ async def test_get_image_http(hass, aiohttp_client):
|
||||
async def test_get_image_http_remote(hass, aiohttp_client):
|
||||
"""Test get image url via http command."""
|
||||
with patch(
|
||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
||||
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||
"media_image_remotely_accessible",
|
||||
return_value=True,
|
||||
):
|
||||
@@ -80,7 +81,7 @@ async def test_get_image_http_remote(hass, aiohttp_client):
|
||||
client = await aiohttp_client(hass.http.app)
|
||||
|
||||
with patch(
|
||||
"homeassistant.components.media_player.MediaPlayerDevice."
|
||||
"homeassistant.components.media_player.MediaPlayerEntity."
|
||||
"async_get_media_image",
|
||||
return_value=(b"image", "image/jpeg"),
|
||||
):
|
||||
@@ -88,3 +89,13 @@ async def test_get_image_http_remote(hass, aiohttp_client):
|
||||
content = await resp.read()
|
||||
|
||||
assert content == b"image"
|
||||
|
||||
|
||||
def test_deprecated_base_class(caplog):
|
||||
"""Test deprecated base class."""
|
||||
|
||||
class CustomMediaPlayer(media_player.MediaPlayerDevice):
|
||||
pass
|
||||
|
||||
CustomMediaPlayer()
|
||||
assert "MediaPlayerDevice is deprecated, modify CustomMediaPlayer" in caplog.text
|
||||
Reference in new issue
Block a user