Tests for warning behavior on oauth scope change #810
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When Oauth scope changes, oauthlib raises a Warning with special attributes (
token
,old_scope
, andnew_scope
). This behavior was documented in theoriginal commit message from ca4811b, but
there are no tests to check for this behavior. I started working on #809 and
while reading the code, I thought the extra attributes tacked onto the warning
were strange. I thought it was even more strange that this behavior wasn't
documented anywhere or tested for.
I decided not to add any documentation because there is no existing
documentation about scope changes already, and this is a very specific
situation, however I think that having the test case, and the
TokenScopeChangedWarning
class makes it much clearer to anyone taking aglance at the source code what the behavior is.
Plus, I didn't want to break anything while working on #809, and I became a
little suspicious when I deleted those lines (
w.token = params; w.old_scope = ...
),and all the unit tests still passed!