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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
681 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."""
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 = {
"condition": "cloudy",
"temperature": 15,
"pressure": 100,
"humidity": 50,
"wind_speed": 10,
"wind_bearing": "NE",
2023-08-17 08:45:23 +03:00
"dew_point": 12.1,
}
mock_data.get_forecast.return_value = {}
yield mock_data