conftest.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. """Test configuration for Solar of Things integration."""
  2. import pytest
  3. from homeassistant.core import HomeAssistant
  4. from homeassistant.config_entries import ConfigEntry
  5. from pytest_homeassistant_custom_component.common import MockConfigEntry
  6. from custom_components.solar_of_things.const import DOMAIN
  7. @pytest.fixture
  8. def mock_config_entry() -> ConfigEntry:
  9. """Return a mock config entry."""
  10. return MockConfigEntry(
  11. domain=DOMAIN,
  12. data={
  13. "iot_token": "test_token_123",
  14. "station_id": "123456789012345678",
  15. "device_id": "876543210987654321",
  16. },
  17. entry_id="test_entry_id",
  18. )
  19. @pytest.fixture
  20. def mock_api_response():
  21. """Return mock API response data."""
  22. return {
  23. "data": {
  24. "pvInputPower": [{"ts": 1234567890, "value": 2500}],
  25. "acOutputActivePower": [{"ts": 1234567890, "value": 1800}],
  26. "batteryDischargeCurrent": [{"ts": 1234567890, "value": 0}],
  27. "batteryChargingCurrent": [{"ts": 1234567890, "value": 10}],
  28. "batteryVoltage": [{"ts": 1234567890, "value": 48}],
  29. "feedInPower": [{"ts": 1234567890, "value": 500}],
  30. "batterySOC": [{"ts": 1234567890, "value": 75}],
  31. }
  32. }