mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix flapping trafikverket tests (#116238)
* Fix flapping trafikverket tests * Fix copy-paste mistake
This commit is contained in:
parent
09a18459ff
commit
56f2f10a17
@ -25,24 +25,9 @@ async def load_integration_from_entry(
|
||||
get_train_stop: TrainStop,
|
||||
) -> MockConfigEntry:
|
||||
"""Set up the Trafikverket Train integration in Home Assistant."""
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
source=SOURCE_USER,
|
||||
data=ENTRY_CONFIG,
|
||||
options=OPTIONS_CONFIG,
|
||||
entry_id="1",
|
||||
unique_id="stockholmc-uppsalac--['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']",
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
config_entry2 = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
source=SOURCE_USER,
|
||||
data=ENTRY_CONFIG2,
|
||||
entry_id="2",
|
||||
unique_id="stockholmc-uppsalac-1100-['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']",
|
||||
)
|
||||
config_entry2.add_to_hass(hass)
|
||||
|
||||
async def setup_config_entry_with_mocked_data(config_entry_id: str) -> None:
|
||||
"""Set up a config entry with mocked trafikverket data."""
|
||||
with (
|
||||
patch(
|
||||
"homeassistant.components.trafikverket_train.coordinator.TrafikverketTrain.async_get_next_train_stops",
|
||||
@ -56,9 +41,30 @@ async def load_integration_from_entry(
|
||||
"homeassistant.components.trafikverket_train.TrafikverketTrain.async_get_train_station",
|
||||
),
|
||||
):
|
||||
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||
await hass.config_entries.async_setup(config_entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
config_entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
source=SOURCE_USER,
|
||||
data=ENTRY_CONFIG,
|
||||
options=OPTIONS_CONFIG,
|
||||
entry_id="1",
|
||||
unique_id="stockholmc-uppsalac--['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']",
|
||||
)
|
||||
config_entry.add_to_hass(hass)
|
||||
await setup_config_entry_with_mocked_data(config_entry.entry_id)
|
||||
|
||||
config_entry2 = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
source=SOURCE_USER,
|
||||
data=ENTRY_CONFIG2,
|
||||
entry_id="2",
|
||||
unique_id="stockholmc-uppsalac-1100-['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']",
|
||||
)
|
||||
config_entry2.add_to_hass(hass)
|
||||
await setup_config_entry_with_mocked_data(config_entry2.entry_id)
|
||||
|
||||
return config_entry
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user