core/tests/components/airly/__init__.py

32 lines
972 B
Python
Raw Normal View History

"""Tests for Airly."""
from homeassistant.components.airly.const import DOMAIN
from tests.common import MockConfigEntry, load_fixture
API_NEAREST_URL = "https://airapi.airly.eu/v2/measurements/nearest?lat=123.000000&lng=456.000000&maxDistanceKM=5.000000"
2020-12-17 15:44:46 +00:00
API_POINT_URL = (
"https://airapi.airly.eu/v2/measurements/point?lat=123.000000&lng=456.000000"
)
2020-12-17 15:44:46 +00:00
async def init_integration(hass, aioclient_mock) -> MockConfigEntry:
"""Set up the Airly integration in Home Assistant."""
entry = MockConfigEntry(
domain=DOMAIN,
title="Home",
2020-12-17 15:44:46 +00:00
unique_id="123-456",
data={
"api_key": "foo",
2020-12-17 15:44:46 +00:00
"latitude": 123,
"longitude": 456,
"name": "Home",
},
)
2021-11-02 03:47:05 +00:00
aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly"))
2020-12-17 15:44:46 +00:00
entry.add_to_hass(hass)
await hass.config_entries.async_setup(entry.entry_id)
await hass.async_block_till_done()
return entry