Files
mailcat/tests/test_dagelijks_overzicht.py
wienen 99cd891b1e Add Apple Mail links to daily report
The prompts used to arrive at this change since the previous commit

User asked whether daily report emails could include links, then chose Apple Mail links as the first implementation.

Any special observations that may be relevant for version management for this version. Be brief.

Apple Mail links use Message-ID-based message:// URLs and depend on macOS Mail having the messages synced/indexed locally. verplaats_log.json and plan.md were left unstaged.
2026-07-05 11:22:03 +02:00

42 lines
1.2 KiB
Python

import unittest
from dagelijks_overzicht import apple_mail_url, bouw_html
class DagelijksOverzichtTests(unittest.TestCase):
def test_apple_mail_url_encodes_message_id(self):
self.assertEqual(
apple_mail_url("<abc.123@example.com>"),
"message://%3Cabc.123%40example.com%3E",
)
def test_apple_mail_url_wraps_bare_message_id(self):
self.assertEqual(
apple_mail_url("abc.123@example.com"),
"message://%3Cabc.123%40example.com%3E",
)
def test_bouw_html_links_subject_and_escapes_headers(self):
html = bouw_html(
{
"INBOX.Test & Folder": [
{
"time": "08:15",
"from": "Alice <admin>",
"subject": "Factuur <juli>",
"message_id": "<msg@example.com>",
}
]
},
__import__("datetime").date(2026, 7, 5),
)
self.assertIn("message://%3Cmsg%40example.com%3E", html)
self.assertIn("Alice &lt;admin&gt;", html)
self.assertIn("Factuur &lt;juli&gt;", html)
self.assertIn("Test &amp; Folder", html)
if __name__ == "__main__":
unittest.main()