From 977f1a691612e90e96deab1640005c33b32f6cf9 Mon Sep 17 00:00:00 2001 From: Eugenio Panadero Date: Tue, 31 Mar 2020 17:17:09 +0200 Subject: [PATCH] Fix hue tests that have uncaught exceptions (#33443) --- tests/components/hue/test_bridge.py | 2 +- tests/components/hue/test_init.py | 10 ++++------ tests/components/hue/test_light.py | 4 ++-- tests/ignore_uncaught_exceptions.py | 3 --- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/components/hue/test_bridge.py b/tests/components/hue/test_bridge.py index 03966560d8d0d..6ac68d222ebbe 100644 --- a/tests/components/hue/test_bridge.py +++ b/tests/components/hue/test_bridge.py @@ -99,7 +99,7 @@ async def test_reset_unloads_entry_if_setup(hass): async def test_handle_unauthorized(hass): """Test handling an unauthorized error on update.""" - entry = Mock() + entry = Mock(async_setup=Mock(return_value=mock_coro(Mock()))) entry.data = {"host": "1.2.3.4", "username": "mock-username"} hue_bridge = bridge.HueBridge(hass, entry, False, False) diff --git a/tests/components/hue/test_init.py b/tests/components/hue/test_init.py index d9131dad226a9..51ea3f2ae7162 100644 --- a/tests/components/hue/test_init.py +++ b/tests/components/hue/test_init.py @@ -193,17 +193,15 @@ async def test_security_vuln_check(hass): entry = MockConfigEntry(domain=hue.DOMAIN, data={"host": "0.0.0.0"}) entry.add_to_hass(hass) + config = Mock(bridgeid="", mac="", modelid="BSB002", swversion="1935144020") + config.name = "Hue" + with patch.object( hue, "HueBridge", Mock( return_value=Mock( - async_setup=CoroutineMock(return_value=True), - api=Mock( - config=Mock( - bridgeid="", mac="", modelid="BSB002", swversion="1935144020" - ) - ), + async_setup=CoroutineMock(return_value=True), api=Mock(config=config) ) ), ): diff --git a/tests/components/hue/test_light.py b/tests/components/hue/test_light.py index 72546891a631e..a99b947e48e92 100644 --- a/tests/components/hue/test_light.py +++ b/tests/components/hue/test_light.py @@ -893,7 +893,7 @@ async def test_group_features(hass, mock_bridge): "modelid": "LCT001", "swversion": "66009461", "manufacturername": "Philips", - "uniqueid": "456", + "uniqueid": "4567", } light_3 = { "state": { @@ -945,7 +945,7 @@ async def test_group_features(hass, mock_bridge): "modelid": "LCT001", "swversion": "66009461", "manufacturername": "Philips", - "uniqueid": "123", + "uniqueid": "1234", } light_response = { "1": light_1, diff --git a/tests/ignore_uncaught_exceptions.py b/tests/ignore_uncaught_exceptions.py index 58531b251e04b..1a37f2d0f5446 100644 --- a/tests/ignore_uncaught_exceptions.py +++ b/tests/ignore_uncaught_exceptions.py @@ -52,9 +52,6 @@ ("tests.components.dyson.test_fan", "test_purecool_component_setup_only_once"), ("tests.components.dyson.test_sensor", "test_purecool_component_setup_only_once"), ("test_homeassistant_bridge", "test_homeassistant_bridge_fan_setup"), - ("tests.components.hue.test_bridge", "test_handle_unauthorized"), - ("tests.components.hue.test_init", "test_security_vuln_check"), - ("tests.components.hue.test_light", "test_group_features"), ("tests.components.ios.test_init", "test_creating_entry_sets_up_sensor"), ("tests.components.ios.test_init", "test_not_configuring_ios_not_creates_entry"), ("tests.components.local_file.test_camera", "test_file_not_readable"),