1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add Ring config flow (#30564)

* Add Ring config flow

* Address comments + migrate platforms to config entry

* Migrate camera too

* Address comments

* Fix order config flows

* setup -> async_setup
This commit is contained in:
Paulus Schoutsen
2020-01-10 21:35:31 +01:00
committed by GitHub
parent 3348f4f6d1
commit 3f29c234b8
17 changed files with 435 additions and 146 deletions

View File

@@ -1,6 +1,8 @@
"""The tests for the Ring sensor platform."""
from asyncio import run_coroutine_threadsafe
import os
import unittest
from unittest.mock import patch
import requests_mock
@@ -8,7 +10,12 @@ from homeassistant.components import ring as base_ring
import homeassistant.components.ring.sensor as ring
from homeassistant.helpers.icon import icon_for_battery_level
from tests.common import get_test_config_dir, get_test_home_assistant, load_fixture
from tests.common import (
get_test_config_dir,
get_test_home_assistant,
load_fixture,
mock_storage,
)
from tests.components.ring.test_init import ATTRIBUTION, VALID_CONFIG
@@ -76,8 +83,18 @@ class TestRingSensorSetup(unittest.TestCase):
"https://api.ring.com/clients_api/chimes/999999/health",
text=load_fixture("ring_chime_health_attrs.json"),
)
base_ring.setup(self.hass, VALID_CONFIG)
ring.setup_platform(self.hass, self.config, self.add_entities, None)
with mock_storage(), patch("homeassistant.components.ring.PLATFORMS", []):
run_coroutine_threadsafe(
base_ring.async_setup(self.hass, VALID_CONFIG), self.hass.loop
).result()
run_coroutine_threadsafe(
self.hass.async_block_till_done(), self.hass.loop
).result()
run_coroutine_threadsafe(
ring.async_setup_entry(self.hass, None, self.add_entities),
self.hass.loop,
).result()
for device in self.DEVICES:
device.update()