From b8b1963fd21eb4d3e4b28b494d3c72602bd2c0c8 Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Fri, 14 Apr 2023 17:54:23 +0200 Subject: [PATCH] fix: date after api upgrade --- .../psa/connected_car_api/models/energy.py | 2 +- .../connected_car_api/models/position_properties.py | 2 +- .../psa/connected_car_api/models/vehicle_odometer.py | 2 +- tests/data/car_status.py | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/psa_car_controller/psa/connected_car_api/models/energy.py b/psa_car_controller/psa/connected_car_api/models/energy.py index bafcaca..2773959 100644 --- a/psa_car_controller/psa/connected_car_api/models/energy.py +++ b/psa_car_controller/psa/connected_car_api/models/energy.py @@ -42,7 +42,7 @@ class Energy(object): } attribute_map = { - 'updated_at': 'updatedAt', + 'updated_at': 'createdAt', 'autonomy': 'autonomy', 'battery': 'battery', 'charging': 'charging', diff --git a/psa_car_controller/psa/connected_car_api/models/position_properties.py b/psa_car_controller/psa/connected_car_api/models/position_properties.py index 8961dc1..94aff50 100644 --- a/psa_car_controller/psa/connected_car_api/models/position_properties.py +++ b/psa_car_controller/psa/connected_car_api/models/position_properties.py @@ -41,7 +41,7 @@ class PositionProperties(object): 'heading': 'heading', 'signal_quality': 'signalQuality', 'type': 'type', - 'updated_at': 'updatedAt' + 'updated_at': 'createdAt' } def __init__(self, heading=None, signal_quality=None, type=None, updated_at=None): # noqa: E501 diff --git a/psa_car_controller/psa/connected_car_api/models/vehicle_odometer.py b/psa_car_controller/psa/connected_car_api/models/vehicle_odometer.py index 6afbe06..696eaf3 100644 --- a/psa_car_controller/psa/connected_car_api/models/vehicle_odometer.py +++ b/psa_car_controller/psa/connected_car_api/models/vehicle_odometer.py @@ -36,7 +36,7 @@ class VehicleOdometer(object): } attribute_map = { - 'updated_at': 'updatedAt', + 'updated_at': 'createdAt', 'mileage': 'mileage' } diff --git a/tests/data/car_status.py b/tests/data/car_status.py index 5302626..aa6811f 100644 --- a/tests/data/car_status.py +++ b/tests/data/car_status.py @@ -5,8 +5,8 @@ FUEL_CAR_STATUS = { 'airConditioning': {'updatedAt': '2021-04-01T16:17:01Z', 'status': 'Disabled', 'programs': [ {'enabled': False, 'slot': 1, 'recurrence': 'Daily', 'start': 'PT21H40M', 'occurence': {'day': ['Sat']}}]}}, - 'energy': [{'updatedAt': '2021-02-23T22:29:03Z', 'type': 'Fuel', 'level': 0}, - {'updatedAt': '2021-04-01T16:17:01Z', 'type': 'Electric', 'level': 70, 'autonomy': 192, + 'energy': [{'createdAt': '2021-02-23T22:29:03Z', 'type': 'Fuel', 'level': 0}, + {'createdAt': '2021-04-01T16:17:01Z', 'type': 'Electric', 'level': 70, 'autonomy': 192, 'charging': {'plugged': True, 'status': 'InProgress', 'remainingTime': 'PT0S', 'chargingRate': 20, 'chargingMode': 'Slow', 'nextDelayedTime': 'PT21H30M'}}], 'createdAt': '2021-04-01T16:17:01Z', @@ -24,15 +24,15 @@ ELECTRIC_CAR_STATUS = { "lastPosition": {"type": "Feature", "geometry": {"type": "Point", "coordinates": [-1.59008, 47.274, 30]}, "properties": {"updatedAt": "2021-03-29T06:22:51Z", "type": "Acquire", "signalQuality": 9}}, "preconditionning": {"airConditioning": {"updatedAt": "2022-03-26T10:52:11Z", "status": "Disabled"}}, - "energy": [{"updatedAt": "2021-09-14T20:39:06Z", "type": "Fuel", "level": 0}, - {"updatedAt": "2022-03-26T11:02:54Z", "type": "Electric", "level": 59, "autonomy": 122, + "energy": [{"createdAt": "2021-09-14T20:39:06Z", "type": "Fuel", "level": 0}, + {"createdAt": "2022-03-26T11:02:54Z", "type": "Electric", "level": 59, "autonomy": 122, "charging": {"plugged": False, "status": "Disconnected", "remainingTime": "PT0S", "chargingRate": 0, "chargingMode": "No", "nextDelayedTime": "PT22H31M"}}], "createdAt": "2022-03-26T11:02:54Z", "battery": {"voltage": 83.5, "current": 0, "createdAt": "2022-03-26T10:52:11Z"}, "kinetic": {"createdAt": "2021-03-29T06:22:51Z", "moving": True}, "privacy": {"createdAt": "2022-03-26T11:02:53Z", "state": "None"}, - "service": {"type": "Electric", "updatedAt": "2022-03-26T11:02:54Z"}, "_links": {"self": { + "service": {"type": "Electric", "createdAt": "2022-03-26T11:02:54Z"}, "_links": {"self": { "href": "https://api.groupe-psa.com/connectedcar/v4/user/vehicles/aa/status"}, "vehicles": { "href": "https://api.groupe-psa.com/connectedcar/v4/user/vehicles/aa"}},