42 lines
1.2 KiB
Python
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 <admin>", html)
|
|
self.assertIn("Factuur <juli>", html)
|
|
self.assertIn("Test & Folder", html)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|