mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +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
|
hass: HomeAssistant, mock_config_entry: MockConfigEntry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Set up the La Marzocco integration for testing."""
|
"""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.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
@ -20,15 +20,19 @@ from tests.common import (
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@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 the default mocked config entry."""
|
||||||
return MockConfigEntry(
|
entry = MockConfigEntry(
|
||||||
title="My LaMarzocco",
|
title="My LaMarzocco",
|
||||||
domain=DOMAIN,
|
domain=DOMAIN,
|
||||||
data=USER_INPUT
|
data=USER_INPUT
|
||||||
| {CONF_MACHINE: mock_lamarzocco.serial_number, CONF_HOST: "host"},
|
| {CONF_MACHINE: mock_lamarzocco.serial_number, CONF_HOST: "host"},
|
||||||
unique_id=mock_lamarzocco.serial_number,
|
unique_id=mock_lamarzocco.serial_number,
|
||||||
)
|
)
|
||||||
|
entry.add_to_hass(hass)
|
||||||
|
return entry
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -74,8 +74,6 @@ async def test_form_abort_already_configured(
|
|||||||
mock_config_entry: MockConfigEntry,
|
mock_config_entry: MockConfigEntry,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we abort if already configured."""
|
"""Test we abort if already configured."""
|
||||||
mock_config_entry.add_to_hass(hass)
|
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
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
|
hass: HomeAssistant, mock_lamarzocco: MagicMock, mock_config_entry: MockConfigEntry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test that the reauth flow."""
|
"""Test that the reauth flow."""
|
||||||
|
|
||||||
mock_config_entry.add_to_hass(hass)
|
|
||||||
|
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
context={
|
context={
|
||||||
|
@ -16,7 +16,6 @@ async def test_load_unload_config_entry(
|
|||||||
mock_lamarzocco: MagicMock,
|
mock_lamarzocco: MagicMock,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test loading and unloading the integration."""
|
"""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.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
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."""
|
"""Test the La Marzocco configuration entry not ready."""
|
||||||
mock_lamarzocco.update_local_machine_status.side_effect = RequestNotSuccessful("")
|
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.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
@ -51,7 +49,6 @@ async def test_invalid_auth(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test auth error during setup."""
|
"""Test auth error during setup."""
|
||||||
mock_lamarzocco.update_local_machine_status.side_effect = AuthFail("")
|
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.config_entries.async_setup(mock_config_entry.entry_id)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user