From a9722c90e92a1dacf09e7fbe5c92218022d573ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Fri, 30 Jul 2021 21:44:10 +0200 Subject: [PATCH] Revert "Rename snapshot -> backup" (#53751) This reverts commit 9806bda272bd855f27a2ebdda97e1725474ad03e. --- homeassistant/components/hassio/__init__.py | 57 +++++------------- homeassistant/components/hassio/http.py | 9 +-- homeassistant/components/hassio/services.yaml | 58 ++----------------- homeassistant/components/zwave_js/__init__.py | 2 +- homeassistant/components/zwave_js/addon.py | 14 ++--- tests/components/hassio/test_http.py | 20 +++---- tests/components/hassio/test_init.py | 43 ++++---------- tests/components/hassio/test_websocket_api.py | 4 +- tests/components/zwave_js/conftest.py | 12 ++-- tests/components/zwave_js/test_init.py | 44 +++++++------- 10 files changed, 82 insertions(+), 181 deletions(-) diff --git a/homeassistant/components/hassio/__init__.py b/homeassistant/components/hassio/__init__.py index 4541685061a..6c71f2eb042 100644 --- a/homeassistant/components/hassio/__init__.py +++ b/homeassistant/components/hassio/__init__.py @@ -89,8 +89,6 @@ SERVICE_HOST_SHUTDOWN = "host_shutdown" SERVICE_HOST_REBOOT = "host_reboot" SERVICE_SNAPSHOT_FULL = "snapshot_full" SERVICE_SNAPSHOT_PARTIAL = "snapshot_partial" -SERVICE_BACKUP_FULL = "backup_full" -SERVICE_BACKUP_PARTIAL = "backup_partial" SERVICE_RESTORE_FULL = "restore_full" SERVICE_RESTORE_PARTIAL = "restore_partial" @@ -103,11 +101,11 @@ SCHEMA_ADDON_STDIN = SCHEMA_ADDON.extend( {vol.Required(ATTR_INPUT): vol.Any(dict, cv.string)} ) -SCHEMA_BACKUP_FULL = vol.Schema( +SCHEMA_SNAPSHOT_FULL = vol.Schema( {vol.Optional(ATTR_NAME): cv.string, vol.Optional(ATTR_PASSWORD): cv.string} ) -SCHEMA_BACKUP_PARTIAL = SCHEMA_BACKUP_FULL.extend( +SCHEMA_SNAPSHOT_PARTIAL = SCHEMA_SNAPSHOT_FULL.extend( { vol.Optional(ATTR_FOLDERS): vol.All(cv.ensure_list, [cv.string]), vol.Optional(ATTR_ADDONS): vol.All(cv.ensure_list, [cv.string]), @@ -115,12 +113,7 @@ SCHEMA_BACKUP_PARTIAL = SCHEMA_BACKUP_FULL.extend( ) SCHEMA_RESTORE_FULL = vol.Schema( - { - vol.Exclusive(ATTR_SLUG, ATTR_SLUG): cv.slug, - vol.Exclusive(ATTR_SNAPSHOT, ATTR_SLUG): cv.slug, - vol.Optional(ATTR_PASSWORD): cv.string, - }, - cv.has_at_least_one_key(ATTR_SLUG, ATTR_SNAPSHOT), + {vol.Required(ATTR_SNAPSHOT): cv.slug, vol.Optional(ATTR_PASSWORD): cv.string} ) SCHEMA_RESTORE_PARTIAL = SCHEMA_RESTORE_FULL.extend( @@ -140,32 +133,25 @@ MAP_SERVICE_API = { SERVICE_ADDON_STDIN: ("/addons/{addon}/stdin", SCHEMA_ADDON_STDIN, 60, False), SERVICE_HOST_SHUTDOWN: ("/host/shutdown", SCHEMA_NO_DATA, 60, False), SERVICE_HOST_REBOOT: ("/host/reboot", SCHEMA_NO_DATA, 60, False), - SERVICE_BACKUP_FULL: ("/backups/new/full", SCHEMA_BACKUP_FULL, 300, True), - SERVICE_BACKUP_PARTIAL: ( - "/backups/new/partial", - SCHEMA_BACKUP_PARTIAL, + SERVICE_SNAPSHOT_FULL: ("/snapshots/new/full", SCHEMA_SNAPSHOT_FULL, 300, True), + SERVICE_SNAPSHOT_PARTIAL: ( + "/snapshots/new/partial", + SCHEMA_SNAPSHOT_PARTIAL, 300, True, ), SERVICE_RESTORE_FULL: ( - "/backups/{slug}/restore/full", + "/snapshots/{snapshot}/restore/full", SCHEMA_RESTORE_FULL, 300, True, ), SERVICE_RESTORE_PARTIAL: ( - "/backups/{slug}/restore/partial", + "/snapshots/{snapshot}/restore/partial", SCHEMA_RESTORE_PARTIAL, 300, True, ), - SERVICE_SNAPSHOT_FULL: ("/backups/new/full", SCHEMA_BACKUP_FULL, 300, True), - SERVICE_SNAPSHOT_PARTIAL: ( - "/backups/new/partial", - SCHEMA_BACKUP_PARTIAL, - 300, - True, - ), } @@ -286,16 +272,16 @@ async def async_get_addon_discovery_info(hass: HomeAssistant, slug: str) -> dict @bind_hass @api_data -async def async_create_backup( +async def async_create_snapshot( hass: HomeAssistant, payload: dict, partial: bool = False ) -> dict: - """Create a full or partial backup. + """Create a full or partial snapshot. The caller of the function should handle HassioAPIError. """ hassio = hass.data[DOMAIN] - backup_type = "partial" if partial else "full" - command = f"/backups/new/{backup_type}" + snapshot_type = "partial" if partial else "full" + command = f"/snapshots/new/{snapshot_type}" return await hassio.send_command(command, payload=payload, timeout=None) @@ -467,22 +453,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: async def async_service_handler(service): """Handle service calls for Hass.io.""" api_command = MAP_SERVICE_API[service.service][0] - if "snapshot" in service.service: - _LOGGER.warning( - "The service '%s' is deprecated and will be removed in Home Assistant 2021.10, use '%s' instead", - service.service, - service.service.replace("snapshot", "backup"), - ) data = service.data.copy() addon = data.pop(ATTR_ADDON, None) - slug = data.pop(ATTR_SLUG, None) snapshot = data.pop(ATTR_SNAPSHOT, None) - if snapshot is not None: - _LOGGER.warning( - "Using 'snapshot' is deprecated and will be removed in Home Assistant 2021.10, use 'slug' instead" - ) - slug = snapshot - payload = None # Pass data to Hass.io API @@ -494,12 +467,12 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: # Call API try: await hassio.send_command( - api_command.format(addon=addon, slug=slug), + api_command.format(addon=addon, snapshot=snapshot), payload=payload, timeout=MAP_SERVICE_API[service.service][2], ) except HassioAPIError as err: - _LOGGER.error("Error on Supervisor API: %s", err) + _LOGGER.error("Error on Hass.io API: %s", err) for service, settings in MAP_SERVICE_API.items(): hass.services.async_register( diff --git a/homeassistant/components/hassio/http.py b/homeassistant/components/hassio/http.py index 302cc00bb9f..47131b80de3 100644 --- a/homeassistant/components/hassio/http.py +++ b/homeassistant/components/hassio/http.py @@ -29,9 +29,6 @@ NO_TIMEOUT = re.compile( r"|hassos/update/cli" r"|supervisor/update" r"|addons/[^/]+/(?:update|install|rebuild)" - r"|backups/.+/full" - r"|backups/.+/partial" - r"|backups/[^/]+/(?:upload|download)" r"|snapshots/.+/full" r"|snapshots/.+/partial" r"|snapshots/[^/]+/(?:upload|download)" @@ -39,7 +36,7 @@ NO_TIMEOUT = re.compile( ) NO_AUTH_ONBOARDING = re.compile( - r"^(?:" r"|supervisor/logs" r"|backups/[^/]+/.+" r"|snapshots/[^/]+/.+" r")$" + r"^(?:" r"|supervisor/logs" r"|snapshots/[^/]+/.+" r")$" ) NO_AUTH = re.compile( @@ -84,13 +81,13 @@ class HassIOView(HomeAssistantView): client_timeout = 10 data = None headers = _init_header(request) - if path in ("snapshots/new/upload", "backups/new/upload"): + if path == "snapshots/new/upload": # We need to reuse the full content type that includes the boundary headers[ "Content-Type" ] = request._stored_content_type # pylint: disable=protected-access - # Backups are big, so we need to adjust the allowed size + # Snapshots are big, so we need to adjust the allowed size request._client_max_size = ( # pylint: disable=protected-access MAX_UPLOAD_SIZE ) diff --git a/homeassistant/components/hassio/services.yaml b/homeassistant/components/hassio/services.yaml index 38d78984ddc..0652b65d6e2 100644 --- a/homeassistant/components/hassio/services.yaml +++ b/homeassistant/components/hassio/services.yaml @@ -67,13 +67,13 @@ host_shutdown: description: Poweroff the host system. snapshot_full: - name: Create a full backup. - description: Create a full backup (deprecated, use backup_full instead). + name: Create a full snapshot. + description: Create a full snapshot. fields: name: name: Name description: Optional or it will be the current date and time. - example: "backup 1" + example: "Snapshot 1" selector: text: password: @@ -84,8 +84,8 @@ snapshot_full: text: snapshot_partial: - name: Create a partial backup. - description: Create a partial backup (deprecated, use backup_partial instead). + name: Create a partial snapshot. + description: Create a partial snapshot. fields: addons: name: Add-ons @@ -102,53 +102,7 @@ snapshot_partial: name: name: Name description: Optional or it will be the current date and time. - example: "Partial backup 1" - selector: - text: - password: - name: Password - description: Optional password. - example: "password" - selector: - text: - -backup_full: - name: Create a full backup. - description: Create a full backup. - fields: - name: - name: Name - description: Optional or it will be the current date and time. - example: "backup 1" - selector: - text: - password: - name: Password - description: Optional password. - example: "password" - selector: - text: - -backup_partial: - name: Create a partial backup. - description: Create a partial backup. - fields: - addons: - name: Add-ons - description: Optional list of addon slugs. - example: ["core_ssh", "core_samba", "core_mosquitto"] - selector: - object: - folders: - name: Folders - description: Optional list of directories. - example: ["homeassistant", "share"] - selector: - object: - name: - name: Name - description: Optional or it will be the current date and time. - example: "Partial backup 1" + example: "Partial Snapshot 1" selector: text: password: diff --git a/homeassistant/components/zwave_js/__init__.py b/homeassistant/components/zwave_js/__init__.py index 6320efddb60..6cd0104e298 100644 --- a/homeassistant/components/zwave_js/__init__.py +++ b/homeassistant/components/zwave_js/__init__.py @@ -547,7 +547,7 @@ async def async_remove_entry(hass: HomeAssistant, entry: ConfigEntry) -> None: LOGGER.error(err) return try: - await addon_manager.async_create_backup() + await addon_manager.async_create_snapshot() except AddonError as err: LOGGER.error(err) return diff --git a/homeassistant/components/zwave_js/addon.py b/homeassistant/components/zwave_js/addon.py index 29ae887b4bc..a0caaa15488 100644 --- a/homeassistant/components/zwave_js/addon.py +++ b/homeassistant/components/zwave_js/addon.py @@ -8,7 +8,7 @@ from functools import partial from typing import Any, Callable, TypeVar, cast from homeassistant.components.hassio import ( - async_create_backup, + async_create_snapshot, async_get_addon_discovery_info, async_get_addon_info, async_install_addon, @@ -202,7 +202,7 @@ class AddonManager: if not addon_info.update_available: return - await self.async_create_backup() + await self.async_create_snapshot() await async_update_addon(self._hass, ADDON_SLUG) @callback @@ -289,14 +289,14 @@ class AddonManager: ) return self._start_task - @api_error("Failed to create a backup of the Z-Wave JS add-on.") - async def async_create_backup(self) -> None: - """Create a partial backup of the Z-Wave JS add-on.""" + @api_error("Failed to create a snapshot of the Z-Wave JS add-on.") + async def async_create_snapshot(self) -> None: + """Create a partial snapshot of the Z-Wave JS add-on.""" addon_info = await self.async_get_addon_info() name = f"addon_{ADDON_SLUG}_{addon_info.version}" - LOGGER.debug("Creating backup: %s", name) - await async_create_backup( + LOGGER.debug("Creating snapshot: %s", name) + await async_create_snapshot( self._hass, {"name": name, "addons": [ADDON_SLUG]}, partial=True, diff --git a/tests/components/hassio/test_http.py b/tests/components/hassio/test_http.py index fc4bb3e6a0d..ff1c348a37b 100644 --- a/tests/components/hassio/test_http.py +++ b/tests/components/hassio/test_http.py @@ -132,13 +132,13 @@ async def test_forwarding_user_info(hassio_client, hass_admin_user, aioclient_mo assert req_headers["X-Hass-Is-Admin"] == "1" -async def test_backup_upload_headers(hassio_client, aioclient_mock, caplog): - """Test that we forward the full header for backup upload.""" +async def test_snapshot_upload_headers(hassio_client, aioclient_mock): + """Test that we forward the full header for snapshot upload.""" content_type = "multipart/form-data; boundary='--webkit'" - aioclient_mock.get("http://127.0.0.1/backups/new/upload") + aioclient_mock.get("http://127.0.0.1/snapshots/new/upload") resp = await hassio_client.get( - "/api/hassio/backups/new/upload", headers={"Content-Type": content_type} + "/api/hassio/snapshots/new/upload", headers={"Content-Type": content_type} ) # Check we got right response @@ -150,18 +150,18 @@ async def test_backup_upload_headers(hassio_client, aioclient_mock, caplog): assert req_headers["Content-Type"] == content_type -async def test_backup_download_headers(hassio_client, aioclient_mock): - """Test that we forward the full header for backup download.""" +async def test_snapshot_download_headers(hassio_client, aioclient_mock): + """Test that we forward the full header for snapshot download.""" content_disposition = "attachment; filename=test.tar" aioclient_mock.get( - "http://127.0.0.1/backups/slug/download", + "http://127.0.0.1/snapshots/slug/download", headers={ "Content-Length": "50000000", "Content-Disposition": content_disposition, }, ) - resp = await hassio_client.get("/api/hassio/backups/slug/download") + resp = await hassio_client.get("/api/hassio/snapshots/slug/download") # Check we got right response assert resp.status == 200 @@ -174,9 +174,9 @@ async def test_backup_download_headers(hassio_client, aioclient_mock): def test_need_auth(hass): """Test if the requested path needs authentication.""" assert not _need_auth(hass, "addons/test/logo") - assert _need_auth(hass, "backups/new/upload") + assert _need_auth(hass, "snapshots/new/upload") assert _need_auth(hass, "supervisor/logs") hass.data["onboarding"] = False - assert not _need_auth(hass, "backups/new/upload") + assert not _need_auth(hass, "snapshots/new/upload") assert not _need_auth(hass, "supervisor/logs") diff --git a/tests/components/hassio/test_init.py b/tests/components/hassio/test_init.py index 910ed12cb52..8377e5287d0 100644 --- a/tests/components/hassio/test_init.py +++ b/tests/components/hassio/test_init.py @@ -303,13 +303,11 @@ async def test_service_register(hassio_env, hass): assert hass.services.has_service("hassio", "host_reboot") assert hass.services.has_service("hassio", "snapshot_full") assert hass.services.has_service("hassio", "snapshot_partial") - assert hass.services.has_service("hassio", "backup_full") - assert hass.services.has_service("hassio", "backup_partial") assert hass.services.has_service("hassio", "restore_full") assert hass.services.has_service("hassio", "restore_partial") -async def test_service_calls(hassio_env, hass, aioclient_mock, caplog): +async def test_service_calls(hassio_env, hass, aioclient_mock): """Call service and check the API calls behind that.""" assert await async_setup_component(hass, "hassio", {}) @@ -320,13 +318,13 @@ async def test_service_calls(hassio_env, hass, aioclient_mock, caplog): aioclient_mock.post("http://127.0.0.1/addons/test/stdin", json={"result": "ok"}) aioclient_mock.post("http://127.0.0.1/host/shutdown", json={"result": "ok"}) aioclient_mock.post("http://127.0.0.1/host/reboot", json={"result": "ok"}) - aioclient_mock.post("http://127.0.0.1/backups/new/full", json={"result": "ok"}) - aioclient_mock.post("http://127.0.0.1/backups/new/partial", json={"result": "ok"}) + aioclient_mock.post("http://127.0.0.1/snapshots/new/full", json={"result": "ok"}) + aioclient_mock.post("http://127.0.0.1/snapshots/new/partial", json={"result": "ok"}) aioclient_mock.post( - "http://127.0.0.1/backups/test/restore/full", json={"result": "ok"} + "http://127.0.0.1/snapshots/test/restore/full", json={"result": "ok"} ) aioclient_mock.post( - "http://127.0.0.1/backups/test/restore/partial", json={"result": "ok"} + "http://127.0.0.1/snapshots/test/restore/partial", json={"result": "ok"} ) await hass.services.async_call("hassio", "addon_start", {"addon": "test"}) @@ -347,48 +345,27 @@ async def test_service_calls(hassio_env, hass, aioclient_mock, caplog): assert aioclient_mock.call_count == 10 - await hass.services.async_call("hassio", "backup_full", {}) - await hass.services.async_call( - "hassio", - "backup_partial", - {"addons": ["test"], "folders": ["ssl"], "password": "123456"}, - ) await hass.services.async_call("hassio", "snapshot_full", {}) await hass.services.async_call( "hassio", "snapshot_partial", - {"addons": ["test"], "folders": ["ssl"]}, + {"addons": ["test"], "folders": ["ssl"], "password": "123456"}, ) await hass.async_block_till_done() - assert ( - "The service 'snapshot_full' is deprecated and will be removed in Home Assistant 2021.10, use 'backup_full' instead" - in caplog.text - ) - assert ( - "The service 'snapshot_partial' is deprecated and will be removed in Home Assistant 2021.10, use 'backup_partial' instead" - in caplog.text - ) - assert aioclient_mock.call_count == 14 - assert aioclient_mock.mock_calls[-3][2] == { + assert aioclient_mock.call_count == 12 + assert aioclient_mock.mock_calls[-1][2] == { "addons": ["test"], "folders": ["ssl"], "password": "123456", } - await hass.services.async_call("hassio", "restore_full", {"slug": "test"}) await hass.services.async_call("hassio", "restore_full", {"snapshot": "test"}) - await hass.async_block_till_done() - assert ( - "Using 'snapshot' is deprecated and will be removed in Home Assistant 2021.10, use 'slug' instead" - in caplog.text - ) - await hass.services.async_call( "hassio", "restore_partial", { - "slug": "test", + "snapshot": "test", "homeassistant": False, "addons": ["test"], "folders": ["ssl"], @@ -397,7 +374,7 @@ async def test_service_calls(hassio_env, hass, aioclient_mock, caplog): ) await hass.async_block_till_done() - assert aioclient_mock.call_count == 17 + assert aioclient_mock.call_count == 14 assert aioclient_mock.mock_calls[-1][2] == { "addons": ["test"], "folders": ["ssl"], diff --git a/tests/components/hassio/test_websocket_api.py b/tests/components/hassio/test_websocket_api.py index 5578194b87c..5278d2cbb91 100644 --- a/tests/components/hassio/test_websocket_api.py +++ b/tests/components/hassio/test_websocket_api.py @@ -61,7 +61,7 @@ async def test_websocket_supervisor_api( assert await async_setup_component(hass, "hassio", {}) websocket_client = await hass_ws_client(hass) aioclient_mock.post( - "http://127.0.0.1/backups/new/partial", + "http://127.0.0.1/snapshots/new/partial", json={"result": "ok", "data": {"slug": "sn_slug"}}, ) @@ -69,7 +69,7 @@ async def test_websocket_supervisor_api( { WS_ID: 1, WS_TYPE: WS_TYPE_API, - ATTR_ENDPOINT: "/backups/new/partial", + ATTR_ENDPOINT: "/snapshots/new/partial", ATTR_METHOD: "post", } ) diff --git a/tests/components/zwave_js/conftest.py b/tests/components/zwave_js/conftest.py index 75b5ab65d38..0f336e396fe 100644 --- a/tests/components/zwave_js/conftest.py +++ b/tests/components/zwave_js/conftest.py @@ -171,13 +171,13 @@ def uninstall_addon_fixture(): yield uninstall_addon -@pytest.fixture(name="create_backup") -def create_backup_fixture(): - """Mock create backup.""" +@pytest.fixture(name="create_shapshot") +def create_snapshot_fixture(): + """Mock create snapshot.""" with patch( - "homeassistant.components.zwave_js.addon.async_create_backup" - ) as create_backup: - yield create_backup + "homeassistant.components.zwave_js.addon.async_create_snapshot" + ) as create_shapshot: + yield create_shapshot @pytest.fixture(name="controller_state", scope="session") diff --git a/tests/components/zwave_js/test_init.py b/tests/components/zwave_js/test_init.py index 447b052b8c0..0b9009cd1d7 100644 --- a/tests/components/zwave_js/test_init.py +++ b/tests/components/zwave_js/test_init.py @@ -365,8 +365,8 @@ async def test_addon_options_changed( @pytest.mark.parametrize( - "addon_version, update_available, update_calls, backup_calls, " - "update_addon_side_effect, create_backup_side_effect", + "addon_version, update_available, update_calls, snapshot_calls, " + "update_addon_side_effect, create_shapshot_side_effect", [ ("1.0", True, 1, 1, None, None), ("1.0", False, 0, 0, None, None), @@ -380,15 +380,15 @@ async def test_update_addon( addon_info, addon_installed, addon_running, - create_backup, + create_shapshot, update_addon, addon_options, addon_version, update_available, update_calls, - backup_calls, + snapshot_calls, update_addon_side_effect, - create_backup_side_effect, + create_shapshot_side_effect, ): """Test update the Z-Wave JS add-on during entry setup.""" device = "/test" @@ -397,7 +397,7 @@ async def test_update_addon( addon_options["network_key"] = network_key addon_info.return_value["version"] = addon_version addon_info.return_value["update_available"] = update_available - create_backup.side_effect = create_backup_side_effect + create_shapshot.side_effect = create_shapshot_side_effect update_addon.side_effect = update_addon_side_effect client.connect.side_effect = InvalidServerVersion("Invalid version") entry = MockConfigEntry( @@ -416,7 +416,7 @@ async def test_update_addon( await hass.async_block_till_done() assert entry.state is ConfigEntryState.SETUP_RETRY - assert create_backup.call_count == backup_calls + assert create_shapshot.call_count == snapshot_calls assert update_addon.call_count == update_calls @@ -469,7 +469,7 @@ async def test_stop_addon( async def test_remove_entry( - hass, addon_installed, stop_addon, create_backup, uninstall_addon, caplog + hass, addon_installed, stop_addon, create_shapshot, uninstall_addon, caplog ): """Test remove the config entry.""" # test successful remove without created add-on @@ -500,8 +500,8 @@ async def test_remove_entry( assert stop_addon.call_count == 1 assert stop_addon.call_args == call(hass, "core_zwave_js") - assert create_backup.call_count == 1 - assert create_backup.call_args == call( + assert create_shapshot.call_count == 1 + assert create_shapshot.call_args == call( hass, {"name": "addon_core_zwave_js_1.0", "addons": ["core_zwave_js"]}, partial=True, @@ -511,7 +511,7 @@ async def test_remove_entry( assert entry.state is ConfigEntryState.NOT_LOADED assert len(hass.config_entries.async_entries(DOMAIN)) == 0 stop_addon.reset_mock() - create_backup.reset_mock() + create_shapshot.reset_mock() uninstall_addon.reset_mock() # test add-on stop failure @@ -523,27 +523,27 @@ async def test_remove_entry( assert stop_addon.call_count == 1 assert stop_addon.call_args == call(hass, "core_zwave_js") - assert create_backup.call_count == 0 + assert create_shapshot.call_count == 0 assert uninstall_addon.call_count == 0 assert entry.state is ConfigEntryState.NOT_LOADED assert len(hass.config_entries.async_entries(DOMAIN)) == 0 assert "Failed to stop the Z-Wave JS add-on" in caplog.text stop_addon.side_effect = None stop_addon.reset_mock() - create_backup.reset_mock() + create_shapshot.reset_mock() uninstall_addon.reset_mock() - # test create backup failure + # test create snapshot failure entry.add_to_hass(hass) assert len(hass.config_entries.async_entries(DOMAIN)) == 1 - create_backup.side_effect = HassioAPIError() + create_shapshot.side_effect = HassioAPIError() await hass.config_entries.async_remove(entry.entry_id) assert stop_addon.call_count == 1 assert stop_addon.call_args == call(hass, "core_zwave_js") - assert create_backup.call_count == 1 - assert create_backup.call_args == call( + assert create_shapshot.call_count == 1 + assert create_shapshot.call_args == call( hass, {"name": "addon_core_zwave_js_1.0", "addons": ["core_zwave_js"]}, partial=True, @@ -551,10 +551,10 @@ async def test_remove_entry( assert uninstall_addon.call_count == 0 assert entry.state is ConfigEntryState.NOT_LOADED assert len(hass.config_entries.async_entries(DOMAIN)) == 0 - assert "Failed to create a backup of the Z-Wave JS add-on" in caplog.text - create_backup.side_effect = None + assert "Failed to create a snapshot of the Z-Wave JS add-on" in caplog.text + create_shapshot.side_effect = None stop_addon.reset_mock() - create_backup.reset_mock() + create_shapshot.reset_mock() uninstall_addon.reset_mock() # test add-on uninstall failure @@ -566,8 +566,8 @@ async def test_remove_entry( assert stop_addon.call_count == 1 assert stop_addon.call_args == call(hass, "core_zwave_js") - assert create_backup.call_count == 1 - assert create_backup.call_args == call( + assert create_shapshot.call_count == 1 + assert create_shapshot.call_args == call( hass, {"name": "addon_core_zwave_js_1.0", "addons": ["core_zwave_js"]}, partial=True,