test: allow mail source folders with spaces

This commit is contained in:
copilot-swe-agent[bot]
2026-05-22 20:07:46 +00:00
committed by GitHub
parent b17c4c309b
commit 2c528137db
+14 -1
View File
@@ -5,6 +5,7 @@ Tests for MailSource model and mail-sources API endpoints.
import asyncio
import json
from datetime import datetime
from pathlib import Path
from unittest.mock import MagicMock, patch
from urllib.parse import parse_qs, urlparse
@@ -139,6 +140,17 @@ class TestMailSourceImportModel:
assert "ignored" not in details[0]
def test_mail_source_folder_input_has_no_pattern_validation():
"""The UI should not reject valid IMAP folder names containing spaces."""
template = (Path(__file__).resolve().parents[1] / "templates" / "mail_sources.html").read_text()
model_position = template.index('x-model="form.folder"')
input_start = template.rfind("<input", 0, model_position)
input_end = template.index(">", model_position)
folder_input = template[input_start:input_end]
assert "pattern=" not in folder_input
class TestImportHistoryDecoding:
"""Unit tests for import-history JSON decoding helpers."""
@@ -263,7 +275,7 @@ class TestMailSourcesAPIAuthed:
"username": "user@example.com",
"password": "s3cr3t",
"use_ssl": True,
"folder": "INBOX",
"folder": "Junk Mail",
"polling_interval": 60,
"enabled": True,
}
@@ -273,6 +285,7 @@ class TestMailSourcesAPIAuthed:
assert data["name"] == "My IMAP"
assert data["method"] == "IMAP"
assert data["server"] == "imap.example.com"
assert data["folder"] == "Junk Mail"
assert data["password"] == "**redacted**"
assert data["id"] is not None