mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +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:
|
if login_success:
|
||||||
return await self.async_step_kamereon()
|
return await self.async_step_kamereon()
|
||||||
errors["base"] = "invalid_credentials"
|
errors["base"] = "invalid_credentials"
|
||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=USER_SCHEMA,
|
data_schema=self.add_suggested_values_to_schema(USER_SCHEMA, user_input),
|
||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from homeassistant.core import HomeAssistant
|
|||||||
from homeassistant.data_entry_flow import FlowResultType
|
from homeassistant.data_entry_flow import FlowResultType
|
||||||
from homeassistant.helpers import aiohttp_client
|
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")
|
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["step_id"] == "user"
|
||||||
assert result["errors"] == {"base": error}
|
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()
|
renault_account = AsyncMock()
|
||||||
type(renault_account).account_id = PropertyMock(return_value="account_id_1")
|
type(renault_account).account_id = PropertyMock(return_value="account_id_1")
|
||||||
renault_account.get_vehicles.return_value = (
|
renault_account.get_vehicles.return_value = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user