Add storage helper and migrate config entries (#15045)
* Add storage helper * Migrate config entries to use the storage helper * Make sure tests do not do I/O * Lint * Add versions to stored data * Add more instance variables * Make migrator load config if nothing to migrate * Address comments
This commit is contained in:
parent
672a3c7178
commit
ae51dc08bf
8 changed files with 384 additions and 46 deletions
|
@ -14,7 +14,7 @@ from homeassistant import auth, core as ha, data_entry_flow, config_entries
|
|||
from homeassistant.setup import setup_component, async_setup_component
|
||||
from homeassistant.config import async_process_component_config
|
||||
from homeassistant.helpers import (
|
||||
intent, entity, restore_state, entity_registry,
|
||||
intent, entity, restore_state, entity_registry,
|
||||
entity_platform)
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
import homeassistant.util.dt as date_util
|
||||
|
@ -110,8 +110,6 @@ def get_test_home_assistant():
|
|||
def async_test_home_assistant(loop):
|
||||
"""Return a Home Assistant object pointing at test config dir."""
|
||||
hass = ha.HomeAssistant(loop)
|
||||
hass.config_entries = config_entries.ConfigEntries(hass, {})
|
||||
hass.config_entries._entries = []
|
||||
hass.config.async_load = Mock()
|
||||
store = auth.AuthStore(hass)
|
||||
hass.auth = auth.AuthManager(hass, store, {})
|
||||
|
@ -137,6 +135,10 @@ def async_test_home_assistant(loop):
|
|||
hass.config.units = METRIC_SYSTEM
|
||||
hass.config.skip_pip = True
|
||||
|
||||
hass.config_entries = config_entries.ConfigEntries(hass, {})
|
||||
hass.config_entries._entries = []
|
||||
hass.config_entries._store._async_ensure_stop_listener = lambda: None
|
||||
|
||||
hass.state = ha.CoreState.running
|
||||
|
||||
# Mock async_start
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue