0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 03:31:04 +01:00

Update test_image_embed_is_rewritten to work on valid HTML input, to make it a more meaningful / representative test

This commit is contained in:
Matt Westcott 2014-07-17 13:14:06 +01:00
parent acb2b0bccd
commit d9b1ac9350

View File

@ -25,9 +25,9 @@ class TestDbWhitelister(TestCase):
self.assertHtmlEqual(expected, output_html)
def test_image_embed_is_rewritten(self):
input_html = '<p>OMG look at this picture of a kitten: <figure data-embedtype="image" data-id="5" data-format="image-with-caption" data-alt="A cute kitten" class="fancy-image"><img src="/media/images/kitten.jpg" width="320" height="200" alt="A cute kitten" /><figcaption>A kitten, yesterday.</figcaption></figure></p>'
input_html = '<p>OMG look at this picture of a kitten:</p><figure data-embedtype="image" data-id="5" data-format="image-with-caption" data-alt="A cute kitten" class="fancy-image"><img src="/media/images/kitten.jpg" width="320" height="200" alt="A cute kitten" /><figcaption>A kitten, yesterday.</figcaption></figure>'
output_html = DbWhitelister.clean(input_html)
expected = '<p>OMG look at this picture of a kitten: </p><embed embedtype="image" id="5" format="image-with-caption" alt="A cute kitten" /><p></p>'
expected = '<p>OMG look at this picture of a kitten:</p><embed embedtype="image" id="5" format="image-with-caption" alt="A cute kitten" />'
self.assertHtmlEqual(expected, output_html)
def test_media_embed_is_rewritten(self):