bgneal@883: """Testing our custom Markdown extensions.""" bgneal@883: bgneal@883: import unittest bgneal@883: bgneal@883: import markdown bgneal@883: bgneal@883: from core.mdexts.ssl_images import SslImagesExtension bgneal@883: bgneal@883: bgneal@883: class SslImagesExtTestCase(unittest.TestCase): bgneal@883: """Tests for the SslImagesExtension.""" bgneal@883: bgneal@883: def setUp(self): bgneal@883: self.md = markdown.Markdown(extensions=[SslImagesExtension()]) bgneal@883: bgneal@883: def test_simple(self): bgneal@883: self.assertEqual(self.md.convert(''), '') bgneal@883: self.assertEqual(self.md.convert('1'), '

1

') bgneal@883: bgneal@883: def test_no_change(self): bgneal@883: self.assertEqual(self.md.convert('![image](https://example.com/1.jpg)'), bgneal@883: u'

image

') bgneal@883: bgneal@883: def test_change(self): bgneal@883: text = u'![image](http://example.com/1.jpg)' bgneal@883: html = u'

Click for image

' bgneal@883: self.assertEqual(self.md.convert(text), html)