Attempt to fix islamic prayer times tests (#38220)

* Attempt to fix islamic_prayer_times tests

* adj
pull/38234/head
J. Nick Koston 2020-07-25 22:26:32 -10:00 committed by GitHub
parent 34d01d5e47
commit a39aec862e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -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