Add fake IMAP server for integration testing#3
Merged
dannywillems merged 6 commits intomasterfrom Feb 9, 2026
Merged
Conversation
Add an in-process fake IMAP server that exercises the full connection lifecycle: TCP -> greeting -> STARTTLS -> TLS handshake -> LOGIN -> commands -> LOGOUT. The fake server generates self-signed certs at runtime via rcgen and implements enough of the IMAP protocol (LIST, SELECT, UID SEARCH, UID FETCH with counted literals, LOGOUT) to test all ProtonClient public methods. Server code is heavily commented explaining the IMAP protocol at each step. 7 integration tests cover: list_folders, fetch_uid, fetch_unseen, fetch_all, fetch_last_n, search, and empty_mailbox.
- Move lint config from per-file attributes to [lints.clippy] - Remove missing_errors_doc and missing_panics_doc allows - Add # Errors doc sections to all public Result-returning fns - Fix clippy issues: const fn, useless conversion, split_once, similar_names
Test all 6 CLI subcommands (folders, list --limit, list --unseen, show, search, list --json) by spawning the binary against the fake IMAP server and asserting on stdout.
Split the monolithic server.rs into one file per IMAP command handler (login, logout, list, select, uid_search, uid_fetch) under handlers/. Each handler is independently testable via tokio::io::duplex, adding 21 unit tests. Shared I/O helpers moved to io.rs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ProtonClientpublic methods:list_folders,fetch_uid,fetch_unseen,fetch_all,fetch_last_n,search, and empty mailbox handlingrcgen(no cert files needed)Architecture
The fake server (
tests/fake_imap/) implements enough of the IMAP protocol to test the client end-to-end:Server code is heavily commented explaining the IMAP protocol at each step (educational).
New dev-dependencies
Test plan