summaryrefslogtreecommitdiffstats
path: root/contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-09-05 12:45:40 +0300
committerrobot-piglet <[email protected]>2025-09-05 13:32:17 +0300
commit22568739dbd9bf62b94abb305c082a53b21e5aef (patch)
tree7833f8119b1292867b256356e25ee8593dccac75 /contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py
parent2db41830cd5fce47e0bac5493c1e1472908cc4c5 (diff)
Intermediate changes
commit_hash:39273c986cf85d42ec97d1388aaaf324a02a04bc
Diffstat (limited to 'contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py')
-rw-r--r--contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py b/contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py
index cd8c9e952ba..bd8a8b61ac1 100644
--- a/contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py
+++ b/contrib/python/oauthlib/tests/oauth2/rfc6749/test_parameters.py
@@ -302,3 +302,30 @@ class ParameterTests(TestCase):
finally:
signals.scope_changed.disconnect(record_scope_change)
del os.environ['OAUTHLIB_RELAX_TOKEN_SCOPE']
+
+
+ def test_parse_expires(self):
+ for title, arg, expected in [
+ ('none', (None, None), (None, None, None)),
+ ('expires_in only', (3600, None), (3600, 4600, 4600)),
+ ('expires_in and expires_at', (3600, 200), (3600, 200, 200)),
+ ('expires_in and expires_at float', (3600, 200.42), (3600, 200.42, 200.42)),
+ ('expires_in and expires_at str-int', (3600, "200"), (3600, 200, 200)),
+ ('expires_in and expires_at str-float', (3600, "200.42"), (3600, 200.42, 200.42)),
+ ('expires_in float only', (3600.12, None), (3600, 4600, 4600)),
+ ('expires_in float and expires_at', (3600.12, 200), (3600, 200, 200)),
+ ('expires_in float and expires_at float', (3600.12, 200.42), (3600, 200.42, 200.42)),
+ ('expires_in float and expires_at str-int', (3600.12, "200"), (3600, 200, 200)),
+ ('expires_in float and expires_at str-float', (3600.12, "200.42"), (3600, 200.42, 200.42)),
+ ('expires_in str only', ("3600", None), (3600, 4600, 4600)),
+ ('expires_in str and expires_at', ("3600", 200), (3600, 200, 200)),
+ ('expires_in str and expires_at float', ("3600", 200.42), (3600, 200.42, 200.42)),
+ ('expires_in str and expires_at str-int', ("3600", "200"), (3600, 200, 200)),
+ ('expires_in str and expires_at str-float', ("3600", "200.42"), (3600, 200.42, 200.42)),
+ ]:
+ with self.subTest(msg=title):
+ params = {
+ "expires_in": arg[0],
+ "expires_at": arg[1]
+ }
+ self.assertEqual(expected, parse_expires(params))