Remove uncaught exceptions from rflink ()

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Ziv 2020-04-07 19:37:54 +03:00 committed by GitHub
parent bb8bbc9c54
commit 3697ea7b27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View file

@ -2,6 +2,9 @@
from unittest.mock import Mock
import pytest
from voluptuous.error import MultipleInvalid
from homeassistant.bootstrap import async_setup_component
from homeassistant.components.rflink import (
CONF_RECONNECT_INTERVAL,
@ -169,16 +172,17 @@ async def test_send_command_invalid_arguments(hass, monkeypatch):
_, _, protocol, _ = await mock_rflink(hass, config, domain, monkeypatch)
# one argument missing
hass.async_create_task(
hass.services.async_call(domain, SERVICE_SEND_COMMAND, {"command": "on"})
)
hass.async_create_task(
hass.services.async_call(
with pytest.raises(MultipleInvalid):
await hass.services.async_call(domain, SERVICE_SEND_COMMAND, {"command": "on"})
with pytest.raises(MultipleInvalid):
await hass.services.async_call(
domain, SERVICE_SEND_COMMAND, {"device_id": "newkaku_0000c6c2_1"}
)
)
# no arguments
hass.async_create_task(hass.services.async_call(domain, SERVICE_SEND_COMMAND, {}))
with pytest.raises(MultipleInvalid):
await hass.services.async_call(domain, SERVICE_SEND_COMMAND, {})
await hass.async_block_till_done()
assert protocol.send_command_ack.call_args_list == []

View file

@ -36,7 +36,6 @@ IGNORE_UNCAUGHT_EXCEPTIONS = [
("tests.components.local_file.test_camera", "test_file_not_readable"),
("tests.components.qwikswitch.test_init", "test_binary_sensor_device"),
("tests.components.qwikswitch.test_init", "test_sensor_device"),
("tests.components.rflink.test_init", "test_send_command_invalid_arguments"),
]
IGNORE_UNCAUGHT_JSON_EXCEPTIONS = []