Skip to content

Commit

Permalink
Fix linting and adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CM000n committed Nov 9, 2023
1 parent 296f99a commit 6984d79
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mytoyota/models/vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def is_connected_services_enabled(self) -> bool:
):
vin_specific_connected_service = None
for device in self._connected_services["connectedService"]["devices"]:
if (device.get("vin") == self.vin):
if device.get("vin") == self.vin:
vin_specific_connected_service = device
break
if vin_specific_connected_service["state"] == "ACTIVE":
Expand Down
36 changes: 33 additions & 3 deletions tests/test_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ def test_vehicle_init(self):
for veh in vehicle_fixtures:
vehicle = Vehicle(
vehicle_info=veh,
connected_services={"connectedService": {"status": "ACTIVE"}},
connected_services={
"connectedService": {
"devices": [
{
"brand": "TOYOTA",
"state": "ACTIVE",
"vin": veh.get("vin"),
}
]
}
},
)

assert vehicle.vin == veh.get("vin")
Expand Down Expand Up @@ -134,7 +144,17 @@ def test_vehicle_init_status(self):

vehicle = Vehicle(
vehicle_info=vehicle_fixtures[0],
connected_services={"connectedService": {"status": "ACTIVE"}},
connected_services={
"connectedService": {
"devices": [
{
"brand": "TOYOTA",
"state": "ACTIVE",
"vin": vehicle_fixtures[0].get("vin"),
}
]
}
},
odometer=odometer_fixture,
status=status_fixture,
)
Expand Down Expand Up @@ -175,7 +195,17 @@ def test_vehicle_init_status_legacy(self):

vehicle = Vehicle(
vehicle_info=vehicle_fixtures[0],
connected_services={"connectedService": {"status": "ACTIVE"}},
connected_services={
"connectedService": {
"devices": [
{
"brand": "TOYOTA",
"state": "ACTIVE",
"vin": vehicle_fixtures[0].get("vin"),
}
]
}
},
odometer=odometer_fixture,
status_legacy=status_fixture,
)
Expand Down

0 comments on commit 6984d79

Please sign in to comment.