tests: Add DocPageTest.

This commit is contained in:
Steve Howell 2016-08-18 09:09:47 -07:00 committed by Tim Abbott
parent d1c34a6618
commit 552a6dc017
1 changed files with 33 additions and 0 deletions

View File

@ -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