Skip to content

❤️ TEST-#38: Add coverage for Sync and Restore single-mailbox paths - #82

Merged
FernandoCelmer merged 1 commit into
developfrom
feature/38
May 17, 2026
Merged

❤️ TEST-#38: Add coverage for Sync and Restore single-mailbox paths#82
FernandoCelmer merged 1 commit into
developfrom
feature/38

Conversation

@FernandoCelmer

Copy link
Copy Markdown
Member

Summary

New test modules:

  • tests/clients/imap/test_sync.py — 5 tests for Sync.sync:
    • inserts new messages
    • skips duplicate message-ids on second pass
    • empty mailbox = no work
    • progress callback invoked, ends at total
    • storage save failure recorded in result.errors
  • tests/clients/imap/test_restore.py — 7 tests for Restore.restore_mailbox + helpers:
    • uploads new message
    • skips messages already on server (via _server_message_ids)
    • missing storage entry is dropped, no APPEND
    • skip_duplicates=False forces upload
    • _ensure_mailbox: existing mailbox is no-op, missing mailbox is created
    • _server_message_ids: empty SEARCH returns empty set

Total mocked IMAP scenarios use the existing make_fake_client fixture, so no new dependencies.

Closes #38

Test plan

  • pytest tests/clients/imap/test_sync.py tests/clients/imap/test_restore.py — 12 passed

@FernandoCelmer FernandoCelmer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Code Review

Code issues found: 0

Test-only PR. Two new modules close the biggest test-coverage gap in the library:

test_sync.py — covers insert, dedupe-on-second-pass, empty mailbox, progress callback invariant (ends at total), and the storage-error path that lands in result.errors.

test_restore.py — covers upload, server-side dedupe via _server_message_ids, missing-storage-entry drop, skip_duplicates=False force-upload, and _ensure_mailbox create/no-op branches.

Reusing make_fake_client keeps the suite hermetic — no new deps. Combined with #81 this fills the two open test-coverage tickets in one round.

Closes #38.

@FernandoCelmer
FernandoCelmer merged commit 4aabd34 into develop May 17, 2026
10 checks passed
@FernandoCelmer
FernandoCelmer deleted the feature/38 branch May 17, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant