Allow multiple configuration entries for nest integration (#73720)

* Add multiple config entry support for Nest

* Set a config entry unique id based on nest project id

* Add missing translations and remove untested committed

* Remove unnecessary translation

* Remove dead code

* Remove old handling to avoid duplicate error logs
This commit is contained in:
Allen Porter 2022-06-21 07:36:13 -07:00 committed by GitHub
parent a96aa64dd1
commit cf9cab900e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 161 additions and 116 deletions

View file

@ -24,6 +24,7 @@ from homeassistant.setup import async_setup_component
from .common import (
DEVICE_ID,
PROJECT_ID,
SUBSCRIBER_ID,
TEST_CONFIG_APP_CREDS,
TEST_CONFIG_YAML_ONLY,
@ -213,11 +214,18 @@ def config(
return config
@pytest.fixture
def config_entry_unique_id() -> str:
"""Fixture to set ConfigEntry unique id."""
return PROJECT_ID
@pytest.fixture
def config_entry(
subscriber_id: str | None,
auth_implementation: str | None,
nest_test_config: NestTestConfig,
config_entry_unique_id: str,
) -> MockConfigEntry | None:
"""Fixture that sets up the ConfigEntry for the test."""
if nest_test_config.config_entry_data is None:
@ -229,7 +237,7 @@ def config_entry(
else:
del data[CONF_SUBSCRIBER_ID]
data["auth_implementation"] = auth_implementation
return MockConfigEntry(domain=DOMAIN, data=data)
return MockConfigEntry(domain=DOMAIN, data=data, unique_id=config_entry_unique_id)
@pytest.fixture(autouse=True)