aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/tests/test_authentication.py
diff options
context:
space:
mode:
authorXavier Ordoquy2014-07-28 07:53:04 +0200
committerXavier Ordoquy2014-07-28 07:53:04 +0200
commitc7a988eb38b96926156f01c2b6f2603a4ef41ecf (patch)
tree01375d5eeebd2ac8cdcdf535dcdfbc1136043a37 /rest_framework/tests/test_authentication.py
parentfe048dc4fbf064b11d7247061c931bb1038cc774 (diff)
parent02187eb2edf34a992bc56da797caded085b1e09a (diff)
downloaddjango-rest-framework-c7a988eb38b96926156f01c2b6f2603a4ef41ecf.tar.bz2
Merge remote-tracking branch 'reference/master'
Diffstat (limited to 'rest_framework/tests/test_authentication.py')
-rw-r--r--rest_framework/tests/test_authentication.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/rest_framework/tests/test_authentication.py b/rest_framework/tests/test_authentication.py
index a1c43d9c..34bf2910 100644
--- a/rest_framework/tests/test_authentication.py
+++ b/rest_framework/tests/test_authentication.py
@@ -550,6 +550,15 @@ class OAuth2Tests(TestCase):
self.assertEqual(response.status_code, 401)
@unittest.skipUnless(oauth2_provider, 'django-oauth2-provider not installed')
+ def test_get_form_with_wrong_authorization_header_token_missing(self):
+ """Ensure that a missing token lead to the correct HTTP error status code"""
+ auth = "Bearer"
+ response = self.csrf_client.get('/oauth2-test/', {}, HTTP_AUTHORIZATION=auth)
+ self.assertEqual(response.status_code, 401)
+ response = self.csrf_client.get('/oauth2-test/', HTTP_AUTHORIZATION=auth)
+ self.assertEqual(response.status_code, 401)
+
+ @unittest.skipUnless(oauth2_provider, 'django-oauth2-provider not installed')
def test_get_form_passing_auth(self):
"""Ensure GETing form over OAuth with correct client credentials succeed"""
auth = self._create_authorization_header()