From 1c983a5d1ac9d54a910e29a794a254a3556cb584 Mon Sep 17 00:00:00 2001 From: Chris <1105672+firstof9@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:22:42 -0700 Subject: [PATCH] refactor: redact amazon forward emails from diagnostics (#948) * refactor: redact amazon forwad emails from diagnostics * update test --- custom_components/mail_and_packages/diagnostics.py | 4 ++-- tests/test_diagnostics.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/custom_components/mail_and_packages/diagnostics.py b/custom_components/mail_and_packages/diagnostics.py index 394cb0fb..f7baf05f 100644 --- a/custom_components/mail_and_packages/diagnostics.py +++ b/custom_components/mail_and_packages/diagnostics.py @@ -11,10 +11,10 @@ from homeassistant.core import HomeAssistant from homeassistant.helpers.device_registry import DeviceEntry -from .const import COORDINATOR, DOMAIN +from .const import CONF_AMAZON_FWDS, COORDINATOR, DOMAIN _LOGGER = logging.getLogger(__name__) -REDACT_KEYS = {CONF_PASSWORD, CONF_USERNAME} +REDACT_KEYS = {CONF_PASSWORD, CONF_USERNAME, CONF_AMAZON_FWDS} async def async_get_config_entry_diagnostics( diff --git a/tests/test_diagnostics.py b/tests/test_diagnostics.py index 96819ece..e0ae3f1d 100644 --- a/tests/test_diagnostics.py +++ b/tests/test_diagnostics.py @@ -6,7 +6,7 @@ from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME from pytest_homeassistant_custom_component.common import MockConfigEntry -from custom_components.mail_and_packages.const import DOMAIN +from custom_components.mail_and_packages.const import CONF_AMAZON_FWDS, DOMAIN from custom_components.mail_and_packages.diagnostics import ( async_get_config_entry_diagnostics, async_get_device_diagnostics, @@ -31,6 +31,7 @@ async def test_config_entry_diagnostics(hass): assert result["config"]["data"][CONF_PORT] == 993 assert result["config"]["data"][CONF_PASSWORD] == "**REDACTED**" assert result["config"]["data"][CONF_USERNAME] == "**REDACTED**" + assert result["config"]["data"][CONF_AMAZON_FWDS] == "**REDACTED**" @pytest.mark.asyncio