import unittest from django.template import Context from ..processors import render_universal_segment, render_template class TestProcessors(unittest.TestCase): def setUp(self): self.context_data = { "document": { "organization": {"name": "Example Corp"}, "created_at": "2025-04-08", "third_party_vendor_access": 50 } } self.template_segments = [ { "segment_type": "example_segment", "content": [ { "title": "Main Title", "subtitle": "Subtitle 1", "description": "This is the first description.\n- Bullet 1\n- Bullet 2" }, { "subtitle": "Subtitle 2", "description": "This is the second description.\nAnother paragraph here." } ], "html": "
Custom HTML content with {{ document.organization.name }}
Custom HTML content with Example Corp
", result) def test_render_template(self): result = render_template(self.template_segments, self.context_data) self.assertIn('Only HTML
"} result = render_universal_segment(segment, self.context_data) self.assertIn("Only HTML
", result)