mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 11:47:06 +00:00
Remember previous input in renault config flow (#143438)
This commit is contained in:
parent
8aab7d5504
commit
06cc505956
@ -64,9 +64,10 @@ class RenaultFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||
if login_success:
|
||||
return await self.async_step_kamereon()
|
||||
errors["base"] = "invalid_credentials"
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="user",
|
||||
data_schema=USER_SCHEMA,
|
||||
data_schema=self.add_suggested_values_to_schema(USER_SCHEMA, user_input),
|
||||
errors=errors,
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
from homeassistant.helpers import aiohttp_client
|
||||
|
||||
from tests.common import MockConfigEntry, load_fixture
|
||||
from tests.common import MockConfigEntry, get_schema_suggested_value, load_fixture
|
||||
|
||||
pytestmark = pytest.mark.usefixtures("mock_setup_entry")
|
||||
|
||||
@ -67,6 +67,11 @@ async def test_config_flow_single_account(
|
||||
assert result["step_id"] == "user"
|
||||
assert result["errors"] == {"base": error}
|
||||
|
||||
data_schema = result["data_schema"].schema
|
||||
assert get_schema_suggested_value(data_schema, CONF_LOCALE) == "fr_FR"
|
||||
assert get_schema_suggested_value(data_schema, CONF_USERNAME) == "email@test.com"
|
||||
assert get_schema_suggested_value(data_schema, CONF_PASSWORD) == "test"
|
||||
|
||||
renault_account = AsyncMock()
|
||||
type(renault_account).account_id = PropertyMock(return_value="account_id_1")
|
||||
renault_account.get_vehicles.return_value = (
|
||||
|
Loading…
x
Reference in New Issue
Block a user