Skip to content

Commit

Permalink
Ignore check for vehicle finder remote service (#643)
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe authored Aug 4, 2024
1 parent 812aa5a commit d23660f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.5.5
rev: v0.5.6
hooks:
- id: ruff
args:
- --fix
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
args:
Expand All @@ -24,7 +24,7 @@ repos:
exclude_types: [csv, json]
exclude: ^test/responses/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.0
rev: v1.11.1
hooks:
- id: mypy
name: mypy
Expand Down
8 changes: 7 additions & 1 deletion bimmer_connected/tests/test_remote_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,16 @@ async def test_vehicles_without_enabled_services(bmw_fixture: respx.Router):
vehicle.update_state({"capabilities": {}})

for service in ALL_SERVICES.values():
with pytest.raises(ValueError):
# Vehicle finder always works, even if API capabilities say different
if service["call"] == "trigger_remote_vehicle_finder":
await getattr(vehicle.remote_services, service["call"])( # type: ignore[call-overload]
*service.get("args", []), **service.get("kwargs", {})
)
else:
with pytest.raises(ValueError):
await getattr(vehicle.remote_services, service["call"])( # type: ignore[call-overload]
*service.get("args", []), **service.get("kwargs", {})
)


@pytest.mark.asyncio
Expand Down
5 changes: 3 additions & 2 deletions bimmer_connected/vehicle/remote_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,9 @@ async def trigger_send_poi(self, poi: Union[PointOfInterest, Dict]) -> RemoteSer

async def trigger_remote_vehicle_finder(self) -> RemoteServiceStatus:
"""Trigger the vehicle finder."""
if not self._vehicle.is_vehicle_tracking_enabled:
raise ValueError(f"Vehicle does not support remote service '{Services.VEHICLE_FINDER.value}'.")
# Even if the API reports this as False, calling the service still works
# if not self._vehicle.is_vehicle_tracking_enabled:
# raise ValueError(f"Vehicle does not support remote service '{Services.VEHICLE_FINDER.value}'.")

status = await self.trigger_remote_service(Services.VEHICLE_FINDER)
result = await self._get_event_position(status.event_id)
Expand Down

0 comments on commit d23660f

Please sign in to comment.