Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DashboardViewTest(TestCase):
- fixtures = ['app']
- def test_dashboard_url_exist_at_desidered_location(self):
- self.client.login(username='admin', password='12345')
- resp = self.client.get('/dashboard/')
- self.assertEqual(resp.status_code, status.HTTP_200_OK)
- def test_dashboard_url_accessibile_by_name(self):
- self.client.login(username='admin', password='12345')
- resp = self.client.get(reverse('dashboard'))
- self.assertEqual(resp.status_code, status.HTTP_200_OK)
- def test_dashboard_redirect_if_not_logged_in(self):
- resp = self.client.get(reverse('dashboard'))
- self.assertRedirects(resp, expected_url='/login/?next=/dashboard/', status_code=302, target_status_code=200)
- class ValidateUsernameViewTest(TestCase):
- fixtures = ['app']
- def test_dashboard_url_exist_at_desidered_location(self):
- self.client.login(username='admin', password='12345')
- resp = self.client.get('/ajax/validate_username/')
- self.assertEqual(resp.status_code, status.HTTP_200_OK)
- def test_dashboard_url_accessibile_by_name(self):
- self.client.login(username='admin', password='12345')
- resp = self.client.get(reverse('validate_username'))
- self.assertEqual(resp.status_code, status.HTTP_200_OK)
- def test_dashboard_redirect_if_not_logged_in(self):
- resp = self.client.get(reverse('validate_username'))
- 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