Fix hue tests that have uncaught exceptions (#33443)

This commit is contained in:
Eugenio Panadero 2020-03-31 17:17:09 +02:00 committed by GitHub
parent ffefdcfe22
commit 977f1a6916
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View file

@ -99,7 +99,7 @@ async def test_reset_unloads_entry_if_setup(hass):
async def test_handle_unauthorized(hass): async def test_handle_unauthorized(hass):
"""Test handling an unauthorized error on update.""" """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"} entry.data = {"host": "1.2.3.4", "username": "mock-username"}
hue_bridge = bridge.HueBridge(hass, entry, False, False) hue_bridge = bridge.HueBridge(hass, entry, False, False)

View file

@ -193,17 +193,15 @@ async def test_security_vuln_check(hass):
entry = MockConfigEntry(domain=hue.DOMAIN, data={"host": "0.0.0.0"}) entry = MockConfigEntry(domain=hue.DOMAIN, data={"host": "0.0.0.0"})
entry.add_to_hass(hass) entry.add_to_hass(hass)
config = Mock(bridgeid="", mac="", modelid="BSB002", swversion="1935144020")
config.name = "Hue"
with patch.object( with patch.object(
hue, hue,
"HueBridge", "HueBridge",
Mock( Mock(
return_value=Mock( return_value=Mock(
async_setup=CoroutineMock(return_value=True), async_setup=CoroutineMock(return_value=True), api=Mock(config=config)
api=Mock(
config=Mock(
bridgeid="", mac="", modelid="BSB002", swversion="1935144020"
)
),
) )
), ),
): ):

View file

@ -893,7 +893,7 @@ async def test_group_features(hass, mock_bridge):
"modelid": "LCT001", "modelid": "LCT001",
"swversion": "66009461", "swversion": "66009461",
"manufacturername": "Philips", "manufacturername": "Philips",
"uniqueid": "456", "uniqueid": "4567",
} }
light_3 = { light_3 = {
"state": { "state": {
@ -945,7 +945,7 @@ async def test_group_features(hass, mock_bridge):
"modelid": "LCT001", "modelid": "LCT001",
"swversion": "66009461", "swversion": "66009461",
"manufacturername": "Philips", "manufacturername": "Philips",
"uniqueid": "123", "uniqueid": "1234",
} }
light_response = { light_response = {
"1": light_1, "1": light_1,

View file

@ -52,9 +52,6 @@ IGNORE_UNCAUGHT_EXCEPTIONS = [
("tests.components.dyson.test_fan", "test_purecool_component_setup_only_once"), ("tests.components.dyson.test_fan", "test_purecool_component_setup_only_once"),
("tests.components.dyson.test_sensor", "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"), ("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_creating_entry_sets_up_sensor"),
("tests.components.ios.test_init", "test_not_configuring_ios_not_creates_entry"), ("tests.components.ios.test_init", "test_not_configuring_ios_not_creates_entry"),
("tests.components.local_file.test_camera", "test_file_not_readable"), ("tests.components.local_file.test_camera", "test_file_not_readable"),