Improve test coverage for ESPHome manager (#120400)
This commit is contained in:
parent
76e890865e
commit
c15718519b
2 changed files with 54 additions and 6 deletions
|
@ -1156,3 +1156,28 @@ async def test_start_reauth(
|
|||
assert len(flows) == 1
|
||||
flow = flows[0]
|
||||
assert flow["context"]["source"] == "reauth"
|
||||
|
||||
|
||||
async def test_entry_missing_unique_id(
|
||||
hass: HomeAssistant,
|
||||
mock_client: APIClient,
|
||||
mock_esphome_device: Callable[
|
||||
[APIClient, list[EntityInfo], list[UserService], list[EntityState]],
|
||||
Awaitable[MockESPHomeDevice],
|
||||
],
|
||||
) -> None:
|
||||
"""Test the unique id is added from storage if available."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
unique_id=None,
|
||||
data={
|
||||
CONF_HOST: "test.local",
|
||||
CONF_PORT: 6053,
|
||||
CONF_PASSWORD: "",
|
||||
},
|
||||
options={CONF_ALLOW_SERVICE_CALLS: True},
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
await mock_esphome_device(mock_client=mock_client, mock_storage=True)
|
||||
await hass.async_block_till_done()
|
||||
assert entry.unique_id == "11:22:33:44:55:aa"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue