diff --git a/homeassistant/components/renault/manifest.json b/homeassistant/components/renault/manifest.json index d32ae2f25e8a..1d594aa64ef1 100644 --- a/homeassistant/components/renault/manifest.json +++ b/homeassistant/components/renault/manifest.json @@ -8,6 +8,6 @@ "integration_type": "hub", "iot_class": "cloud_polling", "loggers": ["renault_api"], - "quality_scale": "silver", + "quality_scale": "platinum", "requirements": ["renault-api==0.6.1"] } diff --git a/tests/components/renault/test_config_flow.py b/tests/components/renault/test_config_flow.py index f580a01f9f63..fe60eb3b038b 100644 --- a/tests/components/renault/test_config_flow.py +++ b/tests/components/renault/test_config_flow.py @@ -393,17 +393,47 @@ async def test_reauth(hass: HomeAssistant, config_entry: MockConfigEntry) -> Non assert config_entry.data[RenaultConfigurationKeys.LOGIN_TOKEN] == MOCK_LOGIN_TOKEN +@pytest.mark.parametrize( + ("exception", "error"), + [ + (Exception(), "unknown"), + (aiohttp.ClientConnectionError(), "cannot_connect"), + ( + InvalidCredentialsException(403042, "invalid loginID or password"), + "invalid_credentials", + ), + ], +) async def test_reconfigure( hass: HomeAssistant, mock_setup_entry: AsyncMock, config_entry: MockConfigEntry, + exception: Exception, + error: str, ) -> None: - """Test reconfigure works.""" + """Test reconfigure works, after recovering from a login error.""" result = await config_entry.start_reconfigure_flow(hass) assert result["type"] is FlowResultType.FORM assert result["step_id"] == "user" assert not result["errors"] + with patch( + "renault_api.renault_session.RenaultSession.login", + side_effect=exception, + ): + result = await hass.config_entries.flow.async_configure( + result["flow_id"], + user_input={ + RenaultConfigurationKeys.LOCALE: "fr_FR", + RenaultConfigurationKeys.USERNAME: "email@test.com", + RenaultConfigurationKeys.PASSWORD: "test", + }, + ) + + assert result["type"] is FlowResultType.FORM + assert result["step_id"] == "user" + assert result["errors"] == {"base": error} + data_schema = result["data_schema"].schema assert ( get_schema_suggested_value(data_schema, RenaultConfigurationKeys.LOCALE)