Пример #1
0
 def test_home_handles_logged_in_user(self):
     self.request.session = {
         'username': settings.TEST_USER,
         'password': settings.TEST_PASSWORD,
         'api_url': settings.DEFAULT_API_URL}
     response = home(self.request)
     self.request.session = {}
     self.assertContains(response, 'Latest Alarms')
     self.assertNotContains(response, 'id="id_action_login" name="action_login"')
Пример #2
0
 def test_home_view_login_redirects_to_me_html(self):
     response = home(self.request_post)
     self.assertEqual(response.status_code, 302)
     self.assertTrue(isinstance(response, HttpResponseRedirect))
     self.assertEqual(response.url, '/me/')
Пример #3
0
 def test_home_contains_right_html(self):
     response = home(self.request)
     self.assertContains(response, 'id="id_action_login" name="action_login"')
     self.assertNotContains(response, 'Latest Alarms')
Пример #4
0
 def test_home_returns_appropriate_html_respons_code(self):
     response = home(self.request)
     self.assertEqual(response.status_code, 200)