Merge pull request #114 from christianlouis/copilot/fix-black-check-errors
style: fix black formatting in test_mail_processor_imap.py
This commit is contained in:
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fix timezone display in Mailbox Activity / Admin Logs pages: timestamps from the server were parsed as local time when no timezone indicator was present, causing relative times ("1h ago") and absolute dates to be shifted by the client's UTC offset.
|
||||
- Worker tasks: use a fresh DB session for `send_user_notification` calls and move notifications after `db.commit()` to prevent the post-rollback `greenlet_spawn` SQLAlchemy error.
|
||||
- Worker tasks: ensure `last_check_at` and error status are always committed before notifications, fixing accounts being endlessly re-queued after IMAP auth failures.
|
||||
- Style: apply black formatting to `backend/tests/unit/test_mail_processor_imap.py` to fix CI black check failure.
|
||||
## v0.4.0 (2026-03-28)
|
||||
|
||||
### Features
|
||||
|
||||
@@ -14,7 +14,6 @@ These tests verify that _fetch_imap_emails:
|
||||
import pytest
|
||||
from unittest.mock import AsyncMock, MagicMock, call, patch
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers to build lightweight fakes
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -139,9 +138,7 @@ class TestFetchImapEmailsUidCommands:
|
||||
assert new_uids == ["42"]
|
||||
|
||||
# The fetch call should use UID FETCH
|
||||
fetch_call = [
|
||||
c for c in mock_imap.uid.call_args_list if c.args[0] == "fetch"
|
||||
]
|
||||
fetch_call = [c for c in mock_imap.uid.call_args_list if c.args[0] == "fetch"]
|
||||
assert len(fetch_call) == 1
|
||||
assert fetch_call[0] == call("fetch", "42", "(RFC822)")
|
||||
|
||||
@@ -167,9 +164,7 @@ class TestFetchImapEmailsUidCommands:
|
||||
emails, new_uids = await processor._fetch_imap_emails(10, set())
|
||||
|
||||
# No STORE command should have been called (delete_after_forward=False)
|
||||
store_calls = [
|
||||
c for c in mock_imap.uid.call_args_list if c.args[0] == "store"
|
||||
]
|
||||
store_calls = [c for c in mock_imap.uid.call_args_list if c.args[0] == "store"]
|
||||
assert store_calls == [], "Expected no STORE commands for \\Seen"
|
||||
|
||||
assert len(emails) == 3
|
||||
@@ -201,9 +196,7 @@ class TestFetchImapEmailsUidCommands:
|
||||
assert new_uids == ["6"]
|
||||
assert len(emails) == 1
|
||||
|
||||
store_calls = [
|
||||
c for c in mock_imap.uid.call_args_list if c.args[0] == "store"
|
||||
]
|
||||
store_calls = [c for c in mock_imap.uid.call_args_list if c.args[0] == "store"]
|
||||
# Exactly one STORE for the stale UID
|
||||
assert len(store_calls) == 1
|
||||
assert store_calls[0] == call("store", "5", "+FLAGS", "\\Seen")
|
||||
@@ -226,9 +219,7 @@ class TestFetchImapEmailsUidCommands:
|
||||
):
|
||||
await processor._fetch_imap_emails(10, already_seen_uids={"1", "2"})
|
||||
|
||||
store_calls = [
|
||||
c for c in mock_imap.uid.call_args_list if c.args[0] == "store"
|
||||
]
|
||||
store_calls = [c for c in mock_imap.uid.call_args_list if c.args[0] == "store"]
|
||||
assert len(store_calls) == 1
|
||||
# The UID set string should contain both stale UIDs (order may vary)
|
||||
uid_set_arg = store_calls[0].args[1]
|
||||
@@ -266,9 +257,7 @@ class TestFetchImapEmailsUidCommands:
|
||||
|
||||
assert new_uids == ["7", "8"]
|
||||
|
||||
store_calls = [
|
||||
c for c in mock_imap.uid.call_args_list if c.args[0] == "store"
|
||||
]
|
||||
store_calls = [c for c in mock_imap.uid.call_args_list if c.args[0] == "store"]
|
||||
# Exactly one STORE for deletion covering both UIDs
|
||||
assert len(store_calls) == 1
|
||||
uid_set_arg = store_calls[0].args[1]
|
||||
|
||||
Reference in New Issue
Block a user