Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
url tests: Mock out html_to_text.
Steve Howellf7614e7109d9
diff --git a/zerver/tests/test_urls.py b/zerver/tests/test_urls.pyindex 7496ca0acd3..f06edae90e9 100644--- a/zerver/tests/test_urls.py+++ b/zerver/tests/test_urls.py@@ -1,6 +1,7 @@import importlibimport osfrom typing import List+from unittest import mockimport django.urls.resolversfrom django.test import Client@@ -48,7 +49,17 @@ class PublicURLTest(ZulipTestCase):# We have lots of help files, so this will be expensive!self.assertGreater(len(help_urls), 190)- self.fetch("client_get", help_urls, 200)++ expected_tag = """<meta property="og:description" content="This is a help page" />"""++ for url in help_urls:+ with mock.patch(+ "zerver.lib.html_to_text.html_to_text", return_value="This is a help page"+ ) as m:+ response = self.client_get(url)+ m.assert_called_once()+ self.assertIn(expected_tag, response.content.decode())+ self.assertEqual(response.status_code, 200)def test_public_urls(self) -> None:"""