diff --git a/backend/tests/fixtures/Shinkan_Lara_Felix_Referenzfall_v1.json b/backend/tests/fixtures/Shinkan_Lara_Felix_Referenzfall_v1.json new file mode 100644 index 0000000..51820e8 --- /dev/null +++ b/backend/tests/fixtures/Shinkan_Lara_Felix_Referenzfall_v1.json @@ -0,0 +1,493 @@ +{ + "fixture_version": 1, + "note": "Synthetische Inhalte ohne produktive Rechte. Die Medienbytes dienen der Testung von Groesse und Hash. Sie sind keine abspielbare Filmdatei.", + "manifest_serialization": "UTF-8, JSON ohne Leerraum, Reihenfolge der Felder aus manifest, kein abschliessender Zeilenumbruch", + "channels": { + "lara_felix": { + "recipient_id": "caa20000-0000-4000-8000-0000000001f5", + "events": [ + { + "event_id": "caa20000-0000-4000-8000-000000000258", + "type": "release.published", + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "occurred_at": "2026-11-23T09:01:00Z", + "source_id": "caa20000-0000-4000-8000-00000000000a", + "revision": 1, + "manifest_sha256": "fcebc8c4db56328a55dc7f350e705822cef19f02392f26625274e68c0abc239c" + }, + { + "event_id": "caa20000-0000-4000-8000-000000000259", + "type": "release.published", + "release_id": "caa20000-0000-4000-8000-0000000000ca", + "occurred_at": "2026-11-23T09:02:00Z", + "source_id": "caa20000-0000-4000-8000-00000000000b", + "revision": 1, + "manifest_sha256": "7dad43afb3077fb2d9fb3aa490bb91daf53f175c06575d648411021d352a1744" + }, + { + "event_id": "caa20000-0000-4000-8000-00000000025a", + "type": "release.published", + "release_id": "caa20000-0000-4000-8000-0000000000cb", + "occurred_at": "2026-11-23T09:03:00Z", + "source_id": "caa20000-0000-4000-8000-00000000000a", + "revision": 2, + "manifest_sha256": "f0c8051cee6feb0e6399f1bc5681e0ef1ecd640c1cbe6b634c5df1c1b1df9ed0" + }, + { + "event_id": "caa20000-0000-4000-8000-00000000025b", + "type": "release.retired", + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "occurred_at": "2026-11-23T09:04:00Z" + }, + { + "event_id": "caa20000-0000-4000-8000-00000000025c", + "type": "asset.withdrawn", + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "occurred_at": "2026-11-23T09:05:00Z", + "target_id": "caa20000-0000-4000-8000-00000000012c", + "reason_code": "rights" + }, + { + "event_id": "caa20000-0000-4000-8000-00000000025d", + "type": "asset.withdrawn", + "release_id": "caa20000-0000-4000-8000-0000000000cb", + "occurred_at": "2026-11-23T09:05:00Z", + "target_id": "caa20000-0000-4000-8000-00000000012c", + "reason_code": "rights" + } + ] + }, + "zweiter_verein": { + "recipient_id": "caa20000-0000-4000-8000-0000000001f6", + "events": [ + { + "event_id": "caa20000-0000-4000-8000-0000000002bc", + "type": "release.published", + "release_id": "caa20000-0000-4000-8000-0000000000cc", + "occurred_at": "2026-11-23T09:03:00Z", + "source_id": "caa20000-0000-4000-8000-00000000000c", + "revision": 1, + "manifest_sha256": "3e34007864d308ac1cf6b555bb7fd00dd6962fb6f396eca16492ace0fec59603" + } + ] + } + }, + "releases": { + "vereinsfassung_1": { + "channel": "lara_felix", + "manifest_sha256": "fcebc8c4db56328a55dc7f350e705822cef19f02392f26625274e68c0abc239c", + "manifest": { + "schema_version": 1, + "resource_type": "exercise", + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "source_id": "caa20000-0000-4000-8000-00000000000a", + "revision": 1, + "publisher_id": "caa20000-0000-4000-8000-00000000177a", + "published_at": "2026-11-23T09:01:00Z", + "exercise": { + "title": "Raum und Wege wahrnehmen", + "audience": "Kursleitungen", + "rights_id": "caa20000-0000-4000-8000-000000000191", + "parts": [ + { + "id": "caa20000-0000-4000-8000-000000000065", + "role": "goal", + "text": "Die Gruppe nimmt freie Wege im Raum wahr.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000066", + "role": "instructions", + "text": "Die Kursleitung legt Karten aus und bespricht die freien Wege.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000067", + "role": "trainer_notes", + "text": "Vorab genug Platz vorsehen.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000068", + "role": "instructions", + "text": "Den kurzen Film ansehen und danach die gezeigten Wege vergleichen.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + } + ], + "assets": [ + { + "id": "caa20000-0000-4000-8000-00000000012c", + "role": "demonstration", + "media_type": "video/mp4", + "size_bytes": 32, + "sha256": "0fb807ef5ec44b003f181dfa9ce317becbcfd5755ebf91a57702d2024df2b915", + "rights_id": "caa20000-0000-4000-8000-000000000192", + "label": "Demonstrationsfilm" + } + ], + "common_part_ids": [ + "caa20000-0000-4000-8000-000000000065", + "caa20000-0000-4000-8000-000000000067" + ], + "common_asset_ids": [], + "variants": [ + { + "id": "caa20000-0000-4000-8000-00000000006b", + "label": "Kartenvariante", + "part_ids": [ + "caa20000-0000-4000-8000-000000000066" + ], + "asset_ids": [] + }, + { + "id": "caa20000-0000-4000-8000-00000000006c", + "label": "Filmvariante", + "part_ids": [ + "caa20000-0000-4000-8000-000000000068" + ], + "asset_ids": [ + "caa20000-0000-4000-8000-00000000012c" + ] + } + ] + }, + "rights": [ + { + "id": "caa20000-0000-4000-8000-000000000191", + "evidence_ref": "test-textrechte", + "actions": [ + "store", + "render", + "grant_customer_use", + "commercial_course_use" + ], + "territories": [ + "DE" + ], + "valid_from": "2026-11-23T09:00:00Z", + "valid_until": null + }, + { + "id": "caa20000-0000-4000-8000-000000000192", + "evidence_ref": "test-filmrechte", + "actions": [ + "store", + "stream", + "course_display", + "grant_customer_use", + "commercial_course_use" + ], + "territories": [ + "DE" + ], + "valid_from": "2026-11-23T09:00:00Z", + "valid_until": null + } + ] + }, + "synthetic_asset_base64_by_id": { + "caa20000-0000-4000-8000-00000000012c": "U2hpbmthbiBkaXN0cmlidXRpb24gZml4dHVyZSB2MQo=" + } + }, + "eigener_bestand": { + "channel": "lara_felix", + "manifest_sha256": "7dad43afb3077fb2d9fb3aa490bb91daf53f175c06575d648411021d352a1744", + "manifest": { + "schema_version": 1, + "resource_type": "exercise", + "release_id": "caa20000-0000-4000-8000-0000000000ca", + "source_id": "caa20000-0000-4000-8000-00000000000b", + "revision": 1, + "publisher_id": "caa20000-0000-4000-8000-00000000177b", + "published_at": "2026-11-23T09:02:00Z", + "exercise": { + "title": "Aufmerksam im Raum ankommen", + "audience": "Kursleitungen", + "rights_id": "caa20000-0000-4000-8000-000000000191", + "parts": [ + { + "id": "caa20000-0000-4000-8000-00000000006f", + "role": "goal", + "text": "Die Gruppe nimmt freie Wege im Raum wahr.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000070", + "role": "instructions", + "text": "Die Kursleitung legt Karten aus und bespricht die freien Wege.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000071", + "role": "trainer_notes", + "text": "Vorab genug Platz vorsehen.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + } + ], + "assets": [], + "common_part_ids": [ + "caa20000-0000-4000-8000-00000000006f", + "caa20000-0000-4000-8000-000000000071" + ], + "common_asset_ids": [], + "variants": [ + { + "id": "caa20000-0000-4000-8000-000000000075", + "label": "Kartenvariante", + "part_ids": [ + "caa20000-0000-4000-8000-000000000070" + ], + "asset_ids": [] + } + ] + }, + "rights": [ + { + "id": "caa20000-0000-4000-8000-000000000191", + "evidence_ref": "test-textrechte", + "actions": [ + "store", + "render", + "grant_customer_use", + "commercial_course_use" + ], + "territories": [ + "DE" + ], + "valid_from": "2026-11-23T09:00:00Z", + "valid_until": null + } + ] + }, + "synthetic_asset_base64_by_id": {} + }, + "vereinsfassung_2": { + "channel": "lara_felix", + "manifest_sha256": "f0c8051cee6feb0e6399f1bc5681e0ef1ecd640c1cbe6b634c5df1c1b1df9ed0", + "manifest": { + "schema_version": 1, + "resource_type": "exercise", + "release_id": "caa20000-0000-4000-8000-0000000000cb", + "source_id": "caa20000-0000-4000-8000-00000000000a", + "revision": 2, + "publisher_id": "caa20000-0000-4000-8000-00000000177a", + "published_at": "2026-11-23T09:03:00Z", + "exercise": { + "title": "Raum und Wege wahrnehmen", + "audience": "Kursleitungen", + "rights_id": "caa20000-0000-4000-8000-000000000191", + "parts": [ + { + "id": "caa20000-0000-4000-8000-000000000065", + "role": "goal", + "text": "Die Gruppe nimmt freie Wege im Raum wahr.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000066", + "role": "instructions", + "text": "Die Kursleitung legt Karten aus und bespricht die freien Wege.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000067", + "role": "trainer_notes", + "text": "Vorab genug Platz vorsehen und die Laufwege gemeinsam prüfen.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-000000000068", + "role": "instructions", + "text": "Den kurzen Film ansehen und danach die gezeigten Wege vergleichen.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + } + ], + "assets": [ + { + "id": "caa20000-0000-4000-8000-00000000012c", + "role": "demonstration", + "media_type": "video/mp4", + "size_bytes": 32, + "sha256": "0fb807ef5ec44b003f181dfa9ce317becbcfd5755ebf91a57702d2024df2b915", + "rights_id": "caa20000-0000-4000-8000-000000000192", + "label": "Demonstrationsfilm" + } + ], + "common_part_ids": [ + "caa20000-0000-4000-8000-000000000065", + "caa20000-0000-4000-8000-000000000067" + ], + "common_asset_ids": [], + "variants": [ + { + "id": "caa20000-0000-4000-8000-00000000006b", + "label": "Kartenvariante", + "part_ids": [ + "caa20000-0000-4000-8000-000000000066" + ], + "asset_ids": [] + }, + { + "id": "caa20000-0000-4000-8000-00000000006c", + "label": "Filmvariante", + "part_ids": [ + "caa20000-0000-4000-8000-000000000068" + ], + "asset_ids": [ + "caa20000-0000-4000-8000-00000000012c" + ] + } + ] + }, + "rights": [ + { + "id": "caa20000-0000-4000-8000-000000000191", + "evidence_ref": "test-textrechte", + "actions": [ + "store", + "render", + "grant_customer_use", + "commercial_course_use" + ], + "territories": [ + "DE" + ], + "valid_from": "2026-11-23T09:00:00Z", + "valid_until": null + }, + { + "id": "caa20000-0000-4000-8000-000000000192", + "evidence_ref": "test-filmrechte", + "actions": [ + "store", + "stream", + "course_display", + "grant_customer_use", + "commercial_course_use" + ], + "territories": [ + "DE" + ], + "valid_from": "2026-11-23T09:00:00Z", + "valid_until": null + } + ] + }, + "synthetic_asset_base64_by_id": { + "caa20000-0000-4000-8000-00000000012c": "U2hpbmthbiBkaXN0cmlidXRpb24gZml4dHVyZSB2MQo=" + } + }, + "zweiter_verein": { + "channel": "zweiter_verein", + "manifest_sha256": "3e34007864d308ac1cf6b555bb7fd00dd6962fb6f396eca16492ace0fec59603", + "manifest": { + "schema_version": 1, + "resource_type": "exercise", + "release_id": "caa20000-0000-4000-8000-0000000000cc", + "source_id": "caa20000-0000-4000-8000-00000000000c", + "revision": 1, + "publisher_id": "caa20000-0000-4000-8000-00000000177c", + "published_at": "2026-11-23T09:03:00Z", + "exercise": { + "title": "Gemeinsam den Raum erkunden", + "audience": "Kursleitungen", + "rights_id": "caa20000-0000-4000-8000-000000000191", + "parts": [ + { + "id": "caa20000-0000-4000-8000-000000000079", + "role": "goal", + "text": "Die Gruppe nimmt freie Wege im Raum wahr.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-00000000007a", + "role": "instructions", + "text": "Die Kursleitung legt Karten aus und bespricht die freien Wege.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + }, + { + "id": "caa20000-0000-4000-8000-00000000007b", + "role": "trainer_notes", + "text": "Vorab genug Platz vorsehen.", + "rights_id": "caa20000-0000-4000-8000-000000000191" + } + ], + "assets": [], + "common_part_ids": [ + "caa20000-0000-4000-8000-000000000079", + "caa20000-0000-4000-8000-00000000007b" + ], + "common_asset_ids": [], + "variants": [ + { + "id": "caa20000-0000-4000-8000-00000000007f", + "label": "Kartenvariante", + "part_ids": [ + "caa20000-0000-4000-8000-00000000007a" + ], + "asset_ids": [] + } + ] + }, + "rights": [ + { + "id": "caa20000-0000-4000-8000-000000000191", + "evidence_ref": "test-textrechte", + "actions": [ + "store", + "render", + "grant_customer_use", + "commercial_course_use" + ], + "territories": [ + "DE" + ], + "valid_from": "2026-11-23T09:00:00Z", + "valid_until": null + } + ] + }, + "synthetic_asset_base64_by_id": {} + } + }, + "plans": { + "plan_a_mit_film": { + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "variant_id": "caa20000-0000-4000-8000-00000000006c" + }, + "plan_b_mit_karten": { + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "variant_id": "caa20000-0000-4000-8000-00000000006b" + }, + "plan_c_mit_film_neuere_fassung": { + "release_id": "caa20000-0000-4000-8000-0000000000cb", + "variant_id": "caa20000-0000-4000-8000-00000000006c" + }, + "plan_d_eigener_bestand": { + "release_id": "caa20000-0000-4000-8000-0000000000ca", + "variant_id": "caa20000-0000-4000-8000-000000000075" + } + }, + "expected": { + "plan_binding_after_revision": { + "release_id": "caa20000-0000-4000-8000-0000000000c9", + "variant_id": "caa20000-0000-4000-8000-00000000006c" + }, + "blocked_plans_after_withdrawal": [ + "plan_a_mit_film", + "plan_c_mit_film_neuere_fassung" + ], + "available_plans_after_withdrawal": [ + "plan_b_mit_karten", + "plan_d_eigener_bestand" + ], + "lara_felix_can_retrieve_after_withdrawal": [ + "caa20000-0000-4000-8000-0000000000ca" + ], + "zweiter_verein_can_retrieve": [ + "caa20000-0000-4000-8000-0000000000cc" + ], + "course_film_allowed": true, + "film_download_allowed": false + } +} diff --git a/backend/tests/test_distribution_contract.py b/backend/tests/test_distribution_contract.py index 2160fdb..76b4447 100644 --- a/backend/tests/test_distribution_contract.py +++ b/backend/tests/test_distribution_contract.py @@ -42,10 +42,9 @@ from main import app from routers.exercises import _assert_can_edit_exercise from tenant_context import TenantContext, get_tenant_context +# Liegt im Backend-Baum, weil Pytest im API-Image läuft und dort kein Repo-docs-Ordner existiert. FIXTURE = json.loads( - (Path(__file__).resolve().parents[2] / "docs" / "architecture" / "distribution" / "Shinkan_Lara_Felix_Referenzfall_v1.json").read_text( - encoding="utf-8" - ) + (Path(__file__).resolve().parent / "fixtures" / "Shinkan_Lara_Felix_Referenzfall_v1.json").read_text(encoding="utf-8") )