Behebe R-11: Übersicht und Suche lesen in Blöcken und prüfen Rechte vor der Begrenzung.
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 5m53s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 21s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
StommerandClaude Sonnet 5.5 committed 2026-10-22 17:26:06 +02:00
1 parent a3f328832e
commit d0f09830bb
3 files changed
+92 -18

No files matched your search

+46
View File
@@ -0,0 +1,46 @@
"""R-11: other people's rows must not push your own out of the overview and the search."""
from __future__ import annotations
from tests.support import Actor, case_of, note_on, register
def test_own_entries_are_found_behind_many_foreign_ones(client, db, monkeypatch):
from fastapi.testclient import TestClient
from app.api import routes
from app.main import app
# A tiny batch size makes the paging visible with few rows.
monkeypatch.setattr(routes, "SCAN_BATCH", 2)
register(db, "ada-scan@example.test", "Ada")
register(db, "ben-scan@example.test", "Ben")
ada = Actor(client, "ada-scan@example.test", "Ada")
ben = Actor(TestClient(app), "ben-scan@example.test", "Ben")
ada.login()
ben.login()
ada_case = case_of(ada, "Adas Akte")
for index in range(7):
matter = ada.request("POST", "/api/v1/matters", json={"title": f"Adas Vorgang {index}"}, status=201)
ada.request("POST", "/api/v1/tasks", json={"title": f"Frühe Aufgabe {index}", "due_on": "2026-01-0%d" % (index + 1), "matter_id": matter["id"]}, status=201)
ada.request("POST", "/api/v1/deadlines", json={"title": f"Frühe Frist {index}", "due_on": "2026-01-0%d" % (index + 1), "matter_id": matter["id"]}, status=201)
note_on(ada, f"Gemeinsames Stichwort {index}", "Zebrastreifen", ada_case["id"])
ben_matter = ben.request("POST", "/api/v1/matters", json={"title": "Bens Vorgang"}, status=201)
ben.request("POST", "/api/v1/tasks", json={"title": "Bens späte Aufgabe", "due_on": "2027-01-01", "matter_id": ben_matter["id"]}, status=201)
ben.request("POST", "/api/v1/deadlines", json={"title": "Bens späte Frist", "due_on": "2027-01-01", "matter_id": ben_matter["id"]}, status=201)
ben_case = case_of(ben, "Bens Akte")
note_on(ben, "Bens Zebrastreifen-Notiz", "Zebrastreifen", ben_case["id"])
assert [item["title"] for item in ben.request("GET", "/api/v1/views/open-tasks")["items"]] == ["Bens späte Aufgabe"]
assert [item["title"] for item in ben.request("GET", "/api/v1/views/open-deadlines")["items"]] == ["Bens späte Frist"]
found = ben.request("GET", "/api/v1/search", params={"q": "Zebrastreifen"})["items"]
assert [item["title"] for item in found] == ["Bens Zebrastreifen-Notiz"]
# The own entries still come in order and the cap on the list holds.
monkeypatch.setattr(routes, "VIEW_LIMIT", 3)
first = ada.request("GET", "/api/v1/views/open-tasks")["items"]
assert [item["title"] for item in first] == ["Frühe Aufgabe 0", "Frühe Aufgabe 1", "Frühe Aufgabe 2"]
monkeypatch.setattr(routes, "SEARCH_LIMIT", 4)
assert len(ada.request("GET", "/api/v1/search", params={"q": "Zebrastreifen"})["items"]) == 4