Deliver stored exercise HTML on the catalog API.
Deploy Development / deploy (push) Successful in 52s
Test Suite / pytest-backend (push) Successful in 52s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 16s
Test Suite / k6 /health Baseline (push) Successful in 35s
Test Suite / playwright-tests (push) Failing after 7m43s

The receiving application needs paragraphs, line breaks, lists and emphasis as stored in Shinkan. The catalog now returns that HTML and marks the text format, while titles and short variant descriptions stay plain text.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-23 22:12:14 +01:00
1 parent 68ae82a5e5
commit 5ff0cd43ee
3 files changed
+54 -10

No files matched your search

@@ -345,6 +345,28 @@ def test_catalog_reports_variant_and_media_order_changes() -> None:
]
def test_catalog_keeps_stored_html() -> None:
exercise = _catalog_exercise()
exercise["execution"] = "<p>Stand aufrecht.</p><p>Drehe die <strong>Hüfte</strong>.</p><br><ul><li>eins</li><li>zwei</li></ul>"
exercise["goal"] = "<script>alert(1)</script><p>Sehen</p>"
variant = [{
"id": 1,
"public_id": "var-1",
"variant_name": "Karte",
"description": "Kurzer Text",
"execution_changes": "<p>Langsamer.</p><p>Mit Partner.</p>",
"sequence_order": 1,
}]
document = catalog_document(exercise, variant, [])
assert document["text_format"] == "html"
assert document["execution"] == "<p>Stand aufrecht.</p><p>Drehe die <strong>Hüfte</strong>.</p><br><ul><li>eins</li><li>zwei</li></ul>"
assert document["goal"] == "<p>Sehen</p>"
assert "<script>" not in document["goal"]
assert document["variants"][0]["description"] == "Kurzer Text"
assert document["variants"][0]["execution_changes"] == "<p>Langsamer.</p><p>Mit Partner.</p>"
assert catalog_hash(catalog_document(exercise, variant, [])) == catalog_hash(document)
def test_catalog_hides_unselected_and_out_of_scope_exercises() -> None:
assert catalog_available(True, True) is True
assert catalog_available(False, True) is False