fix(p06): declared-Status deckt alle Sichtbarkeiten ab (kein Level-Vergleich mehr)
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 10s
Test Suite / playwright-tests (push) Successful in 58s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 34s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 10s
Test Suite / playwright-tests (push) Successful in 58s
- check_rights_coverage: rights_status='declared' gibt immer 'ok' zurück (P-06-Erklärung gilt inhaltlich, nicht sichtbarkeitsabhängig) - assert_rights_for_promotion: 'insufficient'-Pfad entfernt - Tests: test_declared_private_insufficient_for_club → test_declared_covers_any_visibility version: 0.8.81 module: media_rights Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
6586d3b68b
commit
56e952f084
4 files changed
+30
-59
No files matched your search
@@ -215,28 +215,18 @@ class TestCheckRightsCoverage:
|
||||
assert check_rights_coverage(cur, 1, "private") == "no_declaration"
|
||||
|
||||
def test_blocked_returns_blocked(self):
|
||||
cur = self._cur({"rights_status": "blocked", "rights_declared_for_visibility": None})
|
||||
cur = self._cur({"rights_status": "blocked"})
|
||||
assert check_rights_coverage(cur, 1, "private") == "blocked"
|
||||
|
||||
def test_legacy_returns_legacy(self):
|
||||
cur = self._cur({"rights_status": "legacy_unreviewed", "rights_declared_for_visibility": None})
|
||||
cur = self._cur({"rights_status": "legacy_unreviewed"})
|
||||
assert check_rights_coverage(cur, 1, "club") == "legacy"
|
||||
|
||||
def test_declared_private_covers_private(self):
|
||||
cur = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "private"})
|
||||
assert check_rights_coverage(cur, 1, "private") == "ok"
|
||||
|
||||
def test_declared_private_insufficient_for_club(self):
|
||||
cur = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "private"})
|
||||
assert check_rights_coverage(cur, 1, "club") == "insufficient"
|
||||
|
||||
def test_declared_official_covers_all(self):
|
||||
cur = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "official"})
|
||||
assert check_rights_coverage(cur, 1, "private") == "ok"
|
||||
cur2 = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "official"})
|
||||
assert check_rights_coverage(cur2, 1, "club") == "ok"
|
||||
cur3 = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "official"})
|
||||
assert check_rights_coverage(cur3, 1, "official") == "ok"
|
||||
def test_declared_covers_any_visibility(self):
|
||||
# Eine bestehende Erklaerung gilt sichtbarkeitsunabhaengig
|
||||
for target in ("private", "club", "official"):
|
||||
cur = self._cur({"rights_status": "declared"})
|
||||
assert check_rights_coverage(cur, 1, target) == "ok", f"failed for target={target}"
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
@@ -250,31 +240,25 @@ class TestAssertRightsForPromotion:
|
||||
cur.fetchone.return_value = row
|
||||
return cur
|
||||
|
||||
def test_ok_passes(self):
|
||||
cur = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "official"})
|
||||
assert_rights_for_promotion(cur, 1, "official") # no raise
|
||||
def test_ok_passes_for_any_target(self):
|
||||
for target in ("private", "club", "official"):
|
||||
cur = self._cur({"rights_status": "declared"})
|
||||
assert_rights_for_promotion(cur, 1, target) # no raise
|
||||
|
||||
def test_legacy_raises_legacy_code(self):
|
||||
cur = self._cur({"rights_status": "legacy_unreviewed", "rights_declared_for_visibility": None})
|
||||
cur = self._cur({"rights_status": "legacy_unreviewed"})
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
assert_rights_for_promotion(cur, 1, "club")
|
||||
assert exc.value.status_code == 400
|
||||
assert exc.value.detail["code"] == "LEGACY_REDECLARATION_REQUIRED"
|
||||
|
||||
def test_blocked_raises_403(self):
|
||||
cur = self._cur({"rights_status": "blocked", "rights_declared_for_visibility": None})
|
||||
cur = self._cur({"rights_status": "blocked"})
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
assert_rights_for_promotion(cur, 1, "official")
|
||||
assert exc.value.status_code == 403
|
||||
assert exc.value.detail["code"] == "RIGHTS_BLOCKED"
|
||||
|
||||
def test_insufficient_raises_scope_code(self):
|
||||
cur = self._cur({"rights_status": "declared", "rights_declared_for_visibility": "private"})
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
assert_rights_for_promotion(cur, 1, "official")
|
||||
assert exc.value.status_code == 400
|
||||
assert exc.value.detail["code"] == "RIGHTS_SCOPE_INSUFFICIENT"
|
||||
|
||||
|
||||
# ===========================================================================
|
||||
# 4. PATCH /api/media-assets/{id} – P-06-Promotion via HTTP
|
||||
|
||||
Reference in new issue
Block a user