summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormasci <mpippi@gmail.com>2014-01-19 23:58:01 +0100
committermasci <mpippi@gmail.com>2014-01-19 23:58:01 +0100
commit7a775552f546eae024027a3521aadaa01783f973 (patch)
treefcd8487ff989c7c582f6ebdfb23647d453a4dcfb
parentc89bcc737ec27b1f7520168a57f502537ad6c555 (diff)
downloadoauthlib-7a775552f546eae024027a3521aadaa01783f973.tar.gz
added tests for content type checking
-rw-r--r--tests/oauth2/rfc6749/grant_types/test_client_credentials.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/oauth2/rfc6749/grant_types/test_client_credentials.py b/tests/oauth2/rfc6749/grant_types/test_client_credentials.py
index 80b92d3..d7e50c3 100644
--- a/tests/oauth2/rfc6749/grant_types/test_client_credentials.py
+++ b/tests/oauth2/rfc6749/grant_types/test_client_credentials.py
@@ -30,9 +30,19 @@ class ClientCredentialsGrantTest(TestCase):
self.assertIn('access_token', token)
self.assertIn('token_type', token)
self.assertIn('expires_in', token)
+ self.assertIn('Content-Type', headers)
+ self.assertEqual(headers['Content-Type'], 'application/json')
def test_error_response(self):
- pass
+ bearer = BearerToken(self.mock_validator)
+ self.mock_validator.authenticate_client.return_value = False
+ headers, body, status_code = self.auth.create_token_response(
+ self.request, bearer)
+ error_msg = json.loads(body)
+ self.assertIn('error', error_msg)
+ self.assertEqual(error_msg['error'], 'invalid_client')
+ self.assertIn('Content-Type', headers)
+ self.assertEqual(headers['Content-Type'], 'application/json')
def test_validate_token_response(self):
# wrong grant type, scope