test_the_repository_and_home_paths_are_redacted¶
Tests › tests/test_wiki_trace_redact.py
What this test is for
Why it exists
`<repo>` for the repository, `~` for the home directory; the key untouched.
Given
home = tmp_path / "home" / "dev"repo = home / "work" / "proj"
4 more
(repo / "traces").mkdir(parents=True)monkeypatch.setenv("HOME", str(home))value = f"[PosixPath('{repo}/src/a.py'), '{home}/.cache/x']"(repo / "traces" / "t.json").write_text(json.dumps(_span(value)))
When
[(rel, otlp)] = load_traces(repo, ("traces/*.json",))attr = otlp["resourceSpans"][0]["scopeSpans"][0]["spans"][0]["attributes"][0]
Then
- ✓ attr["key"] equals "code.return"
- ✓ attr["value"]["stringValue"] equals "[PosixPath('<repo>/src/a.py'), '~/.cache/x']"
- ✓ json.dumps(otlp) does not contain str(home)
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.
Build this wiki from the index · 1 of 400 steps
… 81 earlier steps
… 314 later steps
tests/test_wiki_trace_redact.py:43 · its file's page
What it checks (3)
assert attr["key"] == "code.return"not attributedassert attr["value"]["stringValue"] == "[PosixPath('<repo>/src/a.py'), '~/.cache/x']"not attributedassert str(home) not in json.dumps(otlp)not attributed
Where the product reaches it
build_wiki→_build_site→load_traces(flow)
Call flow
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.
Also reaches 2 requirements
Its run touches their code; that is reach, not proof.
- REQ-DDB-WIKI-036 measured
- REQ-DDB-WIKI-049 measured