Skip to content

Commit

Permalink
Don't set up the integration unless we have to
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Jan 9, 2025
1 parent 50c884a commit 767d2de
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/components/generic/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,9 @@ async def test_slug(hass: HomeAssistant, caplog: pytest.LogCaptureFixture) -> No
@respx.mock
@pytest.mark.usefixtures("fakeimg_png")
async def test_options_only_stream(
hass: HomeAssistant, mock_create_stream: _patch[MagicMock]
hass: HomeAssistant,
mock_setup_entry: _patch[MagicMock],
mock_create_stream: _patch[MagicMock],
) -> None:
"""Test the options flow without a still_image_url."""
data = TESTDATA.copy()
Expand All @@ -818,8 +820,9 @@ async def test_options_only_stream(
data={},
options=data,
)
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry.entry_id)
with mock_setup_entry:
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry.entry_id)

result = await hass.config_entries.options.async_init(mock_entry.entry_id)
assert result["type"] is FlowResultType.FORM
Expand All @@ -843,6 +846,7 @@ async def test_options_only_stream(

async def test_options_still_and_stream_not_provided(
hass: HomeAssistant,
mock_setup_entry: _patch[MagicMock],
) -> None:
"""Test we show a suitable error if neither still or stream URL are provided."""
data = TESTDATA.copy()
Expand All @@ -853,8 +857,9 @@ async def test_options_still_and_stream_not_provided(
data={},
options=data,
)
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry.entry_id)
with mock_setup_entry:
mock_entry.add_to_hass(hass)
await hass.config_entries.async_setup(mock_entry.entry_id)

result = await hass.config_entries.options.async_init(mock_entry.entry_id)
assert result["type"] is FlowResultType.FORM
Expand Down

0 comments on commit 767d2de

Please sign in to comment.