From 62f360f617bbb4820285741558158dfa7f4ce1a4 Mon Sep 17 00:00:00 2001 From: "Yanze (David) Wu" <133224895+David-Wu1119@users.noreply.github.com> Date: Tue, 29 Sep 2026 02:07:29 -0400 Subject: [PATCH] Fix SFTP Storage removed-directory debug log (#183530) Co-authored-by: Claude Opus 5.5 --- homeassistant/components/sftp_storage/__init__.py | 2 +- tests/components/sftp_storage/test_init.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/sftp_storage/__init__.py b/homeassistant/components/sftp_storage/__init__.py index 8aa63be3c2bf..0aa1ed0ed158 100644 --- a/homeassistant/components/sftp_storage/__init__.py +++ b/homeassistant/components/sftp_storage/__init__.py @@ -129,7 +129,7 @@ async def async_remove_entry(hass: HomeAssistant, entry: SFTPConfigEntry) -> Non ) else: LOGGER.debug( - "Removed storage directory for %s integration", + "Removed storage directory for %s integration for host %s@%s", DOMAIN, entry.data[CONF_USERNAME], entry.data[CONF_HOST], diff --git a/tests/components/sftp_storage/test_init.py b/tests/components/sftp_storage/test_init.py index e14049922adf..f922fd244a76 100644 --- a/tests/components/sftp_storage/test_init.py +++ b/tests/components/sftp_storage/test_init.py @@ -1,5 +1,6 @@ """Tests for SFTP Storage.""" +import logging from pathlib import Path from unittest.mock import patch @@ -145,8 +146,10 @@ async def test_setup_invalid_credentials( async def test_async_remove_entry( hass: HomeAssistant, setup_integration: ComponentSetup, + caplog: pytest.LogCaptureFixture, ) -> None: """Test async_remove_entry.""" + caplog.set_level(logging.DEBUG) # Setup default config entry await setup_integration() @@ -194,6 +197,10 @@ async def test_async_remove_entry( assert await hass.config_entries.async_remove(new_config_entry.entry_id) assert not new_private_key.exists() assert not new_private_key.parent.exists() + assert ( + f"Removed storage directory for {DOMAIN} integration for host another@127.0.0.1" + in caplog.text + ) assert hass.config_entries.async_entries(DOMAIN) == [] assert config_entry.state is ConfigEntryState.NOT_LOADED