* Migrate legacy Ecobee notify service * Correct comment * Update homeassistant/components/ecobee/notify.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Use version to check latest entry being used * Use 6 months of deprecation * Add repair flow tests * Only allow migrate_notify fix flow * Simplify repair flow * Use ecobee data to refrence entry * Make entry attrubute puiblic * Use hass.data ro retrieve entry. * Only register issue when legacy service when it is use * Remove backslash * Use ws_client.send_json_auto_id * Cleanup * Import domain from notify integration * Apply suggestions from code review Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update dependencies * Use Issue_registry fixture * remove `update_before_add` flag * Update homeassistant/components/ecobee/notify.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update homeassistant/components/ecobee/notify.py * Update tests/components/ecobee/conftest.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Fix typo and import --------- Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
32 lines
909 B
Python
32 lines
909 B
Python
"""Common methods used across tests for Ecobee."""
|
|
|
|
from unittest.mock import patch
|
|
|
|
from homeassistant.components.ecobee.const import CONF_REFRESH_TOKEN, DOMAIN
|
|
from homeassistant.const import CONF_API_KEY
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def setup_platform(
|
|
hass: HomeAssistant,
|
|
platform: str,
|
|
) -> MockConfigEntry:
|
|
"""Set up the ecobee platform."""
|
|
mock_entry = MockConfigEntry(
|
|
title=DOMAIN,
|
|
domain=DOMAIN,
|
|
data={
|
|
CONF_API_KEY: "ABC123",
|
|
CONF_REFRESH_TOKEN: "EFG456",
|
|
},
|
|
)
|
|
mock_entry.add_to_hass(hass)
|
|
|
|
with patch("homeassistant.components.ecobee.const.PLATFORMS", [platform]):
|
|
assert await async_setup_component(hass, DOMAIN, {})
|
|
await hass.async_block_till_done()
|
|
|
|
return mock_entry
|