2023-12-12 06:30:54 +00:00
|
|
|
"""Fixtures for Tessie."""
|
2024-03-08 13:44:56 +00:00
|
|
|
|
2023-12-12 06:30:54 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from unittest.mock import patch
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
2024-01-18 16:40:36 +00:00
|
|
|
from .common import (
|
|
|
|
TEST_STATE_OF_ALL_VEHICLES,
|
|
|
|
TEST_VEHICLE_STATE_ONLINE,
|
|
|
|
TEST_VEHICLE_STATUS_AWAKE,
|
|
|
|
)
|
2023-12-12 06:30:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def mock_get_state():
|
|
|
|
"""Mock get_state function."""
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.tessie.coordinator.get_state",
|
|
|
|
return_value=TEST_VEHICLE_STATE_ONLINE,
|
|
|
|
) as mock_get_state:
|
|
|
|
yield mock_get_state
|
|
|
|
|
|
|
|
|
2024-01-18 16:40:36 +00:00
|
|
|
@pytest.fixture
|
|
|
|
def mock_get_status():
|
|
|
|
"""Mock get_status function."""
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.tessie.coordinator.get_status",
|
|
|
|
return_value=TEST_VEHICLE_STATUS_AWAKE,
|
|
|
|
) as mock_get_status:
|
|
|
|
yield mock_get_status
|
|
|
|
|
|
|
|
|
2023-12-12 06:30:54 +00:00
|
|
|
@pytest.fixture
|
|
|
|
def mock_get_state_of_all_vehicles():
|
|
|
|
"""Mock get_state_of_all_vehicles function."""
|
|
|
|
with patch(
|
|
|
|
"homeassistant.components.tessie.config_flow.get_state_of_all_vehicles",
|
|
|
|
return_value=TEST_STATE_OF_ALL_VEHICLES,
|
|
|
|
) as mock_get_state_of_all_vehicles:
|
|
|
|
yield mock_get_state_of_all_vehicles
|