Ensure SimpliSafe diagnostics redact the `code` option (#75137)

pull/75147/head
Aaron Bach 2022-07-13 12:52:13 -06:00 committed by Paulus Schoutsen
parent 89e87119f2
commit f052c3ca74
3 changed files with 8 additions and 3 deletions

View File

@ -5,7 +5,7 @@ from typing import Any
from homeassistant.components.diagnostics import async_redact_data
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ADDRESS, CONF_LOCATION
from homeassistant.const import CONF_ADDRESS, CONF_CODE, CONF_LOCATION
from homeassistant.core import HomeAssistant
from . import SimpliSafe
@ -23,6 +23,7 @@ CONF_WIFI_SSID = "wifi_ssid"
TO_REDACT = {
CONF_ADDRESS,
CONF_CODE,
CONF_CREDIT_CARD,
CONF_EXPIRES,
CONF_LOCATION,

View File

@ -43,7 +43,9 @@ def api_fixture(api_auth_state, data_subscription, system_v3, websocket):
@pytest.fixture(name="config_entry")
def config_entry_fixture(hass, config, unique_id):
"""Define a config entry."""
entry = MockConfigEntry(domain=DOMAIN, unique_id=unique_id, data=config)
entry = MockConfigEntry(
domain=DOMAIN, unique_id=unique_id, data=config, options={CONF_CODE: "1234"}
)
entry.add_to_hass(hass)
return entry

View File

@ -8,7 +8,9 @@ async def test_entry_diagnostics(hass, config_entry, hass_client, setup_simplisa
"""Test config entry diagnostics."""
assert await get_diagnostics_for_config_entry(hass, hass_client, config_entry) == {
"entry": {
"options": {},
"options": {
"code": REDACTED,
},
},
"subscription_data": {
"system_123": {