Fix a bug in a nest test that causes side effects for other tests (#58264)

Fix a bug where a constant configuration variable in the common test library
is modified during the test, causing side effects for other tests.

This was found by renaming the tests, which caused other tests to fail.
pull/58266/head
Allen Porter 2021-10-22 21:33:40 -07:00 committed by GitHub
parent 7627b959f8
commit fc7be8aa00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ The tests fake out the subscriber/devicemanager and simulate setup behavior
and failure modes.
"""
import copy
import logging
from unittest.mock import patch
@ -41,7 +42,7 @@ async def async_setup_sdm(hass, config=CONFIG):
async def test_setup_configuration_failure(hass, caplog):
"""Test configuration error."""
config = CONFIG.copy()
config = copy.deepcopy(CONFIG)
config[DOMAIN]["subscriber_id"] = "invalid-subscriber-format"
result = await async_setup_sdm(hass, config)
@ -107,7 +108,7 @@ async def test_subscriber_auth_failure(hass, caplog):
async def test_setup_missing_subscriber_id(hass, caplog):
"""Test successful setup."""
config = CONFIG
config = copy.deepcopy(CONFIG)
del config[DOMAIN]["subscriber_id"]
with caplog.at_level(logging.ERROR, logger="homeassistant.components.nest"):
result = await async_setup_sdm(hass, config)