diff --git a/zerver/tests/test_bugdown.py b/zerver/tests/test_bugdown.py index add925debf..4fad31bd3b 100644 --- a/zerver/tests/test_bugdown.py +++ b/zerver/tests/test_bugdown.py @@ -388,10 +388,12 @@ class BugdownTest(ZulipTestCase): self.assertEqual(converted, '
') @override_settings(INLINE_IMAGE_PREVIEW=True) - def test_inline_image_thumbnail_url(self): - # type: () -> None - msg = '[foobar](/user_uploads/2/50/w2G6ok9kr8AMCQCTNAUOFMln/IMG_0677.JPG)' - thumbnail_img = '<' + def test_inline_image_thumbnail_url(self) -> None: + realm = get_realm("zephyr") + msg = '[foobar](/user_uploads/{realm_id}/50/w2G6ok9kr8AMCQCTNAUOFMln/IMG_0677.JPG)' + msg = msg.format(realm_id=realm.id) + thumbnail_img = '<' + thumbnail_img = thumbnail_img.format(realm_id=realm.id) converted = bugdown_convert(msg) self.assertIn(thumbnail_img, converted) @@ -418,14 +420,15 @@ class BugdownTest(ZulipTestCase): converted = bugdown_convert(msg) self.assertIn(thumbnail_img, converted) - msg = '[foobar](/user_avatars/2/emoji/images/50.png)' - thumbnail_img = ' ' + msg = '[foobar](/user_avatars/{realm_id}/emoji/images/50.png)' + msg = msg.format(realm_id=realm.id) + thumbnail_img = ' ' + thumbnail_img = thumbnail_img.format(realm_id=realm.id) converted = bugdown_convert(msg) self.assertIn(thumbnail_img, converted) @override_settings(INLINE_IMAGE_PREVIEW=True) - def test_inline_image_preview(self): - # type: () -> None + def test_inline_image_preview(self) -> None: with_preview = ' ' without_preview = 'http://cdn.wallpapersafari.com/13/6/16eVjx.jpeg
' content = 'http://cdn.wallpapersafari.com/13/6/16eVjx.jpeg' @@ -469,6 +472,7 @@ class BugdownTest(ZulipTestCase): @override_settings(INLINE_IMAGE_PREVIEW=True) def test_inline_image_preview_order(self) -> None: + realm = get_realm("zulip") content = 'http://imaging.nikon.com/lineup/dslr/df/img/sample/img_01.jpg\nhttp://imaging.nikon.com/lineup/dslr/df/img/sample/img_02.jpg\nhttp://imaging.nikon.com/lineup/dslr/df/img/sample/img_03.jpg' expected = 'http://imaging.nikon.com/lineup/dslr/df/img/sample/img_01.jpg
\nhttp://imaging.nikon.com/lineup/dslr/df/img/sample/img_02.jpg
\nhttp://imaging.nikon.com/lineup/dslr/df/img/sample/img_03.jpg
Test 1
\n21136101110_1dde1c1a7e_o.jpg
Next Image
\nIMG_20161116_023910.jpg
Another Screenshot
\nScreenshot-from-2016-06-01-16-22-42.png
Test 1
\n21136101110_1dde1c1a7e_o.jpg
Next Image
\nIMG_20161116_023910.jpg
Another Screenshot
\nScreenshot-from-2016-06-01-16-22-42.png