2b5e43a64f
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
912 B
Python
32 lines
912 B
Python
from auto_reverse.doc.markdown import render_markdown
|
|
from auto_reverse.models import EndpointRecord, Signature
|
|
|
|
|
|
def _rec(method, template, **kw):
|
|
rec = EndpointRecord(signature=Signature(method, "ex.com", template, "2xx"))
|
|
for k, v in kw.items():
|
|
setattr(rec, k, v)
|
|
return rec
|
|
|
|
|
|
def test_renders_heading_and_endpoints():
|
|
md = render_markdown([_rec("GET", "/api/users", summary="List users")], title="ex.com API")
|
|
assert "# ex.com API" in md
|
|
assert "`GET /api/users`" in md
|
|
assert "List users" in md
|
|
|
|
|
|
def test_groups_by_tag():
|
|
records = [
|
|
_rec("GET", "/api/users", tag="Users"),
|
|
_rec("GET", "/api/cart", tag="Cart"),
|
|
]
|
|
md = render_markdown(records, title="x")
|
|
assert "## Users" in md
|
|
assert "## Cart" in md
|
|
|
|
|
|
def test_untagged_go_under_general():
|
|
md = render_markdown([_rec("GET", "/api/x")], title="x")
|
|
assert "## General" in md
|