Offer the current exercise through an explicit API switch.
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Failing after 29s
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 7m42s
Deploy Development / deploy (push) Successful in 53s
Test Suite / pytest-backend (push) Failing after 29s
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 7m42s
The exercise list turns the live catalog on or off for the caller's edit rights. A distribution key reads that current selection and the changes since its last cursor. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4ad62b6e38
commit
b59b7eae16
13 files changed
+488
-5
No files matched your search
@@ -29,6 +29,10 @@ from distribution_contract import (
|
||||
official_write_allowed,
|
||||
plan_available,
|
||||
rate_decision,
|
||||
catalog_available,
|
||||
catalog_changes,
|
||||
catalog_document,
|
||||
catalog_hash,
|
||||
changed_areas,
|
||||
release_denial,
|
||||
retrievable_release_ids,
|
||||
@@ -282,6 +286,52 @@ def test_release_screen_keeps_the_application_key() -> None:
|
||||
assert [item["label"] for item in keys] == ["Lara"]
|
||||
|
||||
|
||||
def _catalog_exercise() -> dict:
|
||||
return {
|
||||
"public_id": "11111111-1111-1111-1111-111111111111",
|
||||
"title": "Stand",
|
||||
"summary": "",
|
||||
"goal": "Sehen",
|
||||
"execution": "Weg",
|
||||
"preparation": "",
|
||||
"trainer_notes": "",
|
||||
"equipment": None,
|
||||
"duration_min": None,
|
||||
"duration_max": None,
|
||||
}
|
||||
|
||||
|
||||
def test_catalog_reports_variant_and_media_order_changes() -> None:
|
||||
exercise = _catalog_exercise()
|
||||
base_variant = [{"id": 1, "public_id": "var-1", "variant_name": "Karte", "description": "", "execution_changes": "Alt", "sequence_order": 1}]
|
||||
base_media = [
|
||||
{"id": 1, "public_id": "med-1", "media_type": "image", "title": "A", "sort_order": 1},
|
||||
{"id": 2, "public_id": "med-2", "media_type": "image", "title": "B", "sort_order": 2},
|
||||
]
|
||||
original = catalog_hash(catalog_document(exercise, base_variant, base_media))
|
||||
changed_variant = [{**base_variant[0], "execution_changes": "Neu"}]
|
||||
reordered = [base_media[1] | {"sort_order": 1}, base_media[0] | {"sort_order": 2}]
|
||||
assert catalog_hash(catalog_document(exercise, changed_variant, base_media)) != original
|
||||
assert catalog_hash(catalog_document(exercise, base_variant, reordered)) != original
|
||||
assert catalog_hash(catalog_document(exercise, base_variant, base_media)) == original
|
||||
source = exercise["public_id"]
|
||||
assert catalog_changes({source: original}, {source: original}) == []
|
||||
updated = catalog_hash(catalog_document(exercise, changed_variant, base_media))
|
||||
assert catalog_changes({source: original}, {source: updated}) == [
|
||||
{"source_id": source, "change": "updated", "content_hash": updated}
|
||||
]
|
||||
assert catalog_changes({source: original}, {}) == [{"source_id": source, "change": "removed"}]
|
||||
assert catalog_changes({}, {source: original}) == [
|
||||
{"source_id": source, "change": "added", "content_hash": original}
|
||||
]
|
||||
|
||||
|
||||
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
|
||||
assert catalog_available(True, False) is False
|
||||
|
||||
|
||||
def test_changed_areas_names_the_edited_instruction() -> None:
|
||||
exercise = {
|
||||
"title": "Stand",
|
||||
|
||||
Reference in new issue
Block a user