1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

ESPHome discovered dashboard checks reauth flows (#86993)

This commit is contained in:
Paulus Schoutsen
2023-01-30 21:32:52 -05:00
committed by GitHub
parent da35ac1942
commit 98b4a412f7
6 changed files with 77 additions and 12 deletions

View File

@@ -7,7 +7,12 @@ from aioesphomeapi import APIClient, DeviceInfo
import pytest
from zeroconf import Zeroconf
from homeassistant.components.esphome import CONF_NOISE_PSK, DOMAIN, dashboard
from homeassistant.components.esphome import (
CONF_DEVICE_NAME,
CONF_NOISE_PSK,
DOMAIN,
dashboard,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT
from homeassistant.core import HomeAssistant
@@ -27,9 +32,9 @@ def esphome_mock_async_zeroconf(mock_async_zeroconf):
@pytest.fixture
def mock_config_entry() -> MockConfigEntry:
def mock_config_entry(hass) -> MockConfigEntry:
"""Return the default mocked config entry."""
return MockConfigEntry(
config_entry = MockConfigEntry(
title="ESPHome Device",
domain=DOMAIN,
data={
@@ -37,9 +42,12 @@ def mock_config_entry() -> MockConfigEntry:
CONF_PORT: 6053,
CONF_PASSWORD: "pwd",
CONF_NOISE_PSK: "12345678123456781234567812345678",
CONF_DEVICE_NAME: "test",
},
unique_id="11:22:33:44:55:aa",
)
config_entry.add_to_hass(hass)
return config_entry
@pytest.fixture
@@ -59,8 +67,6 @@ async def init_integration(
hass: HomeAssistant, mock_config_entry: MockConfigEntry
) -> MockConfigEntry:
"""Set up the ESPHome integration for testing."""
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()