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.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
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 <admin>", html)
|
||||
self.assertIn("Factuur <juli>", html)
|
||||
self.assertIn("Test & Folder", html)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user