summaryrefslogtreecommitdiff
path: root/tests/oauth2/rfc6749/test_parameters.py
diff options
context:
space:
mode:
authorJonathan Huot <jonathan.huot@thomsonreuters.com>2018-08-02 00:54:54 +0200
committerJonathan Huot <jonathan.huot@thomsonreuters.com>2018-09-10 22:41:49 +0200
commite81ae772e4f260cc02ce07a7396470821ac63b1e (patch)
tree06e602897fe52814353faaa5af9a5cbbc304d8a5 /tests/oauth2/rfc6749/test_parameters.py
parent36e7f50049f3333db72ebcb82677b465ec09f84b (diff)
downloadoauthlib-e81ae772e4f260cc02ce07a7396470821ac63b1e.tar.gz
Add support of custom errors coming from providers
Fix #431. The inherent function "raise_from_error" is called when "error=" is found in the payload. So it MUST raise something, and until now, only RFC errors were raised.
Diffstat (limited to 'tests/oauth2/rfc6749/test_parameters.py')
-rw-r--r--tests/oauth2/rfc6749/test_parameters.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/oauth2/rfc6749/test_parameters.py b/tests/oauth2/rfc6749/test_parameters.py
index b211d1e..c42f516 100644
--- a/tests/oauth2/rfc6749/test_parameters.py
+++ b/tests/oauth2/rfc6749/test_parameters.py
@@ -103,6 +103,7 @@ class ParameterTests(TestCase):
' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",'
' "example_parameter": "example_value" }')
+ json_custom_error = '{ "error": "incorrect_client_credentials" }'
json_error = '{ "error": "access_denied" }'
json_notoken = ('{ "token_type": "example",'
@@ -197,6 +198,9 @@ class ParameterTests(TestCase):
self.assertRaises(ValueError, parse_implicit_response,
self.implicit_wrongstate, state=self.state)
+ def test_custom_json_error(self):
+ self.assertRaises(CustomOAuth2Error, parse_token_response, self.json_custom_error)
+
def test_json_token_response(self):
"""Verify correct parameter parsing and validation for token responses. """
self.assertEqual(parse_token_response(self.json_response), self.json_dict)