Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Dec 2, 2024
1 parent b8cd30a commit fc75ec3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/fixtures/kamereon/vehicle_data/no_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"data": {
"type": "ChargeMode",
"id": "VF1AAAA"
}
}
20 changes: 20 additions & 0 deletions tests/kamereon/test_kamereon_vehicle_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,23 @@ def test_hvac_settings_schedule() -> None:
assert vehicle_data.schedules[i].id == i + 1
for day in DAYS_OF_WEEK:
assert vehicle_data.schedules[i].__dict__.get(day) is None


def test_no_data() -> None:
"""Test missing vehicle data."""
response: models.KamereonVehicleDataResponse = fixtures.get_file_content_as_schema(
f"{fixtures.KAMEREON_FIXTURE_PATH}/vehicle_data/no_data.json",
schemas.KamereonVehicleDataResponseSchema,
)
response.raise_for_error_code()
assert response.data is not None
assert response.data.raw_data == {"id": "VF1AAAA", "type": "ChargeMode"}

vehicle_data = cast(
models.KamereonVehicleCockpitData,
response.get_attributes(schemas.KamereonVehicleCockpitDataSchema),
)

assert vehicle_data.totalMileage is None
assert vehicle_data.fuelAutonomy is None
assert vehicle_data.fuelQuantity is None

0 comments on commit fc75ec3

Please sign in to comment.