49 lines
1.3 KiB
Python
49 lines
1.3 KiB
Python
"""Test configuration and fixtures for elprisenligenu tests."""
|
|
|
|
from datetime import datetime
|
|
from zoneinfo import ZoneInfo
|
|
import pytest
|
|
|
|
|
|
def pytest_configure(config: pytest.Config) -> None:
|
|
"""Configure pytest with custom markers."""
|
|
config.addinivalue_line(
|
|
"markers",
|
|
"integration: marks tests as integration tests (may require internet)",
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def mock_api_response() -> list[dict]:
|
|
"""Fixture providing a mock API response."""
|
|
return [
|
|
{
|
|
"DKK_per_kWh": 1.3929,
|
|
"EUR_per_kWh": 0.18729,
|
|
"EXR": 7.437118,
|
|
"time_start": "2024-10-29T00:00:00+01:00",
|
|
"time_end": "2024-10-29T01:00:00+01:00",
|
|
},
|
|
{
|
|
"DKK_per_kWh": 1.30291,
|
|
"EUR_per_kWh": 0.17519,
|
|
"EXR": 7.437118,
|
|
"time_start": "2024-10-29T01:00:00+01:00",
|
|
"time_end": "2024-10-29T02:00:00+01:00",
|
|
},
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_hour_data() -> dict:
|
|
"""Fixture providing sample HourData for testing."""
|
|
|
|
tz = ZoneInfo("Europe/Copenhagen")
|
|
return {
|
|
"DKK_per_kWh": 1.2345,
|
|
"EUR_per_kWh": 0.1659,
|
|
"EXR": 7.4371,
|
|
"time_start": datetime(2024, 10, 29, 12, 0, 0, tzinfo=tz),
|
|
"time_end": datetime(2024, 10, 29, 13, 0, 0, tzinfo=tz),
|
|
}
|