mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix flaky Samsung TV tests (#28503)
This commit is contained in:
parent
b904a2c5ad
commit
ecf2e9c0ab
@ -2,6 +2,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
from asynctest import mock
|
from asynctest import mock
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import logging
|
||||||
import pytest
|
import pytest
|
||||||
from samsungctl import exceptions
|
from samsungctl import exceptions
|
||||||
from tests.common import MockDependency, async_fire_time_changed
|
from tests.common import MockDependency, async_fire_time_changed
|
||||||
@ -263,6 +264,7 @@ async def test_send_key_autodetect_websocket(hass, remote):
|
|||||||
|
|
||||||
async def test_send_key_autodetect_websocket_exception(hass, caplog):
|
async def test_send_key_autodetect_websocket_exception(hass, caplog):
|
||||||
"""Test for send key with autodetection of protocol."""
|
"""Test for send key with autodetection of protocol."""
|
||||||
|
caplog.set_level(logging.DEBUG)
|
||||||
with patch(
|
with patch(
|
||||||
"samsungctl.Remote", side_effect=[exceptions.AccessDenied("Boom"), mock.DEFAULT]
|
"samsungctl.Remote", side_effect=[exceptions.AccessDenied("Boom"), mock.DEFAULT]
|
||||||
) as remote, patch("homeassistant.components.samsungtv.media_player.socket"):
|
) as remote, patch("homeassistant.components.samsungtv.media_player.socket"):
|
||||||
@ -458,6 +460,7 @@ async def test_turn_off_legacy(hass, remote):
|
|||||||
|
|
||||||
async def test_turn_off_os_error(hass, remote, caplog):
|
async def test_turn_off_os_error(hass, remote, caplog):
|
||||||
"""Test for turn_off with OSError."""
|
"""Test for turn_off with OSError."""
|
||||||
|
caplog.set_level(logging.DEBUG)
|
||||||
await setup_samsungtv(hass, MOCK_CONFIG)
|
await setup_samsungtv(hass, MOCK_CONFIG)
|
||||||
remote.close = mock.Mock(side_effect=OSError("BOOM"))
|
remote.close = mock.Mock(side_effect=OSError("BOOM"))
|
||||||
assert await hass.services.async_call(
|
assert await hass.services.async_call(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user