hass-core/tests/components/epion/conftest.py
Leendert Gravendeel 5011a25ea6
Add Epion integration ()
* Adding initial Epion Air integration logic

* Skipping sensors with missing data

* Patching Epion integration

* Adding additional Epion measurement types

* Cleaning up logging

* Cleaning up code

* Fixing error handling for invalid Epion keys

* Adding tests and improving error handling

* Patching Epion tests

* Cleaning up Epion integration code

* Bumping Epion package and including missing files

* Moving data updates to coordinator and addressing feedback

* Improve exception handling

* Exposing model name and firmware version

* Cleaning up code according to review

* Cleaning up code according to review

* Adding check to prevent duplicate account setup

* Refactoring tests and checking for duplicates

* Cleaning up test code according to review

* Cleaning up test code

* Removing entity name overrides

* Fix code format for tests

* Adding missing newlines in JSON files

* Fixing formatting

* Updating device method to always return a device

* Updating coordinator
2024-01-16 06:39:50 +01:00

25 lines
766 B
Python

"""Epion tests configuration."""
from unittest.mock import MagicMock, patch
import pytest
from tests.common import load_json_object_fixture
@pytest.fixture
def mock_epion():
"""Build a fixture for the Epion API that connects successfully and returns one device."""
current_one_device_data = load_json_object_fixture(
"epion/get_current_one_device.json"
)
mock_epion_api = MagicMock()
with patch(
"homeassistant.components.epion.config_flow.Epion",
return_value=mock_epion_api,
) as mock_epion_api, patch(
"homeassistant.components.epion.Epion",
return_value=mock_epion_api,
):
mock_epion_api.return_value.get_current.return_value = current_one_device_data
yield mock_epion_api