mirror of
https://github.com/elisspace/core.git
synced 2026-09-30 22:39:55 +00:00
Suppress roku power off timeout errors (#67414)
This commit is contained in:
committed by
Paulus Schoutsen
parent
8bbf55c85d
commit
9849b86a84
@@ -3,7 +3,7 @@ from datetime import timedelta
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from rokuecp import RokuError
|
||||
from rokuecp import RokuConnectionError, RokuConnectionTimeoutError, RokuError
|
||||
|
||||
from homeassistant.components.media_player import MediaPlayerDeviceClass
|
||||
from homeassistant.components.media_player.const import (
|
||||
@@ -164,10 +164,15 @@ async def test_tv_setup(
|
||||
assert device_entry.suggested_area == "Living room"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"error",
|
||||
[RokuConnectionTimeoutError, RokuConnectionError, RokuError],
|
||||
)
|
||||
async def test_availability(
|
||||
hass: HomeAssistant,
|
||||
mock_roku: MagicMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
error: RokuError,
|
||||
) -> None:
|
||||
"""Test entity availability."""
|
||||
now = dt_util.utcnow()
|
||||
@@ -179,7 +184,7 @@ async def test_availability(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
with patch("homeassistant.util.dt.utcnow", return_value=future):
|
||||
mock_roku.update.side_effect = RokuError
|
||||
mock_roku.update.side_effect = error
|
||||
async_fire_time_changed(hass, future)
|
||||
await hass.async_block_till_done()
|
||||
assert hass.states.get(MAIN_ENTITY_ID).state == STATE_UNAVAILABLE
|
||||
|
||||
Reference in New Issue
Block a user