Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bang & Olufsen websocket testing #123075

Merged
Prev Previous commit
Merge branch 'dev' into bang_olufsen_add_websocket_testing
  • Loading branch information
mj23000 committed Aug 22, 2024
commit 4a5303fe91ca1412d9304ac4345221ac04b62401
12 changes: 8 additions & 4 deletions tests/components/bang_olufsen/test_media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
import logging
from unittest.mock import AsyncMock, patch

from mozart_api.models import PlaybackContentMetadata, WebsocketNotificationTag
from mozart_api.models import (
PlaybackContentMetadata,
RenderingState,
Source,
WebsocketNotificationTag,
)
import pytest

from homeassistant.components.bang_olufsen.const import (
Expand Down Expand Up @@ -129,7 +134,7 @@ async def test_async_update_sources_outdated_api(


async def test_async_update_sources_remote(
hass: HomeAssistant, mock_mozart_client, mock_config_entry
hass: HomeAssistant, mock_mozart_client, mock_config_entry: MockConfigEntry
) -> None:
"""Test _async_update_sources is called when there are new video sources."""

Expand Down Expand Up @@ -206,8 +211,7 @@ async def test_async_update_playback_error(
)

# The async_dispatcher_send function seems to swallow exceptions, making pytest.raises unusable
with patch("homeassistant.helpers.dispatcher._LOGGER.error") as mock_logger:
playback_error_callback(TEST_PLAYBACK_ERROR)
playback_error_callback(TEST_PLAYBACK_ERROR)

assert (
"Exception in _async_update_playback_error when dispatching '11111111_playback_error': (PlaybackError(error='Test error', item=None),)"
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.