Skip to content

Commit 1268a71

Browse files
Modify comment and fix failing unit test (new error being raised)
1 parent 8b69aea commit 1268a71

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/dot_ext/tests/test_authorization.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# from oauth2_provider.compat import parse_qs, urlparse
99
from oauthlib.oauth2.rfc6749.errors import AccessDeniedError as AccessDeniedTokenCustomError
1010
from oauth2_provider.models import get_access_token_model, get_refresh_token_model
11-
from django.core.exceptions import PermissionDenied
1211
from django.http import HttpRequest
1312
from django.urls import reverse
1413
from django.test import Client
@@ -1122,5 +1121,5 @@ def test_permission_denied_raised_for_refresh_token_app_not_in_flag(
11221121
# Create an instance of the view
11231122
view_instance = TokenView()
11241123

1125-
with self.assertRaises(PermissionDenied):
1124+
with self.assertRaises(AccessDeniedTokenCustomError):
11261125
view_instance.validate_v3_token_call(request)

apps/dot_ext/views/authorization.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,10 @@ def post(self, request, *args, **kwargs):
482482
version = get_api_version_number_from_url(path_info)
483483
url_query = parse_qs(request._body.decode('utf-8'))
484484
grant_type = url_query.get('grant_type', [None])
485-
# If it is not version 3, we don't need to check anything, just return
486-
# We only want to execute this on refresh_token grant types, not authorization_code
487485
try:
486+
# If it is not version 3, we don't need to check that the application is in the v3_early_adopter flag,
487+
# just continue with standard validation.
488+
# Also, we only want to execute this on refresh_token grant types, not authorization_code
488489
if version == Versions.V3 and grant_type[0] and grant_type[0] == 'refresh_token':
489490
self.validate_v3_token_call(request)
490491
self.validate_token_endpoint_request_body(request)

0 commit comments

Comments
 (0)