forked from retoor/devplacepy
feat: add container manager API, islop router, and container runtime files with vim/bot/d stealth clients
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from devplacepy.services.jobs.isslop.badge import badge_html, badge_markdown, render_badge
|
||||
|
||||
|
||||
def test_render_badge_with_grade():
|
||||
svg = render_badge(87.5, "A", "https://devplace.example/tools/isslop/abc/report")
|
||||
assert svg.startswith("<svg")
|
||||
assert "88%" in svg or "87%" in svg
|
||||
assert "authenticity" in svg
|
||||
assert "https://devplace.example/tools/isslop/abc/report" in svg
|
||||
|
||||
|
||||
def test_render_badge_pending():
|
||||
svg = render_badge(None, None, "https://devplace.example/tools/isslop/abc/report")
|
||||
assert "analyzing" in svg
|
||||
|
||||
|
||||
def test_render_badge_escapes_url():
|
||||
svg = render_badge(50.0, "C", 'https://x.example/"><script>')
|
||||
assert "<script>" not in svg
|
||||
|
||||
|
||||
def test_badge_snippets():
|
||||
markdown = badge_markdown("https://x/badge.svg", "https://x/report")
|
||||
assert markdown == "[](https://x/report)"
|
||||
html = badge_html("https://x/badge.svg", "https://x/report")
|
||||
assert '<img src="https://x/badge.svg"' in html
|
||||
Reference in New Issue
Block a user