Mercurial > public > sg101
diff core/tests/test_ssl_images.py @ 871:6900040df0f8
More WIP on ssl_images command & unit test.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 16 Dec 2014 20:59:49 -0600 |
parents | ee56c8c8cf98 |
children | 1bd9dadcd4d9 |
line wrap: on
line diff
--- a/core/tests/test_ssl_images.py Mon Dec 15 21:16:47 2014 -0600 +++ b/core/tests/test_ssl_images.py Tue Dec 16 20:59:49 2014 -0600 @@ -29,5 +29,87 @@ self.assertNotEqual(test_str, expected) self.assertEqual(expected, result) + def test_sg101_with_newlines(self): + test_str = """An image: ![image]( +http://surfguitar101.com/media/zzz.jpg +) + with trailing text.""" + expected = """An image: ![image](/media/zzz.jpg) + with trailing text.""" + result = process_post(test_str) + self.assertNotEqual(test_str, expected) + self.assertEqual(expected, result) + def test_https_already(self): - pass + test_str = """An image that is already using https: + ![flyer](https://example.com/zzz.png) + It's cool. + """ + result = process_post(test_str) + self.assertEqual(test_str, result) + + def test_https_sg101(self): + test_str = """An image that is already using https: + ![flyer](https://www.SURFGUITAR101.com/zzz.png) + It's cool. + """ + expected = """An image that is already using https: + ![flyer](/zzz.png) + It's cool. + """ + result = process_post(test_str) + self.assertEqual(expected, result) + + def test_multiple_non_http(self): + test_str = """An image: ![image](http://www.surfguitar101.com/img.jpg) + And another: ![pic](HTTPS://example.com/foo/bar/img.png). + More stuff here.""" + expected = """An image: ![image](/img.jpg) + And another: ![pic](HTTPS://example.com/foo/bar/img.png). + More stuff here.""" + result = process_post(test_str) + self.assertEqual(expected, result) + + def test_https_already_with_title(self): + test_str = """An image that is already using https: + ![flyer](https://example.com/zzz.png "the title") + It's cool. + """ + result = process_post(test_str) + self.assertEqual(test_str, result) + + def test_sg101_with_title(self): + test_str = """An image on SG101: + ![flyer](http://surfguitar101.com/zzz.png "the title") + It's cool. + """ + expected = """An image on SG101: + ![flyer](/zzz.png "the title") + It's cool. + """ + result = process_post(test_str) + self.assertEqual(expected, result) + + def test_https_sg101_brackets(self): + test_str = """An image that is already using https: + ![flyer](<https://www.SURFGUITAR101.com/zzz.png>) + It's cool. + """ + expected = """An image that is already using https: + ![flyer](/zzz.png) + It's cool. + """ + result = process_post(test_str) + self.assertEqual(expected, result) + + def test_https_already_brackets(self): + test_str = """An image that is already using https: + ![flyer](<https://example.com/zzz.png>) + It's cool. + """ + expected = """An image that is already using https: + ![flyer](https://example.com/zzz.png) + It's cool. + """ + result = process_post(test_str) + self.assertEqual(expected, result)