test_wiki_overlay.py¶
tests/test_wiki_overlay.py
`--wiki-config`: an organisation's wiki settings layered over a repository's own (#73 item 5).
test_an_overlay_carrying_other_sections_is_refused_by_name
None test_wiki_overlay.test_an_overlay_carrying_other_sections_is_refused_by_name(Path tmp_path)
An overlay layers `wiki:` only: requirements and tests stay the repository's.
Checks
assert any("tests" in p and "wiki:" in p for p in problems), problems
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | inferred | test_an_overlay_carrying_other_sections_is_refused_by_name → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_an_overlay_carrying_other_sections_is_refused_by_name → load_wiki_config → _comments → all |
Source · 10 lines
def test_an_overlay_carrying_other_sections_is_refused_by_name(tmp_path: Path) -> None:
"""@brief An overlay layers `wiki:` only: requirements and tests stay the repository's."""
repo = _repo(tmp_path)
overlay = tmp_path / "org.yaml"
overlay.write_text("wiki:\n title: Org\ntests:\n junit: [x.xml]\n")
with wiki_overlay(overlay):
_config, problems = load_wiki_config(repo)
assert any("tests" in p and "wiki:" in p for p in problems), problems
Activity · 6 steps
test_the_overlay_merges_over_the_repositorys_wiki_section
None test_wiki_overlay.test_the_overlay_merges_over_the_repositorys_wiki_section(Path tmp_path)
Mappings merge key by key; the repository's other sections are untouched.
Checks
assert not problems, problemsassert palette["acc"] == "#0969da" and palette["ink"] == "#222222"assert config.title == "Mine" and config.junit == ("build/junit.xml",)
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_the_overlay_merges_over_the_repositorys_wiki_section → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_the_overlay_merges_over_the_repositorys_wiki_section → load_wiki_config → _comments → all |
Source · 13 lines
def test_the_overlay_merges_over_the_repositorys_wiki_section(tmp_path: Path) -> None:
"""@brief Mappings merge key by key; the repository's other sections are untouched."""
repo = _repo(tmp_path)
overlay = tmp_path / "org.yaml"
overlay.write_text("wiki:\n theme:\n palette: {accent: '#0969da'}\n")
with wiki_overlay(overlay):
config, problems = load_wiki_config(repo)
assert not problems, problems
palette = dict(config.theme.palette)
assert palette["acc"] == "#0969da" and palette["ink"] == "#222222"
assert config.title == "Mine" and config.junit == ("build/junit.xml",)
Activity · 9 steps
test_without_an_overlay_nothing_changes
None test_wiki_overlay.test_without_an_overlay_nothing_changes(Path tmp_path)
The overlay applies only inside its context.
Checks
assert load_wiki_config(repo)[0].title == "Org"assert load_wiki_config(repo)[0].title == "Mine"
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-GUARD-012 | measured | test_without_an_overlay_nothing_changes → load_wiki_config → _requirements_section → read_requirements_section |
| REQ-DDB-WIKI-054 | inferred | test_without_an_overlay_nothing_changes → load_wiki_config → _comments → all |
Source · 10 lines
def test_without_an_overlay_nothing_changes(tmp_path: Path) -> None:
"""@brief The overlay applies only inside its context."""
repo = _repo(tmp_path)
overlay = tmp_path / "org.yaml"
overlay.write_text("wiki:\n title: Org\n")
with wiki_overlay(overlay):
assert load_wiki_config(repo)[0].title == "Org"
assert load_wiki_config(repo)[0].title == "Mine"