Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test_changing_options_when_using_yaml (broke after #1141) #1159

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Patch differently
  • Loading branch information
basnijholt committed Jan 2, 2025
commit 728679e0122ea183da5036868b3f3127bb4d5733
20 changes: 4 additions & 16 deletions tests/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
"""Test Adaptive Lighting config flow."""

from collections.abc import Generator
from unittest.mock import AsyncMock, patch
from unittest.mock import patch

import pytest
from homeassistant.components.adaptive_lighting.const import (
CONF_SUNRISE_TIME,
CONF_SUNSET_TIME,
Expand Down Expand Up @@ -118,18 +116,8 @@ async def test_import_twice(hass):
)


@pytest.fixture
def mock_config_entries_async_forward_entry_setup() -> Generator[AsyncMock]:
"""Mock async_forward_entry_setup."""
with patch(
"homeassistant.config_entries.ConfigEntries.async_forward_entry_setups",
) as mock_fn:
yield mock_fn


async def test_changing_options_when_using_yaml(
hass,
mock_config_entries_async_forward_entry_setup,
):
"""Test changing options when using YAML."""
entry = MockConfigEntry(
Expand All @@ -140,9 +128,9 @@ async def test_changing_options_when_using_yaml(
options={},
)
entry.add_to_hass(hass)

await hass.config_entries.async_setup(entry.entry_id)
await hass.block_till_done()
with patch.object(hass.config_entries, "async_forward_entry_setups"):
await hass.config_entries.async_setup(entry.entry_id)
await hass.block_till_done()

result = await hass.config_entries.options.async_init(entry.entry_id)
result = await hass.config_entries.options.async_configure(
Expand Down
Loading