aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/authentication.py
diff options
context:
space:
mode:
authorSébastien Piquemal2012-01-31 23:21:55 +0200
committerSébastien Piquemal2012-01-31 23:21:55 +0200
commit279fa0d371b73974b87267edabe2a4f76a198ebb (patch)
tree28b3a7aa6d489ad1e93acb14c3e890c8733f85cf /djangorestframework/tests/authentication.py
parent152c385f4de37558fe4e522abad5b97f0cf7ddce (diff)
parentb2fcfffb3bdaed89d39ee563c58dc0ede5e857ac (diff)
downloaddjango-rest-framework-279fa0d371b73974b87267edabe2a4f76a198ebb.tar.bz2
merge
Diffstat (limited to 'djangorestframework/tests/authentication.py')
-rw-r--r--djangorestframework/tests/authentication.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/djangorestframework/tests/authentication.py b/djangorestframework/tests/authentication.py
index 1835c523..303bf96b 100644
--- a/djangorestframework/tests/authentication.py
+++ b/djangorestframework/tests/authentication.py
@@ -11,7 +11,7 @@ import base64
class MockView(View):
- permissions = ( permissions.IsAuthenticated, )
+ permissions = (permissions.IsAuthenticated,)
def post(self, request):
return {'a': 1, 'b': 2, 'c': 3}
@@ -74,24 +74,32 @@ class SessionAuthTests(TestCase):
self.csrf_client.logout()
def test_post_form_session_auth_failing_csrf(self):
- """Ensure POSTing form over session authentication without CSRF token fails."""
+ """
+ Ensure POSTing form over session authentication without CSRF token fails.
+ """
self.csrf_client.login(username=self.username, password=self.password)
response = self.csrf_client.post('/', {'example': 'example'})
self.assertEqual(response.status_code, 403)
def test_post_form_session_auth_passing(self):
- """Ensure POSTing form over session authentication with logged in user and CSRF token passes."""
+ """
+ Ensure POSTing form over session authentication with logged in user and CSRF token passes.
+ """
self.non_csrf_client.login(username=self.username, password=self.password)
response = self.non_csrf_client.post('/', {'example': 'example'})
self.assertEqual(response.status_code, 200)
def test_put_form_session_auth_passing(self):
- """Ensure PUTting form over session authentication with logged in user and CSRF token passes."""
+ """
+ Ensure PUTting form over session authentication with logged in user and CSRF token passes.
+ """
self.non_csrf_client.login(username=self.username, password=self.password)
response = self.non_csrf_client.put('/', {'example': 'example'})
self.assertEqual(response.status_code, 200)
def test_post_form_session_auth_failing(self):
- """Ensure POSTing form over session authentication without logged in user fails."""
+ """
+ Ensure POSTing form over session authentication without logged in user fails.
+ """
response = self.csrf_client.post('/', {'example': 'example'})
self.assertEqual(response.status_code, 403)