Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Nov 21, 2024
1 parent 80e1f9e commit f30dbba
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/components/esphome/test_media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ATTR_MEDIA_ANNOUNCE,
ATTR_MEDIA_CONTENT_ID,
ATTR_MEDIA_CONTENT_TYPE,
ATTR_MEDIA_EXTRA,
ATTR_MEDIA_VOLUME_LEVEL,
ATTR_MEDIA_VOLUME_MUTED,
DOMAIN as MEDIA_PLAYER_DOMAIN,
Expand Down Expand Up @@ -414,3 +415,22 @@ async def test_media_player_proxy(

media_args = mock_client.media_player_command.call_args.kwargs
assert media_args["announcement"]

# test with bypass_proxy flag
mock_async_create_proxy_url.reset_mock()
await hass.services.async_call(
MEDIA_PLAYER_DOMAIN,
SERVICE_PLAY_MEDIA,
{
ATTR_ENTITY_ID: "media_player.test_mymedia_player",
ATTR_MEDIA_CONTENT_TYPE: MediaType.MUSIC,
ATTR_MEDIA_CONTENT_ID: media_url,
ATTR_MEDIA_EXTRA: {
"bypass_proxy": True,
},
},
blocking=True,
)
mock_async_create_proxy_url.assert_not_called()
media_args = mock_client.media_player_command.call_args.kwargs
assert media_args["media_url"] == media_url

0 comments on commit f30dbba

Please sign in to comment.