mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Use snapshot assertion for Accuweather diagnostics (#98725)
This commit is contained in:
parent
687bf5e808
commit
af689d7c3e
304
tests/components/accuweather/snapshots/test_diagnostics.ambr
Normal file
304
tests/components/accuweather/snapshots/test_diagnostics.ambr
Normal file
@ -0,0 +1,304 @@
|
||||
# serializer version: 1
|
||||
# name: test_entry_diagnostics
|
||||
dict({
|
||||
'config_entry_data': dict({
|
||||
'api_key': '**REDACTED**',
|
||||
'latitude': '**REDACTED**',
|
||||
'longitude': '**REDACTED**',
|
||||
'name': 'Home',
|
||||
}),
|
||||
'coordinator_data': dict({
|
||||
'ApparentTemperature': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 73.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 22.8,
|
||||
}),
|
||||
}),
|
||||
'Ceiling': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'ft',
|
||||
'UnitType': 0,
|
||||
'Value': 10500.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'm',
|
||||
'UnitType': 5,
|
||||
'Value': 3200.0,
|
||||
}),
|
||||
}),
|
||||
'CloudCover': 10,
|
||||
'DewPoint': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 61.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 16.2,
|
||||
}),
|
||||
}),
|
||||
'HasPrecipitation': False,
|
||||
'IndoorRelativeHumidity': 67,
|
||||
'ObstructionsToVisibility': '',
|
||||
'Past24HourTemperatureDeparture': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 0.3,
|
||||
}),
|
||||
}),
|
||||
'Precip1hr': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
}),
|
||||
'PrecipitationSummary': dict({
|
||||
'Past12Hours': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.15,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 3.8,
|
||||
}),
|
||||
}),
|
||||
'Past18Hours': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.2,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 5.1,
|
||||
}),
|
||||
}),
|
||||
'Past24Hours': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.3,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 7.6,
|
||||
}),
|
||||
}),
|
||||
'Past3Hours': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.05,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 1.3,
|
||||
}),
|
||||
}),
|
||||
'Past6Hours': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.05,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 1.3,
|
||||
}),
|
||||
}),
|
||||
'Past9Hours': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.1,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 2.5,
|
||||
}),
|
||||
}),
|
||||
'PastHour': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
}),
|
||||
'Precipitation': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'in',
|
||||
'UnitType': 1,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mm',
|
||||
'UnitType': 3,
|
||||
'Value': 0.0,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'PrecipitationType': None,
|
||||
'Pressure': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'inHg',
|
||||
'UnitType': 12,
|
||||
'Value': 29.88,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'mb',
|
||||
'UnitType': 14,
|
||||
'Value': 1012.0,
|
||||
}),
|
||||
}),
|
||||
'PressureTendency': dict({
|
||||
'Code': 'F',
|
||||
'LocalizedText': 'Falling',
|
||||
}),
|
||||
'RealFeelTemperature': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 77.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 25.1,
|
||||
}),
|
||||
}),
|
||||
'RealFeelTemperatureShade': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 70.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 21.1,
|
||||
}),
|
||||
}),
|
||||
'RelativeHumidity': 67,
|
||||
'Temperature': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 73.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 22.6,
|
||||
}),
|
||||
}),
|
||||
'UVIndex': 6,
|
||||
'UVIndexText': 'High',
|
||||
'Visibility': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'mi',
|
||||
'UnitType': 2,
|
||||
'Value': 10.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'km',
|
||||
'UnitType': 6,
|
||||
'Value': 16.1,
|
||||
}),
|
||||
}),
|
||||
'WeatherIcon': 1,
|
||||
'WeatherText': 'Sunny',
|
||||
'WetBulbTemperature': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 65.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 18.6,
|
||||
}),
|
||||
}),
|
||||
'Wind': dict({
|
||||
'Direction': dict({
|
||||
'Degrees': 180,
|
||||
'English': 'S',
|
||||
'Localized': 'S',
|
||||
}),
|
||||
'Speed': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'mi/h',
|
||||
'UnitType': 9,
|
||||
'Value': 9.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'km/h',
|
||||
'UnitType': 7,
|
||||
'Value': 14.5,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'WindChillTemperature': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'F',
|
||||
'UnitType': 18,
|
||||
'Value': 73.0,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'C',
|
||||
'UnitType': 17,
|
||||
'Value': 22.8,
|
||||
}),
|
||||
}),
|
||||
'WindGust': dict({
|
||||
'Speed': dict({
|
||||
'Imperial': dict({
|
||||
'Unit': 'mi/h',
|
||||
'UnitType': 9,
|
||||
'Value': 12.6,
|
||||
}),
|
||||
'Metric': dict({
|
||||
'Unit': 'km/h',
|
||||
'UnitType': 7,
|
||||
'Value': 20.3,
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
'forecast': list([
|
||||
]),
|
||||
}),
|
||||
})
|
||||
# ---
|
@ -1,4 +1,5 @@
|
||||
"""Test AccuWeather diagnostics."""
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@ -10,7 +11,9 @@ from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant, hass_client: ClientSessionGenerator
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
entry = await init_integration(hass)
|
||||
@ -23,10 +26,4 @@ async def test_entry_diagnostics(
|
||||
|
||||
result = await get_diagnostics_for_config_entry(hass, hass_client, entry)
|
||||
|
||||
assert result["config_entry_data"] == {
|
||||
"api_key": "**REDACTED**",
|
||||
"latitude": "**REDACTED**",
|
||||
"longitude": "**REDACTED**",
|
||||
"name": "Home",
|
||||
}
|
||||
assert result["coordinator_data"] == coordinator_data
|
||||
assert result == snapshot
|
||||
|
Loading…
x
Reference in New Issue
Block a user