FRE-4693: Add integration tests for mail client

46 new integration tests covering all mail client operations:
- ListMessages: success, folder/starred/read/since filters, combined filters, API errors, bad JSON
- GetMessage: success, URL escaping, not found, decrypt body with PGP
- Send: success, PGP encryption, CC/BCC, HTTP errors, 201 status
- MoveToTrash: success, error handling
- PermanentlyDelete: success, error, URL escaping
- SaveDraft: success, CC/BCC, API error, bad JSON
- UpdateDraft: success, CC, conflict error
- SendDraft: success, error
- ListDrafts: success via ListMessages delegation
- SearchMessages: success, empty results, API error, bad JSON
- Auth header propagation, content-type headers
- Concurrent access safety, timeout handling
- Helper types: Folder.Name, Recipient.DisplayName, Message.Folder

Uses httptest.Server with configurable route handlers to mock ProtonMail API.
All 46 tests pass. 3 pre-existing pgp_test.go failures unchanged.
This commit is contained in:
Senior Engineer
2026-05-03 17:34:27 -04:00
committed by Michael Freno
parent 6cc520e221
commit 90bee9119e

1386
internal/mail/client_test.go Normal file

File diff suppressed because it is too large Load Diff