Use snapshot assertion for rdw diagnostics test (#99027)

This commit is contained in:
Jan-Philipp Benecke 2023-08-25 13:40:08 +02:00 committed by GitHub
parent d79e8b7a02
commit 4fb00e448c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 29 deletions

View File

@ -0,0 +1,30 @@
# serializer version: 1
# name: test_diagnostics
dict({
'apk_expiration': '2022-01-04',
'ascription_date': '2021-11-04',
'ascription_possible': True,
'brand': 'Skoda',
'energy_label': 'A',
'engine_capacity': 999,
'exported': False,
'first_admission': '2013-01-04',
'interior': 'hatchback',
'last_odometer_registration_year': 2021,
'liability_insured': False,
'license_plate': '11ZKZ3',
'list_price': 10697,
'mass_driveable': 940,
'mass_empty': 840,
'model': 'Citigo',
'number_of_cylinders': 3,
'number_of_doors': 0,
'number_of_seats': 4,
'number_of_wheelchair_seats': 0,
'number_of_wheels': 4,
'odometer_judgement': 'Logisch',
'pending_recall': False,
'taxi': None,
'vehicle_type': 'Personenauto',
})
# ---

View File

@ -1,4 +1,5 @@
"""Tests for the diagnostics data provided by the RDW integration.""" """Tests for the diagnostics data provided by the RDW integration."""
from syrupy import SnapshotAssertion
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -11,34 +12,10 @@ async def test_diagnostics(
hass: HomeAssistant, hass: HomeAssistant,
hass_client: ClientSessionGenerator, hass_client: ClientSessionGenerator,
init_integration: MockConfigEntry, init_integration: MockConfigEntry,
snapshot: SnapshotAssertion,
) -> None: ) -> None:
"""Test diagnostics.""" """Test diagnostics."""
assert await get_diagnostics_for_config_entry( assert (
hass, hass_client, init_integration await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
) == { == snapshot
"apk_expiration": "2022-01-04", )
"ascription_date": "2021-11-04",
"ascription_possible": True,
"brand": "Skoda",
"energy_label": "A",
"engine_capacity": 999,
"exported": False,
"interior": "hatchback",
"last_odometer_registration_year": 2021,
"liability_insured": False,
"license_plate": "11ZKZ3",
"list_price": 10697,
"first_admission": "2013-01-04",
"mass_empty": 840,
"mass_driveable": 940,
"model": "Citigo",
"number_of_cylinders": 3,
"number_of_doors": 0,
"number_of_seats": 4,
"number_of_wheelchair_seats": 0,
"number_of_wheels": 4,
"odometer_judgement": "Logisch",
"pending_recall": False,
"taxi": None,
"vehicle_type": "Personenauto",
}