diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.py index b0ed99e621..338603d3d2 100644 --- a/zerver/tests/test_bugdown.py +++ b/zerver/tests/test_bugdown.py @@ -40,6 +40,7 @@ import six class FencedBlockPreprocessorTest(TestCase): def test_simple_quoting(self): + # type: () -> None processor = bugdown.fenced_code.FencedBlockPreprocessor(None) markdown = [ '~~~ quote', @@ -60,6 +61,7 @@ class FencedBlockPreprocessorTest(TestCase): self.assertEqual(lines, expected) def test_serial_quoting(self): + # type: () -> None processor = bugdown.fenced_code.FencedBlockPreprocessor(None) markdown = [ '~~~ quote', @@ -86,6 +88,7 @@ class FencedBlockPreprocessorTest(TestCase): self.assertEqual(lines, expected) def test_serial_code(self): + # type: () -> None processor = bugdown.fenced_code.FencedBlockPreprocessor(None) # Simulate code formatting. @@ -118,6 +121,7 @@ class FencedBlockPreprocessorTest(TestCase): self.assertEqual(lines, expected) def test_nested_code(self): + # type: () -> None processor = bugdown.fenced_code.FencedBlockPreprocessor(None) # Simulate code formatting. @@ -163,6 +167,7 @@ class BugdownTest(TestCase): return test_fixtures, data['linkify_tests'] def test_bugdown_fixtures(self): + # type: () -> None format_tests, linkify_tests = self.load_bugdown_tests() self.maxDiff = None @@ -195,12 +200,14 @@ class BugdownTest(TestCase): self.assertEqual(match, converted) def test_inline_youtube(self): + # type: () -> None msg = 'Check out the debate: http://www.youtube.com/watch?v=hx1mjT73xYE' converted = bugdown_convert(msg) self.assertEqual(converted, '
Check out the debate: http://www.youtube.com/watch?v=hx1mjT73xYE
\n') def test_inline_dropbox(self): + # type: () -> None msg = 'Look at how hilarious our old office was: https://www.dropbox.com/s/ymdijjcg67hv2ta/IMG_0923.JPG' image_info = {'image': 'https://photos-4.dropbox.com/t/2/AABIre1oReJgPYuc_53iv0IHq1vUzRaDg2rrCfTpiWMccQ/12/129/jpeg/1024x1024/2/_/0/4/IMG_0923.JPG/CIEBIAEgAiAHKAIoBw/ymdijjcg67hv2ta/AABz2uuED1ox3vpWWvMpBxu6a/IMG_0923.JPG', 'desc': 'Shared with Dropbox', 'title': 'IMG_0923.JPG'} with mock.patch('zerver.lib.bugdown.fetch_open_graph_image', return_value=image_info): @@ -216,6 +223,7 @@ class BugdownTest(TestCase): self.assertEqual(converted, 'Look at my hilarious drawing folder: https://www.dropbox.com/sh/cm39k9e04z7fhim/AAAII5NK-9daee3FcF41anEua?dl=
\n') def test_inline_dropbox_preview(self): + # type: () -> None # Test photo album previews msg = 'https://www.dropbox.com/sc/tditp9nitko60n5/03rEiZldy5' image_info = {'image': 'https://photos-6.dropbox.com/t/2/AAAlawaeD61TyNewO5vVi-DGf2ZeuayfyHFdNTNzpGq-QA/12/271544745/jpeg/1024x1024/2/_/0/5/baby-piglet.jpg/CKnjvYEBIAIgBygCKAc/tditp9nitko60n5/AADX03VAIrQlTl28CtujDcMla/0', 'desc': 'Shared with Dropbox', 'title': '1 photo'} @@ -225,6 +233,7 @@ class BugdownTest(TestCase): self.assertEqual(converted, 'https://www.dropbox.com/sc/tditp9nitko60n5/03rEiZldy5
\n') def test_inline_dropbox_negative(self): + # type: () -> None # Make sure we're not overzealous in our conversion: msg = 'Look at the new dropbox logo: https://www.dropbox.com/static/images/home_logo.png' with mock.patch('zerver.lib.bugdown.fetch_open_graph_image', return_value=None): @@ -233,6 +242,7 @@ class BugdownTest(TestCase): self.assertEqual(converted, 'Look at the new dropbox logo: https://www.dropbox.com/static/images/home_logo.png
\n') def test_inline_dropbox_bad(self): + # type: () -> None # Don't fail on bad dropbox links msg = "https://zulip-test.dropbox.com/photos/cl/ROmr9K1XYtmpneM" with mock.patch('zerver.lib.bugdown.fetch_open_graph_image', return_value=None): @@ -240,6 +250,7 @@ class BugdownTest(TestCase): self.assertEqual(converted, 'https://zulip-test.dropbox.com/photos/cl/ROmr9K1XYtmpneM
') def test_twitter_id_extraction(self): + # type: () -> None self.assertEqual(bugdown.get_tweet_id('http://twitter.com/#!/VizzQuotes/status/409030735191097344'), '409030735191097344') self.assertEqual(bugdown.get_tweet_id('http://twitter.com/VizzQuotes/status/409030735191097344'), '409030735191097344') self.assertEqual(bugdown.get_tweet_id('http://twitter.com/VizzQuotes/statuses/409030735191097344'), '409030735191097344') @@ -249,6 +260,7 @@ class BugdownTest(TestCase): self.assertEqual(bugdown.get_tweet_id('https://twitter.com/windyoona/status/410766290349879296/'), '410766290349879296') def test_inline_interesting_links(self): + # type: () -> None def make_link(url): return '%s' % (url, url, url) @@ -359,10 +371,12 @@ class BugdownTest(TestCase): '')))) def test_fetch_tweet_data_settings_validation(self): + # type: () -> None with self.settings(TEST_SUITE=False, TWITTER_CONSUMER_KEY=None): self.assertIs(None, bugdown.fetch_tweet_data('287977969287315459')) def test_realm_emoji(self): + # type: () -> None def emoji_img(name, url): return ':test:
') def test_unicode_emoji(self): + # type: () -> None msg = u'\u2615' # ☕ converted = bugdown_convert(msg) self.assertEqual(converted, u'

