diff options
author | Josh Holmer <jholmer@activecampaign.com> | 2019-04-30 12:50:43 -0400 |
---|---|---|
committer | Josh Holmer <jholmer@activecampaign.com> | 2019-04-30 12:50:43 -0400 |
commit | 73092d039fa67a88d0989e7bf0ae7d0044a0bdc6 (patch) | |
tree | 47ca440d40171ac9698f418629732b8ba811b5e9 /tests | |
parent | 30321dd3c0ca784d3508a1970cf90d9f76835c79 (diff) | |
download | oauthlib-73092d039fa67a88d0989e7bf0ae7d0044a0bdc6.tar.gz |
Handle null value in expires_in field in JSON handler
Closes #672
Diffstat (limited to 'tests')
-rw-r--r-- | tests/oauth2/rfc6749/test_parameters.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/oauth2/rfc6749/test_parameters.py b/tests/oauth2/rfc6749/test_parameters.py index c42f516..b9fda9c 100644 --- a/tests/oauth2/rfc6749/test_parameters.py +++ b/tests/oauth2/rfc6749/test_parameters.py @@ -102,6 +102,15 @@ class ParameterTests(TestCase): ' "expires_in": 3600,' ' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",' ' "example_parameter": "example_value" }') + json_response_noexpire = ('{ "access_token": "2YotnFZFEjr1zCsicMWpAA",' + ' "token_type": "example",' + ' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",' + ' "example_parameter": "example_value"}') + json_response_expirenull = ('{ "access_token": "2YotnFZFEjr1zCsicMWpAA",' + ' "token_type": "example",' + ' "expires_in": null,' + ' "refresh_token": "tGzv3JOkF0XG5Qx2TlKWIA",' + ' "example_parameter": "example_value"}') json_custom_error = '{ "error": "incorrect_client_credentials" }' json_error = '{ "error": "access_denied" }' @@ -135,6 +144,13 @@ class ParameterTests(TestCase): 'example_parameter': 'example_value' } + json_noexpire_dict = { + 'access_token': '2YotnFZFEjr1zCsicMWpAA', + 'token_type': 'example', + 'refresh_token': 'tGzv3JOkF0XG5Qx2TlKWIA', + 'example_parameter': 'example_value' + } + json_notype_dict = { 'access_token': '2YotnFZFEjr1zCsicMWpAA', 'expires_in': 3600, @@ -209,6 +225,8 @@ class ParameterTests(TestCase): self.assertEqual(parse_token_response(self.json_response_noscope, scope=['all', 'the', 'scopes']), self.json_noscope_dict) + self.assertEqual(parse_token_response(self.json_response_noexpire), self.json_noexpire_dict) + self.assertEqual(parse_token_response(self.json_response_expirenull), self.json_noexpire_dict) scope_changes_recorded = [] def record_scope_change(sender, message, old, new): |