Skip to content

Commit

Permalink
move entry mock out of patch context
Browse files Browse the repository at this point in the history
  • Loading branch information
miaucl committed Jan 17, 2024
1 parent 028019a commit 7b17638
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/components/swiss_public_transport/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ async def test_flow_user_init_data_error_and_recover(
async def test_flow_user_init_data_already_configured(hass: HomeAssistant) -> None:
"""Test we abort user data set when entry is already configured."""

entry = MockConfigEntry(
domain=config_flow.DOMAIN,
data=MOCK_DATA_STEP,
unique_id=f"{MOCK_DATA_STEP[CONF_START]} {MOCK_DATA_STEP[CONF_DESTINATION]}",
)
entry.add_to_hass(hass)

with patch(
"homeassistant.components.swiss_public_transport.config_flow.OpendataTransport.async_get_data",
autospec=True,
return_value=True,
):
entry = MockConfigEntry(
domain=config_flow.DOMAIN,
data=MOCK_DATA_STEP,
unique_id=f"{MOCK_DATA_STEP[CONF_START]} {MOCK_DATA_STEP[CONF_DESTINATION]}",
)
entry.add_to_hass(hass)

result = await hass.config_entries.flow.async_init(
config_flow.DOMAIN, context={"source": "user"}
)
Expand Down

0 comments on commit 7b17638

Please sign in to comment.