Update API tests to use login instead of force_authenticate.

This commit is contained in:
Roberto Rosario
2016-02-04 17:39:27 -04:00
parent 8614bc4bfc
commit 10eb7d49b2
6 changed files with 27 additions and 12 deletions

View File

@@ -29,7 +29,8 @@ class UserLoginTestCase(TestCase):
def test_normal_behaviour(self):
response = self.client.get(reverse('documents:document_list'))
self.assertRedirects(
response, 'http://testserver/authentication/login/'
response,
'http://testserver/authentication/login/?next=/documents/list/'
)
@override_settings(AUTHENTICATION_LOGIN_METHOD='username')
@@ -63,7 +64,8 @@ class UserLoginTestCase(TestCase):
def test_username_login_via_views(self):
response = self.client.get(reverse('documents:document_list'))
self.assertRedirects(
response, 'http://testserver/authentication/login/'
response,
'http://testserver/authentication/login/?next=/documents/list/'
)
response = self.client.post(
@@ -81,7 +83,8 @@ class UserLoginTestCase(TestCase):
with self.settings(AUTHENTICATION_BACKENDS=(TEST_EMAIL_AUTHENTICATION_BACKEND,)):
response = self.client.get(reverse('documents:document_list'))
self.assertRedirects(
response, 'http://testserver/authentication/login/'
response,
'http://testserver/authentication/login/?next=/documents/list/'
)
response = self.client.post(