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.

tests/test_wiki_overlay.py:52

Show on the map →

Called by none

Calls _repo, load_wiki_config, wiki_overlay

Checks

  • assert any("tests" in p and "wiki:" in p for p in problems), problems

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012inferredtest_an_overlay_carrying_other_sections_is_refused_by_name → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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
lines 54–54repo = _repo(tmp_path)lines 55–55overlay = tmp_path / "org.yaml"lines 56–56overlay.write_text("wiki:\n title: Org\ntests:\n junit: [x.xml]\n")lines 57–57with wiki_overlay(overlay)lines 58–58_config, problems = load_wiki_config(repo)lines 59–59assert any("tests" in p and "wiki:" in p for p in problems), problems

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.

tests/test_wiki_overlay.py:29

Show on the map →

Called by none

Calls _repo, load_wiki_config, wiki_overlay

Checks

  • assert not problems, problems
  • assert palette["acc"] == "#0969da" and palette["ink"] == "#222222"
  • assert config.title == "Mine" and config.junit == ("build/junit.xml",)

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_the_overlay_merges_over_the_repositorys_wiki_section → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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
lines 31–31repo = _repo(tmp_path)lines 32–32overlay = tmp_path / "org.yaml"lines 33–33overlay.write_text("wiki:\n theme:\n palette: {accent: '#0969da'}\n")lines 34–34with wiki_overlay(overlay)lines 35–35config, problems = load_wiki_config(repo)lines 36–36assert not problems, problemslines 37–37palette = dict(config.theme.palette)lines 38–38assert palette["acc"] == "#0969da" and palette["ink"] == "#222222"lines 39–39assert config.title == "Mine" and config.junit == ("build/junit.xml",)

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.

tests/test_wiki_overlay.py:42

Show on the map →

Called by none

Calls _repo, load_wiki_config, wiki_overlay

Checks

  • assert load_wiki_config(repo)[0].title == "Org"
  • assert load_wiki_config(repo)[0].title == "Mine"

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-012measuredtest_without_an_overlay_nothing_changes → load_wiki_config → _requirements_section → read_requirements_section
REQ-DDB-WIKI-054inferredtest_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"

Activity · 6 steps
lines 44–44repo = _repo(tmp_path)lines 45–45overlay = tmp_path / "org.yaml"lines 46–46overlay.write_text("wiki:\n title: Org\n")lines 47–47with wiki_overlay(overlay)lines 48–48assert load_wiki_config(repo)[0].title == "Org"lines 49–49assert load_wiki_config(repo)[0].title == "Mine"