Harden Open-Meteo rate limiting
This commit is contained in:
@@ -4,6 +4,7 @@ import time
|
||||
from src.database.runtime_state import (
|
||||
DailyRecordRepository,
|
||||
OpenMeteoCacheRepository,
|
||||
OpenMeteoRateLimitRepository,
|
||||
ProbabilitySnapshotRepository,
|
||||
RuntimeStateDB,
|
||||
TelegramAlertStateRepository,
|
||||
@@ -77,6 +78,16 @@ def test_open_meteo_cache_repository_roundtrip(tmp_path, monkeypatch):
|
||||
assert loaded['ensemble']['ankara']['spread'] == 1.5
|
||||
|
||||
|
||||
def test_open_meteo_rate_limit_repository_roundtrip(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv('POLYWEATHER_DB_PATH', str(tmp_path / 'polyweather.db'))
|
||||
repo = OpenMeteoRateLimitRepository(RuntimeStateDB(str(tmp_path / 'polyweather.db')))
|
||||
|
||||
repo.set_until(12345.0, reason='429')
|
||||
|
||||
loaded = repo.load_until()
|
||||
assert loaded == 12345.0
|
||||
|
||||
|
||||
def test_truth_record_repository_tracks_revisions(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv('POLYWEATHER_DB_PATH', str(tmp_path / 'polyweather.db'))
|
||||
db = RuntimeStateDB(str(tmp_path / 'polyweather.db'))
|
||||
|
||||
Reference in New Issue
Block a user