Halte die Richtung an der einzelnen Einbindung und mach sie in der Uebersicht waehlbar.
Deploy Development / deploy (push) Successful in 28s
Deploy Development / deploy (push) Successful in 28s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
2664021e7f
commit
95381030bc
12 files changed
+185
-52
No files matched your search
@@ -194,3 +194,65 @@ def test_chapter_and_matter_can_be_renamed_and_moved(client, db):
|
||||
json={"expected_version": ada.request("GET", f"/api/v1/cases/{case['id']}")["version"]},
|
||||
)
|
||||
ada.request("GET", f"/api/v1/cases/{case['id']}", status=404)
|
||||
|
||||
|
||||
def test_one_beleg_does_not_classify_the_chapter(client, db):
|
||||
ada = Actor(client, "ada-kapitel@example.test", "Ada Kapitel")
|
||||
register(db, ada.email, ada.name)
|
||||
ada.login()
|
||||
matter = matter_of(ada, "Schriftverkehr")
|
||||
chapter = ada.request(
|
||||
"POST",
|
||||
f"/api/v1/matters/{matter['id']}/chapters",
|
||||
json={"title": "Belege"},
|
||||
status=201,
|
||||
)
|
||||
for title, external_id in (("Eingangsschreiben", "pl-1"), ("Antwortschreiben", "pl-2"), ("Rechnung", "pl-3")):
|
||||
ada.request(
|
||||
"POST",
|
||||
"/api/v1/external-refs",
|
||||
json={
|
||||
"title": title,
|
||||
"source": "paperless",
|
||||
"external_id": external_id,
|
||||
"context": {"kind": "matter", "id": matter["id"]},
|
||||
"chapter_id": chapter["id"],
|
||||
"dates": {"document_on": "2026-10-01"},
|
||||
},
|
||||
status=201,
|
||||
)
|
||||
detail = _matter(ada, matter["id"])
|
||||
incoming = _binding(detail, "Eingangsschreiben")
|
||||
reply = _binding(detail, "Antwortschreiben")
|
||||
invoice = _binding(detail, "Rechnung")
|
||||
ada.request(
|
||||
"POST",
|
||||
f"/api/v1/elements/{reply['element']['id']}/references",
|
||||
json={"refers_to_element_id": incoming["element"]["id"], "context": {"kind": "matter", "id": matter["id"]}},
|
||||
status=204,
|
||||
)
|
||||
ada.request(
|
||||
"PATCH",
|
||||
f"/api/v1/bindings/{incoming['id']}/communication",
|
||||
json={"expected_version": incoming["element"]["version"], "direction": "in", "context": {"kind": "matter", "id": matter["id"]}},
|
||||
)
|
||||
shown = _matter(ada, matter["id"])
|
||||
assert _binding(shown, "Eingangsschreiben")["communication"] == {"direction": "in", "explicit": True}
|
||||
assert _binding(shown, "Antwortschreiben")["communication"]["direction"] is None
|
||||
assert _binding(shown, "Rechnung")["communication"]["direction"] is None
|
||||
assert _binding(shown, "Antwortschreiben")["element"]["refers_to"][0]["direction"] == "in"
|
||||
ada.request(
|
||||
"PATCH",
|
||||
f"/api/v1/bindings/{reply['id']}/communication",
|
||||
json={"expected_version": reply["element"]["version"], "direction": "out", "context": {"kind": "matter", "id": matter["id"]}},
|
||||
)
|
||||
ada.request(
|
||||
"PATCH",
|
||||
f"/api/v1/bindings/{invoice['id']}/communication",
|
||||
json={"expected_version": invoice["element"]["version"], "direction": "local", "context": {"kind": "matter", "id": matter["id"]}},
|
||||
)
|
||||
final = _matter(ada, matter["id"])
|
||||
assert _binding(final, "Eingangsschreiben")["communication"]["direction"] == "in"
|
||||
assert _binding(final, "Antwortschreiben")["communication"]["direction"] == "out"
|
||||
assert _binding(final, "Rechnung")["communication"] == {"direction": "local", "explicit": True}
|
||||
assert all(item["chapter_id"] == chapter["id"] for item in final["bindings"])
|
||||
Reference in new issue
Block a user