diff --git a/zerver/tests/tests.py b/zerver/tests/tests.py index 478ced326f..832673eb01 100644 --- a/zerver/tests/tests.py +++ b/zerver/tests/tests.py @@ -475,6 +475,39 @@ class ActivityTest(AuthedTestCase): self.assert_length(queries, 13) +class DocPageTest(AuthedTestCase): + def _test(self, url, expected_content): + # type: (str, str) -> None + result = self.client_get(url) + self.assertEqual(result.status_code, 200) + self.assertIn(expected_content, str(result.content)) + + def test_doc_endpoints(self): + # type: () -> None + self._test('/api/', 'We hear you like APIs') + self._test('/api/endpoints/', 'pre-built API bindings for Python') + self._test('/apps/', 'Appsolutely') + self._test('/features/', 'Talk about multiple topics at once') + self._test('/hello/', 'workplace chat that actually improves your productivity') + self._test('/integrations/', 'require creating a Zulip bot') + self._test('/login/', '(Normal users)') + self._test('/register/', 'get started') + + result = self.client_get('/new-user/') + self.assertEqual(result.status_code, 301) + self.assertIn('hello', result['Location']) + + result = self.client_get('/robots.txt') + self.assertEqual(result.status_code, 301) + self.assertIn('static/robots.txt', result['Location']) + + result = self.client_get('/static/robots.txt') + self.assertEqual(result.status_code, 200) + self.assertIn( + 'Disallow: /', + ''.join(str(x) for x in list(result.streaming_content)) + ) + class UserProfileTest(TestCase): def test_get_emails_from_user_ids(self): # type: () -> None