# tests ## Purpose Pytest suite for `codeberg_to_gitea_migrator`. ## Ownership Project maintainer (Alexander Kucera). ## Local Contracts - pytest `testpaths = ["tests"]` (root `pyproject.toml`). - Test files named `test_*.py`; test functions `test_*`. ## Work Guidance - `test_smoke.py` — package imports + version. - `test_refs.py` — `#NNN`/URL cross-reference rewrite + `NumberMap`. - `test_clients.py` — `ApiClient` pagination, param cleaning, 4xx handling, JSON POST, all via `httpx.MockTransport` (no network). - `test_git.py` — the `GitRunner` seam (auth delivery via non-persisted `extraHeader`, known-secret redaction, timeout/error contract, `ok` never raises) + an AST guard that git is invoked only through `GitRunner`. Driven by a recording exec fake; no git binary, no network. - `test_mirror.py` — the mirror procedure's ordering invariants (capture → prune → mirror push → PR-head push; LFS gated on the probe) and per-op auth wiring (fetch=source, push=target, local ref ops=none), via a recording exec fake that captures command intent only — never the token. - `test_phases.py` — all four entity phases (labels, milestones, issues+PRs two-pass, releases) driven through the `Migration` seam: two `httpx.MockTransport`-backed clients + a `NumberMap`, asserting the paths/bodies the target received and the resulting number-map state. Covers ref rewriting, state-setting, best-effort PR merge (409 tolerated), the deleted-branch `_pr/` head fallback, and the 404-releases skip. No network. - Keep tests network-free: never hit live Codeberg/Gitea from the suite. The end-to-end run is a manual CLI invocation, not a test. ## Verification - `pytest` from the repo root. ## Child DOX Index - No children.