test_a_wiki_is_built_on_demand_and_then_served

Tests › tests/test_wiki_hub.py

passed Passed in the packaged run.

What this test is for

Why it exists

First visit starts a build and says so; once built, the site is served.

Verifies REQ-DDB-WIKI-054

Given

  1. server, builder, live, _gone = hub
  2. cookie = f"clew_wiki={server.token}"
3 more
  1. status, body, _h = _get(f"http://127.0.0.1:{server.port}/r/{live.slug}/", cookie)
  2. builder.release.set()
  3. for _ in range(100): status, body, _h = _get(f"http://127.0.0.1:{server.port}/r/{live.slug}/", cookie) if status == 200: break threading.Event().wait(0.05)
→

When

  1. —
→

Then

  1. ✓ status equals 202
  2. ✓ body contains "Building"
  3. ✓ body contains 'http-equiv="refresh"'
  4. ✓ status equals 200
  5. ✓ body contains f"wiki of {live.slug}"
  6. ✓ builder.calls equals [live.slug]

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

thread `WikiHub._build` — `_build` (clew/mcp_server/wikihub.py) · 5 of 7 steps

thread startthread startthread startthread startAnswer: query engine + MCP serverAnswer: query engine + MCP serverAnswer: query engine + MCP serverAnswer: query engine + MCP serverWiki: this siteWiki: this siteWiki: this siteWiki: this sitetry (line 334)tryloop (line 115)loop_build1. _build → site_dir1site_dir▶ test enters2. site_dir → wiki_site_dir2wiki_site_dir3. _build → publish3publish4. publish → list4list5. list → link5link6. _build → find6find7. _build → 7… 1 call not run

tests/test_wiki_hub.py:104 · its file's page

What it checks (3)

  1. assert status == 202 and "Building" in body and 'http-equiv="refresh"' in body not attributed
  2. assert status == 200 and f"wiki of {live.slug}" in body not attributed
  3. assert builder.calls == [live.slug] not attributed

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_a_wiki_is_built_on_demand_and_then_served→_get

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

Requirements it verifies (1)

requirementlinked byimplementers exercised
REQ-DDB-WIKI-054catalogunknown
Also reaches 4 requirements

Its run touches their code; that is reach, not proof.