mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 01:53:59 +00:00
test_docs: Return response from DocPageTest._test.
Function call hierarchy: `_test` -> `_check_basic_fetch` -> `get_doc` -> `client_get` All the functions in the chain return the request returned by `client_get`, except for `_test`. Now, `_test` also returns the response from the URL on the root subdomain when the ROOT_DOMAIN_LANDING_PAGE is set to False. This enables us to re-use the fetched reponse in our test functions, and limit each URL to a single call of `client_get`.
This commit is contained in:
@@ -86,9 +86,9 @@ class DocPageTest(ZulipTestCase):
|
||||
)
|
||||
return result
|
||||
|
||||
def _test(self, url: str, expected_strings: Sequence[str]) -> None:
|
||||
def _test(self, url: str, expected_strings: Sequence[str]) -> "TestHttpResponse":
|
||||
# Test the URL on the root subdomain
|
||||
self._check_basic_fetch(
|
||||
response = self._check_basic_fetch(
|
||||
url=url,
|
||||
subdomain="",
|
||||
expected_strings=expected_strings,
|
||||
@@ -96,7 +96,7 @@ class DocPageTest(ZulipTestCase):
|
||||
)
|
||||
|
||||
if not self._is_landing_page(url):
|
||||
return
|
||||
return response
|
||||
|
||||
with self.settings(ROOT_DOMAIN_LANDING_PAGE=True):
|
||||
# Test the URL on the root subdomain with the landing page setting
|
||||
@@ -119,6 +119,7 @@ class DocPageTest(ZulipTestCase):
|
||||
],
|
||||
result,
|
||||
)
|
||||
return response
|
||||
|
||||
def test_zephyr_disallows_robots(self) -> None:
|
||||
sample_urls = [
|
||||
|
||||
Reference in New Issue
Block a user