26 lines
853 B
Python
26 lines
853 B
Python
import unittest
|
|
|
|
from generator import inject_outlook_hacks
|
|
|
|
|
|
class HtmlInjectionTest(unittest.TestCase):
|
|
def test_html_injection_adds_folded_alt_desc(self) -> None:
|
|
ical_text = "\n".join(
|
|
[
|
|
"BEGIN:VCALENDAR",
|
|
"BEGIN:VEVENT",
|
|
"UID:abc123",
|
|
"END:VEVENT",
|
|
"END:VCALENDAR",
|
|
]
|
|
)
|
|
long_html = "A" * 200
|
|
result = inject_outlook_hacks(ical_text, {"abc123": long_html})
|
|
|
|
self.assertIn("X-ALT-DESC;FMTTYPE=text/html:", result)
|
|
self.assertIn("X-MICROSOFT-CDO-BUSYSTATUS:BUSY", result)
|
|
self.assertIn("TRANSP:OPAQUE", result)
|
|
alt_index = result.find("X-ALT-DESC;FMTTYPE=text/html:")
|
|
self.assertNotEqual(alt_index, -1)
|
|
self.assertIn("\r\n ", result[alt_index : alt_index + 200])
|