CI / test (push) Canceled after 0s
Introduce a frozen Migration handle binding the identity quintet (src/tgt clients, owner, name, NumberMap) the four entity phases previously received as five loose params. The phases now take the handle; migrate_repo builds one and drives all phases with it. Retire RefCtx and the shared _path helper (absorbed into the handle's .path()/.rewrite() accessors), deleting code rather than leaving dead types. migrate_issues_and_prs mutates m.numbers in place (returns None). Add tests/test_phases.py: the previously-untested entity layer is now reachable through the Migration seam (two mock-transport clients + a number map, no network), covering the two-pass issue/PR flow, label/milestone mappings, state-setting, best-effort PR merge, the deleted-branch head fallback, and release+asset re-upload. Closes #2
33 lines
1.7 KiB
Markdown
33 lines
1.7 KiB
Markdown
# 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/<n>` 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.
|