fix(i-e): Mail-Suite 46/46 gruen in 94s statt 18:29min — globales IMAP-Mock-Fixture + 3 echte Fixes
Check Cross-Plugin Imports / check (push) Has been cancelled

Root-Cause der 35 Suite-Timeouts: test_delete_folder trigger imap_delete_folder -> echter aioimaplib.IMAP4_SSL-Connect zu imap.example.com blockiert bis Netzwerk-Timeout; der blockierte Call vergiftet Event-Loop fuer alle nachfolgenden Tests (Kaskade ab 12. Test).

Fixes: (1) tests/conftest.py: autouse mock_imap_connections-Fixture mit deterministischem Fake-IMAP-Client (_FakeIMAPResponse, alle Client-Methoden) via monkeypatch auf services.aioimaplib.IMAP4_SSL. (2) create_mail_account setzt owner_id=user_id gemaess OwnedMixin-Contract — vorher NULL -> get_effective_access read statt admin -> 403 bei assign_shared_users (echter Production-Bug). (3) test_download_attachment: storage_path relativ zum Storage-Root — Path-Traversal-Guard hat korrekt gearbeitet. (4) GET /mail/threads gibt Plain Array zurueck — konsistent mit Geschwister-Routen und fetchThreads(): Promise<ThreadResult[]>.

Beweise: 46/46 passed in 94.41s (vorher 1 failed, 10 passed, 35 errors in 1109.94s); conftest-ruff-Findings auto-gefixt (8), Rest = Vorbestand E402 dynamische Plugin-Imports; Test nach Fix verifiziert.
This commit is contained in:
Agent Zero
2026-08-25 21:39:58 +02:00
parent ab3c253cbd
commit c291a6ecf1
4 changed files with 113 additions and 18 deletions
+4 -1
View File
@@ -893,7 +893,10 @@ async def list_threads(
threads[tid]["mail_count"] += 1
threads[tid]["mails"].append(mail_to_response(mail))
items = list(threads.values())
return {"items": items, "total": len(items)}
# Plain array — consistent with sibling mail list routes (accounts,
# folders, templates) and with the frontend client type
# fetchThreads(): Promise<ThreadResult[]>.
return items
# ─── Templates (F-MAIL-06) ───
+1
View File
@@ -285,6 +285,7 @@ async def create_mail_account(
account = MailAccount(
tenant_id=tenant_id,
user_id=user_id,
owner_id=user_id,
email_address=data["email_address"],
display_name=data.get("display_name", ""),
imap_host=data["imap_host"],