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."""
from syrupy import SnapshotAssertion
from homeassistant.core import HomeAssistant
@ -11,34 +12,10 @@ async def test_diagnostics(
hass: HomeAssistant,
hass_client: ClientSessionGenerator,
init_integration: MockConfigEntry,
snapshot: SnapshotAssertion,
) -> None:
"""Test diagnostics."""
assert await get_diagnostics_for_config_entry(
hass, hass_client, init_integration
) == {
"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",
}
assert (
await get_diagnostics_for_config_entry(hass, hass_client, init_integration)
== snapshot
)