Skip to content

Commit

Permalink
refactor: redact amazon forward emails from diagnostics (#948)
Browse files Browse the repository at this point in the history
* refactor: redact amazon forwad emails from diagnostics

* update test
  • Loading branch information
firstof9 authored Jul 12, 2024
1 parent c7a9a55 commit 1c983a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions custom_components/mail_and_packages/diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion tests/test_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 1c983a5

Please sign in to comment.