mirror of
https://github.com/home-assistant/core.git
synced 2025-12-20 02:48:57 +00:00
* Initial version * Baseline release * Refactor based on first PR feedback * Refactoring based on second PR feedback * Initial version * Baseline release * Refactor based on first PR feedback * Refactoring based on second PR feedback * Refactoring based on PR feedback * Refactoring based on PR feedback * Remove extra attribute soil type Soil type isn't really a sensor, but more like a configuration entity. Move soil type to a different PR to keep this PR simpler. * Refactor SensoterraSensor to a named tuple * Implement feedback on PR * Remove .coveragerc * Add async_set_unique_id to config flow * Small fix based on feedback * Add test form unique_id * Fix * Fix --------- Co-authored-by: Joostlek <joostlek@outlook.com>
33 lines
837 B
Python
33 lines
837 B
Python
"""Common fixtures for the Sensoterra tests."""
|
|
|
|
from collections.abc import Generator
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
|
|
from .const import API_TOKEN
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_setup_entry() -> Generator[AsyncMock, None, None]:
|
|
"""Override async_setup_entry."""
|
|
with patch(
|
|
"homeassistant.components.sensoterra.async_setup_entry",
|
|
return_value=True,
|
|
) as mock_entry:
|
|
yield mock_entry
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_customer_api_client() -> Generator[AsyncMock, None, None]:
|
|
"""Override async_setup_entry."""
|
|
with (
|
|
patch(
|
|
"homeassistant.components.sensoterra.config_flow.CustomerApi",
|
|
autospec=True,
|
|
) as mock_client,
|
|
):
|
|
mock = mock_client.return_value
|
|
mock.get_token.return_value = API_TOKEN
|
|
yield mock
|