diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2012-06-30 18:54:38 +0100 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2012-07-03 22:20:12 +0100 |
| commit | bee498f3a2f66210db39f0be244ec4fa888b6940 (patch) | |
| tree | 95252d804377899b9d5bb3bff1a1c8dc6206d835 /tests | |
| parent | f33e15036907d6e4bda6116dc84097e9e590d2c8 (diff) | |
Added 'format_html' utility for formatting HTML fragments safely
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/utils/html.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/regressiontests/utils/html.py b/tests/regressiontests/utils/html.py index 434873b9e0..389ae8ec75 100644 --- a/tests/regressiontests/utils/html.py +++ b/tests/regressiontests/utils/html.py @@ -34,6 +34,17 @@ class TestUtilsHtml(unittest.TestCase): # Verify it doesn't double replace &. self.check_output(f, '<&', '<&') + def test_format_html(self): + self.assertEqual( + html.format_html(u"{0} {1} {third} {fourth}", + u"< Dangerous >", + html.mark_safe(u"<b>safe</b>"), + third="< dangerous again", + fourth=html.mark_safe(u"<i>safe again</i>") + ), + u"< Dangerous > <b>safe</b> < dangerous again <i>safe again</i>" + ) + def test_linebreaks(self): f = html.linebreaks items = ( |
