From 76d7a5a53a329c9805d832a00e4627cc900e69f8 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Mon, 12 Jun 2023 20:52:59 +0000 Subject: [PATCH] dev_settings: Remove `THUMBNAIL_IMAGES` from test_extra_settings. THUMBNAIL_IMAGES was previously set to true as there were tests on a new thumbnail functionality. The feature was never stable enough to remain in the codebase and the setting was left enabled. This setting also doesn't reflect how the production deployments are and it has been decided that we should drop setting from test_extra_settings altogether. Co-authored-by: Joseph Ho --- zerver/tests/test_markdown.py | 22 +++++++++++++--------- zproject/dev_settings.py | 2 -- zproject/test_extra_settings.py | 2 -- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/zerver/tests/test_markdown.py b/zerver/tests/test_markdown.py index 5bdaf9124d..7977867f86 100644 --- a/zerver/tests/test_markdown.py +++ b/zerver/tests/test_markdown.py @@ -428,6 +428,7 @@ class MarkdownTest(ZulipTestCase): self.assertTrue(is_unique, message) found_names.add(test_name) + @override_settings(THUMBNAIL_IMAGES=True) def test_markdown_fixtures(self) -> None: format_tests, linkify_tests = self.load_markdown_tests() valid_keys = { @@ -572,7 +573,7 @@ class MarkdownTest(ZulipTestCase): '

https://vimeo.com/246979354

', ) - @override_settings(INLINE_IMAGE_PREVIEW=True) + @override_settings(THUMBNAIL_IMAGES=True, INLINE_IMAGE_PREVIEW=True) def test_inline_image_thumbnail_url(self) -> None: realm = get_realm("zephyr") msg = "[foobar](/user_uploads/{realm_id}/50/w2G6ok9kr8AMCQCTNAUOFMln/IMG_0677.JPG)" @@ -612,7 +613,7 @@ class MarkdownTest(ZulipTestCase): converted = markdown_convert_wrapper(msg) self.assertIn(thumbnail_img, converted) - @override_settings(INLINE_IMAGE_PREVIEW=True) + @override_settings(THUMBNAIL_IMAGES=True, INLINE_IMAGE_PREVIEW=True) def test_inline_image_preview(self) -> None: with_preview = '
' without_preview = '

http://cdn.wallpapersafari.com/13/6/16eVjx.jpeg

' @@ -632,7 +633,7 @@ class MarkdownTest(ZulipTestCase): converted = render_markdown(msg, content) self.assertEqual(converted.rendered_content, without_preview) - @override_settings(THUMBNAIL_IMAGES=False, EXTERNAL_URI_SCHEME="https://") + @override_settings(EXTERNAL_URI_SCHEME="https://") def test_external_image_preview_use_camo(self) -> None: content = "https://example.com/thing.jpeg" @@ -640,7 +641,7 @@ class MarkdownTest(ZulipTestCase): converted = markdown_convert_wrapper(content) self.assertIn(converted, thumbnail_img) - @override_settings(THUMBNAIL_IMAGES=False, EXTERNAL_URI_SCHEME="https://") + @override_settings(EXTERNAL_URI_SCHEME="https://") def test_static_image_preview_skip_camo(self) -> None: content = f"{ settings.STATIC_URL }/thing.jpeg" @@ -648,13 +649,13 @@ class MarkdownTest(ZulipTestCase): converted = markdown_convert_wrapper(content) self.assertIn(converted, thumbnail_img) - @override_settings(THUMBNAIL_IMAGES=False, EXTERNAL_URI_SCHEME="https://") + @override_settings(EXTERNAL_URI_SCHEME="https://") def test_realm_image_preview_skip_camo(self) -> None: content = f"https://zulip.{ settings.EXTERNAL_HOST }/thing.jpeg" converted = markdown_convert_wrapper(content) self.assertNotIn(converted, get_camo_url(content)) - @override_settings(THUMBNAIL_IMAGES=False, EXTERNAL_URI_SCHEME="https://") + @override_settings(EXTERNAL_URI_SCHEME="https://") def test_cross_realm_image_preview_use_camo(self) -> None: content = f"https://otherrealm.{ settings.EXTERNAL_HOST }/thing.jpeg" @@ -694,7 +695,7 @@ class MarkdownTest(ZulipTestCase): soup = BeautifulSoup(converted, "html.parser") self.assert_length(soup(class_="message_inline_image"), 0) - @override_settings(INLINE_IMAGE_PREVIEW=True) + @override_settings(THUMBNAIL_IMAGES=True, INLINE_IMAGE_PREVIEW=True) def test_inline_image_quoted_blocks(self) -> None: content = "http://cdn.wallpapersafari.com/13/6/16eVjx.jpeg" expected = '
' @@ -717,7 +718,7 @@ class MarkdownTest(ZulipTestCase): converted = render_markdown(msg, content) self.assertEqual(converted.rendered_content, expected) - @override_settings(INLINE_IMAGE_PREVIEW=True) + @override_settings(THUMBNAIL_IMAGES=True, 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" @@ -745,7 +746,7 @@ class MarkdownTest(ZulipTestCase): converted = render_markdown(msg, content) self.assertEqual(converted.rendered_content, expected) - @override_settings(INLINE_IMAGE_PREVIEW=True) + @override_settings(THUMBNAIL_IMAGES=True, INLINE_IMAGE_PREVIEW=True) def test_corrected_image_source(self) -> None: # testing only Wikipedia because linx.li URLs can be expected to expire content = "https://en.wikipedia.org/wiki/File:Wright_of_Derby,_The_Orrery.jpg" @@ -859,6 +860,7 @@ class MarkdownTest(ZulipTestCase): f"""

https://www.dropbox.com/sc/tditp9nitko60n5/03rEiZldy5

\n
""", ) + @override_settings(THUMBNAIL_IMAGES=True) def test_inline_dropbox_negative(self) -> 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" @@ -880,6 +882,7 @@ class MarkdownTest(ZulipTestCase): '

https://zulip-test.dropbox.com/photos/cl/ROmr9K1XYtmpneM

', ) + @override_settings(THUMBNAIL_IMAGES=True) def test_inline_github_preview(self) -> None: # Test photo album previews msg = "Test: https://github.com/zulip/zulip/blob/main/static/images/logo/zulip-icon-128x128.png" @@ -2632,6 +2635,7 @@ class MarkdownTest(ZulipTestCase): ) self.assertEqual(rendering_result.mentions_user_ids, set()) + @override_settings(THUMBNAIL_IMAGES=True) def test_image_preview_title(self) -> None: msg = "[My favorite image](https://example.com/testimage.png)" converted = markdown_convert_wrapper(msg) diff --git a/zproject/dev_settings.py b/zproject/dev_settings.py index 2033fbbdec..e9c50e6bbb 100644 --- a/zproject/dev_settings.py +++ b/zproject/dev_settings.py @@ -162,8 +162,6 @@ if FAKE_LDAP_MODE: } AUTHENTICATION_BACKENDS += ("zproject.backends.ZulipLDAPAuthBackend",) -THUMBNAIL_IMAGES = True - BILLING_ENABLED = True LANDING_PAGE_NAVBAR_MESSAGE: Optional[str] = None diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py index ee546e59d9..be7a3d261b 100644 --- a/zproject/test_extra_settings.py +++ b/zproject/test_extra_settings.py @@ -208,8 +208,6 @@ BIG_BLUE_BUTTON_URL = "https://bbb.example.com/bigbluebutton/" TWO_FACTOR_AUTHENTICATION_ENABLED = False PUSH_NOTIFICATION_BOUNCER_URL: Optional[str] = None -THUMBNAIL_IMAGES = True - # Logging the emails while running the tests adds them # to /emails page. DEVELOPMENT_LOG_EMAILS = False