2022-08-16 19:36:33 +00:00
|
|
|
"""Fixtures for BMW tests."""
|
|
|
|
|
2023-03-30 17:37:03 +00:00
|
|
|
from unittest.mock import AsyncMock
|
|
|
|
|
2023-01-11 00:09:45 +00:00
|
|
|
from bimmer_connected.api.authentication import MyBMWAuthentication
|
2023-03-30 17:37:03 +00:00
|
|
|
from bimmer_connected.vehicle.remote_services import RemoteServices, RemoteServiceStatus
|
2022-08-16 19:36:33 +00:00
|
|
|
import pytest
|
|
|
|
|
2023-01-11 00:09:45 +00:00
|
|
|
from . import mock_login, mock_vehicles
|
2022-08-16 19:36:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
async def bmw_fixture(monkeypatch):
|
2023-01-11 00:09:45 +00:00
|
|
|
"""Patch the MyBMW Login and mock HTTP calls."""
|
|
|
|
monkeypatch.setattr(MyBMWAuthentication, "login", mock_login)
|
|
|
|
|
2023-03-30 17:37:03 +00:00
|
|
|
monkeypatch.setattr(
|
|
|
|
RemoteServices,
|
|
|
|
"trigger_remote_service",
|
|
|
|
AsyncMock(return_value=RemoteServiceStatus({"eventStatus": "EXECUTED"})),
|
|
|
|
)
|
|
|
|
|
2023-01-11 00:09:45 +00:00
|
|
|
with mock_vehicles():
|
|
|
|
yield mock_vehicles
|