hass-core/tests/components/met/conftest.py

23 lines
649 B
Python
Raw Normal View History

"""Fixtures for Met weather testing."""
2021-01-01 22:31:56 +01:00
from unittest.mock import AsyncMock, patch
2021-01-01 22:31:56 +01:00
import pytest
@pytest.fixture
def mock_weather():
"""Mock weather data."""
2019-07-31 12:25:30 -07:00
with patch("metno.MetWeatherData") as mock_data:
mock_data = mock_data.return_value
mock_data.fetching_data = AsyncMock(return_value=True)
mock_data.get_current_weather.return_value = {
2019-07-31 12:25:30 -07:00
"condition": "cloudy",
"temperature": 15,
"pressure": 100,
"humidity": 50,
"wind_speed": 10,
"wind_bearing": "NE",
}
mock_data.get_forecast.return_value = {}
yield mock_data