mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Add sensor and weather tests to meteo_france (#137318)
This commit is contained in:
parent
4ceced6405
commit
d2b9a3b106
@ -2,13 +2,48 @@
|
|||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from meteofrance_api.model import CurrentPhenomenons, Forecast, Rain
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from homeassistant.components.meteo_france.const import CONF_CITY, DOMAIN
|
||||||
|
from homeassistant.config_entries import SOURCE_USER
|
||||||
|
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry, load_json_object_fixture
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def patch_requests():
|
def patch_requests():
|
||||||
"""Stub out services that makes requests."""
|
"""Stub out services that makes requests."""
|
||||||
patch_client = patch("homeassistant.components.meteo_france.MeteoFranceClient")
|
with patch("homeassistant.components.meteo_france.MeteoFranceClient") as mock_data:
|
||||||
|
mock_data = mock_data.return_value
|
||||||
|
mock_data.get_forecast.return_value = Forecast(
|
||||||
|
load_json_object_fixture("raw_forecast.json", DOMAIN)
|
||||||
|
)
|
||||||
|
mock_data.get_rain.return_value = Rain(
|
||||||
|
load_json_object_fixture("raw_rain.json", DOMAIN)
|
||||||
|
)
|
||||||
|
mock_data.get_warning_current_phenomenoms.return_value = CurrentPhenomenons(
|
||||||
|
load_json_object_fixture("raw_warning_current_phenomenoms.json", DOMAIN)
|
||||||
|
)
|
||||||
|
yield mock_data
|
||||||
|
|
||||||
with patch_client:
|
|
||||||
yield
|
@pytest.fixture(name="config_entry")
|
||||||
|
def get_config_entry(hass: HomeAssistant) -> MockConfigEntry:
|
||||||
|
"""Create and register mock config entry."""
|
||||||
|
entry_data = {
|
||||||
|
CONF_CITY: "La Clusaz",
|
||||||
|
CONF_LATITUDE: 45.90417,
|
||||||
|
CONF_LONGITUDE: 6.42306,
|
||||||
|
}
|
||||||
|
config_entry = MockConfigEntry(
|
||||||
|
domain=DOMAIN,
|
||||||
|
source=SOURCE_USER,
|
||||||
|
unique_id=f"{entry_data[CONF_LATITUDE], entry_data[CONF_LONGITUDE]}",
|
||||||
|
title=entry_data[CONF_CITY],
|
||||||
|
data=entry_data,
|
||||||
|
)
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
return config_entry
|
||||||
|
53
tests/components/meteo_france/fixtures/raw_forecast.json
Normal file
53
tests/components/meteo_france/fixtures/raw_forecast.json
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"updated_on": 1737995400,
|
||||||
|
"position": {
|
||||||
|
"country": "FR - France",
|
||||||
|
"dept": "74",
|
||||||
|
"insee": "74080",
|
||||||
|
"lat": 45.90417,
|
||||||
|
"lon": 6.42306,
|
||||||
|
"name": "La Clusaz",
|
||||||
|
"rain_product_available": 1,
|
||||||
|
"timezone": "Europe/Paris"
|
||||||
|
},
|
||||||
|
"daily_forecast": [
|
||||||
|
{
|
||||||
|
"T": { "max": 10.4, "min": 6.9, "sea": null },
|
||||||
|
"dt": 1737936000,
|
||||||
|
"humidity": { "max": 90, "min": 65 },
|
||||||
|
"precipitation": { "24h": 1.3 },
|
||||||
|
"sun": { "rise": 1737963392, "set": 1737996163 },
|
||||||
|
"uv": 1,
|
||||||
|
"weather12H": { "desc": "Eclaircies", "icon": "p2j" }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"forecast": [
|
||||||
|
{
|
||||||
|
"T": { "value": 9.1, "windchill": 5.4 },
|
||||||
|
"clouds": 70,
|
||||||
|
"dt": 1737990000,
|
||||||
|
"humidity": 75,
|
||||||
|
"iso0": 1250,
|
||||||
|
"rain": { "1h": 0 },
|
||||||
|
"rain snow limit": "Non pertinent",
|
||||||
|
"sea_level": 988.7,
|
||||||
|
"snow": { "1h": 0 },
|
||||||
|
"uv": 1,
|
||||||
|
"weather": { "desc": "Eclaircies", "icon": "p2j" },
|
||||||
|
"wind": {
|
||||||
|
"direction": 200,
|
||||||
|
"gust": 18,
|
||||||
|
"icon": "SSO",
|
||||||
|
"speed": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"probability_forecast": [
|
||||||
|
{
|
||||||
|
"dt": 1737990000,
|
||||||
|
"freezing": 0,
|
||||||
|
"rain": { "3h": null, "6h": null },
|
||||||
|
"snow": { "3h": null, "6h": null }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
24
tests/components/meteo_france/fixtures/raw_rain.json
Normal file
24
tests/components/meteo_france/fixtures/raw_rain.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"position": {
|
||||||
|
"lat": 48.807166,
|
||||||
|
"lon": 2.239895,
|
||||||
|
"alti": 76,
|
||||||
|
"name": "Meudon",
|
||||||
|
"country": "FR - France",
|
||||||
|
"dept": "92",
|
||||||
|
"timezone": "Europe/Paris"
|
||||||
|
},
|
||||||
|
"updated_on": 1589995200,
|
||||||
|
"quality": 0,
|
||||||
|
"forecast": [
|
||||||
|
{ "dt": 1589996100, "rain": 1, "desc": "Temps sec" },
|
||||||
|
{ "dt": 1589996400, "rain": 1, "desc": "Temps sec" },
|
||||||
|
{ "dt": 1589996700, "rain": 1, "desc": "Temps sec" },
|
||||||
|
{ "dt": 1589997000, "rain": 2, "desc": "Pluie faible" },
|
||||||
|
{ "dt": 1589997300, "rain": 3, "desc": "Pluie modérée" },
|
||||||
|
{ "dt": 1589997600, "rain": 2, "desc": "Pluie faible" },
|
||||||
|
{ "dt": 1589998200, "rain": 1, "desc": "Temps sec" },
|
||||||
|
{ "dt": 1589998800, "rain": 1, "desc": "Temps sec" },
|
||||||
|
{ "dt": 1589999400, "rain": 1, "desc": "Temps sec" }
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"update_time": 1591279200,
|
||||||
|
"end_validity_time": 1591365600,
|
||||||
|
"domain_id": "32",
|
||||||
|
"phenomenons_max_colors": [
|
||||||
|
{ "phenomenon_id": "6", "phenomenon_max_color_id": 1 },
|
||||||
|
{ "phenomenon_id": "4", "phenomenon_max_color_id": 1 },
|
||||||
|
{ "phenomenon_id": "5", "phenomenon_max_color_id": 3 },
|
||||||
|
{ "phenomenon_id": "2", "phenomenon_max_color_id": 1 },
|
||||||
|
{ "phenomenon_id": "1", "phenomenon_max_color_id": 1 },
|
||||||
|
{ "phenomenon_id": "3", "phenomenon_max_color_id": 2 }
|
||||||
|
]
|
||||||
|
}
|
764
tests/components/meteo_france/snapshots/test_sensor.ambr
Normal file
764
tests/components/meteo_france/snapshots/test_sensor.ambr
Normal file
@ -0,0 +1,764 @@
|
|||||||
|
# serializer version: 1
|
||||||
|
# name: test_sensor[sensor.32_weather_alert-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.32_weather_alert',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': 'mdi:weather-cloudy-alert',
|
||||||
|
'original_name': '32 Weather alert',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '32 Weather alert',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.32_weather_alert-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'Canicule': 'Vert',
|
||||||
|
'Inondation': 'Vert',
|
||||||
|
'Neige-verglas': 'Orange',
|
||||||
|
'Orages': 'Jaune',
|
||||||
|
'Pluie-inondation': 'Vert',
|
||||||
|
'Vent violent': 'Vert',
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': '32 Weather alert',
|
||||||
|
'icon': 'mdi:weather-cloudy-alert',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.32_weather_alert',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'Orange',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_cloud_cover-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_cloud_cover',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': 'mdi:weather-partly-cloudy',
|
||||||
|
'original_name': 'La Clusaz Cloud cover',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_cloud',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_cloud_cover-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz Cloud cover',
|
||||||
|
'icon': 'mdi:weather-partly-cloudy',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_cloud_cover',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '70',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_daily_original_condition-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_daily_original_condition',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Daily original condition',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_daily_original_condition',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_daily_original_condition-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz Daily original condition',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_daily_original_condition',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'Eclaircies',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_daily_precipitation-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_daily_precipitation',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.PRECIPITATION: 'precipitation'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Daily precipitation',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_precipitation',
|
||||||
|
'unit_of_measurement': <UnitOfPrecipitationDepth.MILLIMETERS: 'mm'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_daily_precipitation-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'precipitation',
|
||||||
|
'friendly_name': 'La Clusaz Daily precipitation',
|
||||||
|
'unit_of_measurement': <UnitOfPrecipitationDepth.MILLIMETERS: 'mm'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_daily_precipitation',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '1.3',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_freeze_chance-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_freeze_chance',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': 'mdi:snowflake',
|
||||||
|
'original_name': 'La Clusaz Freeze chance',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_freeze_chance',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_freeze_chance-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz Freeze chance',
|
||||||
|
'icon': 'mdi:snowflake',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_freeze_chance',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '0',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_humidity-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_humidity',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.HUMIDITY: 'humidity'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Humidity',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_humidity',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_humidity-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'humidity',
|
||||||
|
'friendly_name': 'La Clusaz Humidity',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_humidity',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '75',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_original_condition-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_original_condition',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Original condition',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_original_condition',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_original_condition-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz Original condition',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_original_condition',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'Eclaircies',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_pressure-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_pressure',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.PRESSURE: 'pressure'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Pressure',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_pressure',
|
||||||
|
'unit_of_measurement': <UnitOfPressure.HPA: 'hPa'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_pressure-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'pressure',
|
||||||
|
'friendly_name': 'La Clusaz Pressure',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfPressure.HPA: 'hPa'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_pressure',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '988.7',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_rain_chance-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_rain_chance',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': 'mdi:weather-rainy',
|
||||||
|
'original_name': 'La Clusaz Rain chance',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_rain_chance',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_rain_chance-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz Rain chance',
|
||||||
|
'icon': 'mdi:weather-rainy',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_rain_chance',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_snow_chance-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_snow_chance',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': 'mdi:weather-snowy',
|
||||||
|
'original_name': 'La Clusaz Snow chance',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_snow_chance',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_snow_chance-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz Snow chance',
|
||||||
|
'icon': 'mdi:weather-snowy',
|
||||||
|
'unit_of_measurement': '%',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_snow_chance',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'unknown',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_temperature-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_temperature',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.TEMPERATURE: 'temperature'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Temperature',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_temperature',
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_temperature-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'temperature',
|
||||||
|
'friendly_name': 'La Clusaz Temperature',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_temperature',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '9.1',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_uv-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_uv',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': 'mdi:sunglasses',
|
||||||
|
'original_name': 'La Clusaz UV',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_uv',
|
||||||
|
'unit_of_measurement': 'UV index',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_uv-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz UV',
|
||||||
|
'icon': 'mdi:sunglasses',
|
||||||
|
'unit_of_measurement': 'UV index',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_uv',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '1',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_wind_gust-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_wind_gust',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.WIND_SPEED: 'wind_speed'>,
|
||||||
|
'original_icon': 'mdi:weather-windy-variant',
|
||||||
|
'original_name': 'La Clusaz Wind gust',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_wind_gust',
|
||||||
|
'unit_of_measurement': <UnitOfSpeed.KILOMETERS_PER_HOUR: 'km/h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_wind_gust-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'wind_speed',
|
||||||
|
'friendly_name': 'La Clusaz Wind gust',
|
||||||
|
'icon': 'mdi:weather-windy-variant',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfSpeed.KILOMETERS_PER_HOUR: 'km/h'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_wind_gust',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '65',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_wind_speed-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': dict({
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
}),
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.la_clusaz_wind_speed',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.WIND_SPEED: 'wind_speed'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz Wind speed',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306_wind_speed',
|
||||||
|
'unit_of_measurement': <UnitOfSpeed.KILOMETERS_PER_HOUR: 'km/h'>,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.la_clusaz_wind_speed-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'wind_speed',
|
||||||
|
'friendly_name': 'La Clusaz Wind speed',
|
||||||
|
'state_class': <SensorStateClass.MEASUREMENT: 'measurement'>,
|
||||||
|
'unit_of_measurement': <UnitOfSpeed.KILOMETERS_PER_HOUR: 'km/h'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.la_clusaz_wind_speed',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '29',
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.meudon_next_rain-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'sensor',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'sensor.meudon_next_rain',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': <SensorDeviceClass.TIMESTAMP: 'timestamp'>,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'Meudon Next rain',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': 0,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '48.807166,2.239895_next_rain',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_sensor[sensor.meudon_next_rain-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'1_hour_forecast': dict({
|
||||||
|
'0 min': 'Temps sec',
|
||||||
|
'10 min': 'Temps sec',
|
||||||
|
'15 min': 'Pluie faible',
|
||||||
|
'20 min': 'Pluie modérée',
|
||||||
|
'25 min': 'Pluie faible',
|
||||||
|
'35 min': 'Temps sec',
|
||||||
|
'45 min': 'Temps sec',
|
||||||
|
'5 min': 'Temps sec',
|
||||||
|
'55 min': 'Temps sec',
|
||||||
|
}),
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'device_class': 'timestamp',
|
||||||
|
'forecast_time_ref': '2020-05-20T17:35:00+00:00',
|
||||||
|
'friendly_name': 'Meudon Next rain',
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'sensor.meudon_next_rain',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': '2020-05-20T17:50:00+00:00',
|
||||||
|
})
|
||||||
|
# ---
|
59
tests/components/meteo_france/snapshots/test_weather.ambr
Normal file
59
tests/components/meteo_france/snapshots/test_weather.ambr
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# serializer version: 1
|
||||||
|
# name: test_weather[weather.la_clusaz-entry]
|
||||||
|
EntityRegistryEntrySnapshot({
|
||||||
|
'aliases': set({
|
||||||
|
}),
|
||||||
|
'area_id': None,
|
||||||
|
'capabilities': None,
|
||||||
|
'config_entry_id': <ANY>,
|
||||||
|
'device_class': None,
|
||||||
|
'device_id': <ANY>,
|
||||||
|
'disabled_by': None,
|
||||||
|
'domain': 'weather',
|
||||||
|
'entity_category': None,
|
||||||
|
'entity_id': 'weather.la_clusaz',
|
||||||
|
'has_entity_name': False,
|
||||||
|
'hidden_by': None,
|
||||||
|
'icon': None,
|
||||||
|
'id': <ANY>,
|
||||||
|
'labels': set({
|
||||||
|
}),
|
||||||
|
'name': None,
|
||||||
|
'options': dict({
|
||||||
|
}),
|
||||||
|
'original_device_class': None,
|
||||||
|
'original_icon': None,
|
||||||
|
'original_name': 'La Clusaz',
|
||||||
|
'platform': 'meteo_france',
|
||||||
|
'previous_unique_id': None,
|
||||||
|
'supported_features': <WeatherEntityFeature: 3>,
|
||||||
|
'translation_key': None,
|
||||||
|
'unique_id': '45.90417,6.42306',
|
||||||
|
'unit_of_measurement': None,
|
||||||
|
})
|
||||||
|
# ---
|
||||||
|
# name: test_weather[weather.la_clusaz-state]
|
||||||
|
StateSnapshot({
|
||||||
|
'attributes': ReadOnlyDict({
|
||||||
|
'attribution': 'Data provided by Météo-France',
|
||||||
|
'friendly_name': 'La Clusaz',
|
||||||
|
'humidity': 75,
|
||||||
|
'precipitation_unit': <UnitOfPrecipitationDepth.MILLIMETERS: 'mm'>,
|
||||||
|
'pressure': 988.7,
|
||||||
|
'pressure_unit': <UnitOfPressure.HPA: 'hPa'>,
|
||||||
|
'supported_features': <WeatherEntityFeature: 3>,
|
||||||
|
'temperature': 9.1,
|
||||||
|
'temperature_unit': <UnitOfTemperature.CELSIUS: '°C'>,
|
||||||
|
'visibility_unit': <UnitOfLength.KILOMETERS: 'km'>,
|
||||||
|
'wind_bearing': 200,
|
||||||
|
'wind_speed': 28.8,
|
||||||
|
'wind_speed_unit': <UnitOfSpeed.KILOMETERS_PER_HOUR: 'km/h'>,
|
||||||
|
}),
|
||||||
|
'context': <ANY>,
|
||||||
|
'entity_id': 'weather.la_clusaz',
|
||||||
|
'last_changed': <ANY>,
|
||||||
|
'last_reported': <ANY>,
|
||||||
|
'last_updated': <ANY>,
|
||||||
|
'state': 'partlycloudy',
|
||||||
|
})
|
||||||
|
# ---
|
32
tests/components/meteo_france/test_sensor.py
Normal file
32
tests/components/meteo_france/test_sensor.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"""Test Météo France weather entity."""
|
||||||
|
|
||||||
|
from collections.abc import Generator
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from syrupy.assertion import SnapshotAssertion
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry, snapshot_platform
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def override_platforms() -> Generator[None]:
|
||||||
|
"""Override PLATFORMS."""
|
||||||
|
with patch("homeassistant.components.meteo_france.PLATFORMS", [Platform.SENSOR]):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||||
|
async def test_sensor(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
) -> None:
|
||||||
|
"""Test the sensor entity."""
|
||||||
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
|
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
31
tests/components/meteo_france/test_weather.py
Normal file
31
tests/components/meteo_france/test_weather.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
"""Test Météo France weather entity."""
|
||||||
|
|
||||||
|
from collections.abc import Generator
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from syrupy.assertion import SnapshotAssertion
|
||||||
|
|
||||||
|
from homeassistant.const import Platform
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
|
from tests.common import MockConfigEntry, snapshot_platform
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def override_platforms() -> Generator[None]:
|
||||||
|
"""Override PLATFORMS."""
|
||||||
|
with patch("homeassistant.components.meteo_france.PLATFORMS", [Platform.WEATHER]):
|
||||||
|
yield
|
||||||
|
|
||||||
|
|
||||||
|
async def test_weather(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
config_entry: MockConfigEntry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
snapshot: SnapshotAssertion,
|
||||||
|
) -> None:
|
||||||
|
"""Test the weather entity."""
|
||||||
|
await hass.config_entries.async_setup(config_entry.entry_id)
|
||||||
|
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
|
Loading…
x
Reference in New Issue
Block a user