abf7181475
load_config no longer reads a bgg_username toml key — BGG_USERNAME in the environment is its single home (public, but the account should have exactly one). Docs, messages, and tests updated to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
32 lines
985 B
Python
32 lines
985 B
Python
"""The one test allowed to touch the real BGG API. Read-only, skipped by
|
|
default; run with: uv run pytest --run-live -m live
|
|
|
|
Needs BGG_USERNAME and BGG_API_TOKEN in the environment
|
|
(register at https://boardgamegeek.com/applications).
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from bggpipe.bgg_client import BGGClient
|
|
from bggpipe.config import load_config
|
|
|
|
|
|
@pytest.mark.live
|
|
def test_fetch_own_collection_read_only(tmp_path: Path) -> None:
|
|
cfg = load_config()
|
|
if not cfg.bgg_username:
|
|
pytest.skip("set BGG_USERNAME to run the live smoke test")
|
|
if not os.environ.get("BGG_API_TOKEN"):
|
|
pytest.skip("set BGG_API_TOKEN to run the live smoke test")
|
|
|
|
# fresh cache dir so this genuinely exercises the live API + 202 queue
|
|
client = BGGClient(cache_dir=tmp_path / "cache")
|
|
items = client.collection_full(cfg.bgg_username)
|
|
assert isinstance(items, list)
|
|
assert all(item.own for item in items)
|