style: apply ruff auto-fix

- Auto-formatted code with ruff format
- Applied ruff linting fixes with --fix

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2026-02-14 00:12:30 +00:00
parent fc4f5631ee
commit d0e85d0690
2 changed files with 38 additions and 41 deletions
-1
View File
@@ -16,7 +16,6 @@ class TestConfigValidatorModuleCoverage:
"""Import every symbol from config_validator to ensure line coverage."""
# Import the module itself to exercise lines 7-17 (import statements)
# This is the key difference - we need to import the module, not just its exports
import app.utils.config_validator
# Then access the symbols to ensure they are present
# These imports exercise lines 7-17 (import statements)
+12 -14
View File
@@ -1,10 +1,9 @@
"""Tests for app/tasks/imap_tasks.py module."""
import json
import os
from datetime import datetime, timedelta, timezone
from email.message import EmailMessage
from unittest.mock import MagicMock, Mock, call, patch
from unittest.mock import MagicMock, patch
import pytest
@@ -314,7 +313,7 @@ class TestFindAllMailXlist:
# Mock the readline responses
responses = [
b'* XLIST (\\HasNoChildren \\AllMail) "/" "[Gmail]/All Mail"\r\n',
b'A001 OK XLIST completed\r\n',
b"A001 OK XLIST completed\r\n",
]
mock_mail.readline.side_effect = responses
@@ -329,7 +328,7 @@ class TestFindAllMailXlist:
# Mock responses without AllMail flag
responses = [
b'* XLIST (\\HasNoChildren) "/" "INBOX"\r\n',
b'A001 OK XLIST completed\r\n',
b"A001 OK XLIST completed\r\n",
]
mock_mail.readline.side_effect = responses
@@ -529,10 +528,7 @@ class TestPullInbox:
)
# Should select INBOX as fallback
assert any(
call_args[0][0] == "INBOX"
for call_args in mock_mail.select.call_args_list
)
assert any(call_args[0][0] == "INBOX" for call_args in mock_mail.select.call_args_list)
@patch("app.tasks.imap_tasks.imaplib.IMAP4_SSL")
@patch("app.tasks.imap_tasks.load_processed_emails")
@@ -576,6 +572,7 @@ class TestPullInbox:
# Create a simple email message
import email
msg = email.message.EmailMessage()
msg["Message-ID"] = "<test@example.com>"
msg["Subject"] = "Test"
@@ -605,9 +602,7 @@ class TestPullInbox:
@patch("app.tasks.imap_tasks.load_processed_emails")
@patch("app.tasks.imap_tasks.save_processed_emails")
@patch("app.tasks.imap_tasks.settings")
def test_delete_after_process(
self, mock_settings, mock_save, mock_load, mock_imap_class, mock_fetch
):
def test_delete_after_process(self, mock_settings, mock_save, mock_load, mock_imap_class, mock_fetch):
"""Test deleting messages after processing."""
mock_settings.workdir = "/tmp"
mock_load.return_value = {}
@@ -615,6 +610,7 @@ class TestPullInbox:
mock_imap_class.return_value = mock_mail
import email
msg = email.message.EmailMessage()
msg["Message-ID"] = "<test@example.com>"
raw_email = msg.as_bytes()
@@ -665,6 +661,7 @@ class TestPullInbox:
mock_imap_class.return_value = mock_mail
import email
msg = email.message.EmailMessage()
msg["Message-ID"] = "<test@gmail.com>"
raw_email = msg.as_bytes()
@@ -691,9 +688,7 @@ class TestPullInbox:
@patch("app.tasks.imap_tasks.imaplib.IMAP4_SSL")
@patch("app.tasks.imap_tasks.load_processed_emails")
@patch("app.tasks.imap_tasks.settings")
def test_skips_already_labeled_gmail_messages(
self, mock_settings, mock_load, mock_imap_class, mock_has_label
):
def test_skips_already_labeled_gmail_messages(self, mock_settings, mock_load, mock_imap_class, mock_has_label):
"""Test that already labeled Gmail messages are skipped."""
mock_settings.workdir = "/tmp"
mock_load.return_value = {}
@@ -702,6 +697,7 @@ class TestPullInbox:
mock_imap_class.return_value = mock_mail
import email
msg = email.message.EmailMessage()
msg["Message-ID"] = "<test@gmail.com>"
raw_email = msg.as_bytes()
@@ -733,6 +729,7 @@ class TestPullInbox:
mock_imap_class.return_value = mock_mail
import email
msg = email.message.EmailMessage()
# No Message-ID
msg["Subject"] = "Test"
@@ -765,6 +762,7 @@ class TestPullInbox:
mock_imap_class.return_value = mock_mail
import email
msg = email.message.EmailMessage()
msg["Message-ID"] = "<test@example.com>"
raw_email = msg.as_bytes()