Improve coordinator logic in Tessie to allow sleep (#107988)
* Poll status before state * Tests
This commit is contained in:
parent
cdb798bec0
commit
32b0bf6b4e
6 changed files with 60 additions and 31 deletions
|
@ -5,7 +5,11 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
from .common import TEST_STATE_OF_ALL_VEHICLES, TEST_VEHICLE_STATE_ONLINE
|
||||
from .common import (
|
||||
TEST_STATE_OF_ALL_VEHICLES,
|
||||
TEST_VEHICLE_STATE_ONLINE,
|
||||
TEST_VEHICLE_STATUS_AWAKE,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -18,6 +22,16 @@ def mock_get_state():
|
|||
yield mock_get_state
|
||||
|
||||
|
||||
@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
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_get_state_of_all_vehicles():
|
||||
"""Mock get_state_of_all_vehicles function."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue