diff --git a/.coveragerc b/.coveragerc index de0c947eecb..85b36a2d7d4 100644 --- a/.coveragerc +++ b/.coveragerc @@ -905,7 +905,9 @@ omit = homeassistant/components/screenlogic/switch.py homeassistant/components/scsgate/* homeassistant/components/sendgrid/notify.py - homeassistant/components/sense/* + homeassistant/components/sense/__init__.py + homeassistant/components/sense/binary_sensor.py + homeassistant/components/sense/sensor.py homeassistant/components/sensehat/light.py homeassistant/components/sensehat/sensor.py homeassistant/components/sensibo/climate.py diff --git a/tests/components/sense/test_config_flow.py b/tests/components/sense/test_config_flow.py index 55348cca838..a56422dcb84 100644 --- a/tests/components/sense/test_config_flow.py +++ b/tests/components/sense/test_config_flow.py @@ -72,3 +72,22 @@ async def test_form_cannot_connect(hass): assert result2["type"] == "form" assert result2["errors"] == {"base": "cannot_connect"} + + +async def test_form_unknown_exception(hass): + """Test we handle unknown error.""" + result = await hass.config_entries.flow.async_init( + DOMAIN, context={"source": config_entries.SOURCE_USER} + ) + + with patch( + "sense_energy.ASyncSenseable.authenticate", + side_effect=Exception, + ): + result2 = await hass.config_entries.flow.async_configure( + result["flow_id"], + {"timeout": "6", "email": "test-email", "password": "test-password"}, + ) + + assert result2["type"] == "form" + assert result2["errors"] == {"base": "unknown"}