Passe Export-Tests an TOC-Anker und nummerierte Pfade an.
Links in der Übersicht dürfen Fragment-Anker nutzen; Pfadassertions und Versionsstände folgen der einheitlichen Nummerierung und der Auswahl nur exportierbarer Blattknoten. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
59434a4045
commit
60a76803e1
2 files changed
+26
-8
No files matched your search
@@ -384,7 +384,9 @@ 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("/01 Anschreiben/Anlagen/Lageplan.pdf"))
|
||||
snapshot = next(
|
||||
name for name in names if "Anschreiben" in name and 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 +519,9 @@ 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("/01 Anschreiben/Anlagen/Lageplan.pdf"))
|
||||
secured = next(
|
||||
name for name in full.namelist() if "Anschreiben" in name and name.endswith("/Anlagen/Lageplan.pdf")
|
||||
)
|
||||
assert full.read(secured) == PDF_B
|
||||
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ def _links_resolve(archive: zipfile.ZipFile) -> None:
|
||||
names = set(archive.namelist())
|
||||
for chunk in html.split('href="')[1:]:
|
||||
href = unquote(chunk.split('"', 1)[0])
|
||||
if href.startswith("#"):
|
||||
continue
|
||||
assert href in names, href
|
||||
for name in archive.namelist():
|
||||
if not name.endswith(".md"):
|
||||
@@ -93,7 +95,7 @@ def _links_resolve(archive: zipfile.ZipFile) -> None:
|
||||
base = name.rsplit("/", 1)[0] + "/" if "/" in name else ""
|
||||
for chunk in text.split("](")[1:]:
|
||||
href = unquote(chunk.split(")", 1)[0])
|
||||
if href.startswith("http"):
|
||||
if href.startswith("http") or href.startswith("#"):
|
||||
continue
|
||||
target = urljoin(base, href)
|
||||
assert target in names, (name, href, target)
|
||||
@@ -760,9 +762,13 @@ def test_nested_chapter_export_keeps_path_and_complete_mail(client, db, monkeypa
|
||||
response = _post_zip(ada, matter["id"], body)
|
||||
assert response.status_code == 200, response.text
|
||||
names = _archive(response.content).namelist()
|
||||
heating = next(name for name in names if name.endswith("/Heizkostenbeleg/Heizkostenbeleg.pdf"))
|
||||
heating = next(
|
||||
name
|
||||
for name in names
|
||||
if name.endswith("/Heizkostenbeleg.pdf") and "Einzelbelege" in name and "Heizkostenbeleg" in name
|
||||
)
|
||||
assert heating.startswith(
|
||||
"01 Nebenkostenabrechnung 2025/02 Übermittelte Abrechnungsunterlagen/01 Einzelbelege/01 Heizkostenbeleg/"
|
||||
"01 Nebenkostenabrechnung 2025/02 Übermittelte Abrechnungsunterlagen/01 Einzelbelege/"
|
||||
)
|
||||
assert any(
|
||||
name.startswith("01 Nebenkostenabrechnung 2025/01 ") and "Antwort des Vermieters" in name
|
||||
@@ -840,7 +846,8 @@ def test_chapter_entries_share_one_numbering_sequence(client, db, monkeypatch):
|
||||
)
|
||||
monkeypatch.setattr("app.retrieval.pull_rfc822", lambda *args, **kwargs: raw)
|
||||
tree = ada.request("GET", f"/api/v1/matters/{matter['id']}/export-tree")["tree"]
|
||||
selected = [node["id"] for node in _walk(tree) if node["exportable"]]
|
||||
exportable = {"binding", "annotation", "attachment", "dispatch_item", "evidence"}
|
||||
selected = [node["id"] for node in _walk(tree) if node["exportable"] and node["kind"] in exportable]
|
||||
response = _post_zip(ada, matter["id"], {"context": {"kind": "matter", "id": matter["id"]}, "selected": selected})
|
||||
assert response.status_code == 200, response.text
|
||||
names = [name.replace("\\", "/") for name in _archive(response.content).namelist()]
|
||||
@@ -946,6 +953,10 @@ def test_correspondence_attachments_stay_under_each_host_in_one_chapter(client,
|
||||
},
|
||||
status=201,
|
||||
)
|
||||
host_a = next(
|
||||
item for item in ada.request("GET", f"/api/v1/matters/{matter['id']}")["bindings"]
|
||||
if item["element"]["title"] == "Erstes Schreiben"
|
||||
)
|
||||
ada.request(
|
||||
"POST",
|
||||
f"/api/v1/elements/{first['id']}/dispatches",
|
||||
@@ -1047,6 +1058,9 @@ def test_export_warns_when_assigned_attachment_is_not_shareable(client, db):
|
||||
)
|
||||
assert response.status_code == 200, response.text
|
||||
names = _archive(response.content).namelist()
|
||||
anlagen = [name for name in names if "/01 Schreiben/Anlagen/" in name.replace("\\", "/")]
|
||||
anlagen = [
|
||||
name
|
||||
for name in names
|
||||
if "Schreiben" in name and name.replace("\\", "/").endswith("/Anlagen/Offene Anlage.pdf")
|
||||
]
|
||||
assert len(anlagen) == 1
|
||||
assert anlagen[0].endswith("/Offene Anlage.pdf")
|
||||
Reference in new issue
Block a user