Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. class DashboardViewTest(TestCase):
  2. fixtures = ['app']
  3.  
  4. def test_dashboard_url_exist_at_desidered_location(self):
  5. self.client.login(username='admin', password='12345')
  6. resp = self.client.get('/dashboard/')
  7. self.assertEqual(resp.status_code, status.HTTP_200_OK)
  8.  
  9. def test_dashboard_url_accessibile_by_name(self):
  10. self.client.login(username='admin', password='12345')
  11. resp = self.client.get(reverse('dashboard'))
  12. self.assertEqual(resp.status_code, status.HTTP_200_OK)
  13.  
  14. def test_dashboard_redirect_if_not_logged_in(self):
  15. resp = self.client.get(reverse('dashboard'))
  16. self.assertRedirects(resp, expected_url='/login/?next=/dashboard/', status_code=302, target_status_code=200)
  17.  
  18.  
  19. class ValidateUsernameViewTest(TestCase):
  20. fixtures = ['app']
  21.  
  22. def test_dashboard_url_exist_at_desidered_location(self):
  23. self.client.login(username='admin', password='12345')
  24. resp = self.client.get('/ajax/validate_username/')
  25. self.assertEqual(resp.status_code, status.HTTP_200_OK)
  26.  
  27. def test_dashboard_url_accessibile_by_name(self):
  28. self.client.login(username='admin', password='12345')
  29. resp = self.client.get(reverse('validate_username'))
  30. self.assertEqual(resp.status_code, status.HTTP_200_OK)
  31.  
  32. def test_dashboard_redirect_if_not_logged_in(self):
  33. resp = self.client.get(reverse('validate_username'))
  34. self.assertRedirects(resp, expected_url='/login/?next=/ajax/validate_username/', status_code=302, target_status_code=200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement