Rename to force_authenticate

This commit is contained in:
Tom Christie 2013-06-29 22:53:15 +01:00
parent ab799ccc3e
commit c9485c783a
2 changed files with 4 additions and 4 deletions

View File

@ -109,7 +109,7 @@ class APIClient(APIRequestFactory, DjangoClient):
""" """
self._credentials = kwargs self._credentials = kwargs
def authenticate(self, user=None, token=None): def force_authenticate(self, user=None, token=None):
""" """
Forcibly authenticates outgoing requests with the given Forcibly authenticates outgoing requests with the given
user and/or token. user and/or token.

View File

@ -37,12 +37,12 @@ class CheckTestClient(TestCase):
response = self.client.get('/view/') response = self.client.get('/view/')
self.assertEqual(response.data['auth'], 'example') self.assertEqual(response.data['auth'], 'example')
def test_authenticate(self): def test_force_authenticate(self):
""" """
Setting `.authenticate()` forcibly authenticates each request. Setting `.force_authenticate()` forcibly authenticates each request.
""" """
user = User.objects.create_user('example', 'example@example.com') user = User.objects.create_user('example', 'example@example.com')
self.client.authenticate(user) self.client.force_authenticate(user)
response = self.client.get('/view/') response = self.client.get('/view/')
self.assertEqual(response.data['user'], 'example') self.assertEqual(response.data['user'], 'example')