hass-core/tests/components/bmw_connected_drive/conftest.py
rikroe 52ef4a3b75
Ensure state update after BMW remote service execution (#93745)
Co-authored-by: rikroe <rikroe@users.noreply.github.com>
2023-05-29 23:28:06 +02:00

34 lines
906 B
Python

"""Fixtures for BMW tests."""
from unittest.mock import AsyncMock, Mock
from bimmer_connected.api.authentication import MyBMWAuthentication
from bimmer_connected.vehicle.remote_services import RemoteServices, RemoteServiceStatus
import pytest
from homeassistant.components.bmw_connected_drive.coordinator import (
BMWDataUpdateCoordinator,
)
from . import mock_login, mock_vehicles
@pytest.fixture
async def bmw_fixture(monkeypatch):
"""Patch the MyBMW Login and mock HTTP calls."""
monkeypatch.setattr(MyBMWAuthentication, "login", mock_login)
monkeypatch.setattr(
RemoteServices,
"trigger_remote_service",
AsyncMock(return_value=RemoteServiceStatus({"eventStatus": "EXECUTED"})),
)
monkeypatch.setattr(
BMWDataUpdateCoordinator,
"async_update_listeners",
Mock(),
)
with mock_vehicles():
yield mock_vehicles