annotate core/tests/test_mdexts.py @ 947:49646a78e965

Update requirements_dev.txt for Django 1.7.7 upgrade.
author Brian Neal <bgneal@gmail.com>
date Sat, 16 May 2015 14:36:31 -0500
parents f12751259f66
children
rev   line source
bgneal@883 1 """Testing our custom Markdown extensions."""
bgneal@883 2
bgneal@883 3 import unittest
bgneal@883 4
bgneal@883 5 import markdown
bgneal@883 6
bgneal@883 7 from core.mdexts.ssl_images import SslImagesExtension
bgneal@883 8
bgneal@883 9
bgneal@883 10 class SslImagesExtTestCase(unittest.TestCase):
bgneal@883 11 """Tests for the SslImagesExtension."""
bgneal@883 12
bgneal@883 13 def setUp(self):
bgneal@883 14 self.md = markdown.Markdown(extensions=[SslImagesExtension()])
bgneal@883 15
bgneal@883 16 def test_simple(self):
bgneal@883 17 self.assertEqual(self.md.convert(''), '')
bgneal@883 18 self.assertEqual(self.md.convert('1'), '<p>1</p>')
bgneal@883 19
bgneal@883 20 def test_no_change(self):
bgneal@883 21 self.assertEqual(self.md.convert('![image](https://example.com/1.jpg)'),
bgneal@883 22 u'<p><img alt="image" src="https://example.com/1.jpg" /></p>')
bgneal@883 23
bgneal@883 24 def test_change(self):
bgneal@883 25 text = u'![image](http://example.com/1.jpg)'
bgneal@883 26 html = u'<p><a href="http://example.com/1.jpg">Click for image</a></p>'
bgneal@883 27 self.assertEqual(self.md.convert(text), html)