mirror of
https://github.com/home-assistant/core.git
synced 2025-12-27 06:28:31 +00:00
Add scaffold template for backup (#68961)
This commit is contained in:
10
script/scaffold/templates/backup/integration/backup.py
Normal file
10
script/scaffold/templates/backup/integration/backup.py
Normal file
@@ -0,0 +1,10 @@
|
||||
"""Backup platform for the NEW_NAME integration."""
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
async def async_pre_backup(hass: HomeAssistant) -> None:
|
||||
"""Perform operations before a backup starts."""
|
||||
|
||||
|
||||
async def async_post_backup(hass: HomeAssistant) -> None:
|
||||
"""Perform operations after a backup finishes."""
|
||||
18
script/scaffold/templates/backup/tests/test_backup.py
Normal file
18
script/scaffold/templates/backup/tests/test_backup.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Test the NEW_NAME backup platform."""
|
||||
from homeassistant.components.NEW_DOMAIN.backup import (
|
||||
async_post_backup,
|
||||
async_pre_backup,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
|
||||
async def test_async_post_backup(hass: HomeAssistant) -> None:
|
||||
"""Verify async_post_backup."""
|
||||
# TODO: verify that the async_post_backup function executes as expected
|
||||
assert await async_post_backup(hass)
|
||||
|
||||
|
||||
async def test_async_pre_backup(hass: HomeAssistant) -> None:
|
||||
"""Verify async_pre_backup."""
|
||||
# TODO: verify that the async_pre_backup function executes as expected
|
||||
assert await async_pre_backup(hass)
|
||||
Reference in New Issue
Block a user