[PR #158] [MERGED] [tests] Add local-server e2e and CLI smoke, report coverage in CI #161

Closed
opened 2026-10-13 19:48:10 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/158
Author: @Glitchy-Sheep
Created: 8/17/2026
Status: ✅ Merged
Merged: 8/17/2026
Merged by: @Glitchy-Sheep

Base: main ← Head: test/e2e-and-coverage-gate


📝 Commits (1)

  • 7333c6e test: Add local-server e2e and CLI smoke, report coverage in CI

📊 Changes

5 files changed (+246 additions, -6 deletions)

View changed files

📝 .github/workflows/ci.yaml (+3 -1)
📝 Taskfile.yml (+2 -2)
📝 pyproject.toml (+3 -3)
➕ test/e2e/download_flow_test.py (+197 -0)
➕ test/unit/cli/cli_smoke_test.py (+41 -0)

📄 Description

[tests] Add local-server e2e and CLI smoke, report coverage in CI

Summary

Final PR of the test safety-net stage. The e2e test is the piece the audit called the key to a safe DI/use-case refactoring: a full download run must produce exactly the same tree on disk, byte for byte where it matters. No network, no credentials - everything runs against a local server, so it works in CI and forks.

What is in here

E2e (test/e2e/download_flow_test.py):

  • a local aiohttp test server plays Boosty: serves the sanitized fixture post (rewriting its fake hosts to itself) and small media blobs
  • the run is wired like the real app: real BoostyAPIClient (pointed at the local server), real file downloader, real SQLite cache, real HTML renderer; only the console reporter and yt-dlp are absent
  • test 1 asserts the on-disk contract: post folder named date - title (id8), image with a guessed .png, file with the author's exact name and bytes, video Fixture video (10000000).mp4, audio, post.html with the title and relative links
  • test 2 asserts the cache promise: a second run makes zero media requests and reports the post as cached

CLI smoke (test/unit/cli/cli_smoke_test.py): the real typer app through CliRunner - every help screen exits 0, download without --username is a usage error (exit 2), not a crash.

Coverage in CI: the test step runs task test:cov, so every CI log shows the coverage table (78% now). Reported, not enforced - a deliberate choice.

Verification

  • task ci checks green: lint, format, pyright, 164 passed + 1 xfail, build
  • Both e2e tests pass in ~1.5s, no external requests

Notes

  • test/e2e added to testpaths and both Taskfile test targets
  • No changelog entry: tests and CI only (ci/skip-changelog)
  • This closes the safety-net stage: client, cache, filters, mapper golden, HTML golden, e2e, smoke - all eight audit categories exist

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Glitchy-Sheep/boosty-downloader/pull/158 **Author:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Created:** 8/17/2026 **Status:** ✅ Merged **Merged:** 8/17/2026 **Merged by:** [@Glitchy-Sheep](https://github.com/Glitchy-Sheep) **Base:** `main` ← **Head:** `test/e2e-and-coverage-gate` --- ### 📝 Commits (1) - [`7333c6e`](https://github.com/Glitchy-Sheep/boosty-downloader/commit/7333c6ef941f7b8a7bfab65d7cd667790be3978d) test: Add local-server e2e and CLI smoke, report coverage in CI ### 📊 Changes **5 files changed** (+246 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yaml` (+3 -1) 📝 `Taskfile.yml` (+2 -2) 📝 `pyproject.toml` (+3 -3) ➕ `test/e2e/download_flow_test.py` (+197 -0) ➕ `test/unit/cli/cli_smoke_test.py` (+41 -0) </details> ### 📄 Description # [tests] Add local-server e2e and CLI smoke, report coverage in CI ## Summary Final PR of the test safety-net stage. The e2e test is the piece the audit called the key to a safe DI/use-case refactoring: a full download run must produce exactly the same tree on disk, byte for byte where it matters. No network, no credentials - everything runs against a local server, so it works in CI and forks. ## What is in here **E2e** (`test/e2e/download_flow_test.py`): - a local aiohttp test server plays Boosty: serves the sanitized fixture post (rewriting its fake hosts to itself) and small media blobs - the run is wired like the real app: real `BoostyAPIClient` (pointed at the local server), real file downloader, real SQLite cache, real HTML renderer; only the console reporter and yt-dlp are absent - test 1 asserts the on-disk contract: post folder named `date - title (id8)`, image with a guessed `.png`, file with the author's exact name and bytes, video `Fixture video (10000000).mp4`, audio, post.html with the title and relative links - test 2 asserts the cache promise: a second run makes zero media requests and reports the post as cached **CLI smoke** (`test/unit/cli/cli_smoke_test.py`): the real typer app through `CliRunner` - every help screen exits 0, `download` without `--username` is a usage error (exit 2), not a crash. **Coverage in CI**: the test step runs `task test:cov`, so every CI log shows the coverage table (78% now). Reported, not enforced - a deliberate choice. ## Verification - `task ci` checks green: lint, format, pyright, **164 passed + 1 xfail**, build - Both e2e tests pass in ~1.5s, no external requests ## Notes - `test/e2e` added to `testpaths` and both Taskfile test targets - No changelog entry: tests and CI only (`ci/skip-changelog`) - This closes the safety-net stage: client, cache, filters, mapper golden, HTML golden, e2e, smoke - all eight audit categories exist --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-13 19:48:10 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Glitchy-Sheep/boosty-downloader#161
No description provided.