mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Ensure lamarzocco tests add config entry before updating it (#110423)
This commit is contained in:
parent
3529eb6044
commit
d49bccf123
@ -20,6 +20,5 @@ async def async_init_integration(
|
||||
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||
) -> None:
|
||||
"""Set up the La Marzocco 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()
|
||||
|
@ -20,15 +20,19 @@ from tests.common import (
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_config_entry(mock_lamarzocco: MagicMock) -> MockConfigEntry:
|
||||
def mock_config_entry(
|
||||
hass: HomeAssistant, mock_lamarzocco: MagicMock
|
||||
) -> MockConfigEntry:
|
||||
"""Return the default mocked config entry."""
|
||||
return MockConfigEntry(
|
||||
entry = MockConfigEntry(
|
||||
title="My LaMarzocco",
|
||||
domain=DOMAIN,
|
||||
data=USER_INPUT
|
||||
| {CONF_MACHINE: mock_lamarzocco.serial_number, CONF_HOST: "host"},
|
||||
unique_id=mock_lamarzocco.serial_number,
|
||||
)
|
||||
entry.add_to_hass(hass)
|
||||
return entry
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -74,8 +74,6 @@ async def test_form_abort_already_configured(
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test we abort if already configured."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
)
|
||||
@ -211,9 +209,6 @@ async def test_reauth_flow(
|
||||
hass: HomeAssistant, mock_lamarzocco: MagicMock, mock_config_entry: MockConfigEntry
|
||||
) -> None:
|
||||
"""Test that the reauth flow."""
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN,
|
||||
context={
|
||||
|
@ -16,7 +16,6 @@ async def test_load_unload_config_entry(
|
||||
mock_lamarzocco: MagicMock,
|
||||
) -> None:
|
||||
"""Test loading and unloading the integration."""
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -36,7 +35,6 @@ async def test_config_entry_not_ready(
|
||||
"""Test the La Marzocco configuration entry not ready."""
|
||||
mock_lamarzocco.update_local_machine_status.side_effect = RequestNotSuccessful("")
|
||||
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
@ -51,7 +49,6 @@ async def test_invalid_auth(
|
||||
) -> None:
|
||||
"""Test auth error during setup."""
|
||||
mock_lamarzocco.update_local_machine_status.side_effect = AuthFail("")
|
||||
mock_config_entry.add_to_hass(hass)
|
||||
await hass.config_entries.async_setup(mock_config_entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user