mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Convert nws integration to component configuration (#31398)
* convert nws to component configuration * add more debug logging * remove assumed state * move initialization of data into init * refactor update logic * use forecast success for checking available entities * Split unique_id into more usable pieces. use a base_unique_id for each entry. Add domain for signaling to entities. Each entity in each platform can use base_unique_id to form individual unique_id's. * Revert "move initialization of data into init" This reverts commit 09eb0220469285b10f0500f5f6def67415931a81. * add silver quality scale to manifest * unsubscribe listener in will_remove_from_hass * initialize _unsub_listener in __init__ * use async_on_remove * remove scan interval from configuration * Use better name Co-Authored-By: J. Nick Koston <nick@koston.org> Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
24
tests/components/nws/conftest.py
Normal file
24
tests/components/nws/conftest.py
Normal file
@@ -0,0 +1,24 @@
|
||||
"""Fixtures for National Weather Service tests."""
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.common import mock_coro
|
||||
from tests.components.nws.const import DEFAULT_FORECAST, DEFAULT_OBSERVATION
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def mock_simple_nws():
|
||||
"""Mock pynws SimpleNWS with default values."""
|
||||
with patch("homeassistant.components.nws.SimpleNWS") as mock_nws:
|
||||
instance = mock_nws.return_value
|
||||
instance.set_station.return_value = mock_coro()
|
||||
instance.update_observation.return_value = mock_coro()
|
||||
instance.update_forecast.return_value = mock_coro()
|
||||
instance.update_forecast_hourly.return_value = mock_coro()
|
||||
instance.station = "ABC"
|
||||
instance.stations = ["ABC"]
|
||||
instance.observation = DEFAULT_OBSERVATION
|
||||
instance.forecast = DEFAULT_FORECAST
|
||||
instance.forecast_hourly = DEFAULT_FORECAST
|
||||
yield mock_nws
|
||||
Reference in New Issue
Block a user