-
-
Notifications
You must be signed in to change notification settings - Fork 493
Handle expires_at with best effort basis #900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a best‑effort handling of the token attribute "expires_at" by updating the conversion logic across token parsing and client methods, and adds a multi‑case test for various "expires_at" types.
- Updated tests to cover multiple input types for "expires_at" and removed an invalid case test.
- Changed the computation of expires_at in parameters and adjusted the client’s parsing logic accordingly.
- Added a dependency on pytest‑subtests to support sub‑test execution.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tests/oauth2/rfc6749/clients/test_base.py | Updated tests for various "expires_at" types and removed an invalid test case. |
requirements-test.txt | Added pytest‑subtests as a dependency. |
oauthlib/oauth2/rfc6749/parameters.py | Changed expires_at computation to use round(time.time()). |
oauthlib/oauth2/rfc6749/clients/base.py | Updated token attribute parsing with layered conversion for expires_at. |
Comments suppressed due to low confidence (1)
tests/oauth2/rfc6749/clients/test_base.py:303
- Consider retaining or reintroducing tests for invalid 'expires_at' values to ensure robust error handling for malformed inputs.
def test_parse_token_response_invalid_expires_at(self):
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added similar behaviors to all interfaces where expires_at is parsed, this will facilitate the implementations. Note this is breaking change for those which are expecting the "default" `expires_at` (as in, not provided) to be a float. This will now default to a int.
I fixed few edge cases and added more unit tests to cover all scenarios. |
I reviewed but forgot to merge 🗡️ |
Proposal for #899