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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user