Zeige die Zusatzfelder in der Trefferliste und erkenne Vorschaubilder am Inhalt statt am Antwort-Header.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f7de33049
commit
38406d3293
4 files changed
+89
-10
No files matched your search
@@ -472,6 +472,14 @@ def test_paperless_default_search_reads_title_and_content_and_shows_a_preview(cl
|
||||
"tags": [2, 5, 99],
|
||||
"archive_serial_number": 1042,
|
||||
"page_count": 3,
|
||||
"custom_fields": [
|
||||
{"field": 1, "value": "EUR100.50"},
|
||||
{"field": 2, "value": "2024-03-09"},
|
||||
{"field": 3, "value": "b"},
|
||||
{"field": 4, "value": True},
|
||||
{"field": 5, "value": None},
|
||||
{"field": 99, "value": "fremd"},
|
||||
],
|
||||
"content": body,
|
||||
}
|
||||
],
|
||||
@@ -482,6 +490,16 @@ def test_paperless_default_search_reads_title_and_content_and_shows_a_preview(cl
|
||||
return {"results": [{"id": 2, "name": "Miete"}, {"id": 5, "name": "Wohnung"}]}
|
||||
if path == "/api/correspondents/":
|
||||
return {"results": [{"id": 4, "name": "Hausverwaltung"}]}
|
||||
if path == "/api/custom_fields/":
|
||||
return {
|
||||
"results": [
|
||||
{"id": 1, "name": "Rechnungsbetrag", "data_type": "monetary"},
|
||||
{"id": 2, "name": "bezahlt_am", "data_type": "date"},
|
||||
{"id": 3, "name": "Status", "data_type": "select", "extra_data": {"select_options": [{"id": "b", "label": "bezahlt"}]}},
|
||||
{"id": 4, "name": "Geprüft", "data_type": "boolean"},
|
||||
{"id": 5, "name": "Notiz", "data_type": "string"},
|
||||
]
|
||||
}
|
||||
return {"results": [{"id": 8, "name": "Brief"}]}
|
||||
|
||||
monkeypatch.setattr(sources, "_paperless_get", fake_get)
|
||||
@@ -515,6 +533,12 @@ def test_paperless_default_search_reads_title_and_content_and_shows_a_preview(cl
|
||||
assert "Kündigung des Mietvertrags" in item["snippet"]
|
||||
assert len(item["snippet"]) <= 262
|
||||
assert item["snippet"].startswith("…")
|
||||
assert item["custom_fields"] == [
|
||||
{"name": "Rechnungsbetrag", "type": "monetary", "value": "EUR100.50"},
|
||||
{"name": "bezahlt_am", "type": "date", "value": "2024-03-09"},
|
||||
{"name": "Status", "type": "select", "value": "bezahlt"},
|
||||
{"name": "Geprüft", "type": "boolean", "value": "Ja"},
|
||||
]
|
||||
assert found["total"] == 1
|
||||
assert found["previous_page"] is None
|
||||
facets = ada.request("GET", "/api/v1/sources/paperless/facets", params={"connector_id": first["id"]})
|
||||
@@ -639,6 +663,8 @@ def test_paperless_thumbnail_is_bound_to_the_owners_instance(client, db, monkeyp
|
||||
return b"RIFFxxxxWEBP", "image/webp", ""
|
||||
if path.endswith("/8/thumb/"):
|
||||
return b"<p>", "text/html", ""
|
||||
if path.endswith("/6/thumb/"):
|
||||
return b"\x89PNG\r\n\x1a\nxxxx", "application/octet-stream", ""
|
||||
if path.endswith("/7/thumb/"):
|
||||
return b"<svg xmlns='http://www.w3.org/2000/svg'/>", "image/svg+xml", ""
|
||||
return None
|
||||
@@ -663,6 +689,8 @@ def test_paperless_thumbnail_is_bound_to_the_owners_instance(client, db, monkeyp
|
||||
assert ok.headers["content-type"] == "image/webp"
|
||||
assert ok.headers["cache-control"] == "private, no-store"
|
||||
assert seen[-1] == ("token-alpha", "/api/documents/9/thumb/")
|
||||
typed = get(ada, 6)
|
||||
assert typed.status_code == 200 and typed.headers["content-type"] == "image/png"
|
||||
assert get(ada, 8).status_code == 422
|
||||
assert get(ada, 7).status_code == 422
|
||||
assert get(ada, 5).status_code == 404
|
||||
@@ -673,7 +701,7 @@ def test_paperless_thumbnail_is_bound_to_the_owners_instance(client, db, monkeyp
|
||||
register(db, ben.email, ben.name)
|
||||
ben.login()
|
||||
assert get(ben, 9).status_code == 404
|
||||
assert len(seen) == 4
|
||||
assert len(seen) == 5
|
||||
|
||||
|
||||
def test_revoked_grant_hides_bytes_fetched_during_the_call(client, db, monkeypatch):
|
||||
|
||||
Reference in new issue
Block a user