test_the_script_is_budgeted_and_no_theme_asset_is_remote¶
Tests › tests/test_wiki_site.py
What this test is for
Why it exists
SELF-CONTAINED: no theme stylesheet, layout or script names an http(s) URL, and the one script stays under its byte budget. Deep links and the back button are the script's job: it reads the `#m=` hash and closes on `popstate`.
Verifies REQ-DDB-WIKI-011 REQ-DDB-WIKI-012 REQ-DDB-WIKI-013 REQ-DDB-WIKI-014 REQ-DDB-WIKI-015 REQ-DDB-WIKI-018 REQ-DDB-WIKI-020 REQ-DDB-WIKI-021 REQ-DDB-WIKI-022 REQ-DDB-WIKI-023 REQ-DDB-WIKI-025 REQ-DDB-WIKI-031 REQ-DDB-WIKI-044 REQ-DDB-WIKI-050 REQ-DDB-WIKI-052
Given
js = THEMES / "clew" / "static" / "clew.js"for path in THEMES.rglob("*"): if path.suffix in (".css", ".js", ".html"): text = path.read_text(encoding="utf-8") assert "http://" not in text and "https://" not in text, pathsource = js.read_text(encoding="utf-8")
When
- —
Then
- ✓ js.stat().st_size is at most _JS_BUDGET
- ✓ source contains "#m="
- ✓ source contains "popstate"
tests/test_wiki_site.py:572 · its file's page
What it checks (3)
assert js.stat().st_size <= _JS_BUDGETnot attributedassert "http://" not in text and "https://" not in text, pathnot attributedassert "#m=" in source and "popstate" in sourcenot attributed
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 (15)
| requirement | linked by | implementers exercised |
|---|---|---|
| REQ-DDB-WIKI-011 | catalog | unknown |
| REQ-DDB-WIKI-012 | catalog | unknown |
| REQ-DDB-WIKI-013 | catalog | unknown |
| REQ-DDB-WIKI-014 | catalog | unknown |
| REQ-DDB-WIKI-015 | catalog | unknown |
| REQ-DDB-WIKI-018 | catalog | unknown |
| REQ-DDB-WIKI-020 | catalog | unknown |
| REQ-DDB-WIKI-021 | catalog | unknown |
| REQ-DDB-WIKI-022 | catalog | unknown |
| REQ-DDB-WIKI-023 | catalog | unknown |
| REQ-DDB-WIKI-025 | catalog | unknown |
| REQ-DDB-WIKI-031 | catalog | unknown |
| REQ-DDB-WIKI-044 | catalog | unknown |
| REQ-DDB-WIKI-050 | catalog | unknown |
| REQ-DDB-WIKI-052 | catalog | unknown |