1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-22 02:47:14 +00:00

Refactor BSB-Lan tests (#163245)

This commit is contained in:
Willem-Jan van Rootselaar
2026-02-17 11:40:25 +01:00
committed by GitHub
parent 68c82c2f90
commit f1c142b3d3
3 changed files with 5 additions and 18 deletions

View File

@@ -17,7 +17,6 @@ import pytest
from homeassistant.components.bsblan.const import CONF_PASSKEY, DOMAIN
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
from homeassistant.core import HomeAssistant
from tests.common import MockConfigEntry, load_fixture
@@ -81,16 +80,3 @@ def mock_bsblan() -> Generator[MagicMock]:
bsblan.get_temperature_unit = "°C"
yield bsblan
@pytest.fixture
async def init_integration(
hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_bsblan: MagicMock
) -> MockConfigEntry:
"""Set up the bsblan 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()
return mock_config_entry

View File

@@ -15,12 +15,15 @@ async def test_diagnostics(
hass: HomeAssistant,
mock_bsblan: AsyncMock,
hass_client: ClientSessionGenerator,
init_integration: MockConfigEntry,
mock_config_entry: MockConfigEntry,
snapshot: SnapshotAssertion,
) -> None:
"""Test diagnostics."""
mock_config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_config_entry.entry_id)
await hass.async_block_till_done()
diagnostics_data = await get_diagnostics_for_config_entry(
hass, hass_client, init_integration
hass, hass_client, mock_config_entry
)
assert diagnostics_data == snapshot

View File

@@ -6,7 +6,6 @@ from bsblan import BSBLANAuthError, BSBLANConnectionError, BSBLANError
from freezegun.api import FrozenDateTimeFactory
import pytest
from homeassistant.components.bsblan.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
@@ -29,7 +28,6 @@ async def test_load_unload_config_entry(
await hass.config_entries.async_unload(mock_config_entry.entry_id)
await hass.async_block_till_done()
assert not hass.data.get(DOMAIN)
assert mock_config_entry.state is ConfigEntryState.NOT_LOADED