test_wiki_vendor_owners.py¶
tests/test_wiki_vendor_owners.py
Vendor areas are separate boundary blocks sized by their use; owners overlay the map and file pages, and an audience can redact them (P5, item 3; 2.0.0).
test_an_audience_can_redact_owners
test_an_audience_can_redact_owners(root: Path)
tests/test_wiki_vendor_owners.py:133
Checks
assert all("owner" not in n for n in web["nodes"])assert '<option value="owner">' not in pages["map.html"]assert not any("@net-team" in v for v in pages.values())
Result: passed
Verifies
Source · 7 lines
def test_an_audience_can_redact_owners(root: Path) -> None:
"""@brief exclude_owners: no owner on any node, no lens, no names on file pages."""
pages = _site(root, "public")
web = _web(pages["map.html"])
assert all("owner" not in n for n in web["nodes"])
assert '<option value="owner">' not in pages["map.html"]
assert not any("@net-team" in v for v in pages.values())Activity · 5 steps
test_calls_into_a_vendor_area_end_at_its_boundary_node
test_calls_into_a_vendor_area_end_at_its_boundary_node(root: Path)
tests/test_wiki_vendor_owners.py:108
Checks
assert not names & {"lib_a", "a_inner", "a_more", "lib_b"}assert callers == {"sock_open", "main"}
Result: passed
Verifies
Source · 12 lines
def test_calls_into_a_vendor_area_end_at_its_boundary_node(root: Path) -> None:
"""@brief No vendor function is drawn; each first-party caller has an edge to the area's node."""
web = _web(_site(root, None)["map.html"])
names = {n["name"] for n in web["nodes"]}
assert not names & {"lib_a", "a_inner", "a_more", "lib_b"}
index = {b["id"]: i for i, b in enumerate(web["boundary"])}
callers = {
web["nodes"][n]["name"]
for n, j in web["boundary_edges"]
if j == index["Vendor: third_party/a"]
}
assert callers == {"sock_open", "main"}Activity · 6 steps
test_owners_overlay_the_map_and_the_file_page
test_owners_overlay_the_map_and_the_file_page(root: Path)
tests/test_wiki_vendor_owners.py:122
Checks
assert owners["sock_open"] == "@net-team" and owners["main"] == "@core"assert '<option value="owner">' in pages["map.html"]assert "@net-team" in file_page
Result: passed
Verifies
Source · 9 lines
def test_owners_overlay_the_map_and_the_file_page(root: Path) -> None:
"""@brief Nodes carry their owner, the lens is offered, the file page lists owners."""
pages = _site(root, None)
web = _web(pages["map.html"])
owners = {n["name"]: n.get("owner") for n in web["nodes"]}
assert owners["sock_open"] == "@net-team" and owners["main"] == "@core"
assert '<option value="owner">' in pages["map.html"]
file_page = next(v for k, v in pages.items() if k.startswith("sym-src-net-sock-c"))
assert "@net-team" in file_pageActivity · 7 steps
test_vendor_areas_sit_outside_the_first_party_circle
test_vendor_areas_sit_outside_the_first_party_circle(root: Path)
tests/test_wiki_vendor_owners.py:84
Checks
assert not any(b["id"].startswith("Vendor") for b in web["blocks"])assert spans == pytest.approx(2 * math.pi - _GAP * len(web["blocks"]), abs=1e-3)assert (a["calls_in"], b["calls_in"]) == (2, 1)assert a["r"] > b["r"]assert min(math.hypot(x["x"], x["y"]) for x in web["boundary"]) > outer
Result: passed
Verifies
Source · 22 lines
def test_vendor_areas_sit_outside_the_first_party_circle(root: Path) -> None:
"""THE OWNER'S RULING (round 5): "VENDOR OUTSIDE THE BOUNDARY (C4 external systems): one node per
declared submodule, sized by calls INTO it; first-party web gets the full circle; calls into
vendor end at the boundary." P5.3 first drew each area as a WEDGE inside the circle (sized by
use); that was the interim this replaces.
@brief No vendor wedge; first-party wedges fill the circle; each area is one boundary node.
"""
import math
web = _web(_site(root, None)["map.html"])
assert not any(b["id"].startswith("Vendor") for b in web["blocks"])
from clew.wiki.web import _GAP
spans = sum(b["a1"] - b["a0"] for b in web["blocks"])
assert spans == pytest.approx(2 * math.pi - _GAP * len(web["blocks"]), abs=1e-3)
boundary = {b["id"]: b for b in web["boundary"]}
a, b = boundary["Vendor: third_party/a"], boundary["Vendor: third_party/b"]
assert (a["calls_in"], b["calls_in"]) == (2, 1)
assert a["r"] > b["r"]
outer = web["geometry"]["r0"] + (web["max_ring"] + 1) * web["geometry"]["band"]
assert min(math.hypot(x["x"], x["y"]) for x in web["boundary"]) > outer