Verhindere fehlende Anlagen im Übergabepaket und benenne sie nach Titel.
Deploy Development / deploy (push) Successful in 30s
Test Suite / pytest-backend (push) Failing after 1m40s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Anlagen erscheinen unter dem Anzeigenamen statt nur technischem Dateinamen; fehlende Freigabe, Auswahl oder Ausgabe wird in der Prüfung gemeldet statt still wegzulassen.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-18 14:43:48 +02:00
1 parent 8b74e63417
commit ea28c4f246
3 files changed
+167 -6

No files matched your search

+2 -2
View File
@@ -384,7 +384,7 @@ def test_dispatch_keeps_the_secured_stand_and_distinct_mail_parts(client, db, mo
selected = [node["id"] for node in nodes if node["kind"] in {"dispatch_item", "evidence"}]
archive = _zip(ada, matter["id"], selected)
names = archive.namelist()
snapshot = next(name for name in names if name.endswith("/Anlagen/lage.pdf"))
snapshot = next(name for name in names if name.endswith("/Anlagen/Lageplan.pdf"))
assert archive.read(snapshot) == PDF_B
eml_name = next(name for name in names if name.endswith("nachricht.eml"))
assert b"Fachlicher Zusatz" in archive.read(eml_name)
@@ -517,7 +517,7 @@ def test_dispatch_keeps_the_secured_stand_and_distinct_mail_parts(client, db, mo
assert gaps
assert all("Später geänderter Text" not in full.read(name).decode("utf-8") for name in gaps)
assert all(b"%PDF" not in full.read(name) for name in gaps)
secured = next(name for name in full.namelist() if name.endswith("/Anlagen/lage.pdf"))
secured = next(name for name in full.namelist() if name.endswith("/Anlagen/Lageplan.pdf"))
assert full.read(secured) == PDF_B
+71 -2
View File
@@ -901,7 +901,76 @@ def test_correspondence_attachments_stay_under_each_host_in_one_chapter(client,
assert not any("anlagen-arbeitsstand" in name.lower() for name in names)
first_paths = [name for name in names if "Erstes Schreiben/Anlagen/" in name.replace("\\", "/")]
second_paths = [name for name in names if "Zweites Schreiben/Anlagen/" in name.replace("\\", "/")]
assert sorted(name.rsplit("/", 1)[-1] for name in first_paths) == ["a1.pdf", "a2.pdf"]
assert sorted(name.rsplit("/", 1)[-1] for name in second_paths) == ["a1.pdf", "b1.pdf"]
assert sorted(name.rsplit("/", 1)[-1] for name in first_paths) == ["Anlage A1.pdf", "Anlage A2.pdf"]
assert sorted(name.rsplit("/", 1)[-1] for name in second_paths) == ["Anlage B1.pdf", "Anlage B2.pdf"]
assert any("Erstes Schreiben/Belege/" in name.replace("\\", "/") for name in names)
assert not any(name.replace("\\", "/").startswith("01 Schriftwechsel/2026-04") for name in names)
def test_export_warns_when_assigned_attachment_is_not_shareable(client, db):
ada = Actor(client, "ada-share-gap@example.test", "Ada Share Gap")
register(db, ada.email, ada.name)
ada.login()
matter = ada.request("POST", "/api/v1/matters", json={"title": "Anlagenfreigabe"}, status=201)
letter = ada.request(
"POST",
"/api/v1/notes",
json={"title": "Schreiben", "document": document("Text"), "context": {"kind": "matter", "id": matter["id"]}},
status=201,
)
open_att = ada.request(
"POST",
"/api/v1/files",
data={"title": "Offene Anlage", "context_kind": "matter", "context_id": matter["id"]},
files={"upload": ("offen.pdf", PDF_A, "application/pdf")},
status=201,
)
closed_att = ada.request(
"POST",
"/api/v1/files",
data={"title": "Gesperrte Anlage", "context_kind": "matter", "context_id": matter["id"]},
files={"upload": ("gesperrt.pdf", PDF_B, "application/pdf")},
status=201,
)
detail = ada.request("GET", f"/api/v1/matters/{matter['id']}")
host = next(item for item in detail["bindings"] if item["element"]["title"] == "Schreiben")
ada.request(
"POST",
f"/api/v1/elements/{letter['id']}/attachments",
json={
"expected_version": host["element"]["version"],
"context": {"kind": "matter", "id": matter["id"]},
"attachment_element_ids": [open_att["id"], closed_att["id"]],
"fold": "attachment",
},
status=201,
)
ada.request(
"PUT",
"/api/v1/exceptions",
json={
"resource_kind": "element",
"resource_id": closed_att["id"],
"context": {"kind": "matter", "id": matter["id"]},
"remove_share": True,
},
)
tree = ada.request("GET", f"/api/v1/matters/{matter['id']}/export-tree")["tree"]
selected = [node["id"] for node in _walk(tree) if node["exportable"] and node["kind"] in {"binding", "attachment"}]
review = ada.request(
"POST",
f"/api/v1/matters/{matter['id']}/export/review",
json={"context": {"kind": "matter", "id": matter["id"]}, "selected": selected},
)
assert review["ready"] is True
assert any("nicht freigegeben" in item["message"] for item in review["notices"])
response = _post_zip(
ada,
matter["id"],
{"context": {"kind": "matter", "id": matter["id"]}, "selected": selected},
)
assert response.status_code == 200, response.text
names = _archive(response.content).namelist()
anlagen = [name for name in names if "Schreiben/Anlagen/" in name.replace("\\", "/")]
assert len(anlagen) == 1
assert anlagen[0].endswith("/Offene Anlage.pdf")