mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Fix dangerous-default-value warnings in plex tests (#119603)
This commit is contained in:
parent
97e19cb61c
commit
1440ad26c8
@ -1,9 +1,11 @@
|
|||||||
"""Helper methods for Plex tests."""
|
"""Helper methods for Plex tests."""
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from plexwebsocket import SIGNAL_CONNECTION_STATE, STATE_CONNECTED
|
from plexwebsocket import SIGNAL_CONNECTION_STATE, STATE_CONNECTED
|
||||||
|
|
||||||
|
from homeassistant.helpers.typing import UNDEFINED, UndefinedType
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
from tests.common import async_fire_time_changed
|
from tests.common import async_fire_time_changed
|
||||||
@ -27,10 +29,14 @@ def websocket_connected(mock_websocket):
|
|||||||
callback(SIGNAL_CONNECTION_STATE, STATE_CONNECTED, None)
|
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."""
|
"""Call the websocket callback method with a Plex update."""
|
||||||
callback = mock_websocket.call_args[0][1]
|
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):
|
async def wait_for_debouncer(hass):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user