diff --git a/tests/components/plex/helpers.py b/tests/components/plex/helpers.py index 00d0a4539c1..4828b972d9d 100644 --- a/tests/components/plex/helpers.py +++ b/tests/components/plex/helpers.py @@ -1,9 +1,11 @@ """Helper methods for Plex tests.""" from datetime import timedelta +from typing import Any from plexwebsocket import SIGNAL_CONNECTION_STATE, STATE_CONNECTED +from homeassistant.helpers.typing import UNDEFINED, UndefinedType import homeassistant.util.dt as dt_util from tests.common import async_fire_time_changed @@ -27,10 +29,14 @@ def websocket_connected(mock_websocket): callback(SIGNAL_CONNECTION_STATE, STATE_CONNECTED, None) -def trigger_plex_update(mock_websocket, msgtype="playing", payload=UPDATE_PAYLOAD): +def trigger_plex_update( + mock_websocket, + msgtype="playing", + payload: dict[str, Any] | UndefinedType = UNDEFINED, +): """Call the websocket callback method with a Plex update.""" callback = mock_websocket.call_args[0][1] - callback(msgtype, payload, None) + callback(msgtype, UPDATE_PAYLOAD if payload is UNDEFINED else payload, None) async def wait_for_debouncer(hass):