Fix Bang & Olufsen WebSocket debug log and test (#131671)

* Fix test and debug message

* Reorder dict order
pull/131680/head
Markus Jacobsen 2024-11-27 02:48:46 +01:00 committed by GitHub
parent dc62ef8bef
commit f04c50c59e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 16 deletions

View File

@ -204,13 +204,11 @@ class BangOlufsenWebsocket(BangOlufsenBase):
def on_all_notifications_raw(self, notification: BaseWebSocketResponse) -> None: def on_all_notifications_raw(self, notification: BaseWebSocketResponse) -> None:
"""Receive all notifications.""" """Receive all notifications."""
debug_notification = {
"device_id": self._device.id,
"serial_number": int(self._unique_id),
**notification,
}
_LOGGER.debug("%s", notification) _LOGGER.debug("%s", debug_notification)
self.hass.bus.async_fire( self.hass.bus.async_fire(BANG_OLUFSEN_WEBSOCKET_EVENT, debug_notification)
BANG_OLUFSEN_WEBSOCKET_EVENT,
{
"device_id": self._device.id,
"serial_number": int(self._unique_id),
**notification,
},
)

View File

@ -135,7 +135,6 @@ async def test_on_all_notifications_raw(
}, },
"eventType": "WebSocketEventVolume", "eventType": "WebSocketEventVolume",
} }
raw_notification_full = raw_notification
# Get device ID for the modified notification that is sent as an event and in the log # Get device ID for the modified notification that is sent as an event and in the log
assert mock_config_entry.unique_id assert mock_config_entry.unique_id
@ -144,12 +143,11 @@ async def test_on_all_notifications_raw(
identifiers={(DOMAIN, mock_config_entry.unique_id)} identifiers={(DOMAIN, mock_config_entry.unique_id)}
) )
) )
raw_notification_full.update( raw_notification_full = {
{ "device_id": device.id,
"device_id": device.id, "serial_number": int(mock_config_entry.unique_id),
"serial_number": mock_config_entry.unique_id, **raw_notification,
} }
)
caplog.set_level(logging.DEBUG) caplog.set_level(logging.DEBUG)