From 3697ea7b278ecdc0043e7b2dff919f5e3c21ad83 Mon Sep 17 00:00:00 2001 From: Ziv <16467659+ziv1234@users.noreply.github.com> Date: Tue, 7 Apr 2020 19:37:54 +0300 Subject: [PATCH] Remove uncaught exceptions from rflink (#33709) Co-authored-by: Paulus Schoutsen --- tests/components/rflink/test_init.py | 18 +++++++++++------- tests/ignore_uncaught_exceptions.py | 1 - 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/components/rflink/test_init.py b/tests/components/rflink/test_init.py index 135f6322e2d..5946adc90a6 100644 --- a/tests/components/rflink/test_init.py +++ b/tests/components/rflink/test_init.py @@ -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 == [] diff --git a/tests/ignore_uncaught_exceptions.py b/tests/ignore_uncaught_exceptions.py index ee256acbbc6..72da24d38da 100644 --- a/tests/ignore_uncaught_exceptions.py +++ b/tests/ignore_uncaught_exceptions.py @@ -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 = []