mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 04:37:06 +00:00
Switch legacy calls to init_recorder_component using async_add… (#33185)
This commit is contained in:
parent
ea23ffedfe
commit
2360fd4141
@ -36,7 +36,9 @@ def _get_mock_doorbirdapi_side_effects(ready=None, info=None):
|
||||
|
||||
async def test_user_form(hass):
|
||||
"""Test we get the user form."""
|
||||
await hass.async_add_job(init_recorder_component, hass) # force in memory db
|
||||
await hass.async_add_executor_job(
|
||||
init_recorder_component, hass
|
||||
) # force in memory db
|
||||
|
||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
@ -75,7 +77,9 @@ async def test_user_form(hass):
|
||||
|
||||
async def test_form_import(hass):
|
||||
"""Test we get the form with import source."""
|
||||
await hass.async_add_job(init_recorder_component, hass) # force in memory db
|
||||
await hass.async_add_executor_job(
|
||||
init_recorder_component, hass
|
||||
) # force in memory db
|
||||
|
||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
@ -125,7 +129,9 @@ async def test_form_import(hass):
|
||||
|
||||
async def test_form_zeroconf_wrong_oui(hass):
|
||||
"""Test we abort when we get the wrong OUI via zeroconf."""
|
||||
await hass.async_add_job(init_recorder_component, hass) # force in memory db
|
||||
await hass.async_add_executor_job(
|
||||
init_recorder_component, hass
|
||||
) # force in memory db
|
||||
|
||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
@ -142,7 +148,9 @@ async def test_form_zeroconf_wrong_oui(hass):
|
||||
|
||||
async def test_form_zeroconf_correct_oui(hass):
|
||||
"""Test we can setup from zeroconf with the correct OUI source."""
|
||||
await hass.async_add_job(init_recorder_component, hass) # force in memory db
|
||||
await hass.async_add_executor_job(
|
||||
init_recorder_component, hass
|
||||
) # force in memory db
|
||||
|
||||
await setup.async_setup_component(hass, "persistent_notification", {})
|
||||
|
||||
@ -188,7 +196,9 @@ async def test_form_zeroconf_correct_oui(hass):
|
||||
|
||||
async def test_form_user_cannot_connect(hass):
|
||||
"""Test we handle cannot connect error."""
|
||||
await hass.async_add_job(init_recorder_component, hass) # force in memory db
|
||||
await hass.async_add_executor_job(
|
||||
init_recorder_component, hass
|
||||
) # force in memory db
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
@ -209,7 +219,9 @@ async def test_form_user_cannot_connect(hass):
|
||||
|
||||
async def test_form_user_invalid_auth(hass):
|
||||
"""Test we handle cannot invalid auth error."""
|
||||
await hass.async_add_job(init_recorder_component, hass) # force in memory db
|
||||
await hass.async_add_executor_job(
|
||||
init_recorder_component, hass
|
||||
) # force in memory db
|
||||
|
||||
result = await hass.config_entries.flow.async_init(
|
||||
DOMAIN, context={"source": config_entries.SOURCE_USER}
|
||||
|
@ -617,7 +617,7 @@ class TestComponentHistory(unittest.TestCase):
|
||||
|
||||
async def test_fetch_period_api(hass, hass_client):
|
||||
"""Test the fetch period view for history."""
|
||||
await hass.async_add_job(init_recorder_component, hass)
|
||||
await hass.async_add_executor_job(init_recorder_component, hass)
|
||||
await async_setup_component(hass, "history", {})
|
||||
await hass.async_add_job(hass.data[recorder.DATA_INSTANCE].block_till_done)
|
||||
client = await hass_client()
|
||||
@ -629,7 +629,7 @@ async def test_fetch_period_api(hass, hass_client):
|
||||
|
||||
async def test_fetch_period_api_with_include_order(hass, hass_client):
|
||||
"""Test the fetch period view for history."""
|
||||
await hass.async_add_job(init_recorder_component, hass)
|
||||
await hass.async_add_executor_job(init_recorder_component, hass)
|
||||
await async_setup_component(
|
||||
hass,
|
||||
"history",
|
||||
|
@ -1270,7 +1270,7 @@ class TestComponentLogbook(unittest.TestCase):
|
||||
|
||||
async def test_logbook_view(hass, hass_client):
|
||||
"""Test the logbook view."""
|
||||
await hass.async_add_job(init_recorder_component, hass)
|
||||
await hass.async_add_executor_job(init_recorder_component, hass)
|
||||
await async_setup_component(hass, "logbook", {})
|
||||
await hass.async_add_job(hass.data[recorder.DATA_INSTANCE].block_till_done)
|
||||
client = await hass_client()
|
||||
@ -1280,7 +1280,7 @@ async def test_logbook_view(hass, hass_client):
|
||||
|
||||
async def test_logbook_view_period_entity(hass, hass_client):
|
||||
"""Test the logbook view with period and entity."""
|
||||
await hass.async_add_job(init_recorder_component, hass)
|
||||
await hass.async_add_executor_job(init_recorder_component, hass)
|
||||
await async_setup_component(hass, "logbook", {})
|
||||
await hass.async_add_job(hass.data[recorder.DATA_INSTANCE].block_till_done)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user