2017-03-31 15:53:56 +00:00
|
|
|
"""The tests for the Ring component."""
|
2019-12-09 10:58:40 +00:00
|
|
|
|
2023-02-17 17:45:48 +00:00
|
|
|
import requests_mock
|
|
|
|
|
2017-03-31 15:53:56 +00:00
|
|
|
import homeassistant.components.ring as ring
|
2023-02-17 17:45:48 +00:00
|
|
|
from homeassistant.core import HomeAssistant
|
2020-10-04 12:05:49 +00:00
|
|
|
from homeassistant.setup import async_setup_component
|
2017-03-31 15:53:56 +00:00
|
|
|
|
2020-10-04 12:05:49 +00:00
|
|
|
from tests.common import load_fixture
|
2017-03-31 15:53:56 +00:00
|
|
|
|
|
|
|
|
2023-02-17 17:45:48 +00:00
|
|
|
async def test_setup(hass: HomeAssistant, requests_mock: requests_mock.Mocker) -> None:
|
2020-10-04 12:05:49 +00:00
|
|
|
"""Test the setup."""
|
|
|
|
await async_setup_component(hass, ring.DOMAIN, {})
|
|
|
|
|
|
|
|
requests_mock.post(
|
2021-11-02 03:47:05 +00:00
|
|
|
"https://oauth.ring.com/oauth/token", text=load_fixture("oauth.json", "ring")
|
2020-10-04 12:05:49 +00:00
|
|
|
)
|
|
|
|
requests_mock.post(
|
|
|
|
"https://api.ring.com/clients_api/session",
|
2021-11-02 03:47:05 +00:00
|
|
|
text=load_fixture("session.json", "ring"),
|
2020-10-04 12:05:49 +00:00
|
|
|
)
|
|
|
|
requests_mock.get(
|
|
|
|
"https://api.ring.com/clients_api/ring_devices",
|
2021-11-02 03:47:05 +00:00
|
|
|
text=load_fixture("devices.json", "ring"),
|
2020-10-04 12:05:49 +00:00
|
|
|
)
|
|
|
|
requests_mock.get(
|
|
|
|
"https://api.ring.com/clients_api/chimes/999999/health",
|
2021-11-02 03:47:05 +00:00
|
|
|
text=load_fixture("chime_health_attrs.json", "ring"),
|
2020-10-04 12:05:49 +00:00
|
|
|
)
|
|
|
|
requests_mock.get(
|
|
|
|
"https://api.ring.com/clients_api/doorbots/987652/health",
|
2021-11-02 03:47:05 +00:00
|
|
|
text=load_fixture("doorboot_health_attrs.json", "ring"),
|
2020-10-04 12:05:49 +00:00
|
|
|
)
|