feat(3 U5.1+U5.2): per-recipe latest-level badge endpoint /badge/<recipe>.svg (R6, level-coloured, status fallback) + complete docs/results-ux.md §3-5 (card/screenshot/PR-comment/badge-embedding, R8); +2 badge unit tests
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
autonomic-bot
2026-05-31 10:04:14 +00:00
parent 9ca39dc179
commit 91a69b8971
3 changed files with 100 additions and 22 deletions

View File

@ -108,6 +108,22 @@ def test_build_row_degrades_without_results(monkeypatch):
assert "level —" in dashboard.render_overview([r])
def test_level_badge_shows_level_coloured(monkeypatch):
svg = dashboard.render_level_badge("custom-html", 4)
assert "custom-html" in svg and "level 4" in svg
assert dashboard.level_color(4) in svg # coloured by level
assert svg.startswith("<svg") and "image" not in svg # plain SVG
# A higher displayed level than earned would be inflation — badge shows exactly the given level.
assert "level 5" not in svg and "level 6" not in svg
def test_status_badge_fallback_when_no_level():
# Recipe with no results.json level → status badge, not a fabricated level.
svg = dashboard.render_badge("ghost", "failure")
assert "failure" in svg and "level" not in svg
assert dashboard._COLORS["failure"] in svg
def test_results_for_traversal_guarded():
with tempfile.TemporaryDirectory() as d:
os.makedirs(os.path.join(d, "5"))