mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Improve backup tests (#142785)
This commit is contained in:
parent
514363f1c5
commit
5f2ae37ee5
@ -17,6 +17,7 @@ async def test_async_get_manager(hass: HomeAssistant) -> None:
|
|||||||
backup_helper.async_initialize_backup(hass)
|
backup_helper.async_initialize_backup(hass)
|
||||||
task = asyncio.create_task(backup_helper.async_get_manager(hass))
|
task = asyncio.create_task(backup_helper.async_get_manager(hass))
|
||||||
assert await async_setup_component(hass, BACKUP_DOMAIN, {})
|
assert await async_setup_component(hass, BACKUP_DOMAIN, {})
|
||||||
|
await hass.async_block_till_done()
|
||||||
manager = await task
|
manager = await task
|
||||||
assert manager is hass.data[backup_helper.DATA_MANAGER]
|
assert manager is hass.data[backup_helper.DATA_MANAGER]
|
||||||
|
|
||||||
@ -36,7 +37,5 @@ async def test_async_get_manager_backup_failed_setup(hass: HomeAssistant) -> Non
|
|||||||
side_effect=Exception("Boom!"),
|
side_effect=Exception("Boom!"),
|
||||||
):
|
):
|
||||||
assert not await async_setup_component(hass, BACKUP_DOMAIN, {})
|
assert not await async_setup_component(hass, BACKUP_DOMAIN, {})
|
||||||
with (
|
with pytest.raises(Exception, match="Boom!"):
|
||||||
pytest.raises(Exception, match="Boom!"),
|
|
||||||
):
|
|
||||||
await backup_helper.async_get_manager(hass)
|
await backup_helper.async_get_manager(hass)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user