diff --git a/tests/components/islamic_prayer_times/test_init.py b/tests/components/islamic_prayer_times/test_init.py index f3d4351ae29..984bbbf7c75 100644 --- a/tests/components/islamic_prayer_times/test_init.py +++ b/tests/components/islamic_prayer_times/test_init.py @@ -20,7 +20,7 @@ from tests.async_mock import patch from tests.common import MockConfigEntry, async_fire_time_changed -async def test_setup_with_config(hass): +async def test_setup_with_config(hass, legacy_patchable_time): """Test that we import the config and setup the client.""" config = { islamic_prayer_times.DOMAIN: {islamic_prayer_times.CONF_CALC_METHOD: "isna"} @@ -33,9 +33,10 @@ async def test_setup_with_config(hass): await async_setup_component(hass, islamic_prayer_times.DOMAIN, config) is True ) + await hass.async_block_till_done() -async def test_successful_config_entry(hass): +async def test_successful_config_entry(hass, legacy_patchable_time): """Test that Islamic Prayer Times is configured successfully.""" entry = MockConfigEntry(domain=islamic_prayer_times.DOMAIN, data={},) @@ -46,6 +47,7 @@ async def test_successful_config_entry(hass): return_value=PRAYER_TIMES, ): await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() assert entry.state == config_entries.ENTRY_STATE_LOADED assert entry.options == { @@ -53,7 +55,7 @@ async def test_successful_config_entry(hass): } -async def test_setup_failed(hass): +async def test_setup_failed(hass, legacy_patchable_time): """Test Islamic Prayer Times failed due to an error.""" entry = MockConfigEntry(domain=islamic_prayer_times.DOMAIN, data={},) @@ -65,10 +67,11 @@ async def test_setup_failed(hass): side_effect=InvalidResponseError(), ): await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() assert entry.state == config_entries.ENTRY_STATE_SETUP_RETRY -async def test_unload_entry(hass): +async def test_unload_entry(hass, legacy_patchable_time): """Test removing Islamic Prayer Times.""" entry = MockConfigEntry(domain=islamic_prayer_times.DOMAIN, data={},) entry.add_to_hass(hass) @@ -95,6 +98,7 @@ async def test_islamic_prayer_times_timestamp_format(hass, legacy_patchable_time return_value=PRAYER_TIMES, ), patch("homeassistant.util.dt.now", return_value=NOW): await hass.config_entries.async_setup(entry.entry_id) + await hass.async_block_till_done() assert ( hass.data[islamic_prayer_times.DOMAIN].prayer_times_info