annotate core/tests/test_mdexts.py @ 896:0054a4a88c1c

Remove checking for https availability. This seems to take quite a while, plus Python doesn't validate the cert, so we could end up with dodgy sites.
author Brian Neal <bgneal@gmail.com>
date Wed, 25 Feb 2015 21:09:41 -0600
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)