Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

doc tests: Mock html_to_text.

Steve Howellaf11ddb3cf2d
diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py
index 75022367345..2cdb91f4967 100644
--- a/zerver/tests/test_docs.py
+++ b/zerver/tests/test_docs.py
@@ -203,12 +203,19 @@ class DocPageTest(ZulipTestCase):
del content[url]
else:
# TODO: Just fill out dictionary for all ~110 endpoints
- expected_strings = []
-
- self._test(
- url=url,
- expected_strings=expected_strings,
- )
+ # with some specific data from the page.
+ expected_strings = ["This is an API doc"]
+
+ # Mock OpenGraph call purely to speed up these tests.
+ with mock.patch(
+ "zerver.lib.html_to_text.html_to_text", return_value="This is an API doc"
+ ) as m:
+ self._test(
+ url=url,
+ expected_strings=expected_strings,
+ )
+ if url != "/api/":
+ m.assert_called()
# Make sure we exercised all content checks.
self.assert_length(content, 0)