Set username as entry title in Bring integration (#118974)
Set username as entry titlepull/118921/head
parent
d40c940c20
commit
99b85e16d1
|
@ -53,7 +53,7 @@ class BringConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
bring = Bring(session, user_input[CONF_EMAIL], user_input[CONF_PASSWORD])
|
||||
|
||||
try:
|
||||
await bring.login()
|
||||
info = await bring.login()
|
||||
await bring.load_lists()
|
||||
except BringRequestException:
|
||||
errors["base"] = "cannot_connect"
|
||||
|
@ -66,7 +66,7 @@ class BringConfigFlow(ConfigFlow, domain=DOMAIN):
|
|||
await self.async_set_unique_id(bring.uuid)
|
||||
self._abort_if_unique_id_configured()
|
||||
return self.async_create_entry(
|
||||
title=user_input[CONF_EMAIL], data=user_input
|
||||
title=info["name"] or user_input[CONF_EMAIL], data=user_input
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
|
|
|
@ -40,7 +40,7 @@ def mock_bring_client() -> Generator[AsyncMock]:
|
|||
):
|
||||
client = mock_client.return_value
|
||||
client.uuid = UUID
|
||||
client.login.return_value = True
|
||||
client.login.return_value = {"name": "Bring"}
|
||||
client.load_lists.return_value = {"lists": []}
|
||||
yield client
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ async def test_form(
|
|||
await hass.async_block_till_done()
|
||||
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["title"] == MOCK_DATA_STEP["email"]
|
||||
assert result["title"] == "Bring"
|
||||
assert result["data"] == MOCK_DATA_STEP
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
@ -87,7 +87,7 @@ async def test_flow_user_init_data_unknown_error_and_recover(
|
|||
)
|
||||
|
||||
assert result["type"] is FlowResultType.CREATE_ENTRY
|
||||
assert result["result"].title == MOCK_DATA_STEP["email"]
|
||||
assert result["result"].title == "Bring"
|
||||
|
||||
assert result["data"] == MOCK_DATA_STEP
|
||||
|
||||
|
|
Loading…
Reference in New Issue