Files
rf4-spotter/tests/test_community_cli.py
T
ik 3f468799bd
CI / backend-and-migrations (push) Canceled after 0s
CI / astro-build (push) Canceled after 0s
CI / compose-e2e (push) Canceled after 0s
feat: enforce community source cooldown
2026-09-05 07:52:37 +07:00

16 lines
609 B
Python

from pathlib import Path
import pytest
from rf4_research.community_cli import enforce_fetch_interval, mark_fetch
def test_fetch_cooldown_is_persistent_per_source(tmp_path: Path) -> None:
state_file = tmp_path / "fetch-state.json"
mark_fetch("rf4map-point", state_file=state_file, now=1_000)
with pytest.raises(RuntimeError, match="retry in 1800 seconds"):
enforce_fetch_interval("rf4map-point", state_file=state_file, now=1_000)
enforce_fetch_interval("rf4posts-spot", state_file=state_file, now=1_000)
enforce_fetch_interval("rf4map-point", state_file=state_file, now=2_800)