3f8fe75d36
* Add models.py required file to app * Use user_passes_test instead of custom superuser checking in new_user_form as it implements the same "next" redirection as login_required Signed-off-by: Ismael Carnales <icarnales@gmail.com>
40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
from django.test import TestCase
|
|
|
|
|
|
class DevelTest(TestCase):
|
|
|
|
def test_index(self):
|
|
response = self.client.get('/devel/')
|
|
self.assertEqual(response.status_code, 302)
|
|
self.assertEqual(response.has_header('Location'), True)
|
|
self.assertEqual(response['location'],
|
|
'http://testserver/login/?next=/devel/')
|
|
|
|
def test_notify(self):
|
|
response = self.client.get('/devel/notify/')
|
|
self.assertEqual(response.status_code, 302)
|
|
self.assertEqual(response.has_header('Location'), True)
|
|
self.assertEqual(response['location'],
|
|
'http://testserver/login/?next=/devel/notify/')
|
|
|
|
def test_profile(self):
|
|
response = self.client.get('/devel/profile/')
|
|
self.assertEqual(response.status_code, 302)
|
|
self.assertEqual(response.has_header('Location'), True)
|
|
self.assertEqual(response['location'],
|
|
'http://testserver/login/?next=/devel/profile/')
|
|
|
|
def test_newuser(self):
|
|
response = self.client.get('/devel/newuser/')
|
|
self.assertEqual(response.status_code, 302)
|
|
self.assertEqual(response.has_header('Location'), True)
|
|
self.assertEqual(response['location'],
|
|
'http://testserver/login/?next=/devel/newuser/')
|
|
|
|
def test_mirrors(self):
|
|
response = self.client.get('/mirrors/')
|
|
self.assertEqual(response.status_code, 302)
|
|
self.assertEqual(response.has_header('Location'), True)
|
|
self.assertEqual(response['location'],
|
|
'http://testserver/login/?next=/mirrors/')
|